OpenDevice
Open IoT (Internet Of Things) Platform and Framework http://opendevice.io
OpenDeviceClass Class Reference
Collaboration diagram for OpenDeviceClass:

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)
 
DeviceaddSensor (const char *name, uint8_t pin, Device::DeviceType type, uint8_t targetID)
 
DeviceaddSensor (const char *name, uint8_t pin, Device::DeviceType type)
 
DeviceaddSensor (const char *name, Device &sensor)
 
DeviceaddSensor (const char *name, Device *sensor)
 
DeviceaddSensor (const char *name, value_t(*function)())
 
DeviceaddDevice (const char *name, uint8_t pin, Device::DeviceType type, bool sensor, uint8_t id)
 
DeviceaddDevice (const char *name, uint8_t pin, Device::DeviceType type)
 
DeviceaddDevice (Device &device)
 
DeviceaddDevice (const char *name, Device &device)
 
bool addCommand (const char *name, void(*function)())
 
DevicegetDevice (uint8_t)
 
DevicegetDeviceAt (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
 
DeviceConnectiondeviceConnection
 

Detailed Description

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

Author
Ricardo JL Rufino
Date
27/06/2014

Member Function Documentation

◆ _afterBegin()

void OpenDeviceClass::_afterBegin ( )
inline

Allow custom #preprocessor macros

◆ apiKey()

void OpenDeviceClass::apiKey ( char  pname[])

Set APIKey for this Device

◆ begin() [1/2]

void OpenDeviceClass::begin ( unsigned long  baud)

Setup using the standard serial port

Parameters
baud- Sets the data rate in bits per second, Values:(300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200)

◆ begin() [2/2]

void OpenDeviceClass::begin ( void  )
inline

Setup connection using default settings
The connection settings are detected according to the active libraries

◆ clear()

void OpenDeviceClass::clear ( )
inline

◆ enableKeepAlive()

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

◆ generateID()

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.

Parameters
apinMust be passed to the function an analog pin not used

◆ id()

void OpenDeviceClass::id ( uint8_t *  pid)
inline

Sets the ID (formally the MAC) of the device / module.
This ID can be automatically generated by the method: generateID.

◆ load()

void OpenDeviceClass::load ( )
inline

◆ loop()

void OpenDeviceClass::loop ( )
inline

OpenDevice main operating point. You should call this method in the Skech main loop

◆ name()

void OpenDeviceClass::name ( const char *  pname)

Configure this Device/Module Name to identify and group devices

◆ onMessageReceivedImpl()

void OpenDeviceClass::onMessageReceivedImpl ( )
inline

Called when a command is received by the connection

◆ readIntValues()

int OpenDeviceClass::readIntValues ( int  values[],
int  max = -1 
)
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

◆ reset()

void OpenDeviceClass::reset ( )

Reset microcontroller (only for ESP) others need hardware changes

◆ resetPin()

void OpenDeviceClass::resetPin ( byte  pin)

Set reset PIN, if you are using ESP, it must be set to active low

◆ save()

void OpenDeviceClass::save ( )
inline

◆ server()

void OpenDeviceClass::server ( char  pname[])

Set server IP or Host to connect


The documentation for this class was generated from the following files: