The Cayenne MQTT mbed Library provides functions to easily connect to the Cayenne IoT project builder.

Dependents:   Cayenne-ESP8266Interface Cayenne-WIZnet_Library Cayenne-WIZnetInterface Cayenne-X-NUCLEO-IDW01M1 ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TimerInterface.h Source File

TimerInterface.h

00001 /*
00002 The MIT License(MIT)
00003 
00004 Cayenne MQTT Client Library
00005 Copyright (c) 2016 myDevices
00006 
00007 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
00008 documentation files(the "Software"), to deal in the Software without restriction, including without limitation
00009 the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software,
00010 and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
00011 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
00012 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
00013 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR
00014 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00015 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00016 */
00017 
00018 #ifndef _TIMERINTERFACE_h
00019 #define _TIMERINTERFACE_h
00020 
00021 // Interface for the platform specific Timer class used by MQTTClient. You do not need to derive your Timer class from this interface 
00022 // but your platform specific Timer class must provide the same functions.
00023 class TimerInterface
00024 {
00025 public:
00026     ///**
00027     //* A constructor with the following signature should be included in your Timer class. It should construct a timer and immediately start it.
00028     //* @param[in] milliseconds Number of milliseconds to count down.
00029     //*/
00030     //TimerInterface(int milliseconds) {
00031     //  countdown_ms(milliseconds);
00032     //}
00033     
00034     /**
00035     * Start countdown.
00036     * @param[in] milliseconds Number of milliseconds to count down.
00037     */
00038     virtual void countdown_ms(int milliseconds) = 0;
00039 
00040     /**
00041     * Start countdown.
00042     * @param[in] seconds Number of seconds to count down.
00043     */
00044     virtual void countdown(int seconds) = 0;
00045 
00046     /**
00047     * Get the number of milliseconds left in countdown.
00048     * @return Number of milliseconds left.
00049     */
00050     virtual int left_ms() = 0;
00051 
00052     /**
00053     * The countdown timer has expired.
00054     * @return true if countdown has expired, false otherwise.
00055     */
00056     virtual bool expired() = 0;
00057 };
00058 
00059 #endif