This program is porting rosserial_arduino for mbed http://www.ros.org/wiki/rosserial_arduino This program supported the revision of 169 of rosserial.

Dependencies:  

Dependents:   rosserial_mbed robot_S2

Committer:
nucho
Date:
Sun Oct 16 07:19:36 2011 +0000
Revision:
1:ff0ec969dad1
Parent:
0:77afd7560544
Child:
3:1cf99502f396
This program supported the revision of 143 of rosserial.
And the bug fix of receive of array data.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nucho 1:ff0ec969dad1 1 #ifndef ros_std_msgs_Time_h
nucho 1:ff0ec969dad1 2 #define ros_std_msgs_Time_h
nucho 0:77afd7560544 3
nucho 0:77afd7560544 4 #include <stdint.h>
nucho 0:77afd7560544 5 #include <string.h>
nucho 0:77afd7560544 6 #include <stdlib.h>
nucho 0:77afd7560544 7 #include "../ros/msg.h"
nucho 0:77afd7560544 8 #include "ros/time.h"
nucho 0:77afd7560544 9
nucho 0:77afd7560544 10 namespace std_msgs
nucho 0:77afd7560544 11 {
nucho 0:77afd7560544 12
nucho 0:77afd7560544 13 class Time : public ros::Msg
nucho 0:77afd7560544 14 {
nucho 0:77afd7560544 15 public:
nucho 0:77afd7560544 16 ros::Time data;
nucho 0:77afd7560544 17
nucho 0:77afd7560544 18 virtual int serialize(unsigned char *outbuffer)
nucho 0:77afd7560544 19 {
nucho 0:77afd7560544 20 int offset = 0;
nucho 0:77afd7560544 21 union {
nucho 1:ff0ec969dad1 22 uint32_t real;
nucho 1:ff0ec969dad1 23 uint32_t base;
nucho 0:77afd7560544 24 } u_sec;
nucho 0:77afd7560544 25 u_sec.real = this->data.sec;
nucho 0:77afd7560544 26 *(outbuffer + offset + 0) = (u_sec.base >> (8 * 0)) & 0xFF;
nucho 0:77afd7560544 27 *(outbuffer + offset + 1) = (u_sec.base >> (8 * 1)) & 0xFF;
nucho 0:77afd7560544 28 *(outbuffer + offset + 2) = (u_sec.base >> (8 * 2)) & 0xFF;
nucho 0:77afd7560544 29 *(outbuffer + offset + 3) = (u_sec.base >> (8 * 3)) & 0xFF;
nucho 0:77afd7560544 30 offset += sizeof(this->data.sec);
nucho 0:77afd7560544 31 union {
nucho 1:ff0ec969dad1 32 uint32_t real;
nucho 1:ff0ec969dad1 33 uint32_t base;
nucho 0:77afd7560544 34 } u_nsec;
nucho 0:77afd7560544 35 u_nsec.real = this->data.nsec;
nucho 0:77afd7560544 36 *(outbuffer + offset + 0) = (u_nsec.base >> (8 * 0)) & 0xFF;
nucho 0:77afd7560544 37 *(outbuffer + offset + 1) = (u_nsec.base >> (8 * 1)) & 0xFF;
nucho 0:77afd7560544 38 *(outbuffer + offset + 2) = (u_nsec.base >> (8 * 2)) & 0xFF;
nucho 0:77afd7560544 39 *(outbuffer + offset + 3) = (u_nsec.base >> (8 * 3)) & 0xFF;
nucho 0:77afd7560544 40 offset += sizeof(this->data.nsec);
nucho 0:77afd7560544 41 return offset;
nucho 0:77afd7560544 42 }
nucho 0:77afd7560544 43
nucho 0:77afd7560544 44 virtual int deserialize(unsigned char *inbuffer)
nucho 0:77afd7560544 45 {
nucho 0:77afd7560544 46 int offset = 0;
nucho 0:77afd7560544 47 union {
nucho 1:ff0ec969dad1 48 uint32_t real;
nucho 1:ff0ec969dad1 49 uint32_t base;
nucho 0:77afd7560544 50 } u_sec;
nucho 0:77afd7560544 51 u_sec.base = 0;
nucho 0:77afd7560544 52 u_sec.base |= ((typeof(u_sec.base)) (*(inbuffer + offset + 0))) << (8 * 0);
nucho 0:77afd7560544 53 u_sec.base |= ((typeof(u_sec.base)) (*(inbuffer + offset + 1))) << (8 * 1);
nucho 0:77afd7560544 54 u_sec.base |= ((typeof(u_sec.base)) (*(inbuffer + offset + 2))) << (8 * 2);
nucho 0:77afd7560544 55 u_sec.base |= ((typeof(u_sec.base)) (*(inbuffer + offset + 3))) << (8 * 3);
nucho 0:77afd7560544 56 this->data.sec = u_sec.real;
nucho 0:77afd7560544 57 offset += sizeof(this->data.sec);
nucho 0:77afd7560544 58 union {
nucho 1:ff0ec969dad1 59 uint32_t real;
nucho 1:ff0ec969dad1 60 uint32_t base;
nucho 0:77afd7560544 61 } u_nsec;
nucho 0:77afd7560544 62 u_nsec.base = 0;
nucho 0:77afd7560544 63 u_nsec.base |= ((typeof(u_nsec.base)) (*(inbuffer + offset + 0))) << (8 * 0);
nucho 0:77afd7560544 64 u_nsec.base |= ((typeof(u_nsec.base)) (*(inbuffer + offset + 1))) << (8 * 1);
nucho 0:77afd7560544 65 u_nsec.base |= ((typeof(u_nsec.base)) (*(inbuffer + offset + 2))) << (8 * 2);
nucho 0:77afd7560544 66 u_nsec.base |= ((typeof(u_nsec.base)) (*(inbuffer + offset + 3))) << (8 * 3);
nucho 0:77afd7560544 67 this->data.nsec = u_nsec.real;
nucho 0:77afd7560544 68 offset += sizeof(this->data.nsec);
nucho 0:77afd7560544 69 return offset;
nucho 0:77afd7560544 70 }
nucho 0:77afd7560544 71
nucho 0:77afd7560544 72 virtual const char * getType(){ return "std_msgs/Time"; };
nucho 0:77afd7560544 73
nucho 0:77afd7560544 74 };
nucho 0:77afd7560544 75
nucho 0:77afd7560544 76 }
nucho 0:77afd7560544 77 #endif