CellularHelper
Public Member Functions | Data Fields
CellularHelperEnvironmentResponse Class Reference

Used to hold the results from the AT+CGED command. More...

#include <CellularHelper.h>

Inheritance diagram for CellularHelperEnvironmentResponse:
CellularHelperPlusStringResponse CellularHelperCommonResponse CellularHelperEnvironmentResponseStatic< MAX_NEIGHBOR_CELLS >

Public Member Functions

 CellularHelperEnvironmentResponse ()
 Constructor for AT+CGED without neighbor data. More...
 
 CellularHelperEnvironmentResponse (CellularHelperEnvironmentCellData *neighbors, size_t numNeighbors)
 Constructor that takes an external array of CellularHelperEnvironmentCellData. More...
 
virtual int parse (int type, const char *buf, int len)
 Method to parse the output from the modem. More...
 
void clear ()
 Clear the data so the object can be reused.
 
void logResponse () const
 Log the decoded environment data to the debug log using Log.info.
 
size_t getNumNeighbors () const
 Gets the number of neighboring cells that were returned. More...
 
- Public Member Functions inherited from CellularHelperPlusStringResponse
String getDoubleQuotedPart (bool onlyFirst=true) const
 Gets the double quoted part of a string response. More...
 
- Public Member Functions inherited from CellularHelperCommonResponse
void logCellularDebug (int type, const char *buf, int len) const
 Used when enableDebug is true to log the Cellular.command callback data using Log.info. More...
 

Data Fields

CellularHelperEnvironmentCellData service
 Information about the service cell (the one you're connected to) More...
 
CellularHelperEnvironmentCellDataneighbors
 Information about the neighboring cells. More...
 
size_t numNeighbors
 Number of entries in the neighbors array. More...
 
int curDataIndex = -1
 Current index we're writing to. More...
 
- Data Fields inherited from CellularHelperPlusStringResponse
String command
 Your subclass must set this to the command requesting (not including the AT+ part) More...
 
String string
 Returned string is stored here.
 
- Data Fields inherited from CellularHelperCommonResponse
int resp = RESP_ERROR
 Response code from Cellular.command. More...
 
bool enableDebug = false
 Enables debug mode (default: false) More...
 

Detailed Description

Used to hold the results from the AT+CGED command.

You may want to use CellularHelperEnvironmentResponseStatic<> instead of separately allocating this object and the array of CellularHelperEnvironmentCellData.

Using this class with the default contructor is handy if you are using ENVIRONMENT_SERVING_CELL mode with CellularHelper.getLocation()

Constructor & Destructor Documentation

◆ CellularHelperEnvironmentResponse() [1/2]

CellularHelperEnvironmentResponse::CellularHelperEnvironmentResponse ( )

Constructor for AT+CGED without neighbor data.

Since only the Electron 2G (SARA-G350) supports getting neighbor data, this constructor can be used with ENVIRONMENT_SERVING_CELL to get only the serving cell.

◆ CellularHelperEnvironmentResponse() [2/2]

CellularHelperEnvironmentResponse::CellularHelperEnvironmentResponse ( CellularHelperEnvironmentCellData neighbors,
size_t  numNeighbors 
)

Constructor that takes an external array of CellularHelperEnvironmentCellData.

Parameters
neighborsPointer to array of CellularHelperEnvironmentCellData. Can be NULL.
numNeighborsNumber of items in neighbors. Can be 0.

The templated CellularHelperEnvironmentResponseStatic<> uses this constructor but eliminates the need to separately allocate the neighbor CellularHelperEnvironmentCellData and may be easier to use.

Member Function Documentation

◆ getNumNeighbors()

size_t CellularHelperEnvironmentResponse::getNumNeighbors ( ) const

Gets the number of neighboring cells that were returned.

  • 0 = no neighboring cells
  • 1 = one neighboring cell
  • ...

◆ parse()

int CellularHelperEnvironmentResponse::parse ( int  type,
const char *  buf,
int  len 
)
virtual

Method to parse the output from the modem.

Parameters
typeone of 13 different enumerated AT command response types.
bufa pointer to the character array containing the AT command response.
lenlength of the AT command response buf.

This is called from responseCallback, which is the callback to Cellular.command.

Reimplemented from CellularHelperPlusStringResponse.

Field Documentation

◆ curDataIndex

int CellularHelperEnvironmentResponse::curDataIndex = -1

Current index we're writing to.

  • -1 = service
  • 0 = first element of neighbors
  • 1 = second element of neighbors
  • ...

◆ neighbors

CellularHelperEnvironmentCellData* CellularHelperEnvironmentResponse::neighbors

Information about the neighboring cells.

Only filled in when using ENVIRONMENT_SERVING_CELL_AND_NEIGHBORS mode, which only works on the 2G Electron (SARA-G350). Maximum number of neighboring cells is 30, however it will be further limited by the numNeighbors (the size of your array).

The value of this member is passed into the constructor.

◆ numNeighbors

size_t CellularHelperEnvironmentResponse::numNeighbors

Number of entries in the neighbors array.

The value of this member is passed into the constructor.

◆ service

CellularHelperEnvironmentCellData CellularHelperEnvironmentResponse::service

Information about the service cell (the one you're connected to)

Filled in in both ENVIRONMENT_SERVING_CELL and ENVIRONMENT_SERVING_CELL_AND_NEIGHBORS modes.


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