Library for HTTPS Communication with Azure using SIMCOM Modules, such as SIM800, SIM900. SSL is required, update your module to the latest firmware.
Diff: HTTPSConnection.h
- Revision:
- 0:3cf9be45a676
- Child:
- 1:082b9b2c7935
diff -r 000000000000 -r 3cf9be45a676 HTTPSConnection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HTTPSConnection.h Thu Aug 10 10:41:06 2017 +0000 @@ -0,0 +1,66 @@ +#ifndef _HTTPSConnection_H +#define _HTTPSConnection_H + +#include "mbed.h" +#include "ATCommand.h" + +/** Library for HTTPS Communication with Azure using SIMCOM Modules, such as SIM800, SIM900 + * + * @brief Currently tested on SIM900, SIM800, SIM800L and SIM800F + * + */ + +class HTTPSConnection +{ + + protected: + /** Serial port for UART Communication + **/ + ATSerial sim800_HTTPS; + + public: + + /** Create an HTTPS Serial Interface + * + * @param tx Tx pin for the UART + * @param rx RX pin for the UART + * @param baudrate Baudrate for the UART + * + **/ + HTTPSConnection(PinName tx, PinName rx, int baudrate); + + /** Function to initialize the HTTP and SSL capabilities of the module + * + * @param gprs_apn APN of our network provider + * + **/ + void HTTPS_initialization(const char* gprs_apn); + + /** Function set the Azure IoT Hub parameters + * + * @param gprs_url Azure URL + * @param gprs_sas Azure Shared Access Signature + * @param gprs_data data we want to send + * + **/ + void HTTPS_setAzureParameters(const char* gprs_url, const char* gprs_sas, char* gprs_data); + + /** Function set the Azure IoT Hub parameters + * + * @param gprs_data Update the string to send + * + **/ + void HTTPS_updateStringToSend(char* gprs_data); + + /** Function to send an HTTPS Post to Azure + * + * @param timeout Time we wait for the POST response + * + **/ + char* HTTPS_post(int timeout); + + private: + +}; + +#endif \ No newline at end of file