C# Class Microsoft.Azure.Devices.Applications.RemoteMonitoring.Simulator.WebJob.SimulatorCore.Devices.DeviceBase

Simulates a single IoT device that sends and recieves data from a transport
Inheritance: IDevice
Mostra file Open project: Azure/azure-iot-remote-monitoring Class Usage Examples

Protected Properties

Property Type Description
ConfigProvider IConfigurationProvider
Logger ILogger
RootCommandProcessor Microsoft.Azure.Devices.Applications.RemoteMonitoring.Simulator.WebJob.SimulatorCore.CommandProcessors.CommandProcessor
TelemetryFactory ITelemetryFactory
Transport ITransport
TransportFactory ITransportFactory
_telemetryController object

Public Methods

Method Description
DeviceBase ( ILogger logger, ITransportFactory transportFactory, ITelemetryFactory telemetryFactory, IConfigurationProvider configurationProvider ) : System

GetDeviceInfo ( ) : DeviceModel

Generates a DeviceInfo packet for a simulated device to send over the wire

Init ( Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models.InitialDeviceConfig config ) : void
SendDeviceInfo ( ) : Task
StartAsync ( CancellationToken token ) : Task

Starts the send event loop and runs the receive loop in the background to listen for commands that are sent to the device

Protected Methods

Method Description
InitCommandProcessors ( ) : void

Builds up a set of commands supported by this device

InitDeviceInfo ( Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models.InitialDeviceConfig config ) : void

Private Methods

Method Description
StartReceiveLoopAsync ( CancellationToken token ) : Task

Starts the loop that listens for events/commands from the IoT Hub to be sent to this device

StartSendLoopAsync ( CancellationToken token ) : Task

Iterates through the list of IEventGroups and fires off the events in a given event group before moving to the next. If RepeatEventListForever is true the device will continue to loop through each event group, if false once a single pass is made through all event groups the device will stop sending events

Method Details

DeviceBase() public method

public DeviceBase ( ILogger logger, ITransportFactory transportFactory, ITelemetryFactory telemetryFactory, IConfigurationProvider configurationProvider ) : System
logger ILogger Logger where this device will log information to
transportFactory ITransportFactory
telemetryFactory ITelemetryFactory
configurationProvider IConfigurationProvider
return System

GetDeviceInfo() public method

Generates a DeviceInfo packet for a simulated device to send over the wire
public GetDeviceInfo ( ) : DeviceModel
return Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models.DeviceModel

Init() public method

public Init ( Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models.InitialDeviceConfig config ) : void
config Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models.InitialDeviceConfig
return void

InitCommandProcessors() protected method

Builds up a set of commands supported by this device
protected InitCommandProcessors ( ) : void
return void

InitDeviceInfo() protected method

protected InitDeviceInfo ( Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models.InitialDeviceConfig config ) : void
config Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models.InitialDeviceConfig
return void

SendDeviceInfo() public method

public SendDeviceInfo ( ) : Task
return Task

StartAsync() public method

Starts the send event loop and runs the receive loop in the background to listen for commands that are sent to the device
public StartAsync ( CancellationToken token ) : Task
token System.Threading.CancellationToken
return Task

Property Details

ConfigProvider protected_oe property

protected IConfigurationProvider ConfigProvider
return IConfigurationProvider

Logger protected_oe property

protected ILogger Logger
return ILogger

RootCommandProcessor protected_oe property

protected CommandProcessor,Microsoft.Azure.Devices.Applications.RemoteMonitoring.Simulator.WebJob.SimulatorCore.CommandProcessors RootCommandProcessor
return Microsoft.Azure.Devices.Applications.RemoteMonitoring.Simulator.WebJob.SimulatorCore.CommandProcessors.CommandProcessor

TelemetryFactory protected_oe property

protected ITelemetryFactory TelemetryFactory
return ITelemetryFactory

Transport protected_oe property

protected ITransport Transport
return ITransport

TransportFactory protected_oe property

protected ITransportFactory TransportFactory
return ITransportFactory

_telemetryController protected_oe property

protected object _telemetryController
return object