ublox-cellular-base-n2xx

Embed: (wiki syntax)

« Back to documentation index

UbloxCellularBaseN2xx Class Reference

UbloxCellularBase class. More...

#include <UbloxCellularBaseN2xx.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.
bool cgmi (const char *response)
 get the Manufacturer Info
bool cgmm (const char *response)
 get the Module name
bool cimi (const char *response)
 get International Module Subscriber Information
bool ccid (const char *response)
 get the serial number
bool cgmr (const char *response)
 get the firmware version
bool cgsn (int snt, const char *response)
 get the IMEI
bool cops (const char *plmn)
 Connect to the specified PLMN.
bool cops (int mode)
 Set the mode of operation for registering.
bool get_cops (int *status)
 Gets the COPS mode of operation.
bool cfun (int mode)
 Enable or Disable the Radio/Modem.
bool reboot ()
 Reboot the SARA-N2xx module.
bool auto_connect (bool state)
 Sets the AUTOCONNECT feature of SARA-N2xx module.
bool nconfig (const char *name, bool state)
 Set the specified NCONFIG parameter.
 MBED_DEPRECATED ("This method is now replaced by const char * imei(), please use that instead") bool get_imei(char *buffer
 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_N2XX_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.
sara_n2xx_info _sara_n2xx_info
 Information about the SARA-N2xx module.
const char * _pin
 The SIM PIN to use.
bool _debug_trace_on
 Set to true to spit out debug traces.
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 33 of file UbloxCellularBaseN2xx.h.


Member Enumeration Documentation

enum DeviceType [protected]

Supported u-blox modem variants.

Definition at line 290 of file UbloxCellularBaseN2xx.h.

Circuit Switched network registration status (CREG Usage).

UBX-13001820 - AT Commands Example Application Note (Section 7.10.3).

Definition at line 39 of file UbloxCellularBaseN2xx.h.

EPS network registration status (CEREG Usage).

UBX-13001820 - AT Commands Example Application Note (Section 18.36.3).

Definition at line 67 of file UbloxCellularBaseN2xx.h.

Packet Switched network registration status (CGREG Usage).

UBX-13001820 - AT Commands Example Application Note (Section 18.27.3).

Definition at line 54 of file UbloxCellularBaseN2xx.h.

enum RadioAccessNetworkType [protected]

Network registration status.

UBX-13001820 - AT Commands Example Application Note (Section 4.1.4.5).

Definition at line 305 of file UbloxCellularBaseN2xx.h.


Member Function Documentation

void at_set_timeout ( int  timeout ) [protected]

Set the AT parser timeout.

Definition at line 606 of file UbloxCellularBaseN2xx.cpp.

bool auto_connect ( bool  state )

Sets the AUTOCONNECT feature of SARA-N2xx module.

Parameters:
statetrue to enable, false to disable
Returns:
ture if successful, otherwise false.

Definition at line 373 of file UbloxCellularBaseN2xx.cpp.

void baseClassInit ( PinName  tx = MDMTXD,
PinName  rx = MDMRXD,
int  baud = MBED_CONF_UBLOX_CELL_N2XX_BAUD_RATE,
bool  debug_on = false 
) [protected]

Initialise this class.

Parameters:
txthe UART TX data pin to which the modem is attached.
rxthe UART RX data pin to which the modem is attached.
baudthe UART baud rate.
debug_ontrue 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 570 of file UbloxCellularBaseN2xx.cpp.

bool ccid ( const char *  response )

get the serial number

Parameters:
responsethe serial number
Returns:
ture if successful, otherwise false.

Definition at line 290 of file UbloxCellularBaseN2xx.cpp.

bool cfun ( int  mode )

Enable or Disable the Radio/Modem.

Parameters:
mode0=disable, 1=enable
Returns:
ture if successful, otherwise false.

Definition at line 365 of file UbloxCellularBaseN2xx.cpp.

bool cgmi ( const char *  response )

get the Manufacturer Info

Parameters:
responsethe manufacturer
Returns:
ture if successful, otherwise false.

Definition at line 277 of file UbloxCellularBaseN2xx.cpp.

bool cgmm ( const char *  response )

get the Module name

Parameters:
responsethe module name
Returns:
ture if successful, otherwise false.

Definition at line 282 of file UbloxCellularBaseN2xx.cpp.

bool cgmr ( const char *  response )

get the firmware version

Parameters:
responsethe firmware version
Returns:
ture if successful, otherwise false.

Definition at line 294 of file UbloxCellularBaseN2xx.cpp.

bool cgsn ( int  snt,
const char *  response 
)

get the IMEI

Parameters:
responsethe IMEI
Returns:
ture if successful, otherwise false.

Definition at line 298 of file UbloxCellularBaseN2xx.cpp.

bool change_sim_pin ( const char *  new_pin )

Change the SIM pin.

Parameters:
new_pinthe new PIN to use.
Returns:
true if successful, otherwise false.

Definition at line 889 of file UbloxCellularBaseN2xx.cpp.

bool cimi ( const char *  response )

get International Module Subscriber Information

Parameters:
responsethe IMSI
Returns:
ture if successful, otherwise false.

Definition at line 286 of file UbloxCellularBaseN2xx.cpp.

bool cops ( const char *  plmn )

Connect to the specified PLMN.

Parameters:
plmnthe PLMN to register on
Returns:
ture if successful, otherwise false.

Definition at line 353 of file UbloxCellularBaseN2xx.cpp.

bool cops ( int  mode )

Set the mode of operation for registering.

Parameters:
mode0=Auto, 1=Manual, 2=Deregister
Returns:
ture if successful, otherwise false.

Definition at line 357 of file UbloxCellularBaseN2xx.cpp.

void deinit (  )

Put the modem into its lowest power state.

Definition at line 870 of file UbloxCellularBaseN2xx.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 728 of file UbloxCellularBaseN2xx.cpp.

bool get_cops ( int *  status )

Gets the COPS mode of operation.

Parameters:
statusreturns the mode
Returns:
ture if successful, otherwise false.

Definition at line 361 of file UbloxCellularBaseN2xx.cpp.

const char * iccid (  )

Get the ICCID of the SIM.

Returns:
a pointer to the ICCID as a null-terminated string.

Definition at line 938 of file UbloxCellularBaseN2xx.cpp.

const char * imei (  )

Get the IMEI of the module.

Returns:
a pointer to the IMEI as a null-terminated string.

Definition at line 917 of file UbloxCellularBaseN2xx.cpp.

const char * imsi (  )

Get the IMSI of the SIM.

Returns:
a pointer to the IMSI as a null-terminated string.

Definition at line 929 of file UbloxCellularBaseN2xx.cpp.

bool init ( const char *  pin = 0 )

Initialise the modem, ready for use.

Parameters:
pinPIN for the SIM card.
Returns:
true if successful, otherwise false.

Definition at line 746 of file UbloxCellularBaseN2xx.cpp.

bool initialise_sim_card (  ) [protected]

Set up the SIM.

Returns:
true if successful, otherwiss false.

Definition at line 735 of file UbloxCellularBaseN2xx.cpp.

bool is_registered_csd (  )

True if the modem is registered for circuit switched data, otherwise false.

Definition at line 827 of file UbloxCellularBaseN2xx.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 840 of file UbloxCellularBaseN2xx.cpp.

bool is_registered_psd (  )

True if the modem is registered for packet switched data, otherwise false.

Definition at line 834 of file UbloxCellularBaseN2xx.cpp.

void lock ( void   ) [protected]

Lock a mutex when accessing the modem.

Definition at line 469 of file UbloxCellularBaseN2xx.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 923 of file UbloxCellularBaseN2xx.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 502 of file UbloxCellularBaseN2xx.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 497 of file UbloxCellularBaseN2xx.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 512 of file UbloxCellularBaseN2xx.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 507 of file UbloxCellularBaseN2xx.cpp.

bool nconfig ( const char *  name,
bool  state 
)

Set the specified NCONFIG parameter.

Parameters:
namename of the NCONFIG parameter to enable/disable
statetrue to enable, false to disable
Returns:
ture if successful, otherwise false.

Definition at line 377 of file UbloxCellularBaseN2xx.cpp.

bool nwk_deregistration (  )

Perform deregistration from the network.

Returns:
true if successful, otherwise false.

Definition at line 847 of file UbloxCellularBaseN2xx.cpp.

bool nwk_registration (  )

Perform registration with the network.

Returns:
true if successful, otherwise false.

Definition at line 787 of file UbloxCellularBaseN2xx.cpp.

void power_down (  ) [protected]

Power down the modem.

Definition at line 684 of file UbloxCellularBaseN2xx.cpp.

bool power_up (  ) [protected]

Powers up the modem.

Returns:
true if successful, otherwise false.

Definition at line 644 of file UbloxCellularBaseN2xx.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:
bufthe buffer to write to.
sizethe size of the buffer.
endthe character to stop at.
Returns:
the number of characters read, not including the terminator.

Definition at line 616 of file UbloxCellularBaseN2xx.cpp.

bool reboot (  )

Reboot the SARA-N2xx module.

Returns:
ture if successful, otherwise false.

Definition at line 369 of file UbloxCellularBaseN2xx.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 947 of file UbloxCellularBaseN2xx.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 708 of file UbloxCellularBaseN2xx.cpp.

void set_pin ( const char *  pin )

Set the PIN code for the SIM card.

Parameters:
pinPIN for the SIM card.

Definition at line 877 of file UbloxCellularBaseN2xx.cpp.

bool sim_pin_check_enable ( bool  enableNotDisable )

Enable or disable SIM pin checking.

Parameters:
enableNotDisabletrue if SIM PIN checking is to be enabled, otherwise false.
Returns:
true if successful, otherwise false.

Definition at line 882 of file UbloxCellularBaseN2xx.cpp.

void unlock ( void   ) [protected]

Unlock the modem when done accessing it.

Definition at line 477 of file UbloxCellularBaseN2xx.h.


Field Documentation

ATCmdParser* _at [protected]

Point to the instance of the AT parser in use.

Definition at line 345 of file UbloxCellularBaseN2xx.h.

int _at_timeout [protected]

The current AT parser timeout value.

Definition at line 349 of file UbloxCellularBaseN2xx.h.

bool _debug_trace_on [protected]

Set to true to spit out debug traces.

Definition at line 374 of file UbloxCellularBaseN2xx.h.

DeviceInfo _dev_info [protected]

General info about the modem as a device.

Definition at line 361 of file UbloxCellularBaseN2xx.h.

FileHandle* _fh [protected]

File handle used by the AT parser.

Definition at line 353 of file UbloxCellularBaseN2xx.h.

bool _modem_initialised [protected]

True if the modem is ready register to the network, otherwise false.

Definition at line 379 of file UbloxCellularBaseN2xx.h.

Mutex _mtx [protected]

The mutex resource.

Definition at line 357 of file UbloxCellularBaseN2xx.h.

const char* _pin [protected]

The SIM PIN to use.

Definition at line 370 of file UbloxCellularBaseN2xx.h.

sara_n2xx_info _sara_n2xx_info [protected]

Information about the SARA-N2xx module.

Definition at line 366 of file UbloxCellularBaseN2xx.h.

bool _sim_pin_check_enabled [protected]

True it the SIM requires a PIN, otherwise false.

Definition at line 383 of file UbloxCellularBaseN2xx.h.