Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Cayenne-MQTT-mbed by
NetworkInterface.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 _NETWORKINTERFACE_h 00019 #define _NETWORKINTERFACE_h 00020 00021 // Interface for the platform specific Network class used by MQTTClient. You do not need to derive your Network class from this interface 00022 // but your platform specific Network class must provide the same functions. 00023 class NetworkInterface 00024 { 00025 public: 00026 /** 00027 * Read data from the network. 00028 * @param[out] buffer Buffer that receives the data 00029 * @param[in] len Buffer length 00030 * @param[in] timeout_ms Timeout for the read operation, in milliseconds 00031 * @return Number of bytes read, or a negative value if there was an error 00032 */ 00033 virtual int read(unsigned char* buffer, int len, int timeout_ms) = 0; 00034 00035 /** 00036 * Write data to the network. 00037 * @param[in] buffer Buffer that contains data to write 00038 * @param[in] len Number of bytes to write 00039 * @param[in] timeout_ms Timeout for the write operation, in milliseconds 00040 * @return Number of bytes written on success, a negative value for error 00041 */ 00042 virtual int write(unsigned char* buffer, int len, int timeout_ms) = 0; 00043 }; 00044 00045 #endif
Generated on Tue Jul 12 2022 21:31:38 by
1.7.2
