diff --git a/main/ogn1.h b/main/ogn1.h index 73db93e..487aced 100644 --- a/main/ogn1.h +++ b/main/ogn1.h @@ -199,6 +199,25 @@ class OGN1_Packet // Packet structure for the OGN tracker (1.0/64)*DecodeVoltage(), Status.TxPower+4, -0.5*Status.RadioNoise, (1<1) { Msg[Len]=0; return 0; } // give up if neither position nor status nor info if(Position.Time<60) { uint32_t DayTime=Time%86400; int Sec=DayTime%60; // second of the time the packet was recevied int DiffSec=Position.Time-Sec; if(DiffSec>4) DiffSec-=60; // difference should always be zero or negative, but can be small positive for predicted positions Time+=DiffSec; } // get out the correct position time - Msg[Len++] = Header.NonPos?'>':'/'; + Msg[Len++] = Header.NonPos || Header.Encrypted?'>':'/'; Len+=Format_HHMMSS(Msg+Len, Time); Msg[Len++] = 'h'; - if(Header.NonPos) { Len+=WriteStatus(Msg+Len); Msg[Len++]='\n'; Msg[Len]=0; return Len; } + if(Header.NonPos) // status and info packets + { if(Status.ReportType==0) Len+=WriteStatus(Msg+Len); + else Len+=WriteDeviceInfo(Msg+Len); + Msg[Len++]='\n'; Msg[Len]=0; return Len; } + + if(Header.Encrypted) // encrypted packets + { Msg[Len++]=' '; + for(int Idx=0; Idx<4; Idx++) + { Len+=EncodeAscii85(Msg+Len, Data[Idx]); } + Msg[Len++]='\n'; Msg[Len]=0; return Len; } const char *Icon = getAprsIcon(Position.AcftType); diff --git a/main/rf.cpp b/main/rf.cpp index 4a5daaa..66d7297 100644 --- a/main/rf.cpp +++ b/main/rf.cpp @@ -506,9 +506,10 @@ extern "C" { const uint8_t *PktData=TxPktData0; if(PktData==0) PktData=TxPktData1; if(PktData) // if there is a packet to transmit - { OGN1_Packet *OGN = (OGN1_Packet *)PktData; OGN->Dewhiten(); + { OGN1_Packet *OGN = (OGN1_Packet *)PktData; if(!OGN->Header.Encrypted) OGN->Dewhiten(); uint8_t *TxPacket; - bool Short = !OGN->Header.NonPos && OGN->Header.AddrType==3 && OGN->Header.Address==(uint32_t)(getUniqueAddress()&0x00FFFFFF); + bool Short = !OGN->Header.NonPos && !OGN->Header.Encrypted + && OGN->Header.AddrType==3 && OGN->Header.Address==(uint32_t)(getUniqueAddress()&0x00FFFFFF); if(Short) { TxPktLen=WANdev.getDataPacket(&TxPacket, PktData+4, 16, 1, ((RX_Random>>16)&0xF)==0x8 ); } else