-
Notifications
You must be signed in to change notification settings - Fork 26
/
hyteraDecode.c
62 lines (45 loc) · 2.39 KB
/
hyteraDecode.c
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
/*
* Linux DMR Master server
Copyright (C) 2014 Wim Hofman
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "master_server.h"
void sendAprs();
int checkCoordinates();
void decodeHyteraGpsTriggered(int radioId,struct repeater repeater, unsigned char data[300]){
struct gpsCoordinates gpsData = {0};
memcpy(gpsData.latitude,data+33,3);
memcpy(gpsData.latitude+3,data+38,4);
memcpy(gpsData.latitude+7,data+32,1);
memcpy(gpsData.longitude,data+45,8);
memcpy(gpsData.longitude+8,data+44,1);
memcpy(gpsData.speed,data+57,3);
memcpy(gpsData.heading,data+60,3);
syslog(LOG_NOTICE,"[%s]Decoded GPS data triggered(Hytera): LAT(%s) LONG(%s) SPEED(%s) HEADING(%s)",repeater.callsign,gpsData.latitude,gpsData.longitude,gpsData.speed,gpsData.heading);
if (checkCoordinates(gpsData,repeater) == 1) sendAprs(gpsData,radioId,repeater);
}
void decodeHyteraGpsButton(int radioId,struct repeater repeater, unsigned char data[300]){
struct gpsCoordinates gpsData = {0};
memcpy(gpsData.latitude,data+33,3);
memcpy(gpsData.latitude+3,data+38,4);
memcpy(gpsData.latitude+7,data+32,1);
memcpy(gpsData.longitude,data+45,8);
memcpy(gpsData.longitude+8,data+44,1);
memcpy(gpsData.speed,data+57,3);
memcpy(gpsData.heading,data+60,3);
syslog(LOG_NOTICE,"[%s]Decoded GPS data button(Hytera): LAT(%s) LONG(%s) SPEED(%s) HEADING(%s)",repeater.callsign,gpsData.latitude,gpsData.longitude,gpsData.speed,gpsData.heading);
if (checkCoordinates(gpsData,repeater) == 1) sendAprs(gpsData,radioId,repeater);
}
void decodeHyteraGpsCompressed(int radioId,struct repeater repeater, unsigned char data[300]){
syslog(LOG_NOTICE,"[%s]Compressed GPS data(Hytera) not decoding",repeater.callsign);
}