Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
M2MConnectionHandlerPimpl Class Reference
M2MConnectionHandlerPimpl. More...
#include <m2mconnectionhandlerpimpl.h>
Public Member Functions | |
| M2MConnectionHandlerPimpl (M2MConnectionHandler *base, M2MConnectionObserver &observer, M2MConnectionSecurity *sec, M2MInterface::BindingMode mode, M2MInterface::NetworkStack stack) | |
| Constructor. | |
| ~M2MConnectionHandlerPimpl () | |
| Destructor. | |
| bool | bind_connection (const uint16_t listen_port) |
| This binds the socket connection. | |
| bool | resolve_server_address (const String &server_address, const uint16_t server_port, M2MConnectionObserver::ServerType server_type, const M2MSecurity *security) |
| This resolves the server address. | |
| bool | send_data (uint8_t *data_ptr, uint16_t data_len, sn_nsdl_addr_s *address_ptr) |
| Sends data, to the connected sent to server. | |
| bool | start_listening_for_data () |
| Listens for incoming data from remote server. | |
| void | stop_listening () |
| Stops listening for incoming data. | |
| int | send_to_socket (const unsigned char *buf, size_t len) |
| send_to_socket Sends directly to socket. | |
| int | receive_from_socket (unsigned char *buf, size_t len) |
| Receives directly from the socket. | |
| void | handle_connection_error (int error) |
| Error handling for DTLS connectivity. | |
| void | set_platform_network_handler (void *handler=NULL) |
| Sets the network interface handler that is used by client to connect to a network over IP. | |
| void | claim_mutex () |
| Claims mutex to prevent thread clashes in multithreaded environment. | |
| void | release_mutex () |
| Releases mutex to prevent thread clashes in multithreaded environment. | |
| void | send_handler () |
| Callback handler for sending data over socket. | |
| void | receive_handler () |
| Callback handler for receiving data over socket. | |
| void | receive_handshake_handler () |
| Callback handler for receiving data for secured connection. | |
| bool | is_handshake_ongoing () |
| Returns true if DTLS handshake is still ongoing. | |
| int8_t | connection_tasklet_handler () |
| Returns connection handler tasklet ID. | |
| void | dns_handler () |
| Handles DNS resolving through event loop. | |
| void | send_socket_data (uint8_t *data, uint16_t data_len) |
| Sends data to socket through event loop. | |
Detailed Description
This class handles the socket connection for LWM2M Client
Definition at line 40 of file m2mconnectionhandlerpimpl.h.
Constructor & Destructor Documentation
| M2MConnectionHandlerPimpl | ( | M2MConnectionHandler * | base, |
| M2MConnectionObserver & | observer, | ||
| M2MConnectionSecurity * | sec, | ||
| M2MInterface::BindingMode | mode, | ||
| M2MInterface::NetworkStack | stack | ||
| ) |
Constructor.
Definition at line 89 of file m2mconnectionhandlerpimpl.cpp.
Destructor.
Definition at line 125 of file m2mconnectionhandlerpimpl.cpp.
Member Function Documentation
| bool bind_connection | ( | const uint16_t | listen_port ) |
This binds the socket connection.
- Parameters:
-
listen_port Port to listen for incoming connection.
- Returns:
- true if successful else false.
Definition at line 141 of file m2mconnectionhandlerpimpl.cpp.
| void claim_mutex | ( | ) |
Claims mutex to prevent thread clashes in multithreaded environment.
Definition at line 513 of file m2mconnectionhandlerpimpl.cpp.
| int8_t connection_tasklet_handler | ( | ) |
Returns connection handler tasklet ID.
Definition at line 322 of file m2mconnectionhandlerpimpl.cpp.
| void dns_handler | ( | ) |
Handles DNS resolving through event loop.
Definition at line 175 of file m2mconnectionhandlerpimpl.cpp.
| void handle_connection_error | ( | int | error ) |
Error handling for DTLS connectivity.
- Parameters:
-
error,Error code from TLS library
Definition at line 412 of file m2mconnectionhandlerpimpl.cpp.
| bool is_handshake_ongoing | ( | ) |
Returns true if DTLS handshake is still ongoing.
Definition at line 448 of file m2mconnectionhandlerpimpl.cpp.
| int receive_from_socket | ( | unsigned char * | buf, |
| size_t | len | ||
| ) |
Receives directly from the socket.
This is used by the security classes to receive raw data to be decrypted.
- Parameters:
-
buf Buffer to send. len The length of the buffer. timeout Timeout defined from DTLS to wait for blocking receive calls before timing out, by default value is 0.
- Returns:
- Number of bytes read or negative number if failed.
Definition at line 393 of file m2mconnectionhandlerpimpl.cpp.
| void receive_handler | ( | ) |
Callback handler for receiving data over socket.
Definition at line 453 of file m2mconnectionhandlerpimpl.cpp.
| void receive_handshake_handler | ( | ) |
Callback handler for receiving data for secured connection.
Definition at line 424 of file m2mconnectionhandlerpimpl.cpp.
| void release_mutex | ( | ) |
Releases mutex to prevent thread clashes in multithreaded environment.
Definition at line 518 of file m2mconnectionhandlerpimpl.cpp.
| bool resolve_server_address | ( | const String & | server_address, |
| const uint16_t | server_port, | ||
| M2MConnectionObserver::ServerType | server_type, | ||
| const M2MSecurity * | security | ||
| ) |
This resolves the server address.
Output is returned through callback
- Parameters:
-
String server address. uint16_t Server port. ServerType,Server Type to be resolved.
- Returns:
- true if address is valid else false.
Definition at line 147 of file m2mconnectionhandlerpimpl.cpp.
| bool send_data | ( | uint8_t * | data_ptr, |
| uint16_t | data_len, | ||
| sn_nsdl_addr_s * | address_ptr | ||
| ) |
Sends data, to the connected sent to server.
- Parameters:
-
data,Data to be sent.
Definition at line 253 of file m2mconnectionhandlerpimpl.cpp.
| void send_handler | ( | ) |
Callback handler for sending data over socket.
Definition at line 247 of file m2mconnectionhandlerpimpl.cpp.
| void send_socket_data | ( | uint8_t * | data, |
| uint16_t | data_len | ||
| ) |
Sends data to socket through event loop.
Definition at line 286 of file m2mconnectionhandlerpimpl.cpp.
| int send_to_socket | ( | const unsigned char * | buf, |
| size_t | len | ||
| ) |
send_to_socket Sends directly to socket.
This is used by security classes to send after data has been encrypted.
- Parameters:
-
buf Buffer to send len Length of a buffer
- Returns:
- Number of bytes sent or -1 if failed
Definition at line 367 of file m2mconnectionhandlerpimpl.cpp.
| void set_platform_network_handler | ( | void * | handler = NULL ) |
Sets the network interface handler that is used by client to connect to a network over IP.
- Parameters:
-
handler A network interface handler that is used by client to connect. This API is optional but provides a mechanism for different platforms to manage usage of underlying network interface by client.
Definition at line 418 of file m2mconnectionhandlerpimpl.cpp.
| bool start_listening_for_data | ( | ) |
Listens for incoming data from remote server.
- Returns:
- true if successful else false.
Definition at line 348 of file m2mconnectionhandlerpimpl.cpp.
| void stop_listening | ( | ) |
Stops listening for incoming data.
Definition at line 358 of file m2mconnectionhandlerpimpl.cpp.
Generated on Tue Jul 12 2022 12:29:07 by
1.7.2
