Library for the Adafruit FONA. This is a port of the original Arduino library available at: https://github.com/adafruit/Adafruit_FONA_Library . - Modified by Marc PLOUHINEC 27/06/2015 for use in mbed - Modified by lionel VOIRIN 05/08/2018 for use Adafruit FONA 3

Dependents:   Adafruit_FONA_3G_Library_Test

Committer:
Nels885
Date:
Tue Oct 23 19:16:20 2018 +0000
Revision:
9:b18cfba4283a
Parent:
6:8fdb30dc3108
Child:
10:7951d9691cb2
edit sslTCPsend method

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Nels885 0:bf67af6b3913 1 /***************************************************
Nels885 0:bf67af6b3913 2 This is a library for our Adafruit FONA Cellular Module
Nels885 0:bf67af6b3913 3
Nels885 0:bf67af6b3913 4 Designed specifically to work with the Adafruit FONA
Nels885 0:bf67af6b3913 5 ----> http://www.adafruit.com/products/1946
Nels885 0:bf67af6b3913 6 ----> http://www.adafruit.com/products/1963
Nels885 0:bf67af6b3913 7
Nels885 0:bf67af6b3913 8 These displays use TTL Serial to communicate, 2 pins are required to
Nels885 0:bf67af6b3913 9 interface
Nels885 0:bf67af6b3913 10 Adafruit invests time and resources providing this open source code,
Nels885 0:bf67af6b3913 11 please support Adafruit and open-source hardware by purchasing
Nels885 0:bf67af6b3913 12 products from Adafruit!
Nels885 0:bf67af6b3913 13
Nels885 0:bf67af6b3913 14 Written by Limor Fried/Ladyada for Adafruit Industries.
Nels885 0:bf67af6b3913 15 BSD license, all text above must be included in any redistribution
Nels885 0:bf67af6b3913 16 ****************************************************/
Nels885 0:bf67af6b3913 17
Nels885 0:bf67af6b3913 18 /*
Nels885 0:bf67af6b3913 19 * Modified by Marc PLOUHINEC 27/06/2015 for use in mbed
Nels885 0:bf67af6b3913 20 * Modified by lionel VOIRIN 05/08/2018 for use Adafruit FONA 3G
Nels885 0:bf67af6b3913 21 */
Nels885 0:bf67af6b3913 22
Nels885 0:bf67af6b3913 23 #ifndef ADAFRUIT_FONA_H
Nels885 0:bf67af6b3913 24 #define ADAFRUIT_FONA_H
Nels885 0:bf67af6b3913 25
Nels885 0:bf67af6b3913 26 #include "mbed.h"
Nels885 0:bf67af6b3913 27
Nels885 0:bf67af6b3913 28 //#define ADAFRUIT_FONA_DEBUG
Nels885 0:bf67af6b3913 29
Nels885 0:bf67af6b3913 30 #define FONA800L 1
Nels885 0:bf67af6b3913 31 #define FONA800H 6
Nels885 0:bf67af6b3913 32
Nels885 0:bf67af6b3913 33 #define FONA808_V1 2
Nels885 0:bf67af6b3913 34 #define FONA808_V2 3
Nels885 0:bf67af6b3913 35
Nels885 0:bf67af6b3913 36 #define FONA3G_A 4
Nels885 0:bf67af6b3913 37 #define FONA3G_E 5
Nels885 0:bf67af6b3913 38
Nels885 0:bf67af6b3913 39 // Set the preferred SMS storage.
Nels885 0:bf67af6b3913 40 // Use "SM" for storage on the SIM.
Nels885 0:bf67af6b3913 41 // Use "ME" for internal storage on the FONA chip
Nels885 0:bf67af6b3913 42 #define FONA_PREF_SMS_STORAGE "\"SM\""
Nels885 0:bf67af6b3913 43 //#define FONA_PREF_SMS_STORAGE "\"ME\""
Nels885 0:bf67af6b3913 44
Nels885 0:bf67af6b3913 45 #define FONA_HEADSETAUDIO 0
Nels885 0:bf67af6b3913 46 #define FONA_EXTAUDIO 1
Nels885 0:bf67af6b3913 47
Nels885 0:bf67af6b3913 48 #define FONA_STTONE_DIALTONE 1
Nels885 0:bf67af6b3913 49 #define FONA_STTONE_BUSY 2
Nels885 0:bf67af6b3913 50 #define FONA_STTONE_CONGESTION 3
Nels885 0:bf67af6b3913 51 #define FONA_STTONE_PATHACK 4
Nels885 0:bf67af6b3913 52 #define FONA_STTONE_DROPPED 5
Nels885 0:bf67af6b3913 53 #define FONA_STTONE_ERROR 6
Nels885 0:bf67af6b3913 54 #define FONA_STTONE_CALLWAIT 7
Nels885 0:bf67af6b3913 55 #define FONA_STTONE_RINGING 8
Nels885 0:bf67af6b3913 56 #define FONA_STTONE_BEEP 16
Nels885 0:bf67af6b3913 57 #define FONA_STTONE_POSTONE 17
Nels885 0:bf67af6b3913 58 #define FONA_STTONE_ERRTONE 18
Nels885 0:bf67af6b3913 59 #define FONA_STTONE_INDIANDIALTONE 19
Nels885 0:bf67af6b3913 60 #define FONA_STTONE_USADIALTONE 20
Nels885 0:bf67af6b3913 61
Nels885 0:bf67af6b3913 62 #define FONA_DEFAULT_TIMEOUT_MS 500
Nels885 0:bf67af6b3913 63
Nels885 0:bf67af6b3913 64 #define FONA_HTTP_GET 0
Nels885 0:bf67af6b3913 65 #define FONA_HTTP_POST 1
Nels885 0:bf67af6b3913 66 #define FONA_HTTP_HEAD 2
Nels885 0:bf67af6b3913 67
Nels885 0:bf67af6b3913 68 #define FONA_CALL_READY 0
Nels885 0:bf67af6b3913 69 #define FONA_CALL_FAILED 1
Nels885 0:bf67af6b3913 70 #define FONA_CALL_UNKNOWN 2
Nels885 0:bf67af6b3913 71 #define FONA_CALL_RINGING 3
Nels885 0:bf67af6b3913 72 #define FONA_CALL_INPROGRESS 4
Nels885 0:bf67af6b3913 73
Nels885 0:bf67af6b3913 74 #define RX_BUFFER_SIZE 255
Nels885 0:bf67af6b3913 75
Nels885 0:bf67af6b3913 76 class Adafruit_FONA : public Stream
Nels885 0:bf67af6b3913 77 {
Nels885 0:bf67af6b3913 78 public:
Nels885 0:bf67af6b3913 79 /**
Nels885 0:bf67af6b3913 80 * Listener for FONA events.
Nels885 0:bf67af6b3913 81 */
Nels885 0:bf67af6b3913 82 class EventListener
Nels885 0:bf67af6b3913 83 {
Nels885 0:bf67af6b3913 84 public:
Nels885 0:bf67af6b3913 85 /**
Nels885 0:bf67af6b3913 86 * Method called when somebody call the FONA.
Nels885 0:bf67af6b3913 87 */
Nels885 0:bf67af6b3913 88 virtual void onRing() = 0;
Nels885 0:bf67af6b3913 89
Nels885 0:bf67af6b3913 90 /**
Nels885 0:bf67af6b3913 91 * Method called when the calling person stop his call.
Nels885 0:bf67af6b3913 92 */
Nels885 0:bf67af6b3913 93 virtual void onNoCarrier() = 0;
Nels885 0:bf67af6b3913 94 };
Nels885 0:bf67af6b3913 95
Nels885 0:bf67af6b3913 96 public:
Nels885 5:79e4c91f2b73 97 Adafruit_FONA(PinName tx, PinName rx, PinName rst, PinName key);
Nels885 0:bf67af6b3913 98 bool begin(int baudrate);
Nels885 0:bf67af6b3913 99 uint8_t type();
Nels885 5:79e4c91f2b73 100 void powerOn();
Nels885 5:79e4c91f2b73 101 void powerOff();
Nels885 0:bf67af6b3913 102 void setEventListener(EventListener *eventListener);
Nels885 0:bf67af6b3913 103
Nels885 0:bf67af6b3913 104 // Stream
Nels885 0:bf67af6b3913 105 virtual int _putc(int value);
Nels885 0:bf67af6b3913 106 virtual int _getc();
Nels885 0:bf67af6b3913 107 int readable();
Nels885 0:bf67af6b3913 108
Nels885 0:bf67af6b3913 109 // FONA 3G requirements
Nels885 0:bf67af6b3913 110 bool setBaudrate(uint16_t baud);
Nels885 0:bf67af6b3913 111
Nels885 0:bf67af6b3913 112 // RTC
Nels885 0:bf67af6b3913 113 bool enableRTC(uint8_t i); // i = 0 <=> disable, i = 1 <=> enable
Nels885 0:bf67af6b3913 114
Nels885 0:bf67af6b3913 115 // Battery and ADC
Nels885 0:bf67af6b3913 116 bool getADCVoltage(uint16_t *v);
Nels885 0:bf67af6b3913 117 bool getBattPercent(uint16_t *p);
Nels885 0:bf67af6b3913 118 bool getBattVoltage(uint16_t *v);
Nels885 0:bf67af6b3913 119
Nels885 0:bf67af6b3913 120 // SIM query
Nels885 0:bf67af6b3913 121 uint8_t unlockSIM(char *pin);
Nels885 0:bf67af6b3913 122 uint8_t getSIMCCID(char *ccid);
Nels885 0:bf67af6b3913 123 uint8_t getNetworkStatus(void);
Nels885 0:bf67af6b3913 124 uint8_t getRSSI(void);
Nels885 0:bf67af6b3913 125
Nels885 0:bf67af6b3913 126 // IMEI
Nels885 0:bf67af6b3913 127 uint8_t getIMEI(char *imei);
Nels885 0:bf67af6b3913 128
Nels885 0:bf67af6b3913 129 // set Audio output
Nels885 0:bf67af6b3913 130 bool setAudio(uint8_t a);
Nels885 0:bf67af6b3913 131 bool setVolume(uint8_t i);
Nels885 0:bf67af6b3913 132 uint8_t getVolume(void);
Nels885 0:bf67af6b3913 133 bool playToolkitTone(uint8_t t, uint16_t len);
Nels885 0:bf67af6b3913 134 bool setMicVolume(uint8_t a, uint8_t level);
Nels885 0:bf67af6b3913 135 bool playDTMF(char tone);
Nels885 0:bf67af6b3913 136
Nels885 0:bf67af6b3913 137 // FM radio functions
Nels885 0:bf67af6b3913 138 bool tuneFMradio(uint16_t station);
Nels885 0:bf67af6b3913 139 bool FMradio(bool onoff, uint8_t a = FONA_HEADSETAUDIO);
Nels885 0:bf67af6b3913 140 bool setFMVolume(uint8_t i);
Nels885 0:bf67af6b3913 141 int8_t getFMVolume();
Nels885 0:bf67af6b3913 142 int8_t getFMSignalLevel(uint16_t station);
Nels885 0:bf67af6b3913 143
Nels885 0:bf67af6b3913 144 // SMS handling
Nels885 0:bf67af6b3913 145 bool setSMSInterrupt(uint8_t i);
Nels885 0:bf67af6b3913 146 uint8_t getSMSInterrupt(void);
Nels885 0:bf67af6b3913 147 int8_t getNumSMS(void);
Nels885 0:bf67af6b3913 148 bool readSMS(uint8_t i, char *smsbuff, uint16_t max, uint16_t *readsize);
Nels885 0:bf67af6b3913 149 bool sendSMS(char *smsaddr, char *smsmsg);
Nels885 0:bf67af6b3913 150 bool deleteSMS(uint8_t i);
Nels885 0:bf67af6b3913 151 bool getSMSSender(uint8_t i, char *sender, int senderlen);
Nels885 0:bf67af6b3913 152
Nels885 0:bf67af6b3913 153 // Time
Nels885 0:bf67af6b3913 154 bool enableNetworkTimeSync(bool onoff);
Nels885 0:bf67af6b3913 155 bool enableNTPTimeSync(bool onoff, const char* ntpserver=0);
Nels885 0:bf67af6b3913 156 bool getTime(char* buff, uint16_t maxlen);
Nels885 0:bf67af6b3913 157
Nels885 0:bf67af6b3913 158 // GPRS handling
Nels885 0:bf67af6b3913 159 bool enableGPRS(bool onoff);
Nels885 9:b18cfba4283a 160 int GPRSstate(void);
Nels885 0:bf67af6b3913 161 bool getGSMLoc(uint16_t *replycode, char *buff, uint16_t maxlen);
Nels885 0:bf67af6b3913 162 bool getGSMLoc(float *lat, float *lon);
Nels885 0:bf67af6b3913 163 void setGPRSNetworkSettings(const char* apn, const char* username=0, const char* password=0);
Nels885 0:bf67af6b3913 164
Nels885 0:bf67af6b3913 165 // GPS handling
Nels885 0:bf67af6b3913 166 bool enableGPS(bool onoff);
Nels885 0:bf67af6b3913 167 int8_t GPSstatus(void);
Nels885 0:bf67af6b3913 168 uint8_t getGPS(uint8_t arg, char *buffer, uint8_t maxbuff);
Nels885 0:bf67af6b3913 169 bool getGPS(float *lat, float *lon, float *speed_kph=0, float *heading=0, float *altitude=0);
Nels885 0:bf67af6b3913 170 bool enableGPSNMEA(uint8_t nmea);
Nels885 0:bf67af6b3913 171
Nels885 0:bf67af6b3913 172 // TCP raw connections
Nels885 0:bf67af6b3913 173 bool TCPconnect(char *server, uint16_t port);
Nels885 4:05c32425d2da 174 uint8_t getIPADDR(char *ipaddr);
Nels885 0:bf67af6b3913 175 bool TCPclose(void);
Nels885 0:bf67af6b3913 176 bool TCPconnected(void);
Nels885 0:bf67af6b3913 177 bool TCPsend(char *packet, uint8_t len);
Nels885 0:bf67af6b3913 178 uint16_t TCPavailable(void);
Nels885 0:bf67af6b3913 179 uint16_t TCPread(uint8_t *buff, uint8_t len);
Nels885 0:bf67af6b3913 180
Nels885 0:bf67af6b3913 181 // HTTP low level interface (maps directly to SIM800 commands).
Nels885 0:bf67af6b3913 182 bool HTTP_init();
Nels885 0:bf67af6b3913 183 bool HTTP_term();
Nels885 0:bf67af6b3913 184 void HTTP_para_start(const char* parameter, bool quoted = true);
Nels885 0:bf67af6b3913 185 bool HTTP_para_end(bool quoted = true);
Nels885 0:bf67af6b3913 186 bool HTTP_para(const char* parameter, const char *value);
Nels885 0:bf67af6b3913 187 bool HTTP_para(const char* parameter, int32_t value);
Nels885 0:bf67af6b3913 188 bool HTTP_data(uint32_t size, uint32_t maxTime=10000);
Nels885 0:bf67af6b3913 189 bool HTTP_action(uint8_t method, uint16_t *status, uint16_t *datalen, int32_t timeout = 10000);
Nels885 0:bf67af6b3913 190 bool HTTP_readall(uint16_t *datalen);
Nels885 0:bf67af6b3913 191 bool HTTP_ssl(bool onoff);
Nels885 0:bf67af6b3913 192
Nels885 0:bf67af6b3913 193 // HTTP high level interface (easier to use, less flexible).
Nels885 0:bf67af6b3913 194 bool HTTP_GET_start(char *url, uint16_t *status, uint16_t *datalen);
Nels885 0:bf67af6b3913 195 void HTTP_GET_end(void);
Nels885 0:bf67af6b3913 196 bool HTTP_POST_start(char *url, const char* contenttype, const uint8_t *postdata, uint16_t postdatalen, uint16_t *status, uint16_t *datalen);
Nels885 0:bf67af6b3913 197 void HTTP_POST_end(void);
Nels885 0:bf67af6b3913 198 void setUserAgent(const char* useragent);
Nels885 0:bf67af6b3913 199
Nels885 0:bf67af6b3913 200 // HTTPS
Nels885 0:bf67af6b3913 201 void setHTTPSRedirect(bool onoff);
Nels885 0:bf67af6b3913 202
Nels885 0:bf67af6b3913 203 // PWM (buzzer)
Nels885 0:bf67af6b3913 204 bool setPWM(uint16_t period, uint8_t duty = 50);
Nels885 0:bf67af6b3913 205
Nels885 0:bf67af6b3913 206 // Phone calls
Nels885 0:bf67af6b3913 207 bool callPhone(char *phonenum);
Nels885 0:bf67af6b3913 208 bool hangUp(void);
Nels885 0:bf67af6b3913 209 bool pickUp(void);
Nels885 0:bf67af6b3913 210 bool callerIdNotification(bool enable);
Nels885 0:bf67af6b3913 211 bool incomingCallNumber(char* phonenum);
Nels885 0:bf67af6b3913 212
Nels885 0:bf67af6b3913 213 // Helper functions to verify responses.
Nels885 0:bf67af6b3913 214 bool expectReply(const char* reply, uint16_t timeout = 10000);
Nels885 0:bf67af6b3913 215
Nels885 0:bf67af6b3913 216 protected:
Nels885 5:79e4c91f2b73 217 DigitalOut _keypin;
Nels885 0:bf67af6b3913 218 DigitalOut _rstpin;
Nels885 0:bf67af6b3913 219 uint8_t _type;
Nels885 0:bf67af6b3913 220
Nels885 0:bf67af6b3913 221 char replybuffer[255];
Nels885 0:bf67af6b3913 222 char* apn;
Nels885 0:bf67af6b3913 223 char* apnusername;
Nels885 0:bf67af6b3913 224 char* apnpassword;
Nels885 0:bf67af6b3913 225 bool httpsredirect;
Nels885 0:bf67af6b3913 226 char* useragent;
Nels885 0:bf67af6b3913 227 char* ok_reply;
Nels885 0:bf67af6b3913 228
Nels885 0:bf67af6b3913 229 volatile bool _incomingCall;
Nels885 0:bf67af6b3913 230 EventListener *eventListener;
Nels885 0:bf67af6b3913 231 Serial mySerial;
Nels885 0:bf67af6b3913 232
Nels885 0:bf67af6b3913 233 // Circular buffer used to receive serial data from an interruption
Nels885 0:bf67af6b3913 234 int rxBuffer[RX_BUFFER_SIZE + 1];
Nels885 0:bf67af6b3913 235 volatile int rxBufferInIndex; // Index where new data is added to the buffer
Nels885 0:bf67af6b3913 236 volatile int rxBufferOutIndex; // Index where data is removed from the buffer
Nels885 0:bf67af6b3913 237 char currentReceivedLine[RX_BUFFER_SIZE]; // Array containing the current received line
Nels885 0:bf67af6b3913 238 int currentReceivedLineSize;
Nels885 0:bf67af6b3913 239
Nels885 0:bf67af6b3913 240 inline bool isRxBufferFull() {
Nels885 0:bf67af6b3913 241 return ((rxBufferInIndex + 1) % RX_BUFFER_SIZE) == rxBufferOutIndex;
Nels885 0:bf67af6b3913 242 }
Nels885 0:bf67af6b3913 243
Nels885 0:bf67af6b3913 244 inline bool isRxBufferEmpty() {
Nels885 0:bf67af6b3913 245 return rxBufferInIndex == rxBufferOutIndex;
Nels885 0:bf67af6b3913 246 }
Nels885 0:bf67af6b3913 247
Nels885 0:bf67af6b3913 248 inline void incrementRxBufferInIndex() {
Nels885 0:bf67af6b3913 249 rxBufferInIndex = (rxBufferInIndex + 1) % RX_BUFFER_SIZE;
Nels885 0:bf67af6b3913 250 }
Nels885 0:bf67af6b3913 251
Nels885 0:bf67af6b3913 252 inline void incrementRxBufferOutIndex() {
Nels885 0:bf67af6b3913 253 rxBufferOutIndex = (rxBufferOutIndex + 1) % RX_BUFFER_SIZE;
Nels885 0:bf67af6b3913 254 }
Nels885 0:bf67af6b3913 255
Nels885 0:bf67af6b3913 256 /**
Nels885 0:bf67af6b3913 257 * Method called when Serial data is received (interrupt routine).
Nels885 0:bf67af6b3913 258 */
Nels885 0:bf67af6b3913 259 void onSerialDataReceived();
Nels885 0:bf67af6b3913 260
Nels885 0:bf67af6b3913 261 // HTTP helpers
Nels885 0:bf67af6b3913 262 bool HTTP_setup(char *url);
Nels885 0:bf67af6b3913 263
Nels885 0:bf67af6b3913 264 void flushInput();
Nels885 0:bf67af6b3913 265 uint16_t readRaw(uint16_t b);
Nels885 0:bf67af6b3913 266 uint8_t readline(uint16_t timeout = FONA_DEFAULT_TIMEOUT_MS, bool multiline = false);
Nels885 0:bf67af6b3913 267 uint8_t getReply(const char* send, uint16_t timeout = FONA_DEFAULT_TIMEOUT_MS);
Nels885 0:bf67af6b3913 268 uint8_t getReply(const char* prefix, char *suffix, uint16_t timeout = FONA_DEFAULT_TIMEOUT_MS);
Nels885 0:bf67af6b3913 269 uint8_t getReply(const char* prefix, int32_t suffix, uint16_t timeout = FONA_DEFAULT_TIMEOUT_MS);
Nels885 0:bf67af6b3913 270 uint8_t getReply(const char* prefix, int32_t suffix1, int32_t suffix2, uint16_t timeout); // Don't set default value or else function call is ambiguous.
Nels885 0:bf67af6b3913 271 uint8_t getReplyQuoted(const char* prefix, const char* suffix, uint16_t timeout = FONA_DEFAULT_TIMEOUT_MS);
Nels885 0:bf67af6b3913 272
Nels885 0:bf67af6b3913 273 bool sendCheckReply(const char* send, const char* reply, uint16_t timeout = FONA_DEFAULT_TIMEOUT_MS);
Nels885 0:bf67af6b3913 274 bool sendCheckReply(const char* prefix, char *suffix, const char* reply, uint16_t timeout = FONA_DEFAULT_TIMEOUT_MS);
Nels885 0:bf67af6b3913 275 bool sendCheckReply(const char* prefix, int32_t suffix, const char* reply, uint16_t timeout = FONA_DEFAULT_TIMEOUT_MS);
Nels885 0:bf67af6b3913 276 bool sendCheckReply(const char* prefix, int32_t suffix, int32_t suffix2, const char* reply, uint16_t timeout = FONA_DEFAULT_TIMEOUT_MS);
Nels885 0:bf67af6b3913 277 bool sendCheckReplyQuoted(const char* prefix, const char* suffix, const char* reply, uint16_t timeout = FONA_DEFAULT_TIMEOUT_MS);
Nels885 0:bf67af6b3913 278
Nels885 0:bf67af6b3913 279 bool parseReply(const char* toreply, uint16_t *v, char divider = ',', uint8_t index=0);
Nels885 0:bf67af6b3913 280 bool parseReply(const char* toreply, char *v, char divider = ',', uint8_t index=0);
Nels885 0:bf67af6b3913 281 bool parseReplyQuoted(const char* toreply, char* v, int maxlen, char divider, uint8_t index);
Nels885 0:bf67af6b3913 282
Nels885 0:bf67af6b3913 283 bool sendParseReply(const char* tosend, const char* toreply, uint16_t *v, char divider = ',', uint8_t index = 0);
Nels885 0:bf67af6b3913 284
Nels885 0:bf67af6b3913 285 void onIncomingCall();
Nels885 0:bf67af6b3913 286 };
Nels885 0:bf67af6b3913 287
Nels885 0:bf67af6b3913 288 class Adafruit_FONA_3G : public Adafruit_FONA
Nels885 0:bf67af6b3913 289 {
Nels885 0:bf67af6b3913 290 public:
Nels885 5:79e4c91f2b73 291 Adafruit_FONA_3G(PinName tx, PinName rx, PinName rst, PinName key) : Adafruit_FONA(tx, rx, rst, key) {
Nels885 0:bf67af6b3913 292 _type = FONA3G_A;
Nels885 0:bf67af6b3913 293 }
Nels885 0:bf67af6b3913 294
Nels885 0:bf67af6b3913 295 bool getBattVoltage(uint16_t *v);
Nels885 0:bf67af6b3913 296 bool hangUp(void);
Nels885 0:bf67af6b3913 297 bool pickUp(void);
Nels885 0:bf67af6b3913 298 bool enableGPS(bool onoff);
Nels885 2:3fc229f5ec3f 299
Nels885 9:b18cfba4283a 300 // SIM query
Nels885 9:b18cfba4283a 301 uint8_t unlockSIM(char *pin);
Nels885 9:b18cfba4283a 302
Nels885 2:3fc229f5ec3f 303 // TCP raw connections
Nels885 2:3fc229f5ec3f 304 uint8_t TCPinitialize(void);
Nels885 9:b18cfba4283a 305 uint8_t sslTCPinitialize(void);
Nels885 4:05c32425d2da 306 uint8_t getTCPtimeout(char *tcptimeout);
Nels885 2:3fc229f5ec3f 307 bool TCPconnect(char *server, uint16_t port);
Nels885 6:8fdb30dc3108 308 bool sslTCPconnect(char *server, uint16_t port);
Nels885 2:3fc229f5ec3f 309 bool TCPclose(void);
Nels885 6:8fdb30dc3108 310 bool sslTCPclose(void);
Nels885 4:05c32425d2da 311 bool TCPsend(char *packet);
Nels885 9:b18cfba4283a 312 bool sslTCPsend(char *packet);
Nels885 0:bf67af6b3913 313
Nels885 0:bf67af6b3913 314 protected:
Nels885 0:bf67af6b3913 315 bool sendParseReply(const char* tosend, const char* toreply, float *f, char divider, uint8_t index);
Nels885 9:b18cfba4283a 316 bool parseReply(const char* toreply, float *f, char divider, uint8_t index=0);
Nels885 0:bf67af6b3913 317 };
Nels885 0:bf67af6b3913 318
Nels885 0:bf67af6b3913 319 #endif