Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Tablet.h
00001 #ifndef _ROS_jsk_gui_msgs_Tablet_h 00002 #define _ROS_jsk_gui_msgs_Tablet_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 #include "std_msgs/Header.h" 00009 #include "jsk_gui_msgs/Action.h" 00010 #include "jsk_gui_msgs/DeviceSensor.h" 00011 #include "jsk_gui_msgs/Touch.h" 00012 00013 namespace jsk_gui_msgs 00014 { 00015 00016 class Tablet : public ros::Msg 00017 { 00018 public: 00019 typedef std_msgs::Header _header_type; 00020 _header_type header; 00021 typedef const char* _hardware_name_type; 00022 _hardware_name_type hardware_name; 00023 typedef const char* _hardware_id_type; 00024 _hardware_id_type hardware_id; 00025 typedef jsk_gui_msgs::Action _action_type; 00026 _action_type action; 00027 typedef jsk_gui_msgs::DeviceSensor _sensor_type; 00028 _sensor_type sensor; 00029 uint32_t touches_length; 00030 typedef jsk_gui_msgs::Touch _touches_type; 00031 _touches_type st_touches; 00032 _touches_type * touches; 00033 00034 Tablet(): 00035 header(), 00036 hardware_name(""), 00037 hardware_id(""), 00038 action(), 00039 sensor(), 00040 touches_length(0), touches(NULL) 00041 { 00042 } 00043 00044 virtual int serialize(unsigned char *outbuffer) const 00045 { 00046 int offset = 0; 00047 offset += this->header.serialize(outbuffer + offset); 00048 uint32_t length_hardware_name = strlen(this->hardware_name); 00049 varToArr(outbuffer + offset, length_hardware_name); 00050 offset += 4; 00051 memcpy(outbuffer + offset, this->hardware_name, length_hardware_name); 00052 offset += length_hardware_name; 00053 uint32_t length_hardware_id = strlen(this->hardware_id); 00054 varToArr(outbuffer + offset, length_hardware_id); 00055 offset += 4; 00056 memcpy(outbuffer + offset, this->hardware_id, length_hardware_id); 00057 offset += length_hardware_id; 00058 offset += this->action.serialize(outbuffer + offset); 00059 offset += this->sensor.serialize(outbuffer + offset); 00060 *(outbuffer + offset + 0) = (this->touches_length >> (8 * 0)) & 0xFF; 00061 *(outbuffer + offset + 1) = (this->touches_length >> (8 * 1)) & 0xFF; 00062 *(outbuffer + offset + 2) = (this->touches_length >> (8 * 2)) & 0xFF; 00063 *(outbuffer + offset + 3) = (this->touches_length >> (8 * 3)) & 0xFF; 00064 offset += sizeof(this->touches_length); 00065 for( uint32_t i = 0; i < touches_length; i++){ 00066 offset += this->touches[i].serialize(outbuffer + offset); 00067 } 00068 return offset; 00069 } 00070 00071 virtual int deserialize(unsigned char *inbuffer) 00072 { 00073 int offset = 0; 00074 offset += this->header.deserialize(inbuffer + offset); 00075 uint32_t length_hardware_name; 00076 arrToVar(length_hardware_name, (inbuffer + offset)); 00077 offset += 4; 00078 for(unsigned int k= offset; k< offset+length_hardware_name; ++k){ 00079 inbuffer[k-1]=inbuffer[k]; 00080 } 00081 inbuffer[offset+length_hardware_name-1]=0; 00082 this->hardware_name = (char *)(inbuffer + offset-1); 00083 offset += length_hardware_name; 00084 uint32_t length_hardware_id; 00085 arrToVar(length_hardware_id, (inbuffer + offset)); 00086 offset += 4; 00087 for(unsigned int k= offset; k< offset+length_hardware_id; ++k){ 00088 inbuffer[k-1]=inbuffer[k]; 00089 } 00090 inbuffer[offset+length_hardware_id-1]=0; 00091 this->hardware_id = (char *)(inbuffer + offset-1); 00092 offset += length_hardware_id; 00093 offset += this->action.deserialize(inbuffer + offset); 00094 offset += this->sensor.deserialize(inbuffer + offset); 00095 uint32_t touches_lengthT = ((uint32_t) (*(inbuffer + offset))); 00096 touches_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00097 touches_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00098 touches_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00099 offset += sizeof(this->touches_length); 00100 if(touches_lengthT > touches_length) 00101 this->touches = (jsk_gui_msgs::Touch*)realloc(this->touches, touches_lengthT * sizeof(jsk_gui_msgs::Touch)); 00102 touches_length = touches_lengthT; 00103 for( uint32_t i = 0; i < touches_length; i++){ 00104 offset += this->st_touches.deserialize(inbuffer + offset); 00105 memcpy( &(this->touches[i]), &(this->st_touches), sizeof(jsk_gui_msgs::Touch)); 00106 } 00107 return offset; 00108 } 00109 00110 virtual const char * getType(){ return "jsk_gui_msgs/Tablet"; }; 00111 virtual const char * getMD5(){ return "0bab196c7b214826d8c27d7bd5f924f6"; }; 00112 00113 }; 00114 00115 } 00116 #endif
Generated on Mon Sep 26 2022 13:47:04 by
