kopia lustrzana https://github.com/pjalocha/esp32-ogn-tracker
Read and convert .TLG files to APRS
rodzic
4a59b29ed0
commit
f24d63a70d
|
@ -1,6 +1,9 @@
|
|||
read_log: read_log.cc
|
||||
g++ -Wall -Wno-misleading-indentation -O2 -o read_log read_log.cc format.cpp
|
||||
|
||||
tlg2aprs: tlg2aprs.cc
|
||||
g++ -Wall -Wno-misleading-indentation -O2 -o tlg2aprs tlg2aprs.cc format.cpp ognconv.cpp
|
||||
|
||||
aprs2igc: aprs2igc.cc
|
||||
g++ -Wall -Wno-misleading-indentation -O2 -o aprs2igc aprs2igc.cc format.cpp ognconv.cpp
|
||||
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "ogn1.h"
|
||||
#include "ogn.h"
|
||||
|
||||
static char Line[160];
|
||||
|
||||
static int ProcessFile(const char *FileName)
|
||||
{ uint32_t FileTime=0;
|
||||
const char *ShortName=FileName;
|
||||
for( ; ; )
|
||||
{ const char *Slash=strchr(ShortName, '/'); if(Slash==0) break;
|
||||
ShortName=Slash+1; }
|
||||
if(Read_Hex(FileTime, ShortName)!=8) printf("Not a TLG file: %s\n", ShortName);
|
||||
FILE *File = fopen(FileName, "rb"); if(File==0) { printf("Cannot open %s for read\n", FileName); return 0; }
|
||||
OGN_LogPacket<OGN1_Packet> Packet;
|
||||
int Packets=0;
|
||||
for( ; ; )
|
||||
{ if(fread(&Packet, Packet.Bytes, 1, File)!=1) break; // read the next packet from the file
|
||||
if(!Packet.isCorrect()) continue; //
|
||||
uint32_t Time=Packet.getTime(FileTime); // [sec] get exact time from short time in the packet and the file start time
|
||||
int Len=Packet.Packet.WriteAPRS(Line, Time);
|
||||
if(Len==0) continue;
|
||||
printf("%s\n", Line); }
|
||||
fclose(File); return Packets; }
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
for(int arg=1; arg<argc; arg++)
|
||||
{ ProcessFile(argv[arg]); }
|
||||
|
||||
return 0; }
|
||||
|
Ładowanie…
Reference in New Issue