kopia lustrzana https://github.com/OpenRTX/OpenRTX
M17: add data structures for GNSS and extended callsign metadata.
rodzic
ec57e74bc6
commit
278d7850c7
|
@ -32,12 +32,91 @@ namespace M17
|
||||||
{
|
{
|
||||||
|
|
||||||
using call_t = std::array< uint8_t, 6 >; // Data type for encoded callsign
|
using call_t = std::array< uint8_t, 6 >; // Data type for encoded callsign
|
||||||
using meta_t = std::array< uint8_t, 14 >; // Data type for LSF metadata field
|
|
||||||
using payload_t = std::array< uint8_t, 16 >; // Data type for frame payload field
|
using payload_t = std::array< uint8_t, 16 >; // Data type for frame payload field
|
||||||
using lich_t = std::array< uint8_t, 12 >; // Data type for Golay(24,12) encoded LICH data
|
using lich_t = std::array< uint8_t, 12 >; // Data type for Golay(24,12) encoded LICH data
|
||||||
using frame_t = std::array< uint8_t, 48 >; // Data type for a full M17 data frame, including sync word
|
using frame_t = std::array< uint8_t, 48 >; // Data type for a full M17 data frame, including sync word
|
||||||
using syncw_t = std::array< uint8_t, 2 >; // Data type for a sync word
|
using syncw_t = std::array< uint8_t, 2 >; // Data type for a sync word
|
||||||
|
|
||||||
|
enum M17DataMode
|
||||||
|
{
|
||||||
|
M17_DATAMODE_PACKET = 0,
|
||||||
|
M17_DATAMODE_STREAM = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
enum M17DataType
|
||||||
|
{
|
||||||
|
M17_DATATYPE_DATA = 1,
|
||||||
|
M17_DATATYPE_VOICE = 2,
|
||||||
|
M17_DATATYPE_VOICE_DATA = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
enum M17EncyptionType
|
||||||
|
{
|
||||||
|
M17_ENCRYPTION_NONE = 0,
|
||||||
|
M17_ENCRYPTION_AES = 1,
|
||||||
|
M17_ENCRYPTION_SCRAMBLER = 2,
|
||||||
|
M17_ENCRYPTION_OTHER = 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum M17MetaType
|
||||||
|
{
|
||||||
|
M17_META_TEXT = 0,
|
||||||
|
M17_META_GNSS = 1,
|
||||||
|
M17_META_EXTD_CALLSIGN = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum M17ScramblingType
|
||||||
|
{
|
||||||
|
M17_SCRAMBLING_8BIT = 0,
|
||||||
|
M17_SCRAMBLING_16BIT = 1,
|
||||||
|
M17_SCRAMBLING_24BIT = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data structure for M17 GNSS metadata field.
|
||||||
|
*/
|
||||||
|
typedef struct __attribute__((packed))
|
||||||
|
{
|
||||||
|
uint8_t data_src; //< Data source
|
||||||
|
uint8_t station_type; //< Station type
|
||||||
|
uint8_t lat_deg; //< Latitude, whole number
|
||||||
|
uint16_t lat_dec; //< Latitude, decimal part multiplied by 65535
|
||||||
|
uint8_t lon_deg; //< Longitude, whole number
|
||||||
|
uint16_t lon_dec; //< Longitude, decimal part multiplied by 65535
|
||||||
|
uint8_t lat_sign : 1; //< Latitude N/S: 0 = north, 1 = south
|
||||||
|
uint8_t lon_sign : 1; //< Longitude E/W: 0 = east, 1 = west
|
||||||
|
uint8_t alt_valid : 1; //< Altitude data valid
|
||||||
|
uint8_t spd_valid : 1; //< Speed data valid
|
||||||
|
uint8_t _unused : 4;
|
||||||
|
uint16_t altitude; //< Altitude above sea level in feet + 1500
|
||||||
|
uint16_t bearing; //< Bearing in degrees, whole number
|
||||||
|
uint8_t speed; //< Speed in mph, whole number
|
||||||
|
}
|
||||||
|
gnssData_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data structure for M17 extended callsign metadata field.
|
||||||
|
*/
|
||||||
|
typedef struct __attribute__((packed))
|
||||||
|
{
|
||||||
|
call_t call1;
|
||||||
|
call_t call2;
|
||||||
|
uint16_t _unused;
|
||||||
|
}
|
||||||
|
extdCall_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data structure for M17 LSF metadata field.
|
||||||
|
*/
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
extdCall_t extended_call_sign;
|
||||||
|
gnssData_t gnss_data;
|
||||||
|
uint8_t raw_data[14];
|
||||||
|
}
|
||||||
|
meta_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This structure provides bit field definitions for the "TYPE" field
|
* This structure provides bit field definitions for the "TYPE" field
|
||||||
* contained in an M17 Link Setup Frame.
|
* contained in an M17 Link Setup Frame.
|
||||||
|
@ -46,14 +125,13 @@ typedef union
|
||||||
{
|
{
|
||||||
struct __attribute__((packed))
|
struct __attribute__((packed))
|
||||||
{
|
{
|
||||||
uint16_t stream : 1; //< Packet/stream indicator: 0 = packet, 1 = stream
|
uint16_t dataMode : 1; //< Packet/stream indicator: 0 = packet, 1 = stream
|
||||||
uint16_t dataType : 2; //< Data type indicator
|
uint16_t dataType : 2; //< Data type indicator
|
||||||
uint16_t encType : 2; //< Encryption type
|
uint16_t encType : 2; //< Encryption type
|
||||||
uint16_t encSubType : 2; //< Encryption subtype
|
uint16_t encSubType : 2; //< Encryption subtype
|
||||||
uint16_t CAN : 4; //< Channel Access Number
|
uint16_t CAN : 4; //< Channel Access Number
|
||||||
uint16_t : 4; //< Reserved, padding to 16 bit
|
uint16_t : 5; //< Reserved, padding to 16 bit
|
||||||
}
|
} fields;
|
||||||
fields;
|
|
||||||
|
|
||||||
uint16_t value;
|
uint16_t value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,8 +224,8 @@ void OpMode_M17::txState(rtxStatus_t *const status)
|
||||||
if(!dst.empty()) lsf.setDestination(dst);
|
if(!dst.empty()) lsf.setDestination(dst);
|
||||||
|
|
||||||
streamType_t type;
|
streamType_t type;
|
||||||
type.fields.stream = 1; // Stream
|
type.fields.dataMode = M17_DATAMODE_STREAM; // Stream
|
||||||
type.fields.dataType = 2; // Voice data
|
type.fields.dataType = M17_DATATYPE_VOICE; // Voice data
|
||||||
type.fields.CAN = status->can; // Channel access number
|
type.fields.CAN = status->can; // Channel access number
|
||||||
|
|
||||||
lsf.setType(type);
|
lsf.setType(type);
|
||||||
|
|
Ładowanie…
Reference in New Issue