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.
Fork of ublox-cellular-base by
UbloxCellularBase Class Reference
UbloxCellularBase class. More...
#include <UbloxCellularBase.h>
Data Structures | |
| struct | DeviceInfo |
| Info about the modem. More... | |
Public Types | |
| enum | NetworkRegistrationStatusCsd |
Circuit Switched network registration status (CREG Usage). More... | |
| enum | NetworkRegistrationStatusPsd |
Packet Switched network registration status (CGREG Usage). More... | |
| enum | NetworkRegistrationStatusEps |
EPS network registration status (CEREG Usage). More... | |
Public Member Functions | |
| bool | init (const char *pin=0) |
| Initialise the modem, ready for use. | |
| bool | nwk_registration () |
| Perform registration with the network. | |
| bool | is_registered_csd () |
| True if the modem is registered for circuit switched data, otherwise false. | |
| bool | is_registered_psd () |
| True if the modem is registered for packet switched data, otherwise false. | |
| bool | is_registered_eps () |
| True if the modem is registered for enhanced packet switched data (i.e. | |
| bool | nwk_deregistration () |
| Perform deregistration from the network. | |
| void | deinit () |
| Put the modem into its lowest power state. | |
| void | set_pin (const char *pin) |
| Set the PIN code for the SIM card. | |
| bool | sim_pin_check_enable (bool enableNotDisable) |
| Enable or disable SIM pin checking. | |
| bool | change_sim_pin (const char *new_pin) |
| Change the SIM pin. | |
| MBED_DEPRECATED ("This method is now replaced by const char * imei(), please use that instead") bool get_imei(char *imei_to_send | |
| Get the IMEI. | |
| const char * | imei () |
| Get the IMEI of the module. | |
| const char * | meid () |
| Get the Mobile Equipment ID (which may be the same as the IMEI). | |
| const char * | imsi () |
| Get the IMSI of the SIM. | |
| const char * | iccid () |
| Get the ICCID of the SIM. | |
| int | rssi () |
| Get the RSSI. | |
Protected Types | |
| enum | DeviceType |
Supported u-blox modem variants. More... | |
| enum | RadioAccessNetworkType |
Network registration status. More... | |
Protected Member Functions | |
| virtual void | modem_init () |
| Sets the modem up for powering on. | |
| virtual void | modem_deinit () |
| Sets the modem in unplugged state. | |
| virtual void | modem_power_up () |
| Powers up the modem. | |
| virtual void | modem_power_down () |
| Powers down the modem. | |
| void | baseClassInit (PinName tx=MDMTXD, PinName rx=MDMRXD, int baud=MBED_CONF_UBLOX_CELL_BAUD_RATE, bool debug_on=false) |
| Initialise this class. | |
| void | at_set_timeout (int timeout) |
| Set the AT parser timeout. | |
| int | read_at_to_char (char *buf, int size, char end) |
| Read up to size characters from buf or until the character "end" is reached, overwriting the newline with 0 and ensuring a terminator in all cases. | |
| bool | power_up () |
| Powers up the modem. | |
| void | power_down () |
| Power down the modem. | |
| void | lock (void) |
| Lock a mutex when accessing the modem. | |
| void | unlock (void) |
| Unlock the modem when done accessing it. | |
| bool | set_device_identity (DeviceType *dev) |
| Set the device identity in _dev_info based on the ATI string returned by the module. | |
| bool | device_init (DeviceType dev) |
| Perform any modem initialisation that is specialised by device type. | |
| bool | initialise_sim_card () |
| Set up the SIM. | |
Protected Attributes | |
| ATCmdParser * | _at |
| Point to the instance of the AT parser in use. | |
| int | _at_timeout |
| The current AT parser timeout value. | |
| FileHandle * | _fh |
| File handle used by the AT parser. | |
| Mutex | _mtx |
| The mutex resource. | |
| DeviceInfo | _dev_info |
| General info about the modem as a device. | |
| const char * | _pin |
| The SIM PIN to use. | |
| bool | _debug_trace_on |
| Set to true to spit out debug traces. | |
| int | _baud |
| The baud rate to the modem. | |
| bool | _modem_initialised |
| True if the modem is ready register to the network, otherwise false. | |
| bool | _sim_pin_check_enabled |
| True it the SIM requires a PIN, otherwise false. | |
Detailed Description
UbloxCellularBase class.
This class provides all the base support for generic u-blox modems on C030 and C027 boards: module identification, power-up, network registration, etc.
Definition at line 34 of file UbloxCellularBase.h.
Member Enumeration Documentation
enum DeviceType [protected] |
Supported u-blox modem variants.
Definition at line 199 of file UbloxCellularBase.h.
Circuit Switched network registration status (CREG Usage).
UBX-13001820 - AT Commands Example Application Note (Section 7.10.3).
Definition at line 40 of file UbloxCellularBase.h.
EPS network registration status (CEREG Usage).
UBX-13001820 - AT Commands Example Application Note (Section 18.36.3).
Definition at line 68 of file UbloxCellularBase.h.
Packet Switched network registration status (CGREG Usage).
UBX-13001820 - AT Commands Example Application Note (Section 18.27.3).
Definition at line 55 of file UbloxCellularBase.h.
enum RadioAccessNetworkType [protected] |
Network registration status.
UBX-13001820 - AT Commands Example Application Note (Section 4.1.4.5).
Definition at line 215 of file UbloxCellularBase.h.
Member Function Documentation
| void at_set_timeout | ( | int | timeout ) | [protected] |
Set the AT parser timeout.
Definition at line 504 of file UbloxCellularBase.cpp.
| void baseClassInit | ( | PinName | tx = MDMTXD, |
| PinName | rx = MDMRXD, |
||
| int | baud = MBED_CONF_UBLOX_CELL_BAUD_RATE, |
||
| bool | debug_on = false |
||
| ) | [protected] |
Initialise this class.
- Parameters:
-
tx the UART TX data pin to which the modem is attached. rx the UART RX data pin to which the modem is attached. baud the UART baud rate. debug_on true to switch AT interface debug on, otherwise false.
Note: it would be more natural to do this in the constructor however, to avoid the diamond of death, this class is only every inherited virtually. Classes that are inherited virtually do not get passed parameters in their constructor and hence classInit() must be called separately by the first one to wake the beast.
Definition at line 462 of file UbloxCellularBase.cpp.
| bool change_sim_pin | ( | const char * | new_pin ) |
Change the SIM pin.
- Parameters:
-
new_pin the new PIN to use.
- Returns:
- true if successful, otherwise false.
Definition at line 930 of file UbloxCellularBase.cpp.
| void deinit | ( | ) |
Put the modem into its lowest power state.
Definition at line 888 of file UbloxCellularBase.cpp.
| bool device_init | ( | DeviceType | dev ) | [protected] |
Perform any modem initialisation that is specialised by device type.
- Returns:
- true if successful, otherwise false.
Definition at line 659 of file UbloxCellularBase.cpp.
| const char * iccid | ( | ) |
Get the ICCID of the SIM.
- Returns:
- a pointer to the ICCID as a null-terminated string.
Definition at line 993 of file UbloxCellularBase.cpp.
| const char * imei | ( | ) |
Get the IMEI of the module.
- Returns:
- a pointer to the IMEI as a null-terminated string.
Definition at line 972 of file UbloxCellularBase.cpp.
| const char * imsi | ( | ) |
Get the IMSI of the SIM.
- Returns:
- a pointer to the IMSI as a null-terminated string.
Definition at line 984 of file UbloxCellularBase.cpp.
| bool init | ( | const char * | pin = 0 ) |
Initialise the modem, ready for use.
- Parameters:
-
pin PIN for the SIM card.
- Returns:
- true if successful, otherwise false.
Definition at line 734 of file UbloxCellularBase.cpp.
| bool initialise_sim_card | ( | ) | [protected] |
Set up the SIM.
- Returns:
- true if successful, otherwiss false.
Definition at line 679 of file UbloxCellularBase.cpp.
| bool is_registered_csd | ( | ) |
True if the modem is registered for circuit switched data, otherwise false.
Definition at line 849 of file UbloxCellularBase.cpp.
| bool is_registered_eps | ( | ) |
True if the modem is registered for enhanced packet switched data (i.e.
LTE and beyond), otherwise false.
Definition at line 862 of file UbloxCellularBase.cpp.
| bool is_registered_psd | ( | ) |
True if the modem is registered for packet switched data, otherwise false.
Definition at line 856 of file UbloxCellularBase.cpp.
| void lock | ( | void | ) | [protected] |
Lock a mutex when accessing the modem.
Definition at line 373 of file UbloxCellularBase.h.
| MBED_DEPRECATED | ( | "This method is now replaced by const char * | imei(), |
| please use that instead" | |||
| ) |
Get the IMEI.
- Returns:
- true if successful, otherwise false.
| const char * meid | ( | ) |
Get the Mobile Equipment ID (which may be the same as the IMEI).
- Returns:
- a pointer to the Mobile Equipment ID as a null-terminated string.
Definition at line 978 of file UbloxCellularBase.cpp.
| void modem_deinit | ( | ) | [protected, virtual] |
Sets the modem in unplugged state.
modem_deinit() will be equivalent to pulling the plug off of the device, i.e., detaching power and serial port. This puts the modem in lowest power state. Uses onboard_modem_api.h where the implementation of onboard_modem_api is provided by the target.
Definition at line 397 of file UbloxCellularBase.cpp.
| void modem_init | ( | ) | [protected, virtual] |
Sets the modem up for powering on.
modem_init() is equivalent to plugging in the device, e.g., attaching power and serial port. Uses onboard_modem_api.h where the implementation of onboard_modem_api is provided by the target.
Definition at line 392 of file UbloxCellularBase.cpp.
| void modem_power_down | ( | ) | [protected, virtual] |
Powers down the modem.
modem_power_down() is equivalent to turning off the modem by button press. Uses onboard_modem_api.h where the implementation of onboard_modem_api is provided by the target.
Definition at line 407 of file UbloxCellularBase.cpp.
| void modem_power_up | ( | ) | [protected, virtual] |
Powers up the modem.
modem_power_up() is equivalent to pressing the soft power button. The driver may repeat this if the modem is not responsive to AT commands. Uses onboard_modem_api.h where the implementation of onboard_modem_api is provided by the target.
Definition at line 402 of file UbloxCellularBase.cpp.
| bool nwk_deregistration | ( | ) |
Perform deregistration from the network.
- Returns:
- true if successful, otherwise false.
Definition at line 869 of file UbloxCellularBase.cpp.
| bool nwk_registration | ( | ) |
Perform registration with the network.
- Returns:
- true if successful, otherwise false.
Definition at line 775 of file UbloxCellularBase.cpp.
| void power_down | ( | ) | [protected] |
Power down the modem.
Definition at line 600 of file UbloxCellularBase.cpp.
| bool power_up | ( | ) | [protected] |
Powers up the modem.
- Returns:
- true if successful, otherwise false.
Definition at line 542 of file UbloxCellularBase.cpp.
| int read_at_to_char | ( | char * | buf, |
| int | size, | ||
| char | end | ||
| ) | [protected] |
Read up to size characters from buf or until the character "end" is reached, overwriting the newline with 0 and ensuring a terminator in all cases.
- Parameters:
-
buf the buffer to write to. size the size of the buffer. end the character to stop at.
- Returns:
- the number of characters read, not including the terminator.
Definition at line 514 of file UbloxCellularBase.cpp.
| int rssi | ( | ) |
Get the RSSI.
- Returns:
- the RSSI in dBm. If it is not possible to obtain an RSSI reading at the time (e.g. because the modem is in data mode rather than AT command mode) then 0 is returned.
Definition at line 1002 of file UbloxCellularBase.cpp.
| bool set_device_identity | ( | DeviceType * | dev ) | [protected] |
Set the device identity in _dev_info based on the ATI string returned by the module.
- Returns:
- true if dev is a known value, otherwise false.
Definition at line 623 of file UbloxCellularBase.cpp.
| void set_pin | ( | const char * | pin ) |
Set the PIN code for the SIM card.
- Parameters:
-
pin PIN for the SIM card.
Definition at line 895 of file UbloxCellularBase.cpp.
| bool sim_pin_check_enable | ( | bool | enableNotDisable ) |
Enable or disable SIM pin checking.
- Parameters:
-
enableNotDisable true if SIM PIN checking is to be enabled, otherwise false.
- Returns:
- true if successful, otherwise false.
Definition at line 900 of file UbloxCellularBase.cpp.
| void unlock | ( | void | ) | [protected] |
Unlock the modem when done accessing it.
Definition at line 381 of file UbloxCellularBase.h.
Field Documentation
ATCmdParser* _at [protected] |
Point to the instance of the AT parser in use.
Definition at line 250 of file UbloxCellularBase.h.
int _at_timeout [protected] |
The current AT parser timeout value.
Definition at line 254 of file UbloxCellularBase.h.
int _baud [protected] |
The baud rate to the modem.
Definition at line 278 of file UbloxCellularBase.h.
bool _debug_trace_on [protected] |
Set to true to spit out debug traces.
Definition at line 274 of file UbloxCellularBase.h.
DeviceInfo _dev_info [protected] |
General info about the modem as a device.
Definition at line 266 of file UbloxCellularBase.h.
FileHandle* _fh [protected] |
File handle used by the AT parser.
Definition at line 258 of file UbloxCellularBase.h.
bool _modem_initialised [protected] |
True if the modem is ready register to the network, otherwise false.
Definition at line 283 of file UbloxCellularBase.h.
Mutex _mtx [protected] |
The mutex resource.
Definition at line 262 of file UbloxCellularBase.h.
const char* _pin [protected] |
The SIM PIN to use.
Definition at line 270 of file UbloxCellularBase.h.
bool _sim_pin_check_enabled [protected] |
True it the SIM requires a PIN, otherwise false.
Definition at line 287 of file UbloxCellularBase.h.
Generated on Wed Aug 3 2022 16:34:17 by
1.7.2
