C# Класс DeviceHive.DeviceEngine

Base class for DeviceHive .NET Micro Framework devices. All custom devices should be inherited from it.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
DcClient IFrameworkClient

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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.

Приватные методы

Метод Описание
FindDevice ( string code ) : EquipmentEngine

Locates an equipment by a specified code

RegisterEquipment ( ) : bool

Registers all equipment in DeviceHive network

UnregisterEquipment ( ) : bool

Unregisters equipment

Описание методов

Connect() публичный Метод

Connects device to network
This function should be called by implementers to make the device connect to DeviceHive network.
public Connect ( ) : bool
Результат bool

CreateDeviceData() защищенный абстрактный Метод

This function should be overridden by implementers to return a specific DeviceData structure.
protected abstract CreateDeviceData ( ) : Device
Результат Device

CreateEquipment() защищенный абстрактный Метод

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
Результат void

Init() публичный Метод

Initializes the device
This function should be called by implementers before any calls to other DeveiceEngine's functions.
public Init ( ) : bool
Результат bool

ProcessCommands() публичный Метод

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
Результат bool

SendNotification() публичный Метод

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
Результат bool

Описание свойств

DcClient защищенное свойство

DeviceHive client used to handle API calls.
protected IFrameworkClient DcClient
Результат IFrameworkClient