OpenDevice
Open IoT (Internet Of Things) Platform and Framework http://opendevice.io
|
Public Member Functions | |
void | loop () |
void | id (uint8_t *pid) |
void | name (const char *pname) |
void | server (char pname[]) |
void | apiKey (char pname[]) |
void | resetPin (byte pin) |
const char * | name () |
void | ip (uint8_t n1, uint8_t n2, uint8_t n3, uint8_t n4) |
void | begin (unsigned long baud) |
void | begin (Stream &stream) |
void | begin (HardwareSerial &serial, unsigned long baud) |
void | _afterBegin () |
void | begin () |
void | begin (DeviceConnection &deviceConnection) |
void | checkSensorsStatus () |
void | enableKeepAlive (bool val=false) |
void | showFreeRam () |
void | reset () |
void | enableDebug (uint8_t debugTarget=DEBUG_SERIAL) |
void | send (Command cmd) |
void | debug (const char str[], unsigned long value=-1) |
Device * | addSensor (const char *name, uint8_t pin, Device::DeviceType type, uint8_t targetID) |
Device * | addSensor (const char *name, uint8_t pin, Device::DeviceType type) |
Device * | addSensor (const char *name, Device &sensor) |
Device * | addSensor (const char *name, Device *sensor) |
Device * | addSensor (const char *name, value_t(*function)()) |
Device * | addDevice (const char *name, uint8_t pin, Device::DeviceType type, bool sensor, uint8_t id) |
Device * | addDevice (const char *name, uint8_t pin, Device::DeviceType type) |
Device * | addDevice (Device &device) |
Device * | addDevice (const char *name, Device &device) |
bool | addCommand (const char *name, void(*function)()) |
Device * | getDevice (uint8_t) |
Device * | getDeviceAt (uint8_t) |
uint8_t * | generateID (uint8_t apin=0) |
void | setValue (uint8_t id, value_t value) |
void | sendValue (Device *device) |
void | toggle (uint8_t index) |
void | sendToAll (value_t value) |
void | load () |
void | save () |
void | clear () |
void | printStorageSettings () |
bool | isConnected () |
void | setConnected (bool val) |
String | readString () |
int | readInt () |
long | readLong () |
float | readFloat () |
int | readIntValues (int values[], int max=-1) |
int | readLongValues (long values[], int max=-1) |
int | readFloatValues (float values[], int max=-1) |
void | onMessageReceivedImpl () |
Static Public Member Functions | |
static void | onInterruptReceived () |
static void | onMessageReceived (Command cmd) |
Public Attributes | |
Command | lastCMD |
bool | messageReceived = false |
uint8_t | deviceLength |
uint8_t | commandsLength |
DeviceConnection * | deviceConnection |
Main point of device configuration and management in firmware. Several settings can be made through the file: config.h The automatic configuration system is implemented in this file in conjunction with dependencies.h
|
inline |
Allow custom #preprocessor macros
void OpenDeviceClass::apiKey | ( | char | pname[] | ) |
Set APIKey for this Device
void OpenDeviceClass::begin | ( | unsigned long | baud | ) |
Setup using the standard serial port
baud | - Sets the data rate in bits per second, Values:(300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200) |
|
inline |
Setup connection using default settings
The connection settings are detected according to the active libraries
|
inline |
void OpenDeviceClass::enableKeepAlive | ( | bool | val = false | ) |
When enabled OpenDevice will be sending a PING message to connection to inform you that everything is OK.
Control of the Keep Alive / Ping can be left to the other side of the connection, in this case the "device" would be disabled
uint8_t * OpenDeviceClass::generateID | ( | uint8_t | apin = 0 | ) |
This function generates a Module.ID/MAC (pseudo-random) to be used in the connection and save to EEPROM for future use.
apin | Must be passed to the function an analog pin not used |
|
inline |
Sets the ID (formally the MAC) of the device / module.
This ID can be automatically generated by the method: generateID.
|
inline |
|
inline |
OpenDevice main operating point. You should call this method in the Skech main loop
void OpenDeviceClass::name | ( | const char * | pname | ) |
Configure this Device/Module Name to identify and group devices
|
inline |
Called when a command is received by the connection
|
inline |
Can read single value list like: [1,2,3,4] If you need to read two different arrays like: [1,2,3];[5,2,3,4] call the method 'readIntValues' twice
void OpenDeviceClass::reset | ( | ) |
Reset microcontroller (only for ESP) others need hardware changes
void OpenDeviceClass::resetPin | ( | byte | pin | ) |
Set reset PIN, if you are using ESP, it must be set to active low
|
inline |
void OpenDeviceClass::server | ( | char | pname[] | ) |
Set server IP or Host to connect