rosserial library for mbed Inspired by nucho's rosserial library This library is still under development
Dependents: mbed_roshydro_test
Library still under development!
Diff: ur_msgs/Digital.h
- Revision:
- 0:30537dec6e0b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ur_msgs/Digital.h Sun Feb 15 10:53:43 2015 +0000 @@ -0,0 +1,61 @@ +#ifndef _ROS_ur_msgs_Digital_h +#define _ROS_ur_msgs_Digital_h + +#include <stdint.h> +#include <string.h> +#include <stdlib.h> +#include "ros/msg.h" + +namespace ur_msgs +{ + + class Digital : public ros::Msg + { + public: + uint8_t pin; + bool state; + + Digital(): + pin(0), + state(0) + { + } + + virtual int serialize(unsigned char *outbuffer) const + { + int offset = 0; + *(outbuffer + offset + 0) = (this->pin >> (8 * 0)) & 0xFF; + offset += sizeof(this->pin); + union { + bool real; + uint8_t base; + } u_state; + u_state.real = this->state; + *(outbuffer + offset + 0) = (u_state.base >> (8 * 0)) & 0xFF; + offset += sizeof(this->state); + return offset; + } + + virtual int deserialize(unsigned char *inbuffer) + { + int offset = 0; + this->pin = ((uint8_t) (*(inbuffer + offset))); + offset += sizeof(this->pin); + union { + bool real; + uint8_t base; + } u_state; + u_state.base = 0; + u_state.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); + this->state = u_state.real; + offset += sizeof(this->state); + return offset; + } + + const char * getType(){ return "ur_msgs/Digital"; }; + const char * getMD5(){ return "83707be3fa18d2ffe57381ea034aa262"; }; + + }; + +} +#endif