Core Base Classes for the Light Endpoints

Dependencies:   BufferedSerial

Dependents:   mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more

Committer:
ansond
Date:
Wed Mar 12 23:47:30 2014 +0000
Revision:
87:e9d77e9f9eae
Parent:
29:9a99f076129a
Child:
91:8732d54328ae
updates

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 29:9a99f076129a 1 /* Copyright C2013 Doug Anson, MIT License
ansond 29:9a99f076129a 2 *
ansond 29:9a99f076129a 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
ansond 29:9a99f076129a 4 * and associated documentation files the "Software", to deal in the Software without restriction,
ansond 29:9a99f076129a 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
ansond 29:9a99f076129a 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
ansond 29:9a99f076129a 7 * furnished to do so, subject to the following conditions:
ansond 29:9a99f076129a 8 *
ansond 29:9a99f076129a 9 * The above copyright notice and this permission notice shall be included in all copies or
ansond 29:9a99f076129a 10 * substantial portions of the Software.
ansond 29:9a99f076129a 11 *
ansond 29:9a99f076129a 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
ansond 29:9a99f076129a 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
ansond 29:9a99f076129a 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
ansond 29:9a99f076129a 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
ansond 29:9a99f076129a 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
ansond 29:9a99f076129a 17 */
ansond 29:9a99f076129a 18
ansond 29:9a99f076129a 19 #ifndef _PHILIPS_LIGHT_H_
ansond 29:9a99f076129a 20 #define _PHILIPS_LIGHT_H_
ansond 29:9a99f076129a 21
ansond 29:9a99f076129a 22 #include "Definitions.h"
ansond 29:9a99f076129a 23 #include "ErrorHandler.h"
ansond 29:9a99f076129a 24
ansond 29:9a99f076129a 25 class PhilipsLight {
ansond 29:9a99f076129a 26 private:
ansond 29:9a99f076129a 27 int m_id;
ansond 29:9a99f076129a 28 void *m_transport;
ansond 29:9a99f076129a 29 char m_url[PL_URL_BUFFER_LEN+1];
ansond 29:9a99f076129a 30 char m_payload[PL_PAYLOAD_BUFFER_LEN+1];
ansond 29:9a99f076129a 31 char m_response[PL_RESPONSE_BUFFER_LEN+1];
ansond 29:9a99f076129a 32 int m_state;
ansond 29:9a99f076129a 33 int m_dim;
ansond 29:9a99f076129a 34 ErrorHandler *m_error_handler;
ansond 29:9a99f076129a 35
ansond 29:9a99f076129a 36 public:
ansond 29:9a99f076129a 37 PhilipsLight(int id,void *transport,ErrorHandler *error_handler);
ansond 29:9a99f076129a 38 ~PhilipsLight();
ansond 29:9a99f076129a 39
ansond 29:9a99f076129a 40 void on();
ansond 29:9a99f076129a 41 void off();
ansond 87:e9d77e9f9eae 42 void blink();
ansond 29:9a99f076129a 43 void dim(int dim);
ansond 29:9a99f076129a 44 void update();
ansond 29:9a99f076129a 45
ansond 29:9a99f076129a 46 private:
ansond 87:e9d77e9f9eae 47 void doblink();
ansond 29:9a99f076129a 48 ErrorHandler *logger();
ansond 29:9a99f076129a 49 };
ansond 29:9a99f076129a 50
ansond 29:9a99f076129a 51 #endif // _PHILIPS_LIGHT_H_