-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateTeseoGNSS.cpp
713 lines (606 loc) · 20.9 KB
/
createTeseoGNSS.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
/**
******************************************************************************
* @file createTeseoGNSS.cpp
* @author AST/CL
* @version V1.1.0
* @date May, 2017
* @brief .
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
#include "mbed.h"
#include "Teseo.h"
#include "GPSProviderImplBase.h"
#include "TeseoConfig.h"
static void _AppOutputCallback(uint32_t msgId, uint32_t msgType, tTeseoData *pData);
static void _AppEventCallback(eTeseoLocEventType event, uint32_t data);
static char msg[256];
static char *geofenceCirclePosition[] = {
"Unknown",
"Outside",
"Boundary",
"Inside"
};
extern Serial serialDebug;
#define TESEO_APP_LOG_INFO(...) serialDebug.printf(__VA_ARGS__)
GPSProviderImplBase *
createGPSProviderInstance(void)
{
static Teseo gnss(TESEO_PIN_RESET,
TESEO_PIN_WAKEUP,
TESEO_PIN_PPS,
TESEO_PIN_TX,
TESEO_PIN_RX,
&serialDebug);
/* Register output callback and event callback functions */
gnss.TeseoLocRegOutput(_AppOutputCallback, _AppEventCallback);
return &gnss;
}
/**
* @brief This function prints on the console the info about Fix data for single or combined satellite navigation system
* @param pData
* @retval None
*/
static void
GetGNSMsgInfos(tTeseoData *pData)
{
// char msg[256];
TESEO_APP_LOG_INFO("\r\n");
sprintf(msg, "Constellation:\t\t[ %s ]\t",
pData->gns_data.constellation);
TESEO_APP_LOG_INFO(msg);
if (strcmp(pData->gns_data.constellation, "$GPGSV") == 0) {
TESEO_APP_LOG_INFO("-- only GPS constellation is enabled\n\r");
}
else if (strcmp(pData->gns_data.constellation, "$GLGSV") == 0) {
TESEO_APP_LOG_INFO("-- only GLONASS constellation is enabled\n\r");
}
else if (strcmp(pData->gns_data.constellation, "$GAGSV") == 0) {
TESEO_APP_LOG_INFO("-- only GALILEO constellation is enabled\n\r");
}
else if (strcmp(pData->gns_data.constellation, "$BDGSV") == 0) {
TESEO_APP_LOG_INFO("-- only BEIDOU constellation is enabled\n\r");
}
else if (strcmp(pData->gns_data.constellation, "$QZGSV") == 0) {
TESEO_APP_LOG_INFO("-- only QZSS constellation is enabled\n\r");
}
else if (strcmp(pData->gns_data.constellation, "$GNGSV") == 0) {
TESEO_APP_LOG_INFO("-- message to report all satellites for all enabled constellations\n\r");
}
sprintf(msg, "UTC:\t\t\t[ %02d:%02d:%02d ]\n\r",
pData->gns_data.utc.hh,
pData->gns_data.utc.mm,
pData->gns_data.utc.ss);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Latitude:\t\t[ %.0f' %d'' %c ]\n\r",
(pData->gns_data.xyz.lat - ((int)pData->gns_data.xyz.lat % 100)) / 100,
((int)pData->gns_data.xyz.lat % 100),
pData->gns_data.xyz.ns);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Longitude:\t\t[ %.0f' %d'' %c ]\n\r",
(pData->gns_data.xyz.lon - ((int)pData->gns_data.xyz.lon % 100)) / 100,
((int)pData->gns_data.xyz.lon % 100),
pData->gns_data.xyz.ew);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Satellites locked:\t[ %d ]\n\r",
pData->gns_data.sats);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"HDOP:\t\t\t[ %.01f ]\n\r",
pData->gns_data.hdop);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Altitude:\t\t[ %.01f ]\n\r",
pData->gns_data.xyz.alt);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Geoid infos:\t\t[ %.01f ]\n\r",
pData->gns_data.geo_sep);
TESEO_APP_LOG_INFO(msg);
// sprintf(msg,"ID - Checksum:\t\t[ *%x ]\n\r",
// (pData->gns_data.checksum);
// TESEO_APP_LOG_INFO(msg);
TESEO_APP_LOG_INFO("\n\n\r");
return;
}
/**
* @brief This function prints on the console the info about GPS Pseudorange Noise Statistics
* @param pData
* @retval None
*/
static void
GetGPGSTInfos(tTeseoData *pData)
{
// char msg[256];
TESEO_APP_LOG_INFO("\r\n");
sprintf(msg, "UTC:\t\t\t[ %02d:%02d:%02d ]\n\r",
pData->gpgst_data.utc.hh,
pData->gpgst_data.utc.mm,
pData->gpgst_data.utc.ss);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"EHPE:\t\t[ %.01f ]\n\r",
pData->gpgst_data.EHPE);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Semi-major Dev:\t\t[ %.01f ]\n\r",
pData->gpgst_data.semi_major_dev);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Semi-minor Dev:\t\t[ %.01f ]\n\r",
pData->gpgst_data.semi_minor_dev);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Semi-maior Angle:\t\t[ %.01f ]\n\r",
pData->gpgst_data.semi_major_angle);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Lat Err Dev:\t\t[ %.01f ]\n\r",
pData->gpgst_data.lat_err_dev);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Lon Err Dev:\t\t[ %.01f ]\n\r",
pData->gpgst_data.lon_err_dev);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Alt Err Dev:\t\t[ %.01f ]\n\r",
pData->gpgst_data.alt_err_dev);
TESEO_APP_LOG_INFO(msg);
// sprintf(msg,"ID - Checksum:\t\t[ *%x ]\n\r",
// pData->gpgst_data.checksum);
// TESEO_APP_LOG_INFO(msg);
TESEO_APP_LOG_INFO("\n\n\r");
return;
}
/**
* @brief This function prints on the console the info about Recommended Minimum Specific GPS/Transit data got by the most recent reception process
* @param pData
* @retval None
*/
static void
GetGPRMCInfos(tTeseoData *pData)
{
// char msg[256];
TESEO_APP_LOG_INFO("\r\n");
sprintf(msg, "UTC:\t\t\t\t[ %02d:%02d:%02d ]\n\r",
pData->gprmc_data.utc.hh,
pData->gprmc_data.utc.mm,
pData->gprmc_data.utc.ss);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Status:\t\t\t\t[ %c ]\t\t",
pData->gprmc_data.status);
TESEO_APP_LOG_INFO(msg);
if (pData->gprmc_data.status == 'A') {
TESEO_APP_LOG_INFO("-- Valid (reported in 2D and 3D fix conditions)\n\r");
}
else if (pData->gprmc_data.status == 'V') {
TESEO_APP_LOG_INFO("-- Warning (reported in NO FIX conditions)\n\r");
}
else {
TESEO_APP_LOG_INFO("-- Unknown status\n\r");
}
sprintf(msg,"Latitude:\t\t\t[ %.0f' %02d'' %c ]\n\r",
((pData->gprmc_data.xyz.lat - ((int)pData->gprmc_data.xyz.lat % 100))) / 100,
((int)pData->gprmc_data.xyz.lat % 100),
pData->gprmc_data.xyz.ns);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Longitude:\t\t\t[ %.0f' %02d'' %c ]\n\r",
((pData->gprmc_data.xyz.lon - ((int)pData->gprmc_data.xyz.lon % 100))) / 100,
((int)pData->gprmc_data.xyz.lon % 100),
pData->gprmc_data.xyz.ew);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Speed over ground (knots):\t[ %.01f ]\n\r",
pData->gprmc_data.speed);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Trackgood:\t\t\t[ %.01f ]\n\r",
pData->gprmc_data.trackgood);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Date (ddmmyy):\t\t\t[ %d ]\n\r",
pData->gprmc_data.date);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Magnetic Variation:\t\t[ %.01f ]\n\r",
pData->gprmc_data.mag_var);
TESEO_APP_LOG_INFO(msg);
if (pData->gprmc_data.mag_var_dir != 'E' &&
pData->gprmc_data.mag_var_dir != 'W') {
sprintf(msg,"Magnetic Var. Direction:\t[ - ]\n\r");
}
else {
sprintf(msg,"Magnetic Var. Direction:\t[ %c ]\n\r",
pData->gprmc_data.mag_var_dir);
}
TESEO_APP_LOG_INFO(msg);
// sprintf(msg,"Checksum:\t\t[ *%x ]\n\r",
// pData->gprmc_data.checksum);
// TESEO_APP_LOG_INFO(msg);
TESEO_APP_LOG_INFO("\n\n\r");
return;
}
/**
* @brief This function prints on the console the info about GNSS satellites got by the most recent reception process
* @param pData
* @retval None
*/
static void
GetGSAMsgInfos(tTeseoData *pData)
{
// char msg[256];
TESEO_APP_LOG_INFO("\r\n");
sprintf(msg, "Constellation:\t\t[ %s ]\t",
pData->gsa_data.constellation);
TESEO_APP_LOG_INFO(msg);
if (strcmp(pData->gsa_data.constellation, "$GPGSA") == 0) {
TESEO_APP_LOG_INFO("-- only GPS constellation is enabled\n\r");
}
else if (strcmp(pData->gsa_data.constellation, "$GLGSA") == 0) {
TESEO_APP_LOG_INFO("-- only GLONASS constellation is enabled\n\r");
}
else if (strcmp(pData->gsa_data.constellation, "$GAGSA") == 0) {
TESEO_APP_LOG_INFO("-- only GALILEO constellation is enabled\n\r");
}
else if (strcmp(pData->gsa_data.constellation, "$BDGSA") == 0) {
TESEO_APP_LOG_INFO("-- only BEIDOU constellation is enabled\n\r");
}
else if (strcmp(pData->gsa_data.constellation, "$GNGSA") == 0) {
TESEO_APP_LOG_INFO("-- more than one constellation is enabled\n\r");
}
sprintf(msg, "Operating Mode:\t\t[ %c ]\t\t",
pData->gsa_data.operating_mode);
TESEO_APP_LOG_INFO(msg);
if (pData->gsa_data.operating_mode == 'A') {
TESEO_APP_LOG_INFO("-- Auto (2D/3D)\n\r");
}
else if (pData->gsa_data.operating_mode == 'M') {
TESEO_APP_LOG_INFO("-- Manual\n\r");
}
sprintf(msg,"Current Mode:\t\t[ %d ]\t\t",
pData->gsa_data.current_mode);
TESEO_APP_LOG_INFO(msg);
if (pData->gsa_data.current_mode == 1) {
TESEO_APP_LOG_INFO("-- no fix available\n\r");
}
else if (pData->gsa_data.current_mode == 2) {
TESEO_APP_LOG_INFO("-- 2D\n\r");
}
else if (pData->gsa_data.current_mode == 3) {
TESEO_APP_LOG_INFO("-- 3D\n\r");
}
for (uint8_t i=0; i<12; i++) {
sprintf(msg,"SatPRN%02d:\t\t[ %d ]\n\r", i+1,
pData->gsa_data.sat_prn[i]);
TESEO_APP_LOG_INFO(msg);
}
sprintf(msg,"PDOP:\t\t\t[ %.01f ]\n\r",
pData->gsa_data.pdop);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"HDOP:\t\t\t[ %.01f ]\n\r",
pData->gsa_data.hdop);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"VDOP:\t\t\t[ %.01f ]\n\r",
pData->gsa_data.vdop);
TESEO_APP_LOG_INFO(msg);
// sprintf(msg,"ID - Checksum:\t\t[ *%x ]\n\r",
// pData->gsa_data.checksum);
// TESEO_APP_LOG_INFO(msg);
TESEO_APP_LOG_INFO("\n\n\r");
}
/**
* @brief This function prints on the console the info about GNSS satellites got by the most recent reception process
* @param pData
* @retval None
*/
static void
GetGSVMsgInfos(tTeseoData *pData)
{
uint8_t i;
uint8_t tot_sats = pData->gsv_data.tot_sats;
// char msg[256];
char degree_sym = 248;
TESEO_APP_LOG_INFO("\r\n");
sprintf(msg, "Constellation:\t\t[ %s ]\t",
pData->gsv_data.constellation);
TESEO_APP_LOG_INFO(msg);
if (strcmp(pData->gsv_data.constellation, "$GPGSV") == 0) {
TESEO_APP_LOG_INFO("-- message to report all GPS satellites\n\r");
}
else if (strcmp(pData->gsv_data.constellation, "$GLGSV") == 0) {
TESEO_APP_LOG_INFO("-- message to report all GLONASS satellites\n\r");
}
else if (strcmp(pData->gsv_data.constellation, "$GAGSV") == 0) {
TESEO_APP_LOG_INFO("-- message to report all GALILEO satellites\n\r");
}
else if (strcmp(pData->gsv_data.constellation, "$BDGSV") == 0) {
TESEO_APP_LOG_INFO("-- message to report all BEIDOU satellites\n\r");
}
else if (strcmp(pData->gsv_data.constellation, "$QZGSV") == 0) {
TESEO_APP_LOG_INFO("-- message to report all QZSS satellites\n\r");
}
else if (strcmp(pData->gsv_data.constellation, "$GNGSV") == 0) {
TESEO_APP_LOG_INFO("-- message to report all satellites for all enabled constellations\n\r");
}
/* debug */
// sprintf(msg,"Tot Messages:\t\t[ %d ]\n\r",
// ((tTeseoData *)(handle->pData))->gsv_data.amount);
// TESEO_APP_LOG_INFO(msg);
//
// sprintf(msg,"Message Num:\t\t[ %d ]\n\r",
// ((tTeseoData *)(handle->pData))->gsv_data.number);
// TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Num of Satellites:\t[ %d ]\n\r", tot_sats);
TESEO_APP_LOG_INFO(msg);
TESEO_APP_LOG_INFO("\n\r");
for (i=0; i<tot_sats; i++) {
sprintf(msg,"Sat%02dPRN:\t\t[ %03d ]\n\r", i+1,
pData->gsv_data.gsv_sat_i[i].prn);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Sat%02dElev (%c):\t\t[ %03d ]\n\r", i+1, degree_sym,
pData->gsv_data.gsv_sat_i[i].elev);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Sat%02dAzim (%c):\t\t[ %03d ]\n\r", i+1, degree_sym,
pData->gsv_data.gsv_sat_i[i].azim);
TESEO_APP_LOG_INFO(msg);
sprintf(msg,"Sat%02dCN0 (dB):\t\t[ %03d ]\n\r", i+1,
pData->gsv_data.gsv_sat_i[i].cn0);
TESEO_APP_LOG_INFO(msg);
TESEO_APP_LOG_INFO("\n\r");
}
TESEO_APP_LOG_INFO("\r\n");
}
/**
* @brief This function prints on the console the info Geofence
* @param pData
* @retval None
*/
static void
GetGeofenceInfos(tTeseoData *pData)
{
// char msg[256];
TESEO_APP_LOG_INFO("\r\n");
if(pData->geofence_data.op == GNSS_FEATURE_EN_MSG) {
sprintf(msg, "Geofence Enabling:\t\t[ %s ]\t",
pData->geofence_data.result ? "ERROR" : "OK");
TESEO_APP_LOG_INFO(msg);
}
if(pData->geofence_data.op == GNSS_GEOFENCE_CFG_MSG) {
sprintf(msg, "Geofence Configuration:\t\t[ %s ]\t",
pData->geofence_data.result ? "ERROR" : "OK");
TESEO_APP_LOG_INFO(msg);
}
if(pData->geofence_data.op == GNSS_GEOFENCE_STATUS_MSG) {
sprintf(msg, "Geofence Status:\t\t[ %s ]\t",
pData->geofence_data.result ? "ERROR" : "OK");
TESEO_APP_LOG_INFO(msg);
if(pData->geofence_data.result == 0) {
TESEO_APP_LOG_INFO("\r\n");
sprintf(msg, "Time/Date:\t\t%02d:%02d:%02d %02d/%02d/%04d\n",
pData->geofence_data.timestamp.hh,
pData->geofence_data.timestamp.mm,
pData->geofence_data.timestamp.ss,
pData->geofence_data.timestamp.day,
pData->geofence_data.timestamp.month,
pData->geofence_data.timestamp.year);
TESEO_APP_LOG_INFO(msg);
for(uint8_t i = 0; i<MAX_GEOFENCES_NUM; i++) {
sprintf(msg, "Position circle[%d]:\t%s\n",
i, geofenceCirclePosition[pData->geofence_data.status[i]]);
TESEO_APP_LOG_INFO(msg);
}
}
}
if(pData->geofence_data.op == GNSS_GEOFENCE_ALARM_MSG) {
sprintf(msg, "Geofence Alarm:\t\t[ %s ]\t",
pData->geofence_data.result ? "ERROR" : "OK");
TESEO_APP_LOG_INFO(msg);
if(pData->geofence_data.result == 0) {
TESEO_APP_LOG_INFO("\r\n");
sprintf(msg, "Time:\t\t%02d:%02d:%02d\n",
pData->geofence_data.timestamp.hh,
pData->geofence_data.timestamp.mm,
pData->geofence_data.timestamp.ss);
TESEO_APP_LOG_INFO(msg);
int i = pData->geofence_data.idAlarm;
sprintf(msg, "Position circle[%d]:\t%s\n",
i, geofenceCirclePosition[pData->geofence_data.status[i]]);
TESEO_APP_LOG_INFO(msg);
}
}
TESEO_APP_LOG_INFO("\r\n");
}
/**
* @brief This function prints on the console the info about Odometer
* @param pData
* @retval None
*/
static void
GetOdometerInfos(tTeseoData *pData)
{
// char msg[256];
TESEO_APP_LOG_INFO("\r\n");
if(pData->odo_data.op == GNSS_FEATURE_EN_MSG) {
sprintf(msg, "Odometer Enabling:\t\t[ %s ]\t",
pData->odo_data.result ? "ERROR" : "OK");
TESEO_APP_LOG_INFO(msg);
}
if((pData->odo_data.op == GNSS_ODO_START_MSG) ||
(pData->odo_data.op == GNSS_ODO_STOP_MSG)) {
sprintf(msg, "Odometer Operation:\t\t[ %s ]\t",
pData->odo_data.result ? "ERROR" : "OK");
TESEO_APP_LOG_INFO(msg);
}
TESEO_APP_LOG_INFO("\r\n");
}
/**
* @brief This function prints on the console the info about Datalog
* @param pData
* @retval None
*/
static void
GetDatalogInfos(tTeseoData *pData)
{
// char msg[256];
TESEO_APP_LOG_INFO("\r\n");
if(pData->datalog_data.op == GNSS_FEATURE_EN_MSG) {
sprintf(msg, "Datalog Enabling:\t\t[ %s ]\t",
pData->datalog_data.result ? "ERROR" : "OK");
TESEO_APP_LOG_INFO(msg);
}
if(pData->datalog_data.op == GNSS_DATALOG_CFG_MSG) {
sprintf(msg, "Datalog Configuring:\t\t[ %s ]\t",
pData->datalog_data.result ? "ERROR" : "OK");
TESEO_APP_LOG_INFO(msg);
}
if(pData->datalog_data.op == GNSS_DATALOG_START_MSG) {
sprintf(msg, "Datalog Start:\t\t[ %s ]\t",
pData->datalog_data.result ? "ERROR" : "OK");
TESEO_APP_LOG_INFO(msg);
}
if(pData->datalog_data.op == GNSS_DATALOG_STOP_MSG) {
sprintf(msg, "Datalog Stop:\t\t[ %s ]\t",
pData->datalog_data.result ? "ERROR" : "OK");
TESEO_APP_LOG_INFO(msg);
}
if(pData->datalog_data.op == GNSS_DATALOG_ERASE_MSG) {
sprintf(msg, "Datalog Erase:\t\t[ %s ]\t",
pData->datalog_data.result ? "ERROR" : "OK");
TESEO_APP_LOG_INFO(msg);
}
TESEO_APP_LOG_INFO("\r\n");
}
/**
* @brief This function prints on the console the ack about Message List cfg
* @param pData
* @retval None
*/
static void
GetMsgListAck(tTeseoData *pData)
{
// char msg[256];
TESEO_APP_LOG_INFO("\r\n");
sprintf(msg, "Msg List config:\t\t[ %s ]\t",
pData->ack ? "ERROR" : "OK");
TESEO_APP_LOG_INFO(msg);
TESEO_APP_LOG_INFO("\r\n");
}
/**
* @brief This function prints on the console the ack about Message List cfg
* @param pData
* @retval None
*/
static void
GetAck(tTeseoData *pData)
{
// char msg[256];
TESEO_APP_LOG_INFO("\r\n");
sprintf(msg, "Params configuration:\t\t[ %s ]\t",
pData->ack ? "ERROR" : "OK");
TESEO_APP_LOG_INFO(msg);
TESEO_APP_LOG_INFO("\r\n");
}
void
_AppOutputCallback(uint32_t msgId, uint32_t msgType, tTeseoData *pData)
{
switch (msgId) {
case LOC_OUTPUT_LOCATION: {
// Output last location
TESEO_APP_LOG_INFO("Loc: lat=%lf, lon=%lf, alt=%f\r\n", pData->gpgga_data.xyz.lat, pData->gpgga_data.xyz.lon, pData->gpgga_data.xyz.alt);
break;
}
case LOC_OUTPUT_NMEA: {
//return;
Teseo::eMsg msg = (Teseo::eMsg)msgType;
switch(msg) {
case Teseo::GNS:
// GET Fix data for single or combined Satellite navigation system
GetGNSMsgInfos(pData);
break;
case Teseo::GPGST:
// GET GPS Pseudorange Noise Statistics
GetGPGSTInfos(pData);
break;
case Teseo::GPRMC:
// GET Recommended Minimum Specific GPS/Transit data
GetGPRMCInfos(pData);
break;
case Teseo::GSA:
// GET GPS DOP and Active Satellites
GetGSAMsgInfos(pData);
break;
case Teseo::GSV:
// GET GPS Satellites in View
GetGSVMsgInfos(pData);
break;
default:
break;
}
break;
}
case LOC_OUTPUT_PSTM: {
Teseo::ePSTMsg msg = (Teseo::ePSTMsg)msgType;
switch(msg) {
case Teseo::PSTMGEOFENCE:
// GET Geofence info
GetGeofenceInfos(pData);
break;
case Teseo::PSTMODO:
// GET Geofence info
GetOdometerInfos(pData);
break;
case Teseo::PSTMDATALOG:
// GET Datalog info
GetDatalogInfos(pData);
break;
case Teseo::PSTMSGL:
// GET Message List ack
GetMsgListAck(pData);
break;
case Teseo::PSTMSAVEPAR:
// GET SAVE PAR ack
GetAck(pData);
break;
default:
break;
}
break;
}
default:
break;
}
}
void
_AppEventCallback(eTeseoLocEventType event, uint32_t data)
{
switch (event) {
case TESEO_LOC_EVENT_START_RESULT:
if (data != 0) {
TESEO_APP_LOG_INFO("start failed.\r\n");
} else {
TESEO_APP_LOG_INFO("start OK.\r\n");
}
break;
case TESEO_LOC_EVENT_STOP_RESULT:
if (data != 0) {
TESEO_APP_LOG_INFO("stop failed.\r\n");
} else {
TESEO_APP_LOG_INFO("stop OK.\r\n");
}
break;
default:
break;
}
}