CellularHelper
Public Member Functions | Data Fields
CellularHelperEnvironmentCellData Class Reference

Used to hold the results for one cell (service or neighbor) from the AT+CGED command. More...

#include <CellularHelper.h>

Public Member Functions

bool isValid (bool ignoreCI=false) const
 Returns true if this object looks valid. More...
 
void parse (const char *str)
 Parses the output from the modem (used internally) More...
 
void addKeyValue (const char *key, const char *value)
 Add a key-value pair (used internally) More...
 
String toString () const
 Returns a readable representation of this object as a String. More...
 
int getBand () const
 Calculated field to determine the cellular frequency band. More...
 
String getBandString () const
 Returns a readable string that identifies the cellular frequency band. More...
 
int getRSSI () const
 Get the RSSI (received signal strength indication) More...
 
int getBars () const
 Get the RSSI as "bars" of signal strength (0-5) More...
 

Data Fields

int mcc = 65535
 Mobile Country Code. More...
 
int mnc = 255
 Mobile Network Code. More...
 
int lac
 Location Area Code. More...
 
int ci
 Cell Identity. More...
 
int bsic
 Base Station Identify Code. More...
 
int arfcn
 Absolute Radio Frequency Channel Number. More...
 
int rxlev
 Received signal level on the cell. More...
 
bool isUMTS = false
 RAT is GSM (false) or UMTS (true)
 
int dlf
 Downlink frequency. More...
 
int ulf
 Uplink frequency. Range 0 - 16383 [3G only].
 
int rscpLev = 255
 Received signal level [3G]. More...
 

Detailed Description

Used to hold the results for one cell (service or neighbor) from the AT+CGED command.

You will normally use CellularHelperEnvironmentResponseStatic<> or CellularHelperEnvironmentResponse which includes this as a member.

Member Function Documentation

◆ addKeyValue()

void CellularHelperEnvironmentCellData::addKeyValue ( const char *  key,
const char *  value 
)

Add a key-value pair (used internally)

The AT+CGED response contains key-value pairs. This parses out the ones we care about and stores them in the specific fields of this structure.

◆ getBand()

int CellularHelperEnvironmentCellData::getBand ( ) const

Calculated field to determine the cellular frequency band.

Values are frequency in MHz, such as: 700, 800, 850, 900, 1700, 1800, 1900, 2100

Not all bands are used by existing hardware.

Note that for 2G, 1800 is returned for the 1900 MHz band. This is because they use the same arfcn values. So 1800 really means 1800 or 1900 MHz for 2G.

◆ getBandString()

String CellularHelperEnvironmentCellData::getBandString ( ) const

Returns a readable string that identifies the cellular frequency band.

Example 3G: rat=UMTS mcc=310, mnc=410, lac=1af7 ci=817b57f band=UMTS 850 rssi=0 dlf=4384 ulf=4159

Example 2G: rat=GSM mcc=310, mnc=260, lac=ab22 ci=a78a band=DCS 1800 or 1900 rssi=-97 bsic=23 arfcn=596 rxlev=24

◆ getBars()

int CellularHelperEnvironmentCellData::getBars ( ) const

Get the RSSI as "bars" of signal strength (0-5)

RSSI Bars
>= -57 5
> -68 4
> -80 3
> -92 2
> -104 1
<= -104 0

This is simlar to the bar graph display on phones.

◆ getRSSI()

int CellularHelperEnvironmentCellData::getRSSI ( ) const

Get the RSSI (received signal strength indication)

This only available on 3G devices, and even then is not always returned. It may be 0 or 255 if not known.

◆ isValid()

bool CellularHelperEnvironmentCellData::isValid ( bool  ignoreCI = false) const

Returns true if this object looks valid.

Parameters
ignoreCI(bool, default false) Sometimes the cell identifier (CI) valid is not returned by the towers but other fields are set. Passing true in this parameter causes the CI to be ignored.
Returns
true if the object looks valid or false if not.

◆ parse()

void CellularHelperEnvironmentCellData::parse ( const char *  str)

Parses the output from the modem (used internally)

Some classes use postprocess() to process the + response, but the AT+CGED response is sufficiently complicated that we parse each response as it comes in using the parse() method rather than waiting until all responses have come in.

Parameters
strThe comma separated response from the modem to parse

◆ toString()

String CellularHelperEnvironmentCellData::toString ( ) const

Returns a readable representation of this object as a String.

Field Documentation

◆ arfcn

int CellularHelperEnvironmentCellData::arfcn

Absolute Radio Frequency Channel Number.

  • Range 0 - 1023 [2G only]
  • The parameter value also decodes the band indicator bit (DCS or PCS) by means of the most significant byte (8 means 1900 band) (i.e. if the parameter reports the value 33485, it corresponds to 0x82CD, in the most significant byte there is the band indicator bit, so the arfcn is 0x2CD (717) and belongs to 1900 band).

◆ bsic

int CellularHelperEnvironmentCellData::bsic

Base Station Identify Code.

  • Range 0h-3Fh (6 bits) [2G]

◆ ci

int CellularHelperEnvironmentCellData::ci

Cell Identity.

  • 2G cell: range 0h-FFFFh (2 octets)
  • 3G cell: range 0h-FFFFFFFh (28 bits)

◆ dlf

int CellularHelperEnvironmentCellData::dlf

Downlink frequency.

  • Range 0 - 16383 [3G only]

◆ lac

int CellularHelperEnvironmentCellData::lac

Location Area Code.

  • Range 0h-FFFFh (2 octets).

◆ mcc

int CellularHelperEnvironmentCellData::mcc = 65535

Mobile Country Code.

  • Range 0 - 999 (3 digits). Other values are to be considered invalid / not available.

◆ mnc

int CellularHelperEnvironmentCellData::mnc = 255

Mobile Network Code.

  • Range 0 - 999 (1 to 3 digits). Other values are to be considered invalid / not available.

◆ rscpLev

int CellularHelperEnvironmentCellData::rscpLev = 255

Received signal level [3G].

Received Signal Code Power expressed in dBm levels. Range 0 - 91.

Value RSCP Note
0 RSCP < -115 dBm Weak
1 -115 <= RSCP < -114 dBm
90 -26 <= RSCP < -25 dBm
91 RSCP == -25 dBm Strong

◆ rxlev

int CellularHelperEnvironmentCellData::rxlev

Received signal level on the cell.

  • Range 0 - 63; see the 3GPP TS 05.08 [2G]

The documentation for this class was generated from the following files: