Skip to content

Commit

Permalink
[Server] modify ac_id field of CONFIG message for replay sessions (pa…
Browse files Browse the repository at this point in the history
…parazzi#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.
  • Loading branch information
Fabien-B committed Nov 10, 2020
1 parent 65a5405 commit bb7986f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions sw/ground_segment/tmtc/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion sw/lib/python/pprz_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit bb7986f

Please sign in to comment.