mqtt specific components for the impact mbed endpoint library

Dependents:   mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_mqtt_endpoint_nxp

Committer:
ansond
Date:
Wed Mar 26 19:48:35 2014 +0000
Revision:
0:a3fc1c6ef150
Child:
56:789a1a8c5ebe
updates

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 0:a3fc1c6ef150 1 /* Copyright C2013 Doug Anson, MIT License
ansond 0:a3fc1c6ef150 2 *
ansond 0:a3fc1c6ef150 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
ansond 0:a3fc1c6ef150 4 * and associated documentation files the "Software", to deal in the Software without restriction,
ansond 0:a3fc1c6ef150 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
ansond 0:a3fc1c6ef150 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
ansond 0:a3fc1c6ef150 7 * furnished to do so, subject to the following conditions:
ansond 0:a3fc1c6ef150 8 *
ansond 0:a3fc1c6ef150 9 * The above copyright notice and this permission notice shall be included in all copies or
ansond 0:a3fc1c6ef150 10 * substantial portions of the Software.
ansond 0:a3fc1c6ef150 11 *
ansond 0:a3fc1c6ef150 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
ansond 0:a3fc1c6ef150 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
ansond 0:a3fc1c6ef150 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
ansond 0:a3fc1c6ef150 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
ansond 0:a3fc1c6ef150 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
ansond 0:a3fc1c6ef150 17 */
ansond 0:a3fc1c6ef150 18
ansond 0:a3fc1c6ef150 19 #include "EmulatedLightSwitchAction.h"
ansond 0:a3fc1c6ef150 20
ansond 0:a3fc1c6ef150 21 // Our instance
ansond 0:a3fc1c6ef150 22 EmulatedLightSwitchAction *_switchAction = NULL;
ansond 0:a3fc1c6ef150 23
ansond 0:a3fc1c6ef150 24 // static callback for Switching operations
ansond 0:a3fc1c6ef150 25 void emulated_light_switch_cb() {
ansond 0:a3fc1c6ef150 26 if (_switchAction != NULL) ((LightSwitchAction *)_switchAction)->toggle();
ansond 0:a3fc1c6ef150 27 }
ansond 0:a3fc1c6ef150 28
ansond 0:a3fc1c6ef150 29 // default constructor
ansond 0:a3fc1c6ef150 30 EmulatedLightSwitchAction::EmulatedLightSwitchAction(ErrorHandler *error_handler,Light *light) : LightSwitchAction(error_handler,light) {
ansond 0:a3fc1c6ef150 31 _switchAction = this;
ansond 0:a3fc1c6ef150 32 }
ansond 0:a3fc1c6ef150 33
ansond 0:a3fc1c6ef150 34 // destructor
ansond 0:a3fc1c6ef150 35 EmulatedLightSwitchAction::~EmulatedLightSwitchAction() {
ansond 0:a3fc1c6ef150 36 }
ansond 0:a3fc1c6ef150 37
ansond 0:a3fc1c6ef150 38 // Light turned ON
ansond 0:a3fc1c6ef150 39 void EmulatedLightSwitchAction::on() {
ansond 0:a3fc1c6ef150 40 if (this->light() != NULL) ((LightSwitchAction *)this)->light()->on();
ansond 0:a3fc1c6ef150 41 }
ansond 0:a3fc1c6ef150 42
ansond 0:a3fc1c6ef150 43 // Light turned OFF
ansond 0:a3fc1c6ef150 44 void EmulatedLightSwitchAction::off() {
ansond 0:a3fc1c6ef150 45 if (this->light() != NULL) ((LightSwitchAction *)this)->light()->off();
ansond 0:a3fc1c6ef150 46 }