changeset 151:8fc49d9dcd43 main

1) queue length accessors for CANMessage 2) updates to the IMU CAN messages
author Bob Cook <bob@bobcookdev.com>
date Sat, 08 Sep 2012 12:50:15 -0700
parents cbbd86558aa0
children 19626dab8d31
files main/packages/common/can/can_messages.h main/packages/linux/can/CANMessage.cpp main/packages/linux/can/CANMessage.h
diffstat 3 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/main/packages/common/can/can_messages.h	Sun Aug 26 15:31:27 2012 -0700
+++ b/main/packages/common/can/can_messages.h	Sat Sep 08 12:50:15 2012 -0700
@@ -84,9 +84,11 @@
 const uint16_t can_dataid_imu_pitch = 0x0021;
 const uint16_t can_dataid_imu_yaw   = 0x0022;
 
+const int32_t  can_data_imu_multiplier = 10000;
+
 typedef struct
 {
-    int32_t data; // imu value * 1,000,000
+    int32_t data; // imu value * 10,000 (can_data_imu_multiplier)
 
 }   can_data_imu_data;
 
--- a/main/packages/linux/can/CANMessage.cpp	Sun Aug 26 15:31:27 2012 -0700
+++ b/main/packages/linux/can/CANMessage.cpp	Sat Sep 08 12:50:15 2012 -0700
@@ -7,7 +7,7 @@
 //    
 //  CAN message object that can be queued or dequeued from multiple threads.
 //
-//  Copyright (c) 2010 Bob Cook
+//  Copyright (c) 2012 Bob Cook
 //
 //  Permission is hereby granted, free of charge, to any person obtaining a copy
 //  of this software and associated documentation files (the "Software"), to deal
@@ -51,6 +51,13 @@
 
 // ----------------------------------------------------------------------------------------
 
+int CANMessage::SendQueueSize()
+{
+    return sm_MsgsToSend.size();
+}
+
+// ----------------------------------------------------------------------------------------
+
 void CANMessage::QueueToSend( CANMessage* msg )
 {
     sm_MsgsToSend.enqueueNotification( msg );
@@ -66,6 +73,13 @@
 
 // ----------------------------------------------------------------------------------------
 
+int CANMessage::ReceiveQueueSize()
+{
+    return sm_MsgsReceived.size();
+}
+
+// ----------------------------------------------------------------------------------------
+
 void CANMessage::QueueReceived( CANMessage* msg )
 {
     sm_MsgsReceived.enqueueNotification( msg );
--- a/main/packages/linux/can/CANMessage.h	Sun Aug 26 15:31:27 2012 -0700
+++ b/main/packages/linux/can/CANMessage.h	Sat Sep 08 12:50:15 2012 -0700
@@ -7,7 +7,7 @@
 //    
 //  CAN message object that can be queued or dequeued from multiple threads.
 //
-//  Copyright (c) 2011 Bob Cook
+//  Copyright (c) 2012 Bob Cook
 //
 //  Permission is hereby granted, free of charge, to any person obtaining a copy
 //  of this software and associated documentation files (the "Software"), to deal
@@ -45,8 +45,10 @@
 {
     public:
         static bool IsSendQueueEmpty();
+        static int  SendQueueSize();
         static void QueueToSend( CANMessage* msg );
         static CANMessage* WaitDequeueToSend( long timeoutMilliseconds );
+        static int  ReceiveQueueSize();
         static void QueueReceived( CANMessage* msg );
         static CANMessage* WaitDequeueReceived( long timeoutMilliseconds );
         static std::string asText( const CANMessage* msg );