OpenDevice
Open IoT (Internet Of Things) Platform and Framework http://opendevice.io
|
Public Types | |
enum | DeviceType { DIGITAL = 1, ANALOG = 2, ANALOG_SIGNED = 3, NUMERIC = 4, FLOAT2 = 5, FLOAT2_SIGNED = 6, FLOAT4 = 7, CHARACTER = 8, BOARD = 10, MANAGER = 11 } |
Public Member Functions | |
Device (uint8_t ipin) | |
Device (uint8_t ipin, DeviceType type) | |
Device (uint8_t ipin, DeviceType type, bool sensor) | |
Device (uint8_t iid, uint8_t ipin, DeviceType type) | |
Device (uint8_t iid, uint8_t ipin, DeviceType type, bool sensor) | |
bool | setValue (value_t value, bool sync=true) |
void | on () |
void | off () |
bool | isON () |
bool | isOFF () |
value_t | getValue () |
virtual size_t | serializeExtraData (DeviceConnection *conn) |
virtual void | deserializeExtraData (Command *cmd, DeviceConnection *conn) |
virtual bool | hasChanged () |
bool | canReadSensor () |
void | name (const char *name) |
const char * | name () |
Device * | enableInterrupt (uint8_t mode=CHANGE) |
Device * | invertedState () |
Device * | activeLow () |
virtual void | init () |
Device * | setInterval (int32_t _interval) |
void | onChange (DeviceListener) |
void | setSyncListener (DeviceListener listener) |
bool | notifyListeners () |
int | toString (char buffer[]) |
Static Public Attributes | |
static const uint8_t | MAX_ANALOG_VALUE = 255 |
Base class of Devices
bool Device::canReadSensor | ( | ) |
For Sensors :: If set readInterval has set, check if time as elapsed
Device * Device::enableInterrupt | ( | uint8_t | mode = CHANGE | ) |
Enable to read value using interruptions.
NOTE: It is necessary to enable support in the general settings.
value_t Device::getValue | ( | ) |
Get current value.
|
virtual |
For Sensors :: read sensor ans check if value has changed
Reimplemented in IRSensor, AdafruitSensor, CustomSensor, RFIDSensor, and RFSensor.
|
virtual |
This will be called on ODev.begin() to do extra initialization
Reimplemented in IRSensor, AdafruitSensor, and RFIDSensor.
Device * Device::invertedState | ( | ) |
It allows device operate in an inverted logic (the 'ON' command will generate a LOW LEVEL)
bool Device::notifyListeners | ( | ) |
fire 'onChange' listener
Device * Device::setInterval | ( | int32_t | _interval | ) |
Set reading interval for sensor's
bool Device::setValue | ( | value_t | value, |
bool | sync = true |
||
) |
Change value / state of Device
sync | - sync with server |