2020-06-14 11:52:22 +00:00
|
|
|
#ifndef AX25_PAYLOAD_H
|
|
|
|
#define AX25_PAYLOAD_H
|
2020-06-12 14:34:23 +00:00
|
|
|
|
|
|
|
#include <Arduino.h>
|
2021-10-22 19:09:17 +00:00
|
|
|
#include <DebugLog.h>
|
2020-06-12 14:34:23 +00:00
|
|
|
|
2020-06-14 11:52:22 +00:00
|
|
|
#include "ax25_callsign.h"
|
|
|
|
|
2020-06-12 14:34:23 +00:00
|
|
|
namespace AX25 {
|
|
|
|
|
|
|
|
class Payload
|
|
|
|
{
|
|
|
|
public:
|
2020-06-19 07:39:49 +00:00
|
|
|
Payload(const String &textPayload);
|
2021-02-02 09:18:46 +00:00
|
|
|
Payload(const byte *rxPayload, int payloadLength);
|
2021-10-26 09:01:14 +00:00
|
|
|
Payload(const Payload &payload);
|
|
|
|
Payload& operator=(const Payload &payload);
|
2020-06-13 22:15:05 +00:00
|
|
|
|
|
|
|
inline bool IsValid() const { return isValid_; }
|
|
|
|
|
2021-10-26 09:01:14 +00:00
|
|
|
String ToString(const String &customComment=String()) const;
|
2020-06-14 11:52:22 +00:00
|
|
|
int ToBinary(byte *txPayload, int bufferLength) const;
|
2020-06-13 22:15:05 +00:00
|
|
|
|
2020-06-17 07:42:17 +00:00
|
|
|
bool Digirepeat(const Callsign &ownCallsign);
|
2020-06-13 22:15:05 +00:00
|
|
|
void Dump();
|
|
|
|
|
2020-06-12 14:34:23 +00:00
|
|
|
private:
|
2020-06-19 07:39:49 +00:00
|
|
|
bool fromString(const String &textPayload);
|
2020-06-14 11:52:22 +00:00
|
|
|
bool fromBinary(const byte *rxPayload, int payloadLength);
|
2020-06-12 14:34:23 +00:00
|
|
|
|
2020-06-17 07:42:17 +00:00
|
|
|
bool InsertRptCallsign(const Callsign &rptCallsign, int index);
|
|
|
|
|
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-14 11:52:22 +00:00
|
|
|
Callsign srcCall_, dstCall_;
|
|
|
|
Callsign rptCalls_[7];
|
2020-06-12 15:52:04 +00:00
|
|
|
int rptCallsCount_;
|
2020-06-12 15:55:55 +00:00
|
|
|
String info_;
|
2020-06-12 14:34:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // AX25
|
|
|
|
|
2021-02-02 09:22:38 +00:00
|
|
|
#endif // AX25_PAYLOAD_H
|