From bb7986f8ecb2446dbe9f9222487efb977ea5d4f6 Mon Sep 17 00:00:00 2001 From: Fabien-B Date: Tue, 10 Nov 2020 16:42:45 +0100 Subject: [PATCH] [Server] modify ac_id field of CONFIG message for replay sessions (#2616) * [server] Send real ID with CONFIG message instead of the original ID. * Fix pprz_connect to accept non integer ac ids. Makes "conf_by_id" docstring true. * Makes suggested modifications. --- sw/ground_segment/tmtc/server.ml | 8 ++++---- sw/lib/python/pprz_connect.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sw/ground_segment/tmtc/server.ml b/sw/ground_segment/tmtc/server.ml index fb164d19b17..2464c55f939 100644 --- a/sw/ground_segment/tmtc/server.ml +++ b/sw/ground_segment/tmtc/server.ml @@ -749,9 +749,9 @@ let listen_intruders = fun log -> ignore(Ground_Pprz.message_bind "INTRUDER" (update_intruder log)) let send_config = fun http _asker args -> - let ac_id' = PprzLink.string_assoc "ac_id" args in + let real_id = PprzLink.string_assoc "ac_id" args in try - let _is_replayed, ac_id, root_dir, conf_xml = replayed ac_id' in + let _is_replayed, ac_id, root_dir, conf_xml = replayed real_id in let conf = ExtXml.child conf_xml "aircraft" ~select:(fun x -> ExtXml.attrib x "ac_id" = ac_id) in let ac_name = ExtXml.attrib conf "name" in @@ -770,7 +770,7 @@ let send_config = fun http _asker args -> "settings.xml") else "file://replay" in let col = try Xml.attrib conf "gui_color" with _ -> new_color () in let ac_name = try Xml.attrib conf "name" with _ -> "" in - [ "ac_id", PprzLink.String ac_id; + [ "ac_id", PprzLink.String real_id; "flight_plan", PprzLink.String fp; "airframe", PprzLink.String af; "radio", PprzLink.String rc; @@ -779,7 +779,7 @@ let send_config = fun http _asker args -> "ac_name", PprzLink.String ac_name ] with Not_found -> - failwith (sprintf "ground UNKNOWN %s" ac_id') + failwith (sprintf "ground UNKNOWN %s" real_id) let ivy_server = fun http -> ignore (Ground_Pprz.message_answerer my_id "AIRCRAFTS" send_aircrafts_msg); diff --git a/sw/lib/python/pprz_connect.py b/sw/lib/python/pprz_connect.py index 7270f14fb97..afe1ef925c8 100755 --- a/sw/lib/python/pprz_connect.py +++ b/sw/lib/python/pprz_connect.py @@ -216,7 +216,7 @@ def conf_cb(sender, msg): msg['flight_plan'], msg['settings'], msg['radio'], msg['default_gui_color']) self._conf_list_by_name[conf.name] = conf - self._conf_list_by_id[int(conf.id)] = conf + self._conf_list_by_id[conf.id] = conf if self._notify is not None: self._notify(conf) # user defined general callback if self.verbose: