![](/media/cache/profiles/94aef38441efa3380a3bed3faf1f9d5d.50x50_q85.jpg)
This program is porting rosserial_arduino for mbed http://www.ros.org/wiki/rosserial_arduino This program supported the revision of 169 of rosserial. This program contains an example.
Dependencies: rosserial_mbed_lib mbed Servo
std_msgs/Int64.h@0:06fc856e99ca, 2011-08-19 (annotated)
- Committer:
- nucho
- Date:
- Fri Aug 19 09:06:16 2011 +0000
- Revision:
- 0:06fc856e99ca
- Child:
- 1:098e75fd5ad2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nucho | 0:06fc856e99ca | 1 | #ifndef ros_Int64_h |
nucho | 0:06fc856e99ca | 2 | #define ros_Int64_h |
nucho | 0:06fc856e99ca | 3 | |
nucho | 0:06fc856e99ca | 4 | #include <stdint.h> |
nucho | 0:06fc856e99ca | 5 | #include <string.h> |
nucho | 0:06fc856e99ca | 6 | #include <stdlib.h> |
nucho | 0:06fc856e99ca | 7 | #include "../ros/msg.h" |
nucho | 0:06fc856e99ca | 8 | |
nucho | 0:06fc856e99ca | 9 | namespace std_msgs |
nucho | 0:06fc856e99ca | 10 | { |
nucho | 0:06fc856e99ca | 11 | |
nucho | 0:06fc856e99ca | 12 | class Int64 : public ros::Msg |
nucho | 0:06fc856e99ca | 13 | { |
nucho | 0:06fc856e99ca | 14 | public: |
nucho | 0:06fc856e99ca | 15 | long data; |
nucho | 0:06fc856e99ca | 16 | |
nucho | 0:06fc856e99ca | 17 | virtual int serialize(unsigned char *outbuffer) |
nucho | 0:06fc856e99ca | 18 | { |
nucho | 0:06fc856e99ca | 19 | int offset = 0; |
nucho | 0:06fc856e99ca | 20 | *(outbuffer + offset++) = (data >> (8 * 0)) & 0xFF; |
nucho | 0:06fc856e99ca | 21 | *(outbuffer + offset++) = (data >> (8 * 1)) & 0xFF; |
nucho | 0:06fc856e99ca | 22 | *(outbuffer + offset++) = (data >> (8 * 2)) & 0xFF; |
nucho | 0:06fc856e99ca | 23 | *(outbuffer + offset++) = (data >> (8 * 3)) & 0xFF; |
nucho | 0:06fc856e99ca | 24 | *(outbuffer + offset++) = (data > 0) ? 0: 255; |
nucho | 0:06fc856e99ca | 25 | *(outbuffer + offset++) = (data > 0) ? 0: 255; |
nucho | 0:06fc856e99ca | 26 | *(outbuffer + offset++) = (data > 0) ? 0: 255; |
nucho | 0:06fc856e99ca | 27 | *(outbuffer + offset++) = (data > 0) ? 0: 255; |
nucho | 0:06fc856e99ca | 28 | return offset; |
nucho | 0:06fc856e99ca | 29 | } |
nucho | 0:06fc856e99ca | 30 | |
nucho | 0:06fc856e99ca | 31 | virtual int deserialize(unsigned char *inbuffer) |
nucho | 0:06fc856e99ca | 32 | { |
nucho | 0:06fc856e99ca | 33 | int offset = 0; |
nucho | 0:06fc856e99ca | 34 | data = 0; |
nucho | 0:06fc856e99ca | 35 | data += ((long)(*(inbuffer + offset++))) >> (8 * 0); |
nucho | 0:06fc856e99ca | 36 | data += ((long)(*(inbuffer + offset++))) >> (8 * 1); |
nucho | 0:06fc856e99ca | 37 | data += ((long)(*(inbuffer + offset++))) >> (8 * 2); |
nucho | 0:06fc856e99ca | 38 | data += ((long)(*(inbuffer + offset++))) >> (8 * 3); |
nucho | 0:06fc856e99ca | 39 | offset += 4; |
nucho | 0:06fc856e99ca | 40 | return offset; |
nucho | 0:06fc856e99ca | 41 | } |
nucho | 0:06fc856e99ca | 42 | |
nucho | 0:06fc856e99ca | 43 | virtual const char * getType(){ return "std_msgs/Int64"; }; |
nucho | 0:06fc856e99ca | 44 | |
nucho | 0:06fc856e99ca | 45 | }; |
nucho | 0:06fc856e99ca | 46 | |
nucho | 0:06fc856e99ca | 47 | } |
nucho | 0:06fc856e99ca | 48 | #endif |