Interface IAzureDeviceRegistryClientWrapper
- Namespace
- Azure.Iot.Operations.Connector
- Assembly
- Azure.Iot.Operations.Connector.dll
public interface IAzureDeviceRegistryClientWrapper : IAsyncDisposable
- Inherited Members
Methods
CreateOrUpdateDiscoveredAssetAsync(string, string, CreateOrUpdateDiscoveredAssetRequest, TimeSpan?, CancellationToken)
Creates or updates a discovered asset.
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.
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.
GetAssetNames(string, string)
List the names of all available assets within the provided endpoint within the provided device.
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.
GetAssetStatusAsync(string, string, string, TimeSpan?, CancellationToken)
Retrieves the status of a specific asset.
Task<AssetStatus> GetAssetStatusAsync(string deviceName, string inboundEndpointName, string assetName, TimeSpan? commandTimeout = null, CancellationToken cancellationToken = default)
Parameters
deviceNamestringThe name of the device.
inboundEndpointNamestringThe name of the inbound endpoint.
assetNamestringThe name of the asset.
commandTimeoutTimeSpan?Optional timeout for the command.
cancellationTokenCancellationTokenOptional cancellation token.
Returns
- Task<AssetStatus>
The status returned by the Azure Device Registry service.
GetDeviceNames()
List the names of all available devices.
IEnumerable<string> GetDeviceNames()
Returns
- IEnumerable<string>
The names of all available devices
GetDeviceStatusAsync(string, string, TimeSpan?, CancellationToken)
Retrieves the status of a specific device.
Task<DeviceStatus> GetDeviceStatusAsync(string deviceName, string inboundEndpointName, TimeSpan? commandTimeout = null, CancellationToken cancellationToken = default)
Parameters
deviceNamestringThe name of the device.
inboundEndpointNamestringThe name of the inbound endpoint.
commandTimeoutTimeSpan?Optional timeout for the command.
cancellationTokenCancellationTokenOptional cancellation token.
Returns
- Task<DeviceStatus>
The status returned by the Azure Device Registry service.
GetEndpointCredentials(string, string, InboundEndpointSchemaMapValue)
Get the credentials to use when connecting to the provided endpoint.
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.
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.
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.
void ObserveDevices()
UnobserveAllAsync(CancellationToken)
Stop receiving all asset and device notifications on AssetChanged and DeviceChanged.
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.
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.
Task UnobserveDevicesAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
UpdateAssetStatusAsync(string, string, UpdateAssetStatusRequest, TimeSpan?, CancellationToken)
Updates the status of a specific asset.
Task<AssetStatus> UpdateAssetStatusAsync(string deviceName, string inboundEndpointName, UpdateAssetStatusRequest request, TimeSpan? commandTimeout = null, CancellationToken cancellationToken = default)
Parameters
deviceNamestringThe name of the device the asset belongs to.
inboundEndpointNamestringThe name of the inbound endpoint the asset belongs to.
requestUpdateAssetStatusRequestThe new status of this asset and its datasets/event groups/streams/management groups.
commandTimeoutTimeSpan?The timeout for this RPC command invocation.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<AssetStatus>
The status returned by the Azure Device Registry service.
Remarks
This update behaves like a 'put' in that it will replace all current state for this asset in the Azure
Device Registry service with what is provided. It is generally recommended to use GetAssetStatusAsync(string, string, string, TimeSpan?, CancellationToken)
to fetch the current status, patch that status, and then provide it in request to ensure
that no current asset status is lost.
UpdateDeviceStatusAsync(string, string, DeviceStatus, TimeSpan?, CancellationToken)
Update the status of a specific device in the Azure Device Registry service.
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>
The status returned by the Azure Device Registry service
Remarks
This update call will act as a patch for all endpoint level statuses, but will act as a put for the device-level status. That means that, for devices with multiple endpoints, you can safely call this method when each endpoint has a status to report without needing to include the existing status of previously reported endpoints.
Events
AssetChanged
Executes whenever a asset is created, updated, or deleted.
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.
event EventHandler<DeviceChangedEventArgs>? DeviceChanged
Event Type
Remarks
To start receiving these events, use ObserveDevices().