NuMaker connection with AWS IoT thru MQTT/HTTPS (Mbed OS 6)
Dependencies: MQTT
my-tlssocket/MyTLSSocket.h
- Committer:
- ccli8
- Date:
- 2020-03-27
- Revision:
- 41:b878d7cd7035
- Parent:
- 25:edf568984d27
File content as of revision 41:b878d7cd7035:
#ifndef _MY_TLS_SOCKET_H_ #define _MY_TLS_SOCKET_H_ #include "mbed.h" #include "TLSSocket.h" #include "mbedtls_utils.h" #if MBED_CONF_MY_TLSSOCKET_TLS_DEBUG_LEVEL > 0 #include "mbedtls/debug.h" #endif /* MyTLSSocket = TLSSocket + MQTT lib required timed read/write + debug thru console */ class MyTLSSocket : public TLSSocket { public: MyTLSSocket(); ~MyTLSSocket(); /** * Timed recv for MQTT lib */ int read(unsigned char* buffer, int len, int timeout); /** * Timed send for MQTT lib */ int write(unsigned char* buffer, int len, int timeout); protected: #if MBED_CONF_MY_TLSSOCKET_TLS_DEBUG_LEVEL > 0 /** * Debug callback for Mbed TLS * Just prints on the USB serial port */ static void my_debug(void *ctx, int level, const char *file, int line, const char *str); /** * Certificate verification callback for Mbed TLS * Here we only use it to display information on each cert in the chain */ static int my_verify(void *data, mbedtls_x509_crt *crt, int depth, uint32_t *flags); #endif }; #endif // _MY_TLS_SOCKET_H_