C# Class Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Infrastructure.BusinessLogic.DeviceLogic

Inheritance: IDeviceLogic
Exibir arquivo Open project: Azure/azure-iot-remote-monitoring

Public Methods

Method Description
AddDeviceAsync ( DeviceModel device ) : Task

Adds a device to the Device Identity Store and Device Registry

ApplyDevicePropertyValueModels ( DeviceModel device, IEnumerable devicePropertyValueModels ) : void

Modified a Device using a list of DevicePropertyValueModel.

BootstrapDefaultDevices ( ) : Task>
DeviceLogic ( IIotHubRepository iotHubRepository, IDeviceRegistryCrudRepository deviceRegistryCrudRepository, IDeviceRegistryListRepository deviceRegistryListRepository, IVirtualDeviceStorage virtualDeviceStorage, ISecurityKeyGenerator securityKeyGenerator, IConfigurationProvider configProvider, IDeviceRulesLogic deviceRulesLogic ) : System
ExtractDevicePropertyValuesModels ( DeviceModel device ) : IEnumerable
ExtractLocationsData ( List devices ) : Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Infrastructure.Models.DeviceListLocationsModel
ExtractTelemetry ( DeviceModel device ) : IList
GenerateNDevices ( int deviceCount ) : System.Threading.Tasks.Task

Generates N devices with random data and properties for testing NOTE: Adds the devices to both the device registry and device identity repository

TEMPORARY DEVICE GENERATION CODE FOR TESTING PURPOSES!

GetDeviceAsync ( string deviceId ) : Task
GetDevices ( Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Infrastructure.Models.DeviceListQuery q ) : Task
GetIoTHubKeysAsync ( string deviceId ) : Task

Retrieves the IoT Hub keys for the given device

RemoveDeviceAsync ( string deviceId ) : System.Threading.Tasks.Task

Removes a device from the underlying repositories

SendCommandAsync ( string deviceId, string commandName, dynamic parameters ) : System.Threading.Tasks.Task

Send a command to a device based on the provided device id

UpdateDeviceAsync ( DeviceModel device ) : Task

Updates the device in the device registry with the exact device provided in this call. NOTE: The device provided here should represent the entire device that will be serialized into the device registry.

UpdateDeviceEnabledStatusAsync ( string deviceId, bool isEnabled ) : Task
UpdateDeviceFromDeviceInfoPacketAsync ( DeviceModel device ) : Task

Private Methods

Method Description
AddDeviceToRepositoriesAsync ( DeviceModel device, Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models.SecurityKeys securityKeys ) : Task

Adds the given device and assigned keys to the underlying repositories

AddOrRemoveSimulatedDevice ( DeviceModel repositoryDevice, bool isEnabled ) : Task
ApplyPropertyValueModels ( DeviceProperties deviceProperties, IEnumerable devicePropertyValueModels ) : void
CheckIfDeviceExists ( DeviceModel device, List validationErrors ) : System.Threading.Tasks.Task
ExtractPropertyValueModels ( DeviceProperties deviceProperties ) : IEnumerable
GetDevicePropertyConfiguration ( ) : IEnumerable
SendCommandAsyncWithDevice ( DeviceModel device, string commandName, dynamic parameters ) : Task

Sends a command to the provided device and updates the command history of the device

ValidateDevice ( DeviceModel device ) : System.Threading.Tasks.Task
ValidateDeviceId ( DeviceModel device, List validationErrors ) : bool

Method Details

AddDeviceAsync() public method

Adds a device to the Device Identity Store and Device Registry
public AddDeviceAsync ( DeviceModel device ) : Task
device Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models.DeviceModel Device to add to the underlying repositories
return Task

ApplyDevicePropertyValueModels() public method

Modified a Device using a list of DevicePropertyValueModel.
public ApplyDevicePropertyValueModels ( DeviceModel device, IEnumerable devicePropertyValueModels ) : void
device Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models.DeviceModel /// The Device to modify. ///
devicePropertyValueModels IEnumerable /// The list of s for modifying /// . ///
return void

BootstrapDefaultDevices() public method

public BootstrapDefaultDevices ( ) : Task>
return Task>

DeviceLogic() public method

public DeviceLogic ( IIotHubRepository iotHubRepository, IDeviceRegistryCrudRepository deviceRegistryCrudRepository, IDeviceRegistryListRepository deviceRegistryListRepository, IVirtualDeviceStorage virtualDeviceStorage, ISecurityKeyGenerator securityKeyGenerator, IConfigurationProvider configProvider, IDeviceRulesLogic deviceRulesLogic ) : System
iotHubRepository IIotHubRepository
deviceRegistryCrudRepository IDeviceRegistryCrudRepository
deviceRegistryListRepository IDeviceRegistryListRepository
virtualDeviceStorage IVirtualDeviceStorage
securityKeyGenerator ISecurityKeyGenerator
configProvider IConfigurationProvider
deviceRulesLogic IDeviceRulesLogic
return System

ExtractDevicePropertyValuesModels() public method

public ExtractDevicePropertyValuesModels ( DeviceModel device ) : IEnumerable
device Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models.DeviceModel
return IEnumerable

ExtractLocationsData() public method

public ExtractLocationsData ( List devices ) : Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Infrastructure.Models.DeviceListLocationsModel
devices List
return Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Infrastructure.Models.DeviceListLocationsModel

ExtractTelemetry() public method

public ExtractTelemetry ( DeviceModel device ) : IList
device Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models.DeviceModel
return IList

GenerateNDevices() public method

Generates N devices with random data and properties for testing NOTE: Adds the devices to both the device registry and device identity repository
TEMPORARY DEVICE GENERATION CODE FOR TESTING PURPOSES!
public GenerateNDevices ( int deviceCount ) : System.Threading.Tasks.Task
deviceCount int Number of devices to generate
return System.Threading.Tasks.Task

GetDeviceAsync() public method

public GetDeviceAsync ( string deviceId ) : Task
deviceId string
return Task

GetDevices() public method

public GetDevices ( Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Infrastructure.Models.DeviceListQuery q ) : Task
q Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Infrastructure.Models.DeviceListQuery
return Task

GetIoTHubKeysAsync() public method

Retrieves the IoT Hub keys for the given device
public GetIoTHubKeysAsync ( string deviceId ) : Task
deviceId string ID of the device to retrieve
return Task

RemoveDeviceAsync() public method

Removes a device from the underlying repositories
public RemoveDeviceAsync ( string deviceId ) : System.Threading.Tasks.Task
deviceId string ID of the device to remove
return System.Threading.Tasks.Task

SendCommandAsync() public method

Send a command to a device based on the provided device id
public SendCommandAsync ( string deviceId, string commandName, dynamic parameters ) : System.Threading.Tasks.Task
deviceId string The Device's ID
commandName string The name of the command
parameters dynamic The parameters to send
return System.Threading.Tasks.Task

UpdateDeviceAsync() public method

Updates the device in the device registry with the exact device provided in this call. NOTE: The device provided here should represent the entire device that will be serialized into the device registry.
public UpdateDeviceAsync ( DeviceModel device ) : Task
device Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models.DeviceModel Device to update in the device registry
return Task

UpdateDeviceEnabledStatusAsync() public method

public UpdateDeviceEnabledStatusAsync ( string deviceId, bool isEnabled ) : Task
deviceId string
isEnabled bool
return Task

UpdateDeviceFromDeviceInfoPacketAsync() public method

public UpdateDeviceFromDeviceInfoPacketAsync ( DeviceModel device ) : Task
device Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models.DeviceModel
return Task