Dreamforce Heroku Sample mbed application for the FRDM-K64F. This application uses SocketIO to connect and communicate with Heroku.

Dependencies:   BufferedSerial C12832 EthernetInterface HTTPClient-SSL LM75B MMA7660 SocketIO-k64f WebSocketClient-ThermostatDemo mbed-rtos mbed picojson

Fork of df-2013-minihack-thermostat-complete by MBED_DEMOS

Embed: (wiki syntax)

« Back to documentation index

ThermostatSocketIO Class Reference

ThermostatSocketIO Class Reference

ThermostatSocketIO client class. More...

#include <ThermostatSocketIO.h>

Public Member Functions

 ThermostatSocketIO (char *devname)
 Constructor.
 ThermostatSocketIO (char *url, char *devname)
 Constructor.
int emit (float temp, float latitude, float longitude, float bat, int errorState, char *t_status)
 Emit (Broadcast) a socket.io message to the SocketIO server - specific to the ThermostatDemo app.
void resetMessageCounter ()
 Reset the message counter.
bool close ()
 Close the SocketIO connection.

Detailed Description

ThermostatSocketIO client class.

Derived class from SocketIO library specifically for the ThermostatDemo app

Definition at line 41 of file ThermostatSocketIO.h.


Constructor & Destructor Documentation

ThermostatSocketIO ( char *  devname )

Constructor.

Parameters:
devnameThe device's devname for display in the console

Definition at line 10 of file ThermostatSocketIO.cpp.

ThermostatSocketIO ( char *  url,
char *  devname 
)

Constructor.

Parameters:
urlThe SocketIO url in the form "www.example.com:[port]" (by default: port = 80) - i.e. just the endpoint name
devnameThe device's devname for display in the console

Definition at line 15 of file ThermostatSocketIO.cpp.


Member Function Documentation

bool close (  )

Close the SocketIO connection.

Returns:
true if the connection has been closed, false otherwise

Definition at line 47 of file ThermostatSocketIO.cpp.

int emit ( float  temp,
float  latitude,
float  longitude,
float  bat,
int  errorState,
char *  t_status 
)

Emit (Broadcast) a socket.io message to the SocketIO server - specific to the ThermostatDemo app.

Parameters:
temp- temperature
latitude- the device latitude
longitude- the device longitude
bat- the battery level
errorState- the devices current error state
t_status- the devices current error state (string - either OK or FAIL)
Returns:
the number of bytes sent

Definition at line 25 of file ThermostatSocketIO.cpp.

void resetMessageCounter (  )

Reset the message counter.

Definition at line 20 of file ThermostatSocketIO.cpp.