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: controller_manager_msgs/ListControllers.h
- Revision:
- 0:30537dec6e0b
diff -r 000000000000 -r 30537dec6e0b controller_manager_msgs/ListControllers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controller_manager_msgs/ListControllers.h Sun Feb 15 10:53:43 2015 +0000 @@ -0,0 +1,92 @@ +#ifndef _ROS_SERVICE_ListControllers_h +#define _ROS_SERVICE_ListControllers_h +#include <stdint.h> +#include <string.h> +#include <stdlib.h> +#include "ros/msg.h" +#include "controller_manager_msgs/ControllerState.h" + +namespace controller_manager_msgs +{ + +static const char LISTCONTROLLERS[] = "controller_manager_msgs/ListControllers"; + + class ListControllersRequest : public ros::Msg + { + public: + + ListControllersRequest() + { + } + + virtual int serialize(unsigned char *outbuffer) const + { + int offset = 0; + return offset; + } + + virtual int deserialize(unsigned char *inbuffer) + { + int offset = 0; + return offset; + } + + const char * getType(){ return LISTCONTROLLERS; }; + const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; }; + + }; + + class ListControllersResponse : public ros::Msg + { + public: + uint8_t controller_length; + controller_manager_msgs::ControllerState st_controller; + controller_manager_msgs::ControllerState * controller; + + ListControllersResponse(): + controller_length(0), controller(NULL) + { + } + + virtual int serialize(unsigned char *outbuffer) const + { + int offset = 0; + *(outbuffer + offset++) = controller_length; + *(outbuffer + offset++) = 0; + *(outbuffer + offset++) = 0; + *(outbuffer + offset++) = 0; + for( uint8_t i = 0; i < controller_length; i++){ + offset += this->controller[i].serialize(outbuffer + offset); + } + return offset; + } + + virtual int deserialize(unsigned char *inbuffer) + { + int offset = 0; + uint8_t controller_lengthT = *(inbuffer + offset++); + if(controller_lengthT > controller_length) + this->controller = (controller_manager_msgs::ControllerState*)realloc(this->controller, controller_lengthT * sizeof(controller_manager_msgs::ControllerState)); + offset += 3; + controller_length = controller_lengthT; + for( uint8_t i = 0; i < controller_length; i++){ + offset += this->st_controller.deserialize(inbuffer + offset); + memcpy( &(this->controller[i]), &(this->st_controller), sizeof(controller_manager_msgs::ControllerState)); + } + return offset; + } + + const char * getType(){ return LISTCONTROLLERS; }; + const char * getMD5(){ return "12c85fca1984c8ec86264f3d00b938f2"; }; + + }; + + class ListControllers { + public: + typedef ListControllersRequest Request; + typedef ListControllersResponse Response; + }; + +} +#endif +