Table of Contents

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

applicationContext ApplicationContext
mqttPubSubClient IMqttPubSubClient

AdrClientWrapper(IAdrServiceClient, IAssetFileMonitor?)

public AdrClientWrapper(IAdrServiceClient adrServiceClient, IAssetFileMonitor? assetFileMonitor = null)

Parameters

adrServiceClient IAdrServiceClient
assetFileMonitor IAssetFileMonitor

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

deviceName string

The name of the device.

inboundEndpointName string

The name of the inbound endpoint.

request CreateOrUpdateDiscoveredAssetRequest

The request containing discovered asset creation parameters.

commandTimeout TimeSpan?

Optional timeout for the command.

cancellationToken CancellationToken

Optional 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

request CreateOrUpdateDiscoveredDeviceRequestSchema

The request containing discovered device endpoint profile creation parameters.

inboundEndpointType string
commandTimeout TimeSpan?

Optional timeout for the command.

cancellationToken CancellationToken

Optional 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

deviceName string

The name of the device to get asset names from.

inboundEndpointName string

The 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

deviceName string

The name of the device whose inbound endpoint credentials should be retrieved.

inboundEndpointName string

The name of the inbound endpoint whose credentials should be retrieved.

inboundEndpoint InboundEndpointSchemaMapValue

The 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

deviceName string

The 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

deviceName string

The name of the device whose assets will be observed.

inboundEndpointName string

The 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

cancellationToken CancellationToken

Cancellation token.

Returns

Task

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

deviceName string

The name of the device whose assets will no longer be observed.

inboundEndpointName string

The name of the endpoint within the device whose assets will no longer be observed.

cancellationToken CancellationToken

Returns

Task

UnobserveDevicesAsync(CancellationToken)

Stop receiving notifications on DeviceChanged when any device is creatd, updated, or deleted.

public Task UnobserveDevicesAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

Task

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

deviceName string

The name of the device.

inboundEndpointName string

The name of the inbound endpoint.

request UpdateAssetStatusRequest

The request containing asset status update parameters.

commandTimeout TimeSpan?

Optional timeout for the command.

cancellationToken CancellationToken

Optional 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

deviceName string

The name of the device.

inboundEndpointName string

The name of the inbound endpoint.

status DeviceStatus

The new status of the device.

commandTimeout TimeSpan?

Optional timeout for the command.

cancellationToken CancellationToken

Optional 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

EventHandler<AssetChangedEventArgs>

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

EventHandler<DeviceChangedEventArgs>

Remarks

To start receiving these events, use ObserveDevices().