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.
CellularConnectionFSM Class Reference
CellularConnectionFSM class. More...
#include <CellularConnectionFSM.h>
Public Types | |
| enum | CellularState |
Cellular connection states. More... | |
Public Member Functions | |
| nsapi_error_t | init () |
| Initialize cellular device. | |
| void | set_serial (UARTSerial *serial) |
| Set serial connection for cellular device. | |
| void | set_callback (mbed::Callback< bool(int, int)> status_callback) |
| Set callback for state update. | |
| virtual void | attach (mbed::Callback< void(nsapi_event_t, intptr_t)> status_cb) |
| Register callback for status reporting. | |
| events::EventQueue * | get_queue () |
| Get event queue that can be chained to main event queue (or use start_dispatch) | |
| nsapi_error_t | start_dispatch () |
| Start event queue dispatching. | |
| void | stop () |
| Stop event queue dispatching and close cellular interfaces. | |
| CellularNetwork * | get_network () |
| Get cellular network interface. | |
| CellularDevice * | get_device () |
| Get cellular device interface. | |
| CellularSIM * | get_sim () |
| Get cellular sim interface. | |
| nsapi_error_t | continue_to_state (CellularState state=STATE_CONNECTED) |
| Change cellular connection to the target state. | |
| void | set_sim_pin (const char *sim_pin) |
| Set cellular device SIM PIN code. | |
| void | set_retry_timeout_array (uint16_t timeout[], int array_len) |
| Sets the timeout array for network rejects. | |
| void | set_plmn (const char *plmn) |
| Sets the operator plmn which is used when registering to a network specified by plmn. | |
| const char * | get_state_string (CellularState state) |
| returns readable format of the given state. | |
Detailed Description
CellularConnectionFSM class.
Finite State Machine for connecting to cellular network
Definition at line 46 of file CellularConnectionFSM.h.
Member Enumeration Documentation
| enum CellularState |
Cellular connection states.
Definition at line 55 of file CellularConnectionFSM.h.
Member Function Documentation
| void attach | ( | mbed::Callback< void(nsapi_event_t, intptr_t)> | status_cb ) | [virtual] |
Register callback for status reporting.
The specified status callback function will be called on status changes on the network. The parameters on the callback are the event type and event-type dependent reason parameter.
- Parameters:
-
status_cb The callback for status changes
Definition at line 619 of file CellularConnectionFSM.cpp.
| nsapi_error_t continue_to_state | ( | CellularState | state = STATE_CONNECTED ) |
Change cellular connection to the target state.
- Parameters:
-
state to continue. Default is to connect.
- Returns:
- see nsapi_error_t, 0 on success
Definition at line 334 of file CellularConnectionFSM.cpp.
| CellularDevice * get_device | ( | ) |
Get cellular device interface.
- Returns:
- device interface, NULL on failure
Definition at line 678 of file CellularConnectionFSM.cpp.
| CellularNetwork * get_network | ( | ) |
Get cellular network interface.
- Returns:
- network interface, NULL on failure
Definition at line 673 of file CellularConnectionFSM.cpp.
| events::EventQueue * get_queue | ( | ) |
Get event queue that can be chained to main event queue (or use start_dispatch)
- Returns:
- event queue
Definition at line 668 of file CellularConnectionFSM.cpp.
| CellularSIM * get_sim | ( | ) |
Get cellular sim interface.
SIM interface is released after SIM is open and ready for use (moving from STATE_SIM_PIN to next state). After SIM interface is closed this method will return NULL. SIM interface can be created again via CellularDevice which you can get with the method get_device().
- Returns:
- sim interface, NULL on failure
Definition at line 683 of file CellularConnectionFSM.cpp.
| const char * get_state_string | ( | CellularState | state ) |
returns readable format of the given state.
Used for printing states while debugging.
- Parameters:
-
state state which is returned in string format
- Returns:
- string format of the given state
Definition at line 261 of file CellularConnectionFSM.cpp.
| nsapi_error_t init | ( | ) |
Initialize cellular device.
- Remarks:
- Must be called before any other methods
- Returns:
- see nsapi_error_t, 0 on success
Definition at line 97 of file CellularConnectionFSM.cpp.
| void set_callback | ( | mbed::Callback< bool(int, int)> | status_callback ) |
Set callback for state update.
- Parameters:
-
status_callback function to call on state changes
Definition at line 614 of file CellularConnectionFSM.cpp.
| void set_plmn | ( | const char * | plmn ) |
Sets the operator plmn which is used when registering to a network specified by plmn.
If plmn is not set then automatic registering is used when registering to a cellular network. Does not start any operations.
- Parameters:
-
plmn operator in numeric format. See more from 3GPP TS 27.007 chapter 7.3.
Definition at line 153 of file CellularConnectionFSM.cpp.
| void set_retry_timeout_array | ( | uint16_t | timeout[], |
| int | array_len | ||
| ) |
Sets the timeout array for network rejects.
After reject next item is tried and after all items are waited and still fails then current network event will fail.
- Parameters:
-
timeout timeout array using seconds array_len length of the array
Definition at line 693 of file CellularConnectionFSM.cpp.
| void set_serial | ( | UARTSerial * | serial ) |
Set serial connection for cellular device.
- Parameters:
-
serial UART driver
Definition at line 609 of file CellularConnectionFSM.cpp.
| void set_sim_pin | ( | const char * | sim_pin ) |
Set cellular device SIM PIN code.
- Parameters:
-
sim_pin PIN code
Definition at line 147 of file CellularConnectionFSM.cpp.
| nsapi_error_t start_dispatch | ( | ) |
Start event queue dispatching.
- Returns:
- see nsapi_error_t, 0 on success
Definition at line 592 of file CellularConnectionFSM.cpp.
| void stop | ( | void | ) |
Stop event queue dispatching and close cellular interfaces.
After calling stop(), init() must be called before any other methods.
Definition at line 75 of file CellularConnectionFSM.cpp.
Generated on Tue Jul 12 2022 12:47:31 by
1.7.2