AWS IoT C++ SDK
|
Network Connection Class. More...
#include <NetworkConnection.hpp>
Public Member Functions | |
virtual bool | IsConnected ()=0 |
Check if Network layer is still connected. More... | |
virtual bool | IsPhysicalLayerConnected ()=0 |
Check if Network Physical layer is still connected. More... | |
virtual ResponseCode | Connect () final |
Create a Network socket and open the connection. More... | |
virtual ResponseCode | Write (const util::String &buf, size_t &size_written_bytes_out) final |
Write bytes to the network socket. More... | |
virtual ResponseCode | Read (util::Vector< unsigned char > &buf, size_t buf_read_offset, size_t size_bytes_to_read, size_t &size_read_bytes_out) final |
Read bytes from the network socket. More... | |
virtual ResponseCode | Disconnect () final |
Disconnect from network socket. More... | |
Protected Member Functions | |
virtual ResponseCode | ConnectInternal ()=0 |
Create a Network socket and open the connection. More... | |
virtual ResponseCode | WriteInternal (const util::String &buf, size_t &size_written_bytes_out)=0 |
Write bytes to the network socket. More... | |
virtual ResponseCode | ReadInternal (util::Vector< unsigned char > &buf, size_t buf_read_offset, size_t size_bytes_to_read, size_t &size_read_bytes_out)=0 |
Read bytes from the network socket. More... | |
virtual ResponseCode | DisconnectInternal ()=0 |
Disconnect from network socket. More... | |
Protected Attributes | |
std::mutex | read_mutex |
Mutex for synchronizing read operations. More... | |
std::mutex | write_mutex |
Mutex for synchronizing write operations. | |
Defines an interface to the Network layer to be used by the MQTT client. Starting point for porting the SDK to the networking layer of a new platform.
This is an abstract class and cannot be instantiated.
|
finalvirtual |
Calls the internal connect function after obtaining read and write locks
|
protectedpure virtual |
Internal implementation of the Connect function to be provided by the derived class
Creates an open socket connection including Network handshake.
|
finalvirtual |
Calls the internal disconnect function after obtaining read and write locks This will be called by the SDK for both manual and auto-disconnect. It separates the Disconnect logic from destroy, Network stack is NOT destroyed by this API SDK should still be able to reconnect after Disconnect, but not after Destroy
|
protectedpure virtual |
Internal implementation of the Disconnect function to be provided by the derived class
|
pure virtual |
Called to check if the Network layer is still connected or not.
|
pure virtual |
Called to check if the Network Physical layer is still connected or not.
|
finalvirtual |
Calls the internal read function after obtaining read lock
util::String | - reference to buffer where read bytes should be copied |
size_t | - number of bytes to read |
size_t | - reference to store number of bytes read |
|
protectedpure virtual |
Internal implementation of the Read function to be provided by the derived class
util::String | - reference to buffer where read bytes should be copied |
size_t | - number of bytes to read |
size_t | - reference to store number of bytes read |
|
finalvirtual |
Calls the internal write function after obtaining write lock
util::String | - const reference to buffer which should be written to socket |
|
protectedpure virtual |
Internal implementation of the Write function to be provided by the derived class
util::String | - const reference to buffer which should be written to socket |
|
protected |
Both the below mutexes must be locked before connect/disconnect