Skip to content

Commit

Permalink
[gcs] [ground_segment] [speech] speech_name feature now uses GCS sect…
Browse files Browse the repository at this point in the history
…ion 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).
  • Loading branch information
scdwyer committed Jan 14, 2013
1 parent 6cd997d commit fb0f460
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
1 change: 0 additions & 1 deletion conf/messages.xml
Expand Up @@ -2239,7 +2239,6 @@
<field name="settings" type="string" unit="url"/>
<field name="default_gui_color" type="string"/>
<field name="ac_name" type="string"/>
<field name="ac_speech_name" type="string"/>
</message>

<message name="FLIGHT_PARAM" id="11">
Expand Down
15 changes: 12 additions & 3 deletions sw/ground_segment/cockpit/live.ml
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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];
Expand Down
4 changes: 1 addition & 3 deletions sw/ground_segment/tmtc/server.ml
Expand Up @@ -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')
Expand Down

0 comments on commit fb0f460

Please sign in to comment.