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.
M2MConnectionHandlerPimpl Class Reference
M2MConnectionHandlerPimpl. More...
#include <m2mconnectionhandlerpimpl.h>
Public Member Functions | |
M2MConnectionHandlerPimpl (M2MConnectionHandler *base, M2MConnectionObserver &observer, M2MConnectionSecurity *sec, M2MInterface::BindingMode mode, M2MInterface::NetworkStack) | |
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. | |
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 | receive_handler () |
Callback handler for receiving data over socket. | |
bool | is_handshake_ongoing () const |
Returns true if DTLS handshake is still ongoing. | |
void | send_socket_data () |
Sends data to socket through event loop. | |
void | send_socket_event (SocketEvent event_type) |
This function is used for generating socket events. | |
bool | address_resolver (void) |
Does DNS resolving. | |
void | event_handler (arm_event_s *event) |
handler for eventloop events. | |
void | force_close () |
Closes the open connection. | |
void | unregister_network_handler () |
Unregisters the network interface handler that is set in 'set_platform_network_handler'. | |
bool | send_event (SocketEvent event_type) |
Internal helper for sending an event. |
Detailed Description
This class handles the socket connection for LWM2M Client
Definition at line 41 of file m2mconnectionhandlerpimpl.h.
Constructor & Destructor Documentation
M2MConnectionHandlerPimpl | ( | M2MConnectionHandler * | base, |
M2MConnectionObserver & | observer, | ||
M2MConnectionSecurity * | sec, | ||
M2MInterface::BindingMode | mode, | ||
M2MInterface::NetworkStack | stack | ||
) |
Constructor.
Definition at line 160 of file m2mconnectionhandlerpimpl.cpp.
Destructor.
Definition at line 208 of file m2mconnectionhandlerpimpl.cpp.
Member Function Documentation
bool address_resolver | ( | void | ) |
Does DNS resolving.
Return true if DNS has been resolved or triggered though DNS thread.
Definition at line 264 of file m2mconnectionhandlerpimpl.cpp.
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 224 of file m2mconnectionhandlerpimpl.cpp.
void claim_mutex | ( | ) |
Claims mutex to prevent thread clashes in multithreaded environment.
Definition at line 840 of file m2mconnectionhandlerpimpl.cpp.
void event_handler | ( | arm_event_s * | event ) |
handler for eventloop events.
Note, this needs to be public as it is called from C wrapper.
Definition at line 65 of file m2mconnectionhandlerpimpl.cpp.
void force_close | ( | ) |
Closes the open connection.
- Note:
- This must be called from the same event loop context!
Definition at line 966 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 673 of file m2mconnectionhandlerpimpl.cpp.
bool is_handshake_ongoing | ( | ) | const |
Returns true if DTLS handshake is still ongoing.
Definition at line 750 of file m2mconnectionhandlerpimpl.cpp.
void receive_handler | ( | ) |
Callback handler for receiving data over socket.
Definition at line 755 of file m2mconnectionhandlerpimpl.cpp.
void release_mutex | ( | ) |
Releases mutex to prevent thread clashes in multithreaded environment.
Definition at line 845 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 319 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 509 of file m2mconnectionhandlerpimpl.cpp.
bool send_event | ( | SocketEvent | event_type ) |
Internal helper for sending an event.
Definition at line 230 of file m2mconnectionhandlerpimpl.cpp.
void send_socket_data | ( | ) |
Sends data to socket through event loop.
Definition at line 569 of file m2mconnectionhandlerpimpl.cpp.
void send_socket_event | ( | SocketEvent | event_type ) |
This function is used for generating socket events.
Definition at line 139 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 679 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 661 of file m2mconnectionhandlerpimpl.cpp.
void stop_listening | ( | ) |
Stops listening for incoming data.
Definition at line 666 of file m2mconnectionhandlerpimpl.cpp.
void unregister_network_handler | ( | ) |
Unregisters the network interface handler that is set in 'set_platform_network_handler'.
Definition at line 971 of file m2mconnectionhandlerpimpl.cpp.
Generated on Mon Aug 29 2022 19:53:43 by
