ccNOos  v0.0.0
Build Portable Microcontroller Applications!
Data Structures | Functions
NEO_LEA_M8T.h File Reference

IMS: ccNOos, Declarations for straight C and C++ More...

#include "console_menu.h"
Include dependency graph for NEO_LEA_M8T.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  gpsData
 

Functions

struct gpsData createGPSDataStruct ()
 
UI_8 tryParseGPSData (char *gpsStringin, struct gpsData *gpsDataPtr)
 

Detailed Description

IMS: ccNOos, Declarations for straight C and C++

Copyright 2021 InMechaSol, Inc

Licensed under the Apache License, Version 2.0(the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Notes: (.c includes .h) - for straight C or (.cpp includes .c which includes .h) - for C++ wrapped straight C Always compiled to a single compilation unit, either C or CPP, not both

Definition in file NEO_LEA_M8T.h.

Function Documentation

◆ createGPSDataStruct()

struct gpsData createGPSDataStruct ( )

Definition at line 1 of file NEO_LEA_M8T.c.

30 {
31  struct gpsData outStruct;
32  outStruct.altitude = 0;
33  outStruct.day = 0;
34  outStruct.lattitude = 0;
35  outStruct.longitude = 0;
36  outStruct.month = 0;
37  outStruct.utctime = 0;
38  outStruct.year = 0;
39  return outStruct;
40 }

◆ tryParseGPSData()

UI_8 tryParseGPSData ( char *  gpsStringin,
struct gpsData gpsDataPtr 
)

Definition at line 227 of file NEO_LEA_M8T.c.

228 {
229  // check string begins with $
230 // if (gpsStringin[0] == '$')
231 // {
232  int CommaCount = 0;
233  int I_GGA = 0;
234  int I_ZDA = 0;
235  int I_GNS = 0;
236  UI_8 retVal = ui8FALSE;
237 
238  // scan message for valid tokens
239  for (int i = 5; i < charBuffMax; i++)
240  {
241  // find ZDA or GGA token
242  if(gpsStringin[i]=='A')
243  {
244  // ZDA
245  if (gpsStringin[i - 1] == 'D')
246  {
247  if (gpsStringin[i - 2] == 'Z' && gpsStringin[i - 5] == '$')
248  {
249  I_ZDA = i - 2;
250  }
251  }
252  // GGA
253  else if (gpsStringin[i - 1] == 'G')
254  {
255  if (gpsStringin[i - 2] == 'G' && gpsStringin[i - 5] == '$')
256  {
257  I_GGA = i - 2;
258  }
259  }
260  }
261  else if(gpsStringin[i]=='S')
262  {
263  // GNS
264  if (gpsStringin[i - 1] == 'N')
265  {
266  if (gpsStringin[i - 2] == 'G' && gpsStringin[i - 5] == '$')
267  {
268  I_GNS = i - 2;
269  }
270  }
271  }
272 
273  // count all commas
274  if (gpsStringin[i] == ',')
275  CommaCount++;
276 
277  // find star
278  if (gpsStringin[i] == '*')
279  {
280  // try parse GGA string
281  if (I_GGA > 0)
282  {
283  if(tryParseGGAString(gpsStringin, gpsDataPtr, I_GGA, CommaCount)==ui8TRUE)
284  retVal |= ui8TRUE ;
285  I_GGA = 0;
286  }
287  // try parse ZDA string
288  else if (I_ZDA > 0)
289  {
290  if(tryParseZDAString(gpsStringin, gpsDataPtr, I_ZDA, CommaCount)==ui8TRUE)
291  retVal |= ui8TRUE;
292  I_ZDA = 0;
293 
294  }
295  // try parse GNS
296  else if (I_GNS > 0)
297  {
298  if(tryParseGGAString(gpsStringin, gpsDataPtr, I_GNS, CommaCount)==ui8TRUE)
299  retVal |= ui8TRUE;
300  I_GNS = 0;
301  }
302  CommaCount = 0;
303 
304  }
305  }
306 
307 
308 // }
309  return retVal;
310 }
tryParseGGAString
UI_8 tryParseGGAString(char *gpsStringin, struct gpsData *gpsDataPtr, int iGGA, int commaCount)
Definition: NEO_LEA_M8T.c:95
tryParseZDAString
UI_8 tryParseZDAString(char *gpsStringin, struct gpsData *gpsDataPtr, int iZDA, int commaCount)
Definition: NEO_LEA_M8T.c:43
ui8FALSE
#define ui8FALSE
Definition: version_config.h:190
gpsData::altitude
float altitude
Definition: NEO_LEA_M8T.h:35
ui8TRUE
#define ui8TRUE
Definition: version_config.h:191
charBuffMax
#define charBuffMax
Definition: version_config.h:78
gpsData
Definition: NEO_LEA_M8T.h:34