paparazzi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paparazzi-commits] [4455] add -timestamp option to prefix messages sent


From: Pascal Brisset
Subject: [paparazzi-commits] [4455] add -timestamp option to prefix messages sent over ivy with a time
Date: Mon, 18 Jan 2010 20:33:23 +0000

Revision: 4455
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=4455
Author:   hecto
Date:     2010-01-18 20:33:23 +0000 (Mon, 18 Jan 2010)
Log Message:
-----------
 add -timestamp option to prefix messages sent over ivy with a time 

Modified Paths:
--------------
    paparazzi3/trunk/sw/ground_segment/tmtc/link.ml

Modified: paparazzi3/trunk/sw/ground_segment/tmtc/link.ml
===================================================================
--- paparazzi3/trunk/sw/ground_segment/tmtc/link.ml     2010-01-18 20:31:38 UTC 
(rev 4454)
+++ paparazzi3/trunk/sw/ground_segment/tmtc/link.ml     2010-01-18 20:33:23 UTC 
(rev 4455)
@@ -66,6 +66,15 @@
 (* Enable trafic statistics on standard output *)
 let gen_stat_trafic = ref false
 
+let add_timestamp = ref None
+
+let send_message_over_ivy = fun sender name vs ->
+  let timestamp =
+    match !add_timestamp with
+      None -> None
+    | Some start_time -> Some (Unix.gettimeofday () -. start_time) in
+  Tm_Pprz.message_send ?timestamp sender name vs
+
 let ios = int_of_string
 let (//) = Filename.concat
 let conf_dir = Env.paparazzi_home // "conf"
@@ -162,7 +171,7 @@
                "rx_msgs", Pprz.Int status.rx_msg;
                "ping_time", Pprz.Float (1000. *. (status.last_pong -. 
status.last_ping))
              ] in
-      Tm_Pprz.message_send (string_of_int ac_id) "DOWNLINK_STATUS" vs)
+      send_message_over_ivy (string_of_int ac_id) "DOWNLINK_STATUS" vs)
       statuss 
 
 
@@ -208,7 +217,7 @@
   try
     let (msg_id, ac_id, values) = Tm_Pprz.values_of_payload payload in
     let msg = Tm_Pprz.message_of_id msg_id in
-    Tm_Pprz.message_send (string_of_int ac_id) msg.Pprz.name values;
+    send_message_over_ivy (string_of_int ac_id) msg.Pprz.name values;
     update_status ?udp_peername ac_id raw_data_size (msg.Pprz.name = "PONG")
   with
     exc ->
@@ -473,6 +482,7 @@
       "-noac_info", Arg.Clear ac_info, (sprintf "Disables AC traffic info 
(uplink).");
       "-nouplink", Arg.Clear uplink, (sprintf "Disables the uplink (from the 
ground to the aircraft).");
       "-s", Arg.Set_string baudrate, (sprintf "<baudrate>  Default is %s" 
!baudrate);
+      "-timestamp", Arg.Unit (fun () -> add_timestamp := Some 
(Unix.gettimeofday ())), "Add timestamp to messages sent over ivy";
       "-transport", Arg.Set_string transport, (sprintf "<transport> Available 
protocols are modem,pprz and xbee. Default is %s" !transport);
       "-udp", Arg.Set udp, "Listen a UDP connection on <udp_port>";
       "-udp_port", Arg.Set_int udp_port, (sprintf "<UDP port> Default is %d" 
!udp_port);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]