2020-06-12 14:34:23 +00:00
|
|
|
#ifndef APRSMSG_H
|
|
|
|
#define APRSMSG_H
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
|
|
|
namespace AX25 {
|
|
|
|
|
|
|
|
class Payload
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Payload(byte *rxPayload, int payloadLength);
|
2020-06-13 22:15:05 +00:00
|
|
|
Payload(String inputText);
|
|
|
|
|
|
|
|
inline bool IsValid() const { return isValid_; }
|
|
|
|
|
|
|
|
String ToText(String customComment);
|
|
|
|
int ToBinary(byte *txPayload, int bufferLength);
|
|
|
|
|
|
|
|
void Dump();
|
|
|
|
|
2020-06-12 14:34:23 +00:00
|
|
|
private:
|
2020-06-13 22:15:05 +00:00
|
|
|
String decodeCall(const byte *rxPtr);
|
|
|
|
bool encodeCall(String callsign, byte *txPtr, int bufferLength);
|
|
|
|
|
|
|
|
bool parseString(String inputText);
|
|
|
|
bool parsePayload(const byte *rxPayload, int payloadLength);
|
2020-06-12 14:34:23 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
enum AX25Ctrl {
|
|
|
|
UI = 0x03
|
|
|
|
};
|
|
|
|
|
|
|
|
enum AX25Pid {
|
|
|
|
NoLayer3 = 0xf0
|
|
|
|
};
|
|
|
|
|
|
|
|
const int CallsignSize = 7;
|
2020-06-12 15:52:04 +00:00
|
|
|
const int RptMaxCount = 7;
|
2020-06-12 14:34:23 +00:00
|
|
|
|
|
|
|
private:
|
2020-06-13 22:15:05 +00:00
|
|
|
bool isValid_;
|
2020-06-12 14:34:23 +00:00
|
|
|
String srcCall_, dstCall_;
|
2020-06-12 15:52:04 +00:00
|
|
|
String rptCalls_[7];
|
|
|
|
int rptCallsCount_;
|
2020-06-12 15:55:55 +00:00
|
|
|
String info_;
|
2020-06-12 14:34:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // AX25
|
|
|
|
|
|
|
|
#endif // APRSMSG_H
|