[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paparazzi-commits] [4290] add enumerated values to message field descri
From: |
Pascal Brisset |
Subject: |
[paparazzi-commits] [4290] add enumerated values to message field descriptions |
Date: |
Tue, 20 Oct 2009 11:04:01 +0000 |
Revision: 4290
http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=4290
Author: hecto
Date: 2009-10-20 11:04:00 +0000 (Tue, 20 Oct 2009)
Log Message:
-----------
add enumerated values to message field descriptions
Modified Paths:
--------------
paparazzi3/trunk/sw/lib/ocaml/pprz.ml
paparazzi3/trunk/sw/lib/ocaml/pprz.mli
Modified: paparazzi3/trunk/sw/lib/ocaml/pprz.ml
===================================================================
--- paparazzi3/trunk/sw/lib/ocaml/pprz.ml 2009-10-20 11:00:34 UTC (rev
4289)
+++ paparazzi3/trunk/sw/lib/ocaml/pprz.ml 2009-10-20 11:04:00 UTC (rev
4290)
@@ -40,7 +40,8 @@
type field = {
_type : _type;
fformat : format;
- alt_unit_coef : string
+ alt_unit_coef : string;
+ enum : string list
}
type link_mode = Forwarded | Broadcasted
@@ -153,13 +154,17 @@
message.fields
2 (** + message id + aircraft id *)
+let pipe_regexp = Str.regexp "|"
let field_of_xml = fun xml ->
let t = ExtXml.attrib xml "type" in
let t = if is_array_type t then ArrayType (type_of_array_type t) else Scalar
t in
let f = try Xml.attrib xml "format" with _ -> default_format t in
let auc = try Xml.attrib xml "alt_unit_coef" with _ -> "" in
- (String.lowercase (ExtXml.attrib xml "name"), { _type = t; fformat = f;
alt_unit_coef = auc })
+ let values = try Str.split pipe_regexp (Xml.attrib xml "values") with _ ->
[] in
+ ( String.lowercase (ExtXml.attrib xml "name"),
+ { _type = t; fformat = f; alt_unit_coef = auc; enum=values })
+
let string_of_values = fun vs ->
String.concat " " (List.map (fun (a,v) -> sprintf "%s=%s" a (string_of_value
v)) vs)
Modified: paparazzi3/trunk/sw/lib/ocaml/pprz.mli
===================================================================
--- paparazzi3/trunk/sw/lib/ocaml/pprz.mli 2009-10-20 11:00:34 UTC (rev
4289)
+++ paparazzi3/trunk/sw/lib/ocaml/pprz.mli 2009-10-20 11:04:00 UTC (rev
4290)
@@ -39,7 +39,8 @@
type field = {
_type : _type;
fformat : format;
- alt_unit_coef : string (* May be empty *)
+ alt_unit_coef : string; (* May be empty *)
+ enum : string list (* 'values' attribute *)
}
type link_mode = Forwarded | Broadcasted
type message = {
@@ -116,6 +117,7 @@
val messages : (message_id, message) Hashtbl.t
val message_of_id : message_id -> message
val message_of_name : string -> message_id * message
+
val values_of_payload : Serial.payload -> message_id * ac_id * values
(** [values_of_bin payload] Parses a raw payload, returns the
message id, the A/C id and the list of (field_name, value) *)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paparazzi-commits] [4290] add enumerated values to message field descriptions,
Pascal Brisset <=