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

Fork of Cayenne-MQTT-mbed by myDevicesIoT

Committer:
jburhenn
Date:
Fri Oct 28 13:38:43 2016 -0600
Revision:
11:532406b58e8f
Parent:
0:09ef59d2d0f7
Updated documentation comments.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jburhenn 0:09ef59d2d0f7 1 /*
jburhenn 0:09ef59d2d0f7 2 The MIT License(MIT)
jburhenn 0:09ef59d2d0f7 3
jburhenn 0:09ef59d2d0f7 4 Cayenne MQTT Client Library
jburhenn 0:09ef59d2d0f7 5 Copyright (c) 2016 myDevices
jburhenn 0:09ef59d2d0f7 6
jburhenn 0:09ef59d2d0f7 7 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
jburhenn 0:09ef59d2d0f7 8 documentation files(the "Software"), to deal in the Software without restriction, including without limitation
jburhenn 0:09ef59d2d0f7 9 the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software,
jburhenn 0:09ef59d2d0f7 10 and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
jburhenn 0:09ef59d2d0f7 11 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
jburhenn 0:09ef59d2d0f7 12 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
jburhenn 0:09ef59d2d0f7 13 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR
jburhenn 0:09ef59d2d0f7 14 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
jburhenn 0:09ef59d2d0f7 15 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
jburhenn 0:09ef59d2d0f7 16 */
jburhenn 0:09ef59d2d0f7 17
jburhenn 0:09ef59d2d0f7 18 #ifndef _NETWORKINTERFACE_h
jburhenn 0:09ef59d2d0f7 19 #define _NETWORKINTERFACE_h
jburhenn 0:09ef59d2d0f7 20
jburhenn 0:09ef59d2d0f7 21 // Interface for the platform specific Network class used by MQTTClient. You do not need to derive your Network class from this interface
jburhenn 0:09ef59d2d0f7 22 // but your platform specific Network class must provide the same functions.
jburhenn 0:09ef59d2d0f7 23 class NetworkInterface
jburhenn 0:09ef59d2d0f7 24 {
jburhenn 0:09ef59d2d0f7 25 public:
jburhenn 0:09ef59d2d0f7 26 /**
jburhenn 0:09ef59d2d0f7 27 * Read data from the network.
jburhenn 0:09ef59d2d0f7 28 * @param[out] buffer Buffer that receives the data
jburhenn 0:09ef59d2d0f7 29 * @param[in] len Buffer length
jburhenn 0:09ef59d2d0f7 30 * @param[in] timeout_ms Timeout for the read operation, in milliseconds
jburhenn 11:532406b58e8f 31 * @return Number of bytes read, or a negative value if there was an error
jburhenn 0:09ef59d2d0f7 32 */
jburhenn 0:09ef59d2d0f7 33 virtual int read(unsigned char* buffer, int len, int timeout_ms) = 0;
jburhenn 0:09ef59d2d0f7 34
jburhenn 0:09ef59d2d0f7 35 /**
jburhenn 0:09ef59d2d0f7 36 * Write data to the network.
jburhenn 0:09ef59d2d0f7 37 * @param[in] buffer Buffer that contains data to write
jburhenn 0:09ef59d2d0f7 38 * @param[in] len Number of bytes to write
jburhenn 0:09ef59d2d0f7 39 * @param[in] timeout_ms Timeout for the write operation, in milliseconds
jburhenn 0:09ef59d2d0f7 40 * @return Number of bytes written on success, a negative value for error
jburhenn 0:09ef59d2d0f7 41 */
jburhenn 0:09ef59d2d0f7 42 virtual int write(unsigned char* buffer, int len, int timeout_ms) = 0;
jburhenn 0:09ef59d2d0f7 43 };
jburhenn 0:09ef59d2d0f7 44
jburhenn 0:09ef59d2d0f7 45 #endif