mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-30 19:47:50 +08:00
[messages] rename class to msg_class
makes it possible to use the python parser using xmlobject since class is a reserved word.
This commit is contained in:
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
<!DOCTYPE protocol SYSTEM "messages.dtd">
|
<!DOCTYPE protocol SYSTEM "messages.dtd">
|
||||||
<protocol>
|
<protocol>
|
||||||
|
|
||||||
<class name="airborne">
|
<msg_class name="airborne">
|
||||||
|
|
||||||
<message name="BARO_ABS" id="0">
|
<message name="BARO_ABS" id="0">
|
||||||
<field name="pressure" type="float" unit="Pa"/>
|
<field name="pressure" type="float" unit="Pa"/>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
<field name="distance" type="float" unit="m"/>
|
<field name="distance" type="float" unit="m"/>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
</class>
|
</msg_class>
|
||||||
|
|
||||||
|
|
||||||
</protocol>
|
</protocol>
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
<!ELEMENT protocol (class+)>
|
<!ELEMENT protocol (msg_class+)>
|
||||||
<!ATTLIST protocol>
|
<!ATTLIST protocol>
|
||||||
|
|
||||||
<!ELEMENT class (message+)>
|
<!ELEMENT msg_class (message+)>
|
||||||
<!ATTLIST class
|
<!ATTLIST msg_class
|
||||||
name CDATA #REQUIRED
|
name CDATA #REQUIRED
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -2,7 +2,7 @@
|
|||||||
<!DOCTYPE protocol SYSTEM "messages.dtd">
|
<!DOCTYPE protocol SYSTEM "messages.dtd">
|
||||||
<protocol>
|
<protocol>
|
||||||
<!-- messages from modem or sim to server -->
|
<!-- messages from modem or sim to server -->
|
||||||
<class name="telemetry">
|
<msg_class name="telemetry">
|
||||||
|
|
||||||
<message name="BOOT" id="1">
|
<message name="BOOT" id="1">
|
||||||
<field name="version" type="uint16"/>
|
<field name="version" type="uint16"/>
|
||||||
@@ -2185,11 +2185,11 @@
|
|||||||
<field name="V_Down" type="double"/>
|
<field name="V_Down" type="double"/>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
</class>
|
</msg_class>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<class name="datalink">
|
<msg_class name="datalink">
|
||||||
<message name="ACINFO" id="1" link="broadcasted">
|
<message name="ACINFO" id="1" link="broadcasted">
|
||||||
<field name="course" type="int16" unit="decideg"></field>
|
<field name="course" type="int16" unit="decideg"></field>
|
||||||
<field name="utm_east" type="int32" unit="cm"></field>
|
<field name="utm_east" type="int32" unit="cm"></field>
|
||||||
@@ -2515,12 +2515,12 @@
|
|||||||
<field name="pan" type="int8"/>
|
<field name="pan" type="int8"/>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
</class>
|
</msg_class>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<class name="ground">
|
<msg_class name="ground">
|
||||||
<message name="NEW_AIRCRAFT" id="1">
|
<message name="NEW_AIRCRAFT" id="1">
|
||||||
<field name="ac_id" type="string"/>
|
<field name="ac_id" type="string"/>
|
||||||
</message>
|
</message>
|
||||||
@@ -2769,10 +2769,10 @@
|
|||||||
<field name="longs" type="string" format="csv"/>
|
<field name="longs" type="string" format="csv"/>
|
||||||
<field name="values" type="string" format="csv"/>
|
<field name="values" type="string" format="csv"/>
|
||||||
</message>
|
</message>
|
||||||
</class>
|
</msg_class>
|
||||||
|
|
||||||
|
|
||||||
<class name="alert">
|
<msg_class name="alert">
|
||||||
<message name="BAT_LOW" id="1">
|
<message name="BAT_LOW" id="1">
|
||||||
<field name="ac_id" type="string"/>
|
<field name="ac_id" type="string"/>
|
||||||
<field name="level" type="string" values="CATASTROPHIC|CRITIC|WARNING"/>
|
<field name="level" type="string" values="CATASTROPHIC|CRITIC|WARNING"/>
|
||||||
@@ -2782,11 +2782,11 @@
|
|||||||
<field name="ac_id" type="string"/>
|
<field name="ac_id" type="string"/>
|
||||||
<field name="level" type="string" values="CATASTROPHIC|CRITIC|WARNING"/>
|
<field name="level" type="string" values="CATASTROPHIC|CRITIC|WARNING"/>
|
||||||
</message>
|
</message>
|
||||||
</class>
|
</msg_class>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<class name="DIA"> <!-- data in audio -->
|
<msg_class name="DIA"> <!-- data in audio -->
|
||||||
<message name="NAV_INFO" id="1">
|
<message name="NAV_INFO" id="1">
|
||||||
<field name="unix_time" type="float"/>
|
<field name="unix_time" type="float"/>
|
||||||
|
|
||||||
@@ -2800,7 +2800,7 @@
|
|||||||
<field name="cam_roll" type="int16" unit="deg"/>
|
<field name="cam_roll" type="int16" unit="deg"/>
|
||||||
<field name="cam_pitch" type="int16" unit="deg"/>
|
<field name="cam_pitch" type="int16" unit="deg"/>
|
||||||
</message>
|
</message>
|
||||||
</class>
|
</msg_class>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -1,12 +1,12 @@
|
|||||||
<!-- U-BLOX UBX protocol DTD -->
|
<!-- U-BLOX UBX protocol DTD -->
|
||||||
|
|
||||||
<!ELEMENT ubx (class+)>
|
<!ELEMENT ubx (msg_class+)>
|
||||||
<!ELEMENT class (message+)>
|
<!ELEMENT msg_class (message+)>
|
||||||
<!ELEMENT message (field|block)*>
|
<!ELEMENT message (field|block)*>
|
||||||
<!ELEMENT block (field*)>
|
<!ELEMENT block (field*)>
|
||||||
<!ELEMENT field EMPTY>
|
<!ELEMENT field EMPTY>
|
||||||
|
|
||||||
<!ATTLIST class
|
<!ATTLIST msg_class
|
||||||
name CDATA #REQUIRED
|
name CDATA #REQUIRED
|
||||||
ID CDATA #REQUIRED>
|
ID CDATA #REQUIRED>
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<ubx>
|
<ubx>
|
||||||
|
|
||||||
<class name="NAV" ID="0x01">
|
<msg_class name="NAV" ID="0x01">
|
||||||
|
|
||||||
<message name="POSLLH" ID="0x02" length="28">
|
<message name="POSLLH" ID="0x02" length="28">
|
||||||
<field name="ITOW" format="U4" unit="ms"/>
|
<field name="ITOW" format="U4" unit="ms"/>
|
||||||
@@ -96,9 +96,9 @@
|
|||||||
</block>
|
</block>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
</class>
|
</msg_class>
|
||||||
|
|
||||||
<class name="CFG" ID="0x06">
|
<msg_class name="CFG" ID="0x06">
|
||||||
|
|
||||||
<message name="PRT" ID="0x00">
|
<message name="PRT" ID="0x00">
|
||||||
<block length="20">
|
<block length="20">
|
||||||
@@ -192,9 +192,9 @@
|
|||||||
<field name="res4" format="U4"/>
|
<field name="res4" format="U4"/>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
</class>
|
</msg_class>
|
||||||
|
|
||||||
<class name="ACK" ID="0x05">
|
<msg_class name="ACK" ID="0x05">
|
||||||
|
|
||||||
<message name="ACK" ID="0x01" length="2">
|
<message name="ACK" ID="0x01" length="2">
|
||||||
<field name="ClsID" format="U1"/>
|
<field name="ClsID" format="U1"/>
|
||||||
@@ -206,9 +206,9 @@
|
|||||||
<field name="MsgID" format="U1"/>
|
<field name="MsgID" format="U1"/>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
</class>
|
</msg_class>
|
||||||
|
|
||||||
<class name="RXM" ID="0x02">
|
<msg_class name="RXM" ID="0x02">
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Only available with raw data product variant.
|
Only available with raw data product variant.
|
||||||
@@ -249,9 +249,9 @@ supported.
|
|||||||
<field name="dwrd9" format="U4"/>
|
<field name="dwrd9" format="U4"/>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
</class>
|
</msg_class>
|
||||||
|
|
||||||
<class name="MON" ID="0x0A">
|
<msg_class name="MON" ID="0x0A">
|
||||||
|
|
||||||
<message name="GET_VER" ID="0x04" length="0">
|
<message name="GET_VER" ID="0x04" length="0">
|
||||||
</message>
|
</message>
|
||||||
@@ -262,6 +262,6 @@ supported.
|
|||||||
</block>
|
</block>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
</class>
|
</msg_class>
|
||||||
|
|
||||||
</ubx>
|
</ubx>
|
||||||
|
|||||||
@@ -609,7 +609,8 @@ module MessagesOfXml(Class:CLASS_Xml) = struct
|
|||||||
let messages_by_id, messages_by_name =
|
let messages_by_id, messages_by_name =
|
||||||
try
|
try
|
||||||
let select = fun x -> Xml.attrib x "name" = Class.name in
|
let select = fun x -> Xml.attrib x "name" = Class.name in
|
||||||
parse_class (ExtXml.child Class.xml ~select "class")
|
let xml_class = try ExtXml.child Class.xml ~select "msg_class" with Not_found -> ExtXml.child Class.xml ~select "class" in
|
||||||
|
parse_class xml_class
|
||||||
with
|
with
|
||||||
Not_found -> failwith (sprintf "Unknown message class: %s" Class.name)
|
Not_found -> failwith (sprintf "Unknown message class: %s" Class.name)
|
||||||
let messages = messages_by_id
|
let messages = messages_by_id
|
||||||
|
|||||||
+1
-1
@@ -92,7 +92,7 @@ let ubx_xml =
|
|||||||
|
|
||||||
let ubx_get_class = fun name ->
|
let ubx_get_class = fun name ->
|
||||||
let ubx_xml = Lazy.force ubx_xml in
|
let ubx_xml = Lazy.force ubx_xml in
|
||||||
ExtXml.child ubx_xml ~select:(fun x -> ExtXml.attrib x "name" = name) "class"
|
ExtXml.child ubx_xml ~select:(fun x -> ExtXml.attrib x "name" = name) "msg_class"
|
||||||
|
|
||||||
let ubx_get_msg = fun ubx_class name ->
|
let ubx_get_msg = fun ubx_class name ->
|
||||||
ExtXml.child ubx_class ~select:(fun x -> ExtXml.attrib x "name" = name) "message"
|
ExtXml.child ubx_class ~select:(fun x -> ExtXml.attrib x "name" = name) "message"
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ def GetOptions():
|
|||||||
def ParseMessages():
|
def ParseMessages():
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
tree = etree.parse( messages_path)
|
tree = etree.parse( messages_path)
|
||||||
for the_class in tree.xpath("//class[@name]"):
|
for the_class in tree.xpath("//msg_class[@name]"):
|
||||||
class_name = the_class.attrib['name']
|
class_name = the_class.attrib['name']
|
||||||
if class_name not in message_dictionary:
|
if class_name not in message_dictionary:
|
||||||
message_dictionary_id_name[class_name] = {}
|
message_dictionary_id_name[class_name] = {}
|
||||||
|
|||||||
@@ -278,7 +278,8 @@ let popup = fun ?(no_gui = false) xml log_filename data ->
|
|||||||
let msg_names = Hashtbl.create 30 in
|
let msg_names = Hashtbl.create 30 in
|
||||||
List.iter (fun (_, name, _) -> if not (Hashtbl.mem msg_names name) then Hashtbl.add msg_names name ()) data;
|
List.iter (fun (_, name, _) -> if not (Hashtbl.mem msg_names name) then Hashtbl.add msg_names name ()) data;
|
||||||
(** Fill the colums *)
|
(** Fill the colums *)
|
||||||
let xml_class = ExtXml.child ~select:(fun c -> ExtXml.attrib c "name" = class_name) xml "class" in
|
let xml_class = try ExtXml.child ~select:(fun x -> Xml.attrib x "name" = class_name) xml "msg_class"
|
||||||
|
with Not_found -> ExtXml.child ~select:(fun x -> Xml.attrib x "name" = class_name) xml "class" in
|
||||||
(** Filter xml message *)
|
(** Filter xml message *)
|
||||||
let xml_class = Xml.Element (
|
let xml_class = Xml.Element (
|
||||||
class_name, [],
|
class_name, [],
|
||||||
|
|||||||
@@ -668,7 +668,9 @@ let load_log = fun ?export ?factor (plot:plot) (menubar:GMenu.menu_shell GMenu.f
|
|||||||
let class_name =
|
let class_name =
|
||||||
try
|
try
|
||||||
let name = "telemetry_ap" in
|
let name = "telemetry_ap" in
|
||||||
let _ = ExtXml.child protocol ~select:(fun x -> Xml.attrib x "name" = name) "class" in
|
let _ = begin try ExtXml.child protocol ~select:(fun x -> Xml.attrib x "name" = name) "msg_class"
|
||||||
|
with Not_found -> ExtXml.child protocol ~select:(fun x -> Xml.attrib x "name" = name) "class"
|
||||||
|
end in
|
||||||
name
|
name
|
||||||
with _ -> "telemetry" in
|
with _ -> "telemetry" in
|
||||||
|
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ let messages_ap =
|
|||||||
(* let xml = Xml.parse_file (pprz_conf_path // "messages.xml") in *)
|
(* let xml = Xml.parse_file (pprz_conf_path // "messages.xml") in *)
|
||||||
let xml = Xml.parse_file (user_conf_path // "messages.xml") in
|
let xml = Xml.parse_file (user_conf_path // "messages.xml") in
|
||||||
try
|
try
|
||||||
ExtXml.child xml ~select:(fun x -> Xml.attrib x "name" = "telemetry") "class"
|
ExtXml.child xml ~select:(fun x -> Xml.attrib x "name" = "telemetry") "msg_class"
|
||||||
with
|
with
|
||||||
Not_found -> failwith "'telemetry' class missing in messages.xml"
|
Not_found -> failwith "'telemetry' msg_class missing in messages.xml"
|
||||||
|
|
||||||
type aircraft = {
|
type aircraft = {
|
||||||
name : string;
|
name : string;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ module Make (A:Data.MISSION) (FM: FlightModel.SIG) = struct
|
|||||||
let a = array_of_string ubx_payload in
|
let a = array_of_string ubx_payload in
|
||||||
let s = Pprz.string_of_value (Pprz.Array a) in
|
let s = Pprz.string_of_value (Pprz.Array a) in
|
||||||
let vs = ["ac_id",Pprz.Int !my_id;
|
let vs = ["ac_id",Pprz.Int !my_id;
|
||||||
"class", Pprz.Int class_id;
|
"msg_class", Pprz.Int class_id;
|
||||||
"id", Pprz.Int msg_id;
|
"id", Pprz.Int msg_id;
|
||||||
"ubx_payload", Pprz.String s] in
|
"ubx_payload", Pprz.String s] in
|
||||||
|
|
||||||
|
|||||||
@@ -67,12 +67,12 @@ module Syntax = struct
|
|||||||
let read = fun filename class_ ->
|
let read = fun filename class_ ->
|
||||||
let xml = Xml.parse_file filename in
|
let xml = Xml.parse_file filename in
|
||||||
try
|
try
|
||||||
let xml_class = ExtXml.child ~select:(fun x -> Xml.attrib x "name" = class_) xml "class" in
|
let xml_class = ExtXml.child ~select:(fun x -> Xml.attrib x "name" = class_) xml "msg_class" in
|
||||||
let msgs = List.map struct_of_xml (Xml.children xml_class) in
|
let msgs = List.map struct_of_xml (Xml.children xml_class) in
|
||||||
check_single_ids msgs;
|
check_single_ids msgs;
|
||||||
msgs
|
msgs
|
||||||
with
|
with
|
||||||
Not_found -> failwith (sprintf "No class '%s' found" class_)
|
Not_found -> failwith (sprintf "No msg_class '%s' found" class_)
|
||||||
end (* module Suntax *)
|
end (* module Suntax *)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -105,12 +105,12 @@ module Syntax = struct
|
|||||||
let read = fun filename class_ ->
|
let read = fun filename class_ ->
|
||||||
let xml = Xml.parse_file filename in
|
let xml = Xml.parse_file filename in
|
||||||
try
|
try
|
||||||
let xml_class = ExtXml.child ~select:(fun x -> Xml.attrib x "name" = class_) xml "class" in
|
let xml_class = ExtXml.child ~select:(fun x -> Xml.attrib x "name" = class_) xml "msg_class" in
|
||||||
let msgs = List.map struct_of_xml (Xml.children xml_class) in
|
let msgs = List.map struct_of_xml (Xml.children xml_class) in
|
||||||
check_single_ids msgs;
|
check_single_ids msgs;
|
||||||
msgs
|
msgs
|
||||||
with
|
with
|
||||||
Not_found -> failwith (sprintf "No class '%s' found" class_)
|
Not_found -> failwith (sprintf "No msg_class '%s' found" class_)
|
||||||
end (* module Suntax *)
|
end (* module Suntax *)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -123,12 +123,12 @@ module Syntax = struct
|
|||||||
let read = fun filename class_ ->
|
let read = fun filename class_ ->
|
||||||
let xml = Xml.parse_file filename in
|
let xml = Xml.parse_file filename in
|
||||||
try
|
try
|
||||||
let xml_class = ExtXml.child ~select:(fun x -> Xml.attrib x "name" = class_) xml "class" in
|
let xml_class = ExtXml.child ~select:(fun x -> Xml.attrib x "name" = class_) xml "msg_class" in
|
||||||
let msgs = List.map struct_of_xml (Xml.children xml_class) in
|
let msgs = List.map struct_of_xml (Xml.children xml_class) in
|
||||||
check_single_ids msgs;
|
check_single_ids msgs;
|
||||||
msgs
|
msgs
|
||||||
with
|
with
|
||||||
Not_found -> failwith (sprintf "No class '%s' found" class_)
|
Not_found -> failwith (sprintf "No msg_class '%s' found" class_)
|
||||||
end (* module Suntax *)
|
end (* module Suntax *)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class Server(ivy.IvyServer):
|
|||||||
print("server listening on {:d}".format(tcp_port))
|
print("server listening on {:d}".format(tcp_port))
|
||||||
|
|
||||||
self.transp = phoenix.pprz_transport.Transport(check_crc=False, debug=False)
|
self.transp = phoenix.pprz_transport.Transport(check_crc=False, debug=False)
|
||||||
self.protocol = phoenix.messages.Protocol(path=path.join(home_dir, "conf/messages_ng.xml"), debug=True)
|
self.protocol = phoenix.messages.Protocol(path=path.join(home_dir, "conf/messages.xml"), debug=True)
|
||||||
self.start(bus)
|
self.start(bus)
|
||||||
|
|
||||||
GObject.timeout_add(500, self.periodic, priority=GObject.PRIORITY_HIGH)
|
GObject.timeout_add(500, self.periodic, priority=GObject.PRIORITY_HIGH)
|
||||||
|
|||||||
Reference in New Issue
Block a user