Class AdrClientWrapper
- Namespace
- Azure.Iot.Operations.Connector
- Assembly
- Azure.Iot.Operations.Connector.dll
public class AdrClientWrapper : IAdrClientWrapper, IAsyncDisposable
- Inheritance
-
AdrClientWrapper
- Implements
- Inherited Members
Constructors
AdrClientWrapper(ApplicationContext, IMqttPubSubClient)
public AdrClientWrapper(ApplicationContext applicationContext, IMqttPubSubClient mqttPubSubClient)
Parameters
applicationContextApplicationContextmqttPubSubClientIMqttPubSubClient
AdrClientWrapper(IAdrServiceClient, IAssetFileMonitor?)
public AdrClientWrapper(IAdrServiceClient adrServiceClient, IAssetFileMonitor? assetFileMonitor = null)
Parameters
adrServiceClientIAdrServiceClientassetFileMonitorIAssetFileMonitor
Methods
CreateOrUpdateDiscoveredAssetAsync(string, string, CreateOrUpdateDiscoveredAssetRequest, TimeSpan?, CancellationToken)
Creates or updates a discovered asset.
public Task<CreateOrUpdateDiscoveredAssetResponsePayload> CreateOrUpdateDiscoveredAssetAsync(string deviceName, string inboundEndpointName, CreateOrUpdateDiscoveredAssetRequest request, TimeSpan? commandTimeout = null, CancellationToken cancellationToken = default)
Parameters
deviceNamestringThe name of the device.
inboundEndpointNamestringThe name of the inbound endpoint.
requestCreateOrUpdateDiscoveredAssetRequestThe request containing discovered asset creation parameters.
commandTimeoutTimeSpan?Optional timeout for the command.
cancellationTokenCancellationTokenOptional cancellation token.
Returns
- Task<CreateOrUpdateDiscoveredAssetResponsePayload>
A task that represents the asynchronous operation, containing the response for the created discovered asset.
CreateOrUpdateDiscoveredDeviceAsync(CreateOrUpdateDiscoveredDeviceRequestSchema, string, TimeSpan?, CancellationToken)
Creates or updates a discovered device.
public Task<CreateOrUpdateDiscoveredDeviceResponsePayload> CreateOrUpdateDiscoveredDeviceAsync(CreateOrUpdateDiscoveredDeviceRequestSchema request, string inboundEndpointType, TimeSpan? commandTimeout = null, CancellationToken cancellationToken = default)
Parameters
requestCreateOrUpdateDiscoveredDeviceRequestSchemaThe request containing discovered device endpoint profile creation parameters.
inboundEndpointTypestringcommandTimeoutTimeSpan?Optional timeout for the command.
cancellationTokenCancellationTokenOptional cancellation token.
Returns
- Task<CreateOrUpdateDiscoveredDeviceResponsePayload>
A task that represents the asynchronous operation, containing the response for the created discovered device endpoint profile.
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()
Returns
- ValueTask
A task that represents the asynchronous dispose operation.
GetAssetNames(string, string)
List the names of all available assets within the provided endpoint within the provided device.
public IEnumerable<string> GetAssetNames(string deviceName, string inboundEndpointName)
Parameters
deviceNamestringThe name of the device to get asset names from.
inboundEndpointNamestringThe name of the endpoint within the provided device to get asset names from.
Returns
- IEnumerable<string>
The collection of asset names associated with the provided endpoint in the provided device. This collection is empty if the device does not exist (or is unavailable) or if the device has no inbound endpoint with the provided name or if both the device and inbound endpoint are available, but they have no assets.
GetDeviceNames()
List the names of all available devices.
public IEnumerable<string> GetDeviceNames()
Returns
- IEnumerable<string>
The names of all available devices
GetEndpointCredentials(string, string, InboundEndpointSchemaMapValue)
Get the credentials to use when connecting to the provided endpoint.
public EndpointCredentials GetEndpointCredentials(string deviceName, string inboundEndpointName, InboundEndpointSchemaMapValue inboundEndpoint)
Parameters
deviceNamestringThe name of the device whose inbound endpoint credentials should be retrieved.
inboundEndpointNamestringThe name of the inbound endpoint whose credentials should be retrieved.
inboundEndpointInboundEndpointSchemaMapValueThe endpoint whose credentials should be returned.
Returns
- EndpointCredentials
The credentials for the endpoint
GetInboundEndpointNames(string)
List the names of all available inbound endpoints associated with the provided device name.
public IEnumerable<string> GetInboundEndpointNames(string deviceName)
Parameters
deviceNamestringThe device whose inbound endpoint names will be listed.
Returns
- IEnumerable<string>
The collection of inbound endpoint names associated with this device. This collection is empty if the device doesn't exist or isn't available.
ObserveAssets(string, string)
Start receiving notifications on AssetChanged when any asset associated with the provided endpoint in the provided device is created, updated, or deleted.
public void ObserveAssets(string deviceName, string inboundEndpointName)
Parameters
deviceNamestringThe name of the device whose assets will be observed.
inboundEndpointNamestringThe name of the endpoint within the device whose assets will be observed.
ObserveDevices()
Start receiving notifications on DeviceChanged when any device is created, updated, or deleted.
public void ObserveDevices()
UnobserveAllAsync(CancellationToken)
Stop receiving all asset and device notifications on AssetChanged and DeviceChanged.
public Task UnobserveAllAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
UnobserveAssetsAsync(string, string, CancellationToken)
Stop receiving notifications on AssetChanged when any asset associated with the provided endpoint in the provided device is created, updated, or deleted.
public Task UnobserveAssetsAsync(string deviceName, string inboundEndpointName, CancellationToken cancellationToken = default)
Parameters
deviceNamestringThe name of the device whose assets will no longer be observed.
inboundEndpointNamestringThe name of the endpoint within the device whose assets will no longer be observed.
cancellationTokenCancellationToken
Returns
UnobserveDevicesAsync(CancellationToken)
Stop receiving notifications on DeviceChanged when any device is creatd, updated, or deleted.
public Task UnobserveDevicesAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
UpdateAssetStatusAsync(string, string, UpdateAssetStatusRequest, TimeSpan?, CancellationToken)
Updates the status of a specific asset.
public Task<AssetStatus> UpdateAssetStatusAsync(string deviceName, string inboundEndpointName, UpdateAssetStatusRequest request, TimeSpan? commandTimeout = null, CancellationToken cancellationToken = default)
Parameters
deviceNamestringThe name of the device.
inboundEndpointNamestringThe name of the inbound endpoint.
requestUpdateAssetStatusRequestThe request containing asset status update parameters.
commandTimeoutTimeSpan?Optional timeout for the command.
cancellationTokenCancellationTokenOptional cancellation token.
Returns
- Task<AssetStatus>
A task that represents the asynchronous operation, containing the updated asset details.
UpdateDeviceStatusAsync(string, string, DeviceStatus, TimeSpan?, CancellationToken)
Updates the status of a specific device.
public Task<DeviceStatus> UpdateDeviceStatusAsync(string deviceName, string inboundEndpointName, DeviceStatus status, TimeSpan? commandTimeout = null, CancellationToken cancellationToken = default)
Parameters
deviceNamestringThe name of the device.
inboundEndpointNamestringThe name of the inbound endpoint.
statusDeviceStatusThe new status of the device.
commandTimeoutTimeSpan?Optional timeout for the command.
cancellationTokenCancellationTokenOptional cancellation token.
Returns
- Task<DeviceStatus>
A task that represents the asynchronous operation, containing the updated device details.
Events
AssetChanged
Executes whenever a asset is created, updated, or deleted.
public event EventHandler<AssetChangedEventArgs>? AssetChanged
Event Type
Remarks
To start receiving these events, use ObserveAssets(string, string).
DeviceChanged
Executes whenever a device is created, updated, or deleted.
public event EventHandler<DeviceChangedEventArgs>? DeviceChanged
Event Type
Remarks
To start receiving these events, use ObserveDevices().