[gcs] periodically request AIRCRAFTS

periodically probe for new AIRCRAFTS until we got at least one...
This should fix #1078
This commit is contained in:
Felix Ruess
2015-03-02 18:38:30 +01:00
parent 01572870cf
commit 4fa2a80e20
+1 -1
View File
@@ -1421,7 +1421,7 @@ let listen_acs_and_msgs = fun geomap ac_notebook my_alert auto_center_new_ac alt
(** Probe live A/Cs *) (** Probe live A/Cs *)
let probe = fun () -> let probe = fun () ->
message_request "gcs" "AIRCRAFTS" [] (fun _sender vs -> aircrafts_msg my_alert geomap ac_notebook vs) in message_request "gcs" "AIRCRAFTS" [] (fun _sender vs -> aircrafts_msg my_alert geomap ac_notebook vs) in
let _ = GMain.Idle.add (fun () -> probe (); false) in let _ = GMain.Timeout.add 1000 (fun () -> probe (); if Hashtbl.length aircrafts = 0 then true else false) in
(** New aircraft message *) (** New aircraft message *)
safe_bind "NEW_AIRCRAFT" (fun _sender vs -> one_new_ac my_alert geomap ac_notebook (Pprz.string_assoc "ac_id" vs)); safe_bind "NEW_AIRCRAFT" (fun _sender vs -> one_new_ac my_alert geomap ac_notebook (Pprz.string_assoc "ac_id" vs));