From fb0f4600299e9610727046477e33ab317b649fd5 Mon Sep 17 00:00:00 2001 From: Stephen Dwyer Date: Sun, 13 Jan 2013 17:44:46 -0700 Subject: [PATCH] [gcs] [ground_segment] [speech] speech_name feature now uses GCS section with SPEECH_NAME defined in the airframe xml file instead of the conf xml file. Reduces impact on ground segment (no paparazzi center mods required). --- conf/messages.xml | 1 - sw/ground_segment/cockpit/live.ml | 15 ++++++++++++--- sw/ground_segment/tmtc/server.ml | 4 +--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/conf/messages.xml b/conf/messages.xml index 6495e9915dc..6635fc0a5aa 100644 --- a/conf/messages.xml +++ b/conf/messages.xml @@ -2239,7 +2239,6 @@ - diff --git a/sw/ground_segment/cockpit/live.ml b/sw/ground_segment/cockpit/live.ml index 2605ae35919..bf49943f1c1 100644 --- a/sw/ground_segment/cockpit/live.ml +++ b/sw/ground_segment/cockpit/live.ml @@ -373,7 +373,14 @@ let get_alt_shift = fun af_xml -> fvalue "ALT_SHIFT_MINUS" default_minus with _ -> (default_plus_plus, default_plus, default_minus) - +let get_speech_name = fun af_xml def_name -> + let default_speech_name = def_name in + try + let gcs_section = ExtXml.child af_xml ~select:(fun x -> Xml.attrib x "name" = "GCS") "section" in + let fvalue = fun name default -> + try ExtXml.attrib (ExtXml.child gcs_section ~select:(fun x -> ExtXml.attrib x "name" = name) "define") "value" with _ -> default in + fvalue "SPEECH_NAME" default_speech_name + with _ -> default_speech_name let key_press_event = fun keys do_action ev -> try @@ -393,8 +400,7 @@ let key_press_event = fun keys do_action ev -> (*****************************************************************************) let create_ac = fun alert (geomap:G.widget) (acs_notebook:GPack.notebook) (ac_id:string) config -> let color = Pprz.string_assoc "default_gui_color" config - and name = Pprz.string_assoc "ac_name" config - and speech_name = Pprz.string_assoc "ac_speech_name" config in + and name = Pprz.string_assoc "ac_name" config in (** Get the flight plan **) let fp_url = Pprz.string_assoc "flight_plan" config in @@ -408,6 +414,9 @@ let create_ac = fun alert (geomap:G.widget) (acs_notebook:GPack.notebook) (ac_id let af_file = Http.file_of_url af_url in let af_xml = ExtXml.parse_file af_file in + (** Get an alternate speech name if available *) + let speech_name = get_speech_name af_xml name in + (* Aicraft menu decorated with a colored box *) let image = GBin.event_box ~width:10 ~height:10 () in image#coerce#misc#modify_bg [`NORMAL, `NAME color]; diff --git a/sw/ground_segment/tmtc/server.ml b/sw/ground_segment/tmtc/server.ml index 79c4f9624bd..381fd79cac0 100644 --- a/sw/ground_segment/tmtc/server.ml +++ b/sw/ground_segment/tmtc/server.ml @@ -613,15 +613,13 @@ 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 - let ac_speech_name = try Xml.attrib conf "speech_name" with _ -> ac_name in [ "ac_id", Pprz.String ac_id; "flight_plan", Pprz.String fp; "airframe", Pprz.String af; "radio", Pprz.String rc; "settings", Pprz.String settings; "default_gui_color", Pprz.String col; - "ac_name", Pprz.String ac_name; - "ac_speech_name", Pprz.String ac_speech_name ] + "ac_name", Pprz.String ac_name ] with Not_found -> failwith (sprintf "ground UNKNOWN %s" ac_id')