SparkFun Iridium 9604  v1.0.0
Library for the Iridium 9604 Hybrid LTE-M Cellular + Iridium Satellite (SBD) + GNSS IoT module
Loading...
Searching...
No Matches
SparkFun_Iridium_9604::nmeaZDA Class Reference

The NMEA ZDA message: Time and date. More...

#include <nmeaZDA.h>

Inheritance diagram for SparkFun_Iridium_9604::nmeaZDA:

Public Member Functions

 nmeaZDA (void)
 Construct a new nmeaZDA object and register it with the NMEA message registry. More...
 
bool amI (const char *msgId) const
 Check whether this message object represents the given NMEA message identifier. More...
 
bool initStorage (void)
 Lazily allocate this message's raw payload storage (_storage), if not already done. More...
 
bool initCallbackStorage (void)
 Lazily allocate this message's callback ring-buffer storage (_callbackStorage), if not already done. More...
 
bool extractFieldFrom (const uint8_t *buffer, const char *fieldName, sfe_string_t &value, const void *fieldsOverride=nullptr, uint8_t numFieldsOverride=0, uint16_t blockIndex=0) const
 Look up one field of this message, by name, in a given NMEA sentence buffer. More...
 
void addNMEA (const char *msgId, uint8_t messageLength, uint8_t numCallbackCopies, uint8_t numFields, const void *nmeaFields, const void *blockFields=nullptr, uint8_t numBlockFields=0, uint8_t numHeaderFields=0, uint8_t maxNumBlocks=0)
 Register this message's identity, field table and metadata with the base class. More...
 

Public Attributes

const char msgId [4] = "ZDA"
 The message identifier. More...
 
const uint8_t supportedVersions = 1
 Reserved for future use. More...
 
const uint8_t numCallbackCopies = 1
 The number of copies stored for the callback. More...
 
const uint8_t messageLength = NMEA_ZDA_MAX_LENGTH
 The maximum message length (bytes). More...
 
const nmeaField nmeaFields [numFields]
 The message fields, by name. More...
 
const char * _msgId = nullptr
 The message ID, e.g. "GGA". More...
 
uint8_t _messageLength = 0
 The maximum message length in bytes. Messages could be less than this. More...
 
uint8_t _numCallbackCopies = 0
 Number of ring-buffer slots in _callbackStorage - 1 for most messages, 54 for GSV - see the GNSS v4 AGENTS.md "Adding support for NMEA GSV messages". More...
 
uint8_t * _storage = nullptr
 Raw payload storage - nullptr until initStorage() is called. More...
 
uint8_t _numFields = 0
 Number of entries in _fields (header + footer fields only - excludes _numBlockFields) More...
 
bool _moduleQueried = false
 true when fresh data has arrived. Cleared by getNMEA(). More...
 
const void * _fields = nullptr
 Points at the subclass's own, permanently-lived nmeaFields[] table. More...
 
const void * _blockFields = nullptr
 Points at the subclass's own nmeaBlockFields[] table; nullptr => no repeated blocks. More...
 
uint8_t _numBlockFields = 0
 Number of entries in _blockFields. More...
 
uint8_t _numHeaderFields = 0
 Number of header fields before the first repeated block (also the field-table position of the first footer field) More...
 
uint8_t _maxNumBlocks = 0
 Upper bound on the number of repeated blocks (e.g. GSV's 4) More...
 
uint8_t * _callbackStorage = nullptr
 Ring buffer of _numCallbackCopies slots, each _messageLength bytes - nullptr until initCallbackStorage() is called. More...
 
uint8_t _callbackHead = 0
 Next free slot the write side will write into. More...
 
uint8_t _callbackTail = 0
 Next fresh slot checkCallbacks() will read and dispatch. More...
 
uint8_t _callbackCount = 0
 How many slots currently hold fresh, undelivered data (replaces the old single _callbackDataValid bool) More...
 
uint8_t _callbackReadIndex = 0
 Set by checkCallbacks() to _callbackTail immediately before each callback firing, so getNmeaMessageFieldCallback()/getNmeaMessageBlockFieldCallback() know which slot to read. More...
 
void(* _callbackPtr )(nmeaCallbackDataCommon_t *) = nullptr
 The user callback. More...
 
bool _urcEnabled = false
 Has the module been told to output this message as a +UUGNMEA URC? (AT+UGNMEA <output> bit 1) More...
 
bool _memoryEnabled = false
 Has the module been told to store this message in its internal buffer? (AT+UGNMEA <output> bit 0) More...
 

Static Public Attributes

static const uint8_t numFields = 7
 The number of fields. More...
 

Detailed Description

The NMEA ZDA message: Time and date.

Constructor & Destructor Documentation

◆ nmeaZDA()

SparkFun_Iridium_9604::nmeaZDA::nmeaZDA ( void  )
inline

Construct a new nmeaZDA object and register it with the NMEA message registry.

NMEA ZDA: Time and date. Registers this message's identifier, field table and callback-copy count with the base nmeaMessage class via addNMEA(), making it discoverable by the generic NMEA dispatch, field-lookup and callback machinery in DevIridium9604.

Member Function Documentation

◆ addNMEA()

void SparkFun_Iridium_9604::nmeaMessage::addNMEA ( const char *  msgId,
uint8_t  messageLength,
uint8_t  numCallbackCopies,
uint8_t  numFields,
const void *  nmeaFields,
const void *  blockFields = nullptr,
uint8_t  numBlockFields = 0,
uint8_t  numHeaderFields = 0,
uint8_t  maxNumBlocks = 0 
)
inlineinherited

Register this message's identity, field table and metadata with the base class.

Called once, from the subclass's own constructor, to populate every _* member below with the subclass's message identifier, field table(s) and configuration keys, and to reset all storage pointers and callback bookkeeping to their initial "nothing allocated yet" state.

Parameters
msgIdThe 3-character NMEA message identifier (e.g. "GGA").
messageLengthMaximum message length in bytes (an actual received sentence may be shorter).
numCallbackCopiesNumber of ring-buffer slots to allocate for callback storage.
numFieldsNumber of entries in 'nmeaFields' (header + footer fields only - excludes 'numBlockFields').
nmeaFieldsPointer to this message's own, permanently-lived field table.
blockFieldsOptional field table describing one repeated block, for a variable-length message (e.g. NMEA GSV's per-satellite blocks). Defaults to nullptr (no repeated blocks).
numBlockFieldsNumber of entries in 'blockFields'. Defaults to 0.
numHeaderFieldsNumber of header fields before the first repeated block (also the field-table position of the first footer field). Defaults to 0.
maxNumBlocksUpper bound on the number of repeated blocks. Defaults to 0.

◆ amI()

bool SparkFun_Iridium_9604::nmeaMessage::amI ( const char *  msgId) const
inlineinherited

Check whether this message object represents the given NMEA message identifier.

Parameters
msgIdThe 3-character NMEA message identifier to test against (e.g. "GGA").
Returns
true if this object's registered _msgId matches, false otherwise.

◆ extractFieldFrom()

bool SparkFun_Iridium_9604::nmeaMessage::extractFieldFrom ( const uint8_t *  buffer,
const char *  fieldName,
sfe_string_t &  value,
const void *  fieldsOverride = nullptr,
uint8_t  numFieldsOverride = 0,
uint16_t  blockIndex = 0 
) const
inlineinherited

Look up one field of this message, by name, in a given NMEA sentence buffer.

Walks the comma-delimited sentence in 'buffer' to find field 'fieldName' and returns its text, converted according to that field's nmeaDataType (see nmeaFieldFormats_t above). Shared core used both for a live/polled read (from this object's own _storage) and for a callback read (from _callbackStorage) - see getNmeaMessageField() and getNmeaMessageBlockField()/getNmeaMessageBlockFieldCallback() in Iridium_9604_GNSS.cpp.

Parameters
bufferThe NMEA sentence bytes to search (this message's _storage, or its _callbackStorage), which must start with '$'.
fieldNameName of the field to find, matched against each entry's fieldName.
valueOut parameter: filled in with the field's text (converted per its data type), or cleared to an empty String on failure.
fieldsOverrideOptional field table to search instead of this object's own _fields - used to search a repeated block's own field table (see _blockFields, e.g. NMEA GSV's per-satellite blocks). Defaults to nullptr (search _fields).
numFieldsOverrideNumber of entries in 'fieldsOverride'; ignored when 'fieldsOverride' is nullptr.
blockIndexWhich repeated block a block-field lookup should read; ignored unless 'fieldsOverride' is given. Defaults to 0.
Returns
true if 'fieldName' was found (and *value filled in); false if 'buffer' is null, malformed, too short, 'blockIndex' is out of range, or the field name was not found.

◆ initCallbackStorage()

bool SparkFun_Iridium_9604::nmeaMessage::initCallbackStorage ( void  )
inlineinherited

Lazily allocate this message's callback ring-buffer storage (_callbackStorage), if not already done.

Allocates _numCallbackCopies slots of _messageLength bytes each, the first time a callback is registered for this message. Subsequent calls are a no-op.

Returns
true if _callbackStorage is non-null after the call, false if the allocation failed.

◆ initStorage()

bool SparkFun_Iridium_9604::nmeaMessage::initStorage ( void  )
inlineinherited

Lazily allocate this message's raw payload storage (_storage), if not already done.

Allocates and zero-fills a buffer of _messageLength bytes on first call; subsequent calls are a no-op. This is what lets a message that is never instantiated/used avoid consuming any RAM for its payload - see the class-level comment above for the "delete the header, save the RAM" design intent.

Returns
true if _storage is non-null after the call (already allocated, or successfully allocated now); false if the allocation failed.

Member Data Documentation

◆ _blockFields

const void* SparkFun_Iridium_9604::nmeaMessage::_blockFields = nullptr
inherited

Points at the subclass's own nmeaBlockFields[] table; nullptr => no repeated blocks.

◆ _callbackCount

uint8_t SparkFun_Iridium_9604::nmeaMessage::_callbackCount = 0
inherited

How many slots currently hold fresh, undelivered data (replaces the old single _callbackDataValid bool)

◆ _callbackHead

uint8_t SparkFun_Iridium_9604::nmeaMessage::_callbackHead = 0
inherited

Next free slot the write side will write into.

◆ _callbackPtr

void(* SparkFun_Iridium_9604::nmeaMessage::_callbackPtr) (nmeaCallbackDataCommon_t *) = nullptr
inherited

The user callback.

◆ _callbackReadIndex

uint8_t SparkFun_Iridium_9604::nmeaMessage::_callbackReadIndex = 0
inherited

Set by checkCallbacks() to _callbackTail immediately before each callback firing, so getNmeaMessageFieldCallback()/getNmeaMessageBlockFieldCallback() know which slot to read.

◆ _callbackStorage

uint8_t* SparkFun_Iridium_9604::nmeaMessage::_callbackStorage = nullptr
inherited

Ring buffer of _numCallbackCopies slots, each _messageLength bytes - nullptr until initCallbackStorage() is called.

◆ _callbackTail

uint8_t SparkFun_Iridium_9604::nmeaMessage::_callbackTail = 0
inherited

Next fresh slot checkCallbacks() will read and dispatch.

◆ _fields

const void* SparkFun_Iridium_9604::nmeaMessage::_fields = nullptr
inherited

Points at the subclass's own, permanently-lived nmeaFields[] table.

◆ _maxNumBlocks

uint8_t SparkFun_Iridium_9604::nmeaMessage::_maxNumBlocks = 0
inherited

Upper bound on the number of repeated blocks (e.g. GSV's 4)

◆ _memoryEnabled

bool SparkFun_Iridium_9604::nmeaMessage::_memoryEnabled = false
inherited

Has the module been told to store this message in its internal buffer? (AT+UGNMEA <output> bit 0)

◆ _messageLength

uint8_t SparkFun_Iridium_9604::nmeaMessage::_messageLength = 0
inherited

The maximum message length in bytes. Messages could be less than this.

◆ _moduleQueried

bool SparkFun_Iridium_9604::nmeaMessage::_moduleQueried = false
inherited

true when fresh data has arrived. Cleared by getNMEA().

◆ _msgId

const char* SparkFun_Iridium_9604::nmeaMessage::_msgId = nullptr
inherited

The message ID, e.g. "GGA".

◆ _numBlockFields

uint8_t SparkFun_Iridium_9604::nmeaMessage::_numBlockFields = 0
inherited

Number of entries in _blockFields.

◆ _numCallbackCopies

uint8_t SparkFun_Iridium_9604::nmeaMessage::_numCallbackCopies = 0
inherited

Number of ring-buffer slots in _callbackStorage - 1 for most messages, 54 for GSV - see the GNSS v4 AGENTS.md "Adding support for NMEA GSV messages".

◆ _numFields

uint8_t SparkFun_Iridium_9604::nmeaMessage::_numFields = 0
inherited

Number of entries in _fields (header + footer fields only - excludes _numBlockFields)

◆ _numHeaderFields

uint8_t SparkFun_Iridium_9604::nmeaMessage::_numHeaderFields = 0
inherited

Number of header fields before the first repeated block (also the field-table position of the first footer field)

◆ _storage

uint8_t* SparkFun_Iridium_9604::nmeaMessage::_storage = nullptr
inherited

Raw payload storage - nullptr until initStorage() is called.

◆ _urcEnabled

bool SparkFun_Iridium_9604::nmeaMessage::_urcEnabled = false
inherited

Has the module been told to output this message as a +UUGNMEA URC? (AT+UGNMEA <output> bit 1)

◆ messageLength

const uint8_t SparkFun_Iridium_9604::nmeaZDA::messageLength = NMEA_ZDA_MAX_LENGTH

The maximum message length (bytes).

◆ msgId

const char SparkFun_Iridium_9604::nmeaZDA::msgId[4] = "ZDA"

The message identifier.

◆ nmeaFields

const nmeaField SparkFun_Iridium_9604::nmeaZDA::nmeaFields[numFields]
Initial value:
= {
{"xxZDA", nmeaDataTypeString, 0},
{"time", nmeaDataTypeTime, 1},
{"day", nmeaDataTypeString, 2},
{"month", nmeaDataTypeString, 3},
{"year", nmeaDataTypeNumeric, 4},
{"ltzh", nmeaDataTypeNumeric, 5},
{"ltzn", nmeaDataTypeNumeric, 6},
}
@ nmeaDataTypeTime
Time in the format HHMMSS. Could have a variable number of decimal places: HHMMSS....
Definition: nmeaMessage.h:66
@ nmeaDataTypeString
An array of ASCII char.
Definition: nmeaMessage.h:65
@ nmeaDataTypeNumeric
A numeric: could be integer or floating point; could be negative.
Definition: nmeaMessage.h:71

The message fields, by name.

◆ numCallbackCopies

const uint8_t SparkFun_Iridium_9604::nmeaZDA::numCallbackCopies = 1

The number of copies stored for the callback.

◆ numFields

const uint8_t SparkFun_Iridium_9604::nmeaZDA::numFields = 7
static

The number of fields.

◆ supportedVersions

const uint8_t SparkFun_Iridium_9604::nmeaZDA::supportedVersions = 1

Reserved for future use.


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