ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information

Dependencies:   BufferedSerial

Dependents:   rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Int16.h Source File

Int16.h

00001 #ifndef _ROS_std_msgs_Int16_h
00002 #define _ROS_std_msgs_Int16_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace std_msgs
00010 {
00011 
00012   class Int16 : public ros::Msg
00013   {
00014     public:
00015       int16_t data;
00016 
00017     Int16():
00018       data(0)
00019     {
00020     }
00021 
00022     virtual int serialize(unsigned char *outbuffer) const
00023     {
00024       int offset = 0;
00025       union {
00026         int16_t real;
00027         uint16_t base;
00028       } u_data;
00029       u_data.real = this->data;
00030       *(outbuffer + offset + 0) = (u_data.base >> (8 * 0)) & 0xFF;
00031       *(outbuffer + offset + 1) = (u_data.base >> (8 * 1)) & 0xFF;
00032       offset += sizeof(this->data);
00033       return offset;
00034     }
00035 
00036     virtual int deserialize(unsigned char *inbuffer)
00037     {
00038       int offset = 0;
00039       union {
00040         int16_t real;
00041         uint16_t base;
00042       } u_data;
00043       u_data.base = 0;
00044       u_data.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
00045       u_data.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00046       this->data = u_data.real;
00047       offset += sizeof(this->data);
00048      return offset;
00049     }
00050 
00051     const char * getType(){ return "std_msgs/Int16"; };
00052     const char * getMD5(){ return "8524586e34fbd7cb1c08c5f5f1ca0e57"; };
00053 
00054   };
00055 
00056 }
00057 #endif