json input support, some shutdown fixes. json needs cleanup.
This commit is contained in:
11
adsbus/raw.c
11
adsbus/raw.c
@@ -34,7 +34,7 @@ static bool raw_parse_mode_s_short(struct buf *buf, struct packet *packet) {
|
||||
(overlay->cr_lf != '\r' || overlay->lf != '\n'))) {
|
||||
return false;
|
||||
}
|
||||
packet->type = MODE_S_SHORT;
|
||||
packet->type = PACKET_TYPE_MODE_S_SHORT;
|
||||
hex_to_bin(packet->payload, overlay->payload, sizeof(overlay->payload) / 2);
|
||||
buf_consume(buf, overlay->cr_lf == '\r' ? sizeof(*overlay) : sizeof(*overlay) - 1);
|
||||
return true;
|
||||
@@ -49,7 +49,7 @@ static bool raw_parse_mode_s_long(struct buf *buf, struct packet *packet) {
|
||||
(overlay->cr_lf != '\r' || overlay->lf != '\n'))) {
|
||||
return false;
|
||||
}
|
||||
packet->type = MODE_S_LONG;
|
||||
packet->type = PACKET_TYPE_MODE_S_LONG;
|
||||
hex_to_bin(packet->payload, overlay->payload, sizeof(overlay->payload) / 2);
|
||||
buf_consume(buf, overlay->cr_lf == '\r' ? sizeof(*overlay) : sizeof(*overlay) - 1);
|
||||
return true;
|
||||
@@ -90,11 +90,14 @@ void raw_serialize(struct packet *packet, struct buf *buf) {
|
||||
}
|
||||
|
||||
switch (packet->type) {
|
||||
case MODE_S_SHORT:
|
||||
case PACKET_TYPE_NONE:
|
||||
break;
|
||||
|
||||
case PACKET_TYPE_MODE_S_SHORT:
|
||||
raw_serialize_mode_s_short(packet, buf);
|
||||
break;
|
||||
|
||||
case MODE_S_LONG:
|
||||
case PACKET_TYPE_MODE_S_LONG:
|
||||
raw_serialize_mode_s_long(packet, buf);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user