|
|
@ -76,17 +76,19 @@ static TF_Result list_units_lst(TinyFrame *tf, TF_Msg *msg) |
|
|
|
|
|
|
|
|
|
|
|
PayloadParser pp = pp_start((uint8_t*)msg->data, msg->len, NULL); |
|
|
|
PayloadParser pp = pp_start((uint8_t*)msg->data, msg->len, NULL); |
|
|
|
uint8_t count = pp_u8(&pp); |
|
|
|
uint8_t count = pp_u8(&pp); |
|
|
|
char buf[100]; |
|
|
|
char buf[20]; |
|
|
|
|
|
|
|
char buf2[20]; |
|
|
|
struct gex_unit *tail = NULL; |
|
|
|
struct gex_unit *tail = NULL; |
|
|
|
for(int i = 0; i < count; i++) { |
|
|
|
for(int i = 0; i < count; i++) { |
|
|
|
uint8_t callsign = pp_u8(&pp); |
|
|
|
uint8_t callsign = pp_u8(&pp); |
|
|
|
pp_string(&pp, buf, 100); |
|
|
|
pp_string(&pp, buf, 20); |
|
|
|
fprintf(stderr, "- Found unit \"%s\" @ callsign %d\n", buf, callsign); |
|
|
|
pp_string(&pp, buf2, 20); |
|
|
|
|
|
|
|
fprintf(stderr, "- Found unit \"%s\" (type %s) @ callsign %d\n", buf, buf2, callsign); |
|
|
|
|
|
|
|
|
|
|
|
// append
|
|
|
|
// append
|
|
|
|
struct gex_unit *lu = malloc(sizeof(struct gex_unit)); |
|
|
|
struct gex_unit *lu = malloc(sizeof(struct gex_unit)); |
|
|
|
lu->next = NULL; |
|
|
|
lu->next = NULL; |
|
|
|
lu->type = strdup("UNKNOWN"); // TODO
|
|
|
|
lu->type = strdup(buf2); |
|
|
|
lu->name = strdup(buf); |
|
|
|
lu->name = strdup(buf); |
|
|
|
lu->callsign = callsign; |
|
|
|
lu->callsign = callsign; |
|
|
|
lu->gex = gex; |
|
|
|
lu->gex = gex; |
|
|
|