Factor out sendBeastSettings(), use it in view1090.
This commit is contained in:
parent
11b6cdba06
commit
0526388bdc
16
faup1090.c
16
faup1090.c
|
@ -139,22 +139,6 @@ static void backgroundTasks(void) {
|
|||
modesNetPeriodicWork();
|
||||
}
|
||||
|
||||
static void sendBeastSettings(struct client *c, const char *settings) {
|
||||
int len;
|
||||
char *buf, *p;
|
||||
|
||||
len = strlen(settings) * 3;
|
||||
buf = p = alloca(len);
|
||||
|
||||
while (*settings) {
|
||||
*p++ = 0x1a;
|
||||
*p++ = '1';
|
||||
*p++ = *settings++;
|
||||
}
|
||||
|
||||
anetWrite(c->fd, buf, len);
|
||||
}
|
||||
|
||||
//
|
||||
//=========================================================================
|
||||
//
|
||||
|
|
18
net_io.c
18
net_io.c
|
@ -784,6 +784,24 @@ static void handle_radarcape_position(float lat, float lon, float alt)
|
|||
}
|
||||
}
|
||||
|
||||
// Send some Beast settings commands to a client
|
||||
void sendBeastSettings(struct client *c, const char *settings)
|
||||
{
|
||||
int len;
|
||||
char *buf, *p;
|
||||
|
||||
len = strlen(settings) * 3;
|
||||
buf = p = alloca(len);
|
||||
|
||||
while (*settings) {
|
||||
*p++ = 0x1a;
|
||||
*p++ = '1';
|
||||
*p++ = *settings++;
|
||||
}
|
||||
|
||||
anetWrite(c->fd, buf, len);
|
||||
}
|
||||
|
||||
//
|
||||
//=========================================================================
|
||||
//
|
||||
|
|
2
net_io.h
2
net_io.h
|
@ -72,6 +72,8 @@ struct client *createGenericClient(struct net_service *service, int fd);
|
|||
struct net_service *makeBeastInputService(void);
|
||||
struct net_service *makeFatsvOutputService(void);
|
||||
|
||||
void sendBeastSettings(struct client *c, const char *settings);
|
||||
|
||||
void modesInitNet(void);
|
||||
void modesQueueOutput(struct modesMessage *mm, struct aircraft *a);
|
||||
void modesNetPeriodicWork(void);
|
||||
|
|
|
@ -206,6 +206,10 @@ int main(int argc, char **argv) {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
sendBeastSettings(c, "Cd"); // Beast binary format, no filters
|
||||
sendBeastSettings(c, Modes.mode_ac ? "J" : "j"); // Mode A/C on or off
|
||||
sendBeastSettings(c, Modes.check_crc ? "f" : "F"); // CRC checks on or off
|
||||
|
||||
// Keep going till the user does something that stops us
|
||||
while (!Modes.exit) {
|
||||
icaoFilterExpire();
|
||||
|
|
Loading…
Reference in a new issue