Library for HTTPS Communication with Azure using SIMCOM Modules, such as SIM800, SIM900. SSL is required, update your module to the latest firmware.

Dependents:   SIMInterface

Committer:
BorjaTarazona
Date:
Thu Aug 10 11:03:10 2017 +0000
Revision:
1:082b9b2c7935
Parent:
0:3cf9be45a676
Minor comment changes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
BorjaTarazona 0:3cf9be45a676 1 #ifndef _HTTPSConnection_H
BorjaTarazona 0:3cf9be45a676 2 #define _HTTPSConnection_H
BorjaTarazona 0:3cf9be45a676 3
BorjaTarazona 0:3cf9be45a676 4 #include "mbed.h"
BorjaTarazona 0:3cf9be45a676 5 #include "ATCommand.h"
BorjaTarazona 0:3cf9be45a676 6
BorjaTarazona 0:3cf9be45a676 7 /** Library for HTTPS Communication with Azure using SIMCOM Modules, such as SIM800, SIM900
BorjaTarazona 0:3cf9be45a676 8 *
BorjaTarazona 0:3cf9be45a676 9 * @brief Currently tested on SIM900, SIM800, SIM800L and SIM800F
BorjaTarazona 0:3cf9be45a676 10 *
BorjaTarazona 0:3cf9be45a676 11 */
BorjaTarazona 0:3cf9be45a676 12
BorjaTarazona 0:3cf9be45a676 13 class HTTPSConnection
BorjaTarazona 0:3cf9be45a676 14 {
BorjaTarazona 0:3cf9be45a676 15
BorjaTarazona 0:3cf9be45a676 16 protected:
BorjaTarazona 0:3cf9be45a676 17 /** Serial port for UART Communication
BorjaTarazona 0:3cf9be45a676 18 **/
BorjaTarazona 0:3cf9be45a676 19 ATSerial sim800_HTTPS;
BorjaTarazona 0:3cf9be45a676 20
BorjaTarazona 0:3cf9be45a676 21 public:
BorjaTarazona 0:3cf9be45a676 22
BorjaTarazona 0:3cf9be45a676 23 /** Create an HTTPS Serial Interface
BorjaTarazona 0:3cf9be45a676 24 *
BorjaTarazona 0:3cf9be45a676 25 * @param tx Tx pin for the UART
BorjaTarazona 0:3cf9be45a676 26 * @param rx RX pin for the UART
BorjaTarazona 0:3cf9be45a676 27 * @param baudrate Baudrate for the UART
BorjaTarazona 0:3cf9be45a676 28 *
BorjaTarazona 1:082b9b2c7935 29 *
BorjaTarazona 0:3cf9be45a676 30 **/
BorjaTarazona 0:3cf9be45a676 31 HTTPSConnection(PinName tx, PinName rx, int baudrate);
BorjaTarazona 0:3cf9be45a676 32
BorjaTarazona 0:3cf9be45a676 33 /** Function to initialize the HTTP and SSL capabilities of the module
BorjaTarazona 0:3cf9be45a676 34 *
BorjaTarazona 0:3cf9be45a676 35 * @param gprs_apn APN of our network provider
BorjaTarazona 0:3cf9be45a676 36 *
BorjaTarazona 0:3cf9be45a676 37 **/
BorjaTarazona 0:3cf9be45a676 38 void HTTPS_initialization(const char* gprs_apn);
BorjaTarazona 0:3cf9be45a676 39
BorjaTarazona 0:3cf9be45a676 40 /** Function set the Azure IoT Hub parameters
BorjaTarazona 0:3cf9be45a676 41 *
BorjaTarazona 0:3cf9be45a676 42 * @param gprs_url Azure URL
BorjaTarazona 0:3cf9be45a676 43 * @param gprs_sas Azure Shared Access Signature
BorjaTarazona 0:3cf9be45a676 44 * @param gprs_data data we want to send
BorjaTarazona 0:3cf9be45a676 45 *
BorjaTarazona 0:3cf9be45a676 46 **/
BorjaTarazona 0:3cf9be45a676 47 void HTTPS_setAzureParameters(const char* gprs_url, const char* gprs_sas, char* gprs_data);
BorjaTarazona 0:3cf9be45a676 48
BorjaTarazona 0:3cf9be45a676 49 /** Function set the Azure IoT Hub parameters
BorjaTarazona 0:3cf9be45a676 50 *
BorjaTarazona 0:3cf9be45a676 51 * @param gprs_data Update the string to send
BorjaTarazona 0:3cf9be45a676 52 *
BorjaTarazona 0:3cf9be45a676 53 **/
BorjaTarazona 0:3cf9be45a676 54 void HTTPS_updateStringToSend(char* gprs_data);
BorjaTarazona 0:3cf9be45a676 55
BorjaTarazona 0:3cf9be45a676 56 /** Function to send an HTTPS Post to Azure
BorjaTarazona 0:3cf9be45a676 57 *
BorjaTarazona 0:3cf9be45a676 58 * @param timeout Time we wait for the POST response
BorjaTarazona 0:3cf9be45a676 59 *
BorjaTarazona 0:3cf9be45a676 60 **/
BorjaTarazona 0:3cf9be45a676 61 char* HTTPS_post(int timeout);
BorjaTarazona 0:3cf9be45a676 62
BorjaTarazona 0:3cf9be45a676 63 private:
BorjaTarazona 0:3cf9be45a676 64
BorjaTarazona 0:3cf9be45a676 65 };
BorjaTarazona 0:3cf9be45a676 66
BorjaTarazona 0:3cf9be45a676 67 #endif