ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information
Dependents: rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more
ROSSerial_mbed for Indigo Distribution
The Robot Operating System (ROS) is a flexible framework for writing robot software. It is a collection of tools, libraries, and conventions that aim to simplify the task of creating complex and robust robot behavior across a wide variety of robotic platforms.
The rosserial_mbed package allows to write ROS nodes on any mbed enabled devices and have them connected to a running ROS system on your computer using the serial port.
Hello World (example publisher)
Import programrosserial_mbed_hello_world_publisher
rosserial_mbed Hello World
Running the Code
Now, launch the roscore in a new terminal window:
Quote:
$ roscore
Next, run the rosserial client application that forwards your MBED messages to the rest of ROS. Make sure to use the correct serial port:
Quote:
$ rosrun rosserial_python serial_node.py /dev/ttyACM0
Finally, watch the greetings come in from your MBED by launching a new terminal window and entering :
Quote:
$ rostopic echo chatter
See Also
More examples
Blink
/* * rosserial Subscriber Example * Blinks an LED on callback */ #include "mbed.h" #include <ros.h> #include <std_msgs/Empty.h> ros::NodeHandle nh; DigitalOut myled(LED1); void messageCb(const std_msgs::Empty& toggle_msg){ myled = !myled; // blink the led } ros::Subscriber<std_msgs::Empty> sub("toggle_led", &messageCb); int main() { nh.initNode(); nh.subscribe(sub); while (1) { nh.spinOnce(); wait_ms(1); } }
Push
/* * Button Example for Rosserial */ #include "mbed.h" #include <ros.h> #include <std_msgs/Bool.h> PinName button = p20; ros::NodeHandle nh; std_msgs::Bool pushed_msg; ros::Publisher pub_button("pushed", &pushed_msg); DigitalIn button_pin(button); DigitalOut led_pin(LED1); bool last_reading; long last_debounce_time=0; long debounce_delay=50; bool published = true; Timer t; int main() { t.start(); nh.initNode(); nh.advertise(pub_button); //Enable the pullup resistor on the button button_pin.mode(PullUp); //The button is a normally button last_reading = ! button_pin; while (1) { bool reading = ! button_pin; if (last_reading!= reading) { last_debounce_time = t.read_ms(); published = false; } //if the button value has not changed for the debounce delay, we know its stable if ( !published && (t.read_ms() - last_debounce_time) > debounce_delay) { led_pin = reading; pushed_msg.data = reading; pub_button.publish(&pushed_msg); published = true; } last_reading = reading; nh.spinOnce(); } }
gazebo_msgs/GetLinkProperties.h@0:fd24f7ca9688, 2016-03-31 (annotated)
- Committer:
- garyservin
- Date:
- Thu Mar 31 14:22:59 2016 +0000
- Revision:
- 0:fd24f7ca9688
Initial commit, generated based on a clean indigo-desktop-full
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garyservin | 0:fd24f7ca9688 | 1 | #ifndef _ROS_SERVICE_GetLinkProperties_h |
garyservin | 0:fd24f7ca9688 | 2 | #define _ROS_SERVICE_GetLinkProperties_h |
garyservin | 0:fd24f7ca9688 | 3 | #include <stdint.h> |
garyservin | 0:fd24f7ca9688 | 4 | #include <string.h> |
garyservin | 0:fd24f7ca9688 | 5 | #include <stdlib.h> |
garyservin | 0:fd24f7ca9688 | 6 | #include "ros/msg.h" |
garyservin | 0:fd24f7ca9688 | 7 | #include "geometry_msgs/Pose.h" |
garyservin | 0:fd24f7ca9688 | 8 | |
garyservin | 0:fd24f7ca9688 | 9 | namespace gazebo_msgs |
garyservin | 0:fd24f7ca9688 | 10 | { |
garyservin | 0:fd24f7ca9688 | 11 | |
garyservin | 0:fd24f7ca9688 | 12 | static const char GETLINKPROPERTIES[] = "gazebo_msgs/GetLinkProperties"; |
garyservin | 0:fd24f7ca9688 | 13 | |
garyservin | 0:fd24f7ca9688 | 14 | class GetLinkPropertiesRequest : public ros::Msg |
garyservin | 0:fd24f7ca9688 | 15 | { |
garyservin | 0:fd24f7ca9688 | 16 | public: |
garyservin | 0:fd24f7ca9688 | 17 | const char* link_name; |
garyservin | 0:fd24f7ca9688 | 18 | |
garyservin | 0:fd24f7ca9688 | 19 | GetLinkPropertiesRequest(): |
garyservin | 0:fd24f7ca9688 | 20 | link_name("") |
garyservin | 0:fd24f7ca9688 | 21 | { |
garyservin | 0:fd24f7ca9688 | 22 | } |
garyservin | 0:fd24f7ca9688 | 23 | |
garyservin | 0:fd24f7ca9688 | 24 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:fd24f7ca9688 | 25 | { |
garyservin | 0:fd24f7ca9688 | 26 | int offset = 0; |
garyservin | 0:fd24f7ca9688 | 27 | uint32_t length_link_name = strlen(this->link_name); |
garyservin | 0:fd24f7ca9688 | 28 | memcpy(outbuffer + offset, &length_link_name, sizeof(uint32_t)); |
garyservin | 0:fd24f7ca9688 | 29 | offset += 4; |
garyservin | 0:fd24f7ca9688 | 30 | memcpy(outbuffer + offset, this->link_name, length_link_name); |
garyservin | 0:fd24f7ca9688 | 31 | offset += length_link_name; |
garyservin | 0:fd24f7ca9688 | 32 | return offset; |
garyservin | 0:fd24f7ca9688 | 33 | } |
garyservin | 0:fd24f7ca9688 | 34 | |
garyservin | 0:fd24f7ca9688 | 35 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:fd24f7ca9688 | 36 | { |
garyservin | 0:fd24f7ca9688 | 37 | int offset = 0; |
garyservin | 0:fd24f7ca9688 | 38 | uint32_t length_link_name; |
garyservin | 0:fd24f7ca9688 | 39 | memcpy(&length_link_name, (inbuffer + offset), sizeof(uint32_t)); |
garyservin | 0:fd24f7ca9688 | 40 | offset += 4; |
garyservin | 0:fd24f7ca9688 | 41 | for(unsigned int k= offset; k< offset+length_link_name; ++k){ |
garyservin | 0:fd24f7ca9688 | 42 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:fd24f7ca9688 | 43 | } |
garyservin | 0:fd24f7ca9688 | 44 | inbuffer[offset+length_link_name-1]=0; |
garyservin | 0:fd24f7ca9688 | 45 | this->link_name = (char *)(inbuffer + offset-1); |
garyservin | 0:fd24f7ca9688 | 46 | offset += length_link_name; |
garyservin | 0:fd24f7ca9688 | 47 | return offset; |
garyservin | 0:fd24f7ca9688 | 48 | } |
garyservin | 0:fd24f7ca9688 | 49 | |
garyservin | 0:fd24f7ca9688 | 50 | const char * getType(){ return GETLINKPROPERTIES; }; |
garyservin | 0:fd24f7ca9688 | 51 | const char * getMD5(){ return "7d82d60381f1b66a30f2157f60884345"; }; |
garyservin | 0:fd24f7ca9688 | 52 | |
garyservin | 0:fd24f7ca9688 | 53 | }; |
garyservin | 0:fd24f7ca9688 | 54 | |
garyservin | 0:fd24f7ca9688 | 55 | class GetLinkPropertiesResponse : public ros::Msg |
garyservin | 0:fd24f7ca9688 | 56 | { |
garyservin | 0:fd24f7ca9688 | 57 | public: |
garyservin | 0:fd24f7ca9688 | 58 | geometry_msgs::Pose com; |
garyservin | 0:fd24f7ca9688 | 59 | bool gravity_mode; |
garyservin | 0:fd24f7ca9688 | 60 | double mass; |
garyservin | 0:fd24f7ca9688 | 61 | double ixx; |
garyservin | 0:fd24f7ca9688 | 62 | double ixy; |
garyservin | 0:fd24f7ca9688 | 63 | double ixz; |
garyservin | 0:fd24f7ca9688 | 64 | double iyy; |
garyservin | 0:fd24f7ca9688 | 65 | double iyz; |
garyservin | 0:fd24f7ca9688 | 66 | double izz; |
garyservin | 0:fd24f7ca9688 | 67 | bool success; |
garyservin | 0:fd24f7ca9688 | 68 | const char* status_message; |
garyservin | 0:fd24f7ca9688 | 69 | |
garyservin | 0:fd24f7ca9688 | 70 | GetLinkPropertiesResponse(): |
garyservin | 0:fd24f7ca9688 | 71 | com(), |
garyservin | 0:fd24f7ca9688 | 72 | gravity_mode(0), |
garyservin | 0:fd24f7ca9688 | 73 | mass(0), |
garyservin | 0:fd24f7ca9688 | 74 | ixx(0), |
garyservin | 0:fd24f7ca9688 | 75 | ixy(0), |
garyservin | 0:fd24f7ca9688 | 76 | ixz(0), |
garyservin | 0:fd24f7ca9688 | 77 | iyy(0), |
garyservin | 0:fd24f7ca9688 | 78 | iyz(0), |
garyservin | 0:fd24f7ca9688 | 79 | izz(0), |
garyservin | 0:fd24f7ca9688 | 80 | success(0), |
garyservin | 0:fd24f7ca9688 | 81 | status_message("") |
garyservin | 0:fd24f7ca9688 | 82 | { |
garyservin | 0:fd24f7ca9688 | 83 | } |
garyservin | 0:fd24f7ca9688 | 84 | |
garyservin | 0:fd24f7ca9688 | 85 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:fd24f7ca9688 | 86 | { |
garyservin | 0:fd24f7ca9688 | 87 | int offset = 0; |
garyservin | 0:fd24f7ca9688 | 88 | offset += this->com.serialize(outbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 89 | union { |
garyservin | 0:fd24f7ca9688 | 90 | bool real; |
garyservin | 0:fd24f7ca9688 | 91 | uint8_t base; |
garyservin | 0:fd24f7ca9688 | 92 | } u_gravity_mode; |
garyservin | 0:fd24f7ca9688 | 93 | u_gravity_mode.real = this->gravity_mode; |
garyservin | 0:fd24f7ca9688 | 94 | *(outbuffer + offset + 0) = (u_gravity_mode.base >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 95 | offset += sizeof(this->gravity_mode); |
garyservin | 0:fd24f7ca9688 | 96 | union { |
garyservin | 0:fd24f7ca9688 | 97 | double real; |
garyservin | 0:fd24f7ca9688 | 98 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 99 | } u_mass; |
garyservin | 0:fd24f7ca9688 | 100 | u_mass.real = this->mass; |
garyservin | 0:fd24f7ca9688 | 101 | *(outbuffer + offset + 0) = (u_mass.base >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 102 | *(outbuffer + offset + 1) = (u_mass.base >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 103 | *(outbuffer + offset + 2) = (u_mass.base >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 104 | *(outbuffer + offset + 3) = (u_mass.base >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 105 | *(outbuffer + offset + 4) = (u_mass.base >> (8 * 4)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 106 | *(outbuffer + offset + 5) = (u_mass.base >> (8 * 5)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 107 | *(outbuffer + offset + 6) = (u_mass.base >> (8 * 6)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 108 | *(outbuffer + offset + 7) = (u_mass.base >> (8 * 7)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 109 | offset += sizeof(this->mass); |
garyservin | 0:fd24f7ca9688 | 110 | union { |
garyservin | 0:fd24f7ca9688 | 111 | double real; |
garyservin | 0:fd24f7ca9688 | 112 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 113 | } u_ixx; |
garyservin | 0:fd24f7ca9688 | 114 | u_ixx.real = this->ixx; |
garyservin | 0:fd24f7ca9688 | 115 | *(outbuffer + offset + 0) = (u_ixx.base >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 116 | *(outbuffer + offset + 1) = (u_ixx.base >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 117 | *(outbuffer + offset + 2) = (u_ixx.base >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 118 | *(outbuffer + offset + 3) = (u_ixx.base >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 119 | *(outbuffer + offset + 4) = (u_ixx.base >> (8 * 4)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 120 | *(outbuffer + offset + 5) = (u_ixx.base >> (8 * 5)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 121 | *(outbuffer + offset + 6) = (u_ixx.base >> (8 * 6)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 122 | *(outbuffer + offset + 7) = (u_ixx.base >> (8 * 7)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 123 | offset += sizeof(this->ixx); |
garyservin | 0:fd24f7ca9688 | 124 | union { |
garyservin | 0:fd24f7ca9688 | 125 | double real; |
garyservin | 0:fd24f7ca9688 | 126 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 127 | } u_ixy; |
garyservin | 0:fd24f7ca9688 | 128 | u_ixy.real = this->ixy; |
garyservin | 0:fd24f7ca9688 | 129 | *(outbuffer + offset + 0) = (u_ixy.base >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 130 | *(outbuffer + offset + 1) = (u_ixy.base >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 131 | *(outbuffer + offset + 2) = (u_ixy.base >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 132 | *(outbuffer + offset + 3) = (u_ixy.base >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 133 | *(outbuffer + offset + 4) = (u_ixy.base >> (8 * 4)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 134 | *(outbuffer + offset + 5) = (u_ixy.base >> (8 * 5)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 135 | *(outbuffer + offset + 6) = (u_ixy.base >> (8 * 6)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 136 | *(outbuffer + offset + 7) = (u_ixy.base >> (8 * 7)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 137 | offset += sizeof(this->ixy); |
garyservin | 0:fd24f7ca9688 | 138 | union { |
garyservin | 0:fd24f7ca9688 | 139 | double real; |
garyservin | 0:fd24f7ca9688 | 140 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 141 | } u_ixz; |
garyservin | 0:fd24f7ca9688 | 142 | u_ixz.real = this->ixz; |
garyservin | 0:fd24f7ca9688 | 143 | *(outbuffer + offset + 0) = (u_ixz.base >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 144 | *(outbuffer + offset + 1) = (u_ixz.base >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 145 | *(outbuffer + offset + 2) = (u_ixz.base >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 146 | *(outbuffer + offset + 3) = (u_ixz.base >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 147 | *(outbuffer + offset + 4) = (u_ixz.base >> (8 * 4)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 148 | *(outbuffer + offset + 5) = (u_ixz.base >> (8 * 5)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 149 | *(outbuffer + offset + 6) = (u_ixz.base >> (8 * 6)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 150 | *(outbuffer + offset + 7) = (u_ixz.base >> (8 * 7)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 151 | offset += sizeof(this->ixz); |
garyservin | 0:fd24f7ca9688 | 152 | union { |
garyservin | 0:fd24f7ca9688 | 153 | double real; |
garyservin | 0:fd24f7ca9688 | 154 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 155 | } u_iyy; |
garyservin | 0:fd24f7ca9688 | 156 | u_iyy.real = this->iyy; |
garyservin | 0:fd24f7ca9688 | 157 | *(outbuffer + offset + 0) = (u_iyy.base >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 158 | *(outbuffer + offset + 1) = (u_iyy.base >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 159 | *(outbuffer + offset + 2) = (u_iyy.base >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 160 | *(outbuffer + offset + 3) = (u_iyy.base >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 161 | *(outbuffer + offset + 4) = (u_iyy.base >> (8 * 4)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 162 | *(outbuffer + offset + 5) = (u_iyy.base >> (8 * 5)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 163 | *(outbuffer + offset + 6) = (u_iyy.base >> (8 * 6)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 164 | *(outbuffer + offset + 7) = (u_iyy.base >> (8 * 7)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 165 | offset += sizeof(this->iyy); |
garyservin | 0:fd24f7ca9688 | 166 | union { |
garyservin | 0:fd24f7ca9688 | 167 | double real; |
garyservin | 0:fd24f7ca9688 | 168 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 169 | } u_iyz; |
garyservin | 0:fd24f7ca9688 | 170 | u_iyz.real = this->iyz; |
garyservin | 0:fd24f7ca9688 | 171 | *(outbuffer + offset + 0) = (u_iyz.base >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 172 | *(outbuffer + offset + 1) = (u_iyz.base >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 173 | *(outbuffer + offset + 2) = (u_iyz.base >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 174 | *(outbuffer + offset + 3) = (u_iyz.base >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 175 | *(outbuffer + offset + 4) = (u_iyz.base >> (8 * 4)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 176 | *(outbuffer + offset + 5) = (u_iyz.base >> (8 * 5)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 177 | *(outbuffer + offset + 6) = (u_iyz.base >> (8 * 6)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 178 | *(outbuffer + offset + 7) = (u_iyz.base >> (8 * 7)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 179 | offset += sizeof(this->iyz); |
garyservin | 0:fd24f7ca9688 | 180 | union { |
garyservin | 0:fd24f7ca9688 | 181 | double real; |
garyservin | 0:fd24f7ca9688 | 182 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 183 | } u_izz; |
garyservin | 0:fd24f7ca9688 | 184 | u_izz.real = this->izz; |
garyservin | 0:fd24f7ca9688 | 185 | *(outbuffer + offset + 0) = (u_izz.base >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 186 | *(outbuffer + offset + 1) = (u_izz.base >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 187 | *(outbuffer + offset + 2) = (u_izz.base >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 188 | *(outbuffer + offset + 3) = (u_izz.base >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 189 | *(outbuffer + offset + 4) = (u_izz.base >> (8 * 4)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 190 | *(outbuffer + offset + 5) = (u_izz.base >> (8 * 5)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 191 | *(outbuffer + offset + 6) = (u_izz.base >> (8 * 6)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 192 | *(outbuffer + offset + 7) = (u_izz.base >> (8 * 7)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 193 | offset += sizeof(this->izz); |
garyservin | 0:fd24f7ca9688 | 194 | union { |
garyservin | 0:fd24f7ca9688 | 195 | bool real; |
garyservin | 0:fd24f7ca9688 | 196 | uint8_t base; |
garyservin | 0:fd24f7ca9688 | 197 | } u_success; |
garyservin | 0:fd24f7ca9688 | 198 | u_success.real = this->success; |
garyservin | 0:fd24f7ca9688 | 199 | *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 200 | offset += sizeof(this->success); |
garyservin | 0:fd24f7ca9688 | 201 | uint32_t length_status_message = strlen(this->status_message); |
garyservin | 0:fd24f7ca9688 | 202 | memcpy(outbuffer + offset, &length_status_message, sizeof(uint32_t)); |
garyservin | 0:fd24f7ca9688 | 203 | offset += 4; |
garyservin | 0:fd24f7ca9688 | 204 | memcpy(outbuffer + offset, this->status_message, length_status_message); |
garyservin | 0:fd24f7ca9688 | 205 | offset += length_status_message; |
garyservin | 0:fd24f7ca9688 | 206 | return offset; |
garyservin | 0:fd24f7ca9688 | 207 | } |
garyservin | 0:fd24f7ca9688 | 208 | |
garyservin | 0:fd24f7ca9688 | 209 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:fd24f7ca9688 | 210 | { |
garyservin | 0:fd24f7ca9688 | 211 | int offset = 0; |
garyservin | 0:fd24f7ca9688 | 212 | offset += this->com.deserialize(inbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 213 | union { |
garyservin | 0:fd24f7ca9688 | 214 | bool real; |
garyservin | 0:fd24f7ca9688 | 215 | uint8_t base; |
garyservin | 0:fd24f7ca9688 | 216 | } u_gravity_mode; |
garyservin | 0:fd24f7ca9688 | 217 | u_gravity_mode.base = 0; |
garyservin | 0:fd24f7ca9688 | 218 | u_gravity_mode.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:fd24f7ca9688 | 219 | this->gravity_mode = u_gravity_mode.real; |
garyservin | 0:fd24f7ca9688 | 220 | offset += sizeof(this->gravity_mode); |
garyservin | 0:fd24f7ca9688 | 221 | union { |
garyservin | 0:fd24f7ca9688 | 222 | double real; |
garyservin | 0:fd24f7ca9688 | 223 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 224 | } u_mass; |
garyservin | 0:fd24f7ca9688 | 225 | u_mass.base = 0; |
garyservin | 0:fd24f7ca9688 | 226 | u_mass.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:fd24f7ca9688 | 227 | u_mass.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 228 | u_mass.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 229 | u_mass.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 230 | u_mass.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
garyservin | 0:fd24f7ca9688 | 231 | u_mass.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
garyservin | 0:fd24f7ca9688 | 232 | u_mass.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
garyservin | 0:fd24f7ca9688 | 233 | u_mass.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
garyservin | 0:fd24f7ca9688 | 234 | this->mass = u_mass.real; |
garyservin | 0:fd24f7ca9688 | 235 | offset += sizeof(this->mass); |
garyservin | 0:fd24f7ca9688 | 236 | union { |
garyservin | 0:fd24f7ca9688 | 237 | double real; |
garyservin | 0:fd24f7ca9688 | 238 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 239 | } u_ixx; |
garyservin | 0:fd24f7ca9688 | 240 | u_ixx.base = 0; |
garyservin | 0:fd24f7ca9688 | 241 | u_ixx.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:fd24f7ca9688 | 242 | u_ixx.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 243 | u_ixx.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 244 | u_ixx.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 245 | u_ixx.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
garyservin | 0:fd24f7ca9688 | 246 | u_ixx.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
garyservin | 0:fd24f7ca9688 | 247 | u_ixx.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
garyservin | 0:fd24f7ca9688 | 248 | u_ixx.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
garyservin | 0:fd24f7ca9688 | 249 | this->ixx = u_ixx.real; |
garyservin | 0:fd24f7ca9688 | 250 | offset += sizeof(this->ixx); |
garyservin | 0:fd24f7ca9688 | 251 | union { |
garyservin | 0:fd24f7ca9688 | 252 | double real; |
garyservin | 0:fd24f7ca9688 | 253 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 254 | } u_ixy; |
garyservin | 0:fd24f7ca9688 | 255 | u_ixy.base = 0; |
garyservin | 0:fd24f7ca9688 | 256 | u_ixy.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:fd24f7ca9688 | 257 | u_ixy.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 258 | u_ixy.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 259 | u_ixy.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 260 | u_ixy.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
garyservin | 0:fd24f7ca9688 | 261 | u_ixy.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
garyservin | 0:fd24f7ca9688 | 262 | u_ixy.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
garyservin | 0:fd24f7ca9688 | 263 | u_ixy.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
garyservin | 0:fd24f7ca9688 | 264 | this->ixy = u_ixy.real; |
garyservin | 0:fd24f7ca9688 | 265 | offset += sizeof(this->ixy); |
garyservin | 0:fd24f7ca9688 | 266 | union { |
garyservin | 0:fd24f7ca9688 | 267 | double real; |
garyservin | 0:fd24f7ca9688 | 268 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 269 | } u_ixz; |
garyservin | 0:fd24f7ca9688 | 270 | u_ixz.base = 0; |
garyservin | 0:fd24f7ca9688 | 271 | u_ixz.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:fd24f7ca9688 | 272 | u_ixz.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 273 | u_ixz.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 274 | u_ixz.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 275 | u_ixz.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
garyservin | 0:fd24f7ca9688 | 276 | u_ixz.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
garyservin | 0:fd24f7ca9688 | 277 | u_ixz.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
garyservin | 0:fd24f7ca9688 | 278 | u_ixz.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
garyservin | 0:fd24f7ca9688 | 279 | this->ixz = u_ixz.real; |
garyservin | 0:fd24f7ca9688 | 280 | offset += sizeof(this->ixz); |
garyservin | 0:fd24f7ca9688 | 281 | union { |
garyservin | 0:fd24f7ca9688 | 282 | double real; |
garyservin | 0:fd24f7ca9688 | 283 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 284 | } u_iyy; |
garyservin | 0:fd24f7ca9688 | 285 | u_iyy.base = 0; |
garyservin | 0:fd24f7ca9688 | 286 | u_iyy.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:fd24f7ca9688 | 287 | u_iyy.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 288 | u_iyy.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 289 | u_iyy.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 290 | u_iyy.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
garyservin | 0:fd24f7ca9688 | 291 | u_iyy.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
garyservin | 0:fd24f7ca9688 | 292 | u_iyy.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
garyservin | 0:fd24f7ca9688 | 293 | u_iyy.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
garyservin | 0:fd24f7ca9688 | 294 | this->iyy = u_iyy.real; |
garyservin | 0:fd24f7ca9688 | 295 | offset += sizeof(this->iyy); |
garyservin | 0:fd24f7ca9688 | 296 | union { |
garyservin | 0:fd24f7ca9688 | 297 | double real; |
garyservin | 0:fd24f7ca9688 | 298 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 299 | } u_iyz; |
garyservin | 0:fd24f7ca9688 | 300 | u_iyz.base = 0; |
garyservin | 0:fd24f7ca9688 | 301 | u_iyz.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:fd24f7ca9688 | 302 | u_iyz.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 303 | u_iyz.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 304 | u_iyz.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 305 | u_iyz.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
garyservin | 0:fd24f7ca9688 | 306 | u_iyz.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
garyservin | 0:fd24f7ca9688 | 307 | u_iyz.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
garyservin | 0:fd24f7ca9688 | 308 | u_iyz.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
garyservin | 0:fd24f7ca9688 | 309 | this->iyz = u_iyz.real; |
garyservin | 0:fd24f7ca9688 | 310 | offset += sizeof(this->iyz); |
garyservin | 0:fd24f7ca9688 | 311 | union { |
garyservin | 0:fd24f7ca9688 | 312 | double real; |
garyservin | 0:fd24f7ca9688 | 313 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 314 | } u_izz; |
garyservin | 0:fd24f7ca9688 | 315 | u_izz.base = 0; |
garyservin | 0:fd24f7ca9688 | 316 | u_izz.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:fd24f7ca9688 | 317 | u_izz.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 318 | u_izz.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 319 | u_izz.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 320 | u_izz.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
garyservin | 0:fd24f7ca9688 | 321 | u_izz.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
garyservin | 0:fd24f7ca9688 | 322 | u_izz.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
garyservin | 0:fd24f7ca9688 | 323 | u_izz.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
garyservin | 0:fd24f7ca9688 | 324 | this->izz = u_izz.real; |
garyservin | 0:fd24f7ca9688 | 325 | offset += sizeof(this->izz); |
garyservin | 0:fd24f7ca9688 | 326 | union { |
garyservin | 0:fd24f7ca9688 | 327 | bool real; |
garyservin | 0:fd24f7ca9688 | 328 | uint8_t base; |
garyservin | 0:fd24f7ca9688 | 329 | } u_success; |
garyservin | 0:fd24f7ca9688 | 330 | u_success.base = 0; |
garyservin | 0:fd24f7ca9688 | 331 | u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:fd24f7ca9688 | 332 | this->success = u_success.real; |
garyservin | 0:fd24f7ca9688 | 333 | offset += sizeof(this->success); |
garyservin | 0:fd24f7ca9688 | 334 | uint32_t length_status_message; |
garyservin | 0:fd24f7ca9688 | 335 | memcpy(&length_status_message, (inbuffer + offset), sizeof(uint32_t)); |
garyservin | 0:fd24f7ca9688 | 336 | offset += 4; |
garyservin | 0:fd24f7ca9688 | 337 | for(unsigned int k= offset; k< offset+length_status_message; ++k){ |
garyservin | 0:fd24f7ca9688 | 338 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:fd24f7ca9688 | 339 | } |
garyservin | 0:fd24f7ca9688 | 340 | inbuffer[offset+length_status_message-1]=0; |
garyservin | 0:fd24f7ca9688 | 341 | this->status_message = (char *)(inbuffer + offset-1); |
garyservin | 0:fd24f7ca9688 | 342 | offset += length_status_message; |
garyservin | 0:fd24f7ca9688 | 343 | return offset; |
garyservin | 0:fd24f7ca9688 | 344 | } |
garyservin | 0:fd24f7ca9688 | 345 | |
garyservin | 0:fd24f7ca9688 | 346 | const char * getType(){ return GETLINKPROPERTIES; }; |
garyservin | 0:fd24f7ca9688 | 347 | const char * getMD5(){ return "a8619f92d17cfcc3958c0fd13299443d"; }; |
garyservin | 0:fd24f7ca9688 | 348 | |
garyservin | 0:fd24f7ca9688 | 349 | }; |
garyservin | 0:fd24f7ca9688 | 350 | |
garyservin | 0:fd24f7ca9688 | 351 | class GetLinkProperties { |
garyservin | 0:fd24f7ca9688 | 352 | public: |
garyservin | 0:fd24f7ca9688 | 353 | typedef GetLinkPropertiesRequest Request; |
garyservin | 0:fd24f7ca9688 | 354 | typedef GetLinkPropertiesResponse Response; |
garyservin | 0:fd24f7ca9688 | 355 | }; |
garyservin | 0:fd24f7ca9688 | 356 | |
garyservin | 0:fd24f7ca9688 | 357 | } |
garyservin | 0:fd24f7ca9688 | 358 | #endif |