[gcs] add -ac_ids option to specify list of displayed aircrafts

the parameter needs to be a comma separated list of aircraft ids, e.g.

$ ground_segment/cockpit/gcs -ac_ids 11,22
$ ground_segment/cockpit/gcs -ac_ids 33

to display the Aircrafts with IDs 11 and 22 in first GCS, and only the aircraft with ID 33 in the second one.

Should close #1056
This commit is contained in:
Felix Ruess
2015-05-04 18:27:51 +02:00
parent 926cef0059
commit aeaad9a186
3 changed files with 11 additions and 4 deletions
+1
View File
@@ -375,6 +375,7 @@ let options =
"-zoom", Arg.Set_float zoom, "Initial zoom";
"-auto_hide_fp", Arg.Unit (fun () -> Live.auto_hide_fp true; hide_fp := true), "Automatically hide flight plans of unselected aircraft";
"-timestamp", Arg.Set timestamp, "Bind on timestampped telemetry messages";
"-ac_ids", Arg.String (fun s -> Live.filter_ac_ids s), "comma separated list of AC IDs to show in GCS";
]
+9 -4
View File
@@ -114,6 +114,9 @@ type aircraft = {
mutable last_gps_acc : gps_acc_level
}
let list_separator = Str.regexp ","
let filter_acs = ref []
let aircrafts = Hashtbl.create 3
exception AC_not_found
let find_ac = fun ac_id ->
@@ -174,7 +177,11 @@ let select_ac = fun acs_notebook ac_id ->
(* Select and enlarge the label of the A/C notebook *)
let n = acs_notebook#page_num ac.pages in
acs_notebook#goto_page n;
ac.notebook_label#set_width_chars 20;
ac.notebook_label#set_width_chars 20
let filter_ac_ids = fun acs ->
let acs = Str.split list_separator acs in
filter_acs := acs;
module M = Map.Make (struct type t = string let compare = compare end)
let log =
@@ -814,7 +821,7 @@ let ask_config = fun alert geomap fp_notebook strips ac ->
let one_new_ac = fun alert (geomap:G.widget) fp_notebook strips ac ->
if not (Hashtbl.mem aircrafts ac) then
if (List.length !filter_acs = 0) || (List.mem ac !filter_acs) && not (Hashtbl.mem aircrafts ac) then
ask_config alert geomap fp_notebook strips ac
@@ -907,8 +914,6 @@ let listen_if_calib_msg = fun () ->
let listen_telemetry_status = fun a ->
safe_bind "TELEMETRY_STATUS" (get_telemetry_status a)
let list_separator = Str.regexp ","
let aircrafts_msg = fun alert (geomap:G.widget) fp_notebook strips acs ->
let acs = Pprz.string_assoc "ac_list" acs in
let acs = Str.split list_separator acs in
+1
View File
@@ -87,3 +87,4 @@ val jump_to_block : string -> int -> unit
val dl_setting : string -> int -> float -> unit
(** [dl_setting ac_id var_index value] Sends a DL_SETTING message *)
val filter_ac_ids: string -> unit