## HostServices


Scoped host services: clocks, transport, and evidence recording.


Usage

``` python
HostServices()
```


One services object is bound to an adapter session at [open](Adapter.md#benchweave_sdk.Adapter.open). Adapters reach the device only through [transfer](HostServices.md#benchweave_sdk.HostServices.transfer) and take time only from [monotonic](HostServices.md#benchweave_sdk.HostServices.monotonic) and [utc_now](HostServices.md#benchweave_sdk.HostServices.utc_now).


## See Also

[Adapter](Adapter.md#benchweave_sdk.Adapter)  
receives these services at open.

[OperationContext](OperationContext.md#benchweave_sdk.OperationContext)  
per-operation deadline and cancellation state.


## Methods

| Name | Description |
|----|----|
| [close_transport()](#close_transport) | Close the transport bound to this adapter session. |
| [monotonic()](#monotonic) | Return the current reading of the host's monotonic clock in seconds. |
| [record_evidence()](#record_evidence) | Append one evidence entry to the operation's evidence record. |
| [transfer()](#transfer) | Perform one bounded transport exchange with the device. |
| [utc_now()](#utc_now) | Return the current UTC time as an ISO-8601 string. |

------------------------------------------------------------------------


#### close_transport()


Close the transport bound to this adapter session.


Usage

``` python
close_transport(context)
```


------------------------------------------------------------------------


#### monotonic()


Return the current reading of the host's monotonic clock in seconds.


Usage

``` python
monotonic()
```


------------------------------------------------------------------------


#### record_evidence()


Append one evidence entry to the operation's evidence record.


Usage

``` python
record_evidence(entry, context)
```


------------------------------------------------------------------------


#### transfer()


Perform one bounded transport exchange with the device.


Usage

``` python
transfer(transaction, context)
```


##### Parameters


`transaction: dict[str, Any]`  
Exchange description, for example `{"kind": "stream_exchange", "data": b"ID?\n", "max_bytes": 128, "termination": "lf"}`; the host enforces the declared bounds.

`context: OperationContext`  
The operation context; a cancelled or expired operation fails instead of transmitting.


##### Returns


`dict`  
The raw device response, for example `{"data": b"3.3\n"}`.


##### Raises


`TimeoutError`  
If the operation is cancelled or past its deadline.

`ConnectionError`  
If the transport has been lost.


------------------------------------------------------------------------


#### utc_now()


Return the current UTC time as an ISO-8601 string.


Usage

``` python
utc_now()
```
