C# Class DeviceHive.EquipmentEngine

Implementation of common equipment functionality
Implementers should derive from this class when creating their own custom equipment. See Switch class for more details.
Inheritance: Equipment
ファイルを表示 Open project: devicehive/devicehive-.net-mf

Public Methods

Method Description
EquipmentEngine ( DeviceEngine dev ) : Microsoft.SPOT

Constricts an equipment for the specififed parent device

OnCommand ( DeviceCommand cmd ) : bool

Executes an equipment commmand

Implementers should override this function with an equipment-specific command code. Common approact is to check the command code and perform actions accordingly

Register ( ) : bool

Registers the equipment

When the device initializes, it initializes all the equipment it has. By overriding this function an equipment can provide custom initialization steps.

SendNotification ( string DataName, object DataValue ) : bool

Common functionality for sending equipment notifications

Implementers can use this functuions in their custom code to notify of equipment value changes.

Unregister ( ) : bool

Unregisters the equipment

When the device is disconnected from the network or enters the fault state, it tries to unregister all its equipment. Implementers should override this function to provide custon uninitialization steps (closing files or handles, stopping timers, etc.).

Method Details

EquipmentEngine() public method

Constricts an equipment for the specififed parent device
public EquipmentEngine ( DeviceEngine dev ) : Microsoft.SPOT
dev DeviceEngine Device for which the equipment is created
return Microsoft.SPOT

OnCommand() public abstract method

Executes an equipment commmand
Implementers should override this function with an equipment-specific command code. Common approact is to check the command code and perform actions accordingly
public abstract OnCommand ( DeviceCommand cmd ) : bool
cmd DeviceCommand Command data structure
return bool

Register() public method

Registers the equipment
When the device initializes, it initializes all the equipment it has. By overriding this function an equipment can provide custom initialization steps.
public Register ( ) : bool
return bool

SendNotification() public method

Common functionality for sending equipment notifications
Implementers can use this functuions in their custom code to notify of equipment value changes.
public SendNotification ( string DataName, object DataValue ) : bool
DataName string Name of the equipment
DataValue object New value of the equipment
return bool

Unregister() public method

Unregisters the equipment
When the device is disconnected from the network or enters the fault state, it tries to unregister all its equipment. Implementers should override this function to provide custon uninitialization steps (closing files or handles, stopping timers, etc.).
public Unregister ( ) : bool
return bool