C# Class DeviceHive.DeviceEngine

Base class for DeviceHive .NET Micro Framework devices. All custom devices should be inherited from it.
Afficher le fichier Open project: devicehive/devicehive-.net-mf Class Usage Examples

Protected Properties

Свойство Type Description
DcClient IFrameworkClient

Méthodes publiques

Méthode Description
Connect ( ) : bool

Connects device to network

This function should be called by implementers to make the device connect to DeviceHive network.

Init ( ) : bool

Initializes the device

This function should be called by implementers before any calls to other DeveiceEngine's functions.

ProcessCommands ( ) : bool

Default command processing

This function performs a default command processing, including handling equipment commands and firing events. It should be invoked by implementers to perform a single command processing loop. So, it should be ran continuously.

SendNotification ( INotification notification ) : bool

Sends a notification to the DeviceHive network

This function can be used by implementers to send device-specific notifications.

Méthodes protégées

Méthode Description
CreateDeviceData ( ) : Device

This function should be overridden by implementers to return a specific DeviceData structure.

CreateEquipment ( ) : void

Initializes device equipment structure

This function should be overridden by implementers to construct device equipment and fill DeviceData equipment hashtable with equipment. This function is invoked after the device has connected to data network and registered itself. Normally, the constructed equipment should be initialized and send its status to DeviceHive network.

Private Methods

Méthode Description
FindDevice ( string code ) : EquipmentEngine

Locates an equipment by a specified code

RegisterEquipment ( ) : bool

Registers all equipment in DeviceHive network

UnregisterEquipment ( ) : bool

Unregisters equipment

Method Details

Connect() public méthode

Connects device to network
This function should be called by implementers to make the device connect to DeviceHive network.
public Connect ( ) : bool
Résultat bool

CreateDeviceData() protected abstract méthode

This function should be overridden by implementers to return a specific DeviceData structure.
protected abstract CreateDeviceData ( ) : Device
Résultat Device

CreateEquipment() protected abstract méthode

Initializes device equipment structure
This function should be overridden by implementers to construct device equipment and fill DeviceData equipment hashtable with equipment. This function is invoked after the device has connected to data network and registered itself. Normally, the constructed equipment should be initialized and send its status to DeviceHive network.
protected abstract CreateEquipment ( ) : void
Résultat void

Init() public méthode

Initializes the device
This function should be called by implementers before any calls to other DeveiceEngine's functions.
public Init ( ) : bool
Résultat bool

ProcessCommands() public méthode

Default command processing
This function performs a default command processing, including handling equipment commands and firing events. It should be invoked by implementers to perform a single command processing loop. So, it should be ran continuously.
public ProcessCommands ( ) : bool
Résultat bool

SendNotification() public méthode

Sends a notification to the DeviceHive network
This function can be used by implementers to send device-specific notifications.
public SendNotification ( INotification notification ) : bool
notification INotification Notification to be sent
Résultat bool

Property Details

DcClient protected_oe property

DeviceHive client used to handle API calls.
protected IFrameworkClient DcClient
Résultat IFrameworkClient