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.
MQTTNetwork.h
00001 #ifndef _MQTTNETWORK_H_ 00002 #define _MQTTNETWORK_H_ 00003 00004 #include "NetworkInterface.h" 00005 #include "TCPSocket.h" 00006 00007 class MQTTNetwork { 00008 public: 00009 MQTTNetwork(NetworkInterface* aNetwork) : network(aNetwork) { 00010 socket = new TCPSocket(); 00011 } 00012 00013 ~MQTTNetwork() { 00014 delete socket; 00015 } 00016 00017 int read(unsigned char* buffer, int len, int timeout) { 00018 return socket->recv(buffer, len); 00019 } 00020 00021 int write(unsigned char* buffer, int len, int timeout) { 00022 return socket->send(buffer, len); 00023 } 00024 00025 int connect(const char* hostname, int port) { 00026 socket->open(network); 00027 return socket->connect(hostname, port); 00028 } 00029 00030 int disconnect() { 00031 return socket->close(); 00032 } 00033 00034 private: 00035 NetworkInterface* network; 00036 TCPSocket* socket; 00037 }; 00038 00039 #endif // _MQTTNETWORK_H_
Generated on Sun Jul 24 2022 03:43:05 by
1.7.2