Class AssetFileMonitor
- Namespace
- Azure.Iot.Operations.Connector.Files
- Assembly
- Azure.Iot.Operations.Connector.dll
This class allows for getting and monitor changes to assets and devices.
public class AssetFileMonitor : IAssetFileMonitor
- Inheritance
-
AssetFileMonitor
- Implements
- Inherited Members
Remarks
This class is only applicable for connector applications that have been deployed by the Akri operator.
Constructors
AssetFileMonitor(IFilesMonitorFactory?)
Instantiate this class with the provided style of file monitor.
public AssetFileMonitor(IFilesMonitorFactory? filesMonitorFactory = null)
Parameters
filesMonitorFactory
IFilesMonitorFactoryThe factory to provide all file monitors used to watch for device and/or asset changes. If not provided, an instance of FsnotifyFilesMonitorFactory will be used. For operating systems where .NET's FileSystemWatcher isn't sufficient, users can opt to poll for file changes instead using PollingFilesMonitorFactory.
Methods
GetAssetNames(string, string)
List the names of all assets within the provided endpoint within the provided device.
public IEnumerable<string> GetAssetNames(string deviceName, string inboundEndpointName)
Parameters
deviceName
stringThe name of the device to get asset names from.
inboundEndpointName
stringThe 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 if the device has no inbound endpoint with the provided name or if both the device and inbound endpoint exist, but they have no assets.
GetDeviceNames()
List the names of all devices.
public IEnumerable<string> GetDeviceNames()
Returns
GetEndpointCredentials(string, string, InboundEndpointSchemaMapValue)
Get the file-mounted credentials for the provided inbound endpoint.
public EndpointCredentials GetEndpointCredentials(string deviceName, string inboundEndpointName, InboundEndpointSchemaMapValue inboundEndpoint)
Parameters
deviceName
stringThe name of the device whose inbound endpoint credentials should be retrieved.
inboundEndpointName
stringThe name of the inbound endpoint whose credentials should be retrieved.
inboundEndpoint
InboundEndpointSchemaMapValueThe endpoint whose credentials should be returned.
Returns
- EndpointCredentials
The credentials for the endpoint
GetInboundEndpointNames(string)
List the names of inbound endpoints associated with the provided device name.
public IEnumerable<string> GetInboundEndpointNames(string deviceName)
Parameters
deviceName
stringThe 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.
ObserveAssets(string, string)
Start observing changes to assets for the given endpoint within the given device.
public void ObserveAssets(string deviceName, string inboundEndpointName)
Parameters
deviceName
stringThe name of the device to observe asset changes within
inboundEndpointName
stringThe name of the endpoint within the device to observe asset changes within
ObserveDevices()
Start observing changes to all devices.
public void ObserveDevices()
UnobserveAll()
Stop all observation of assets and/or devices.
public void UnobserveAll()
UnobserveAssets(string, string)
Stop observing changes to assets for the given endpoint within the given device.
public void UnobserveAssets(string deviceName, string inboundEndpointName)
Parameters
deviceName
stringThe name of the device to stop observing asset changes within
inboundEndpointName
stringThe name of the endpoint within the device to stop observing asset changes within
UnobserveDevices()
Stop observing changes to all devices.
public void UnobserveDevices()
Events
AssetFileChanged
public event EventHandler<AssetFileChangedEventArgs>? AssetFileChanged
Event Type
DeviceFileChanged
public event EventHandler<DeviceFileChangedEventArgs>? DeviceFileChanged