catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SoundRequestFeedback.h Source File

SoundRequestFeedback.h

00001 #ifndef _ROS_sound_play_SoundRequestFeedback_h
00002 #define _ROS_sound_play_SoundRequestFeedback_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "ros/time.h"
00009 
00010 namespace sound_play
00011 {
00012 
00013   class SoundRequestFeedback : public ros::Msg
00014   {
00015     public:
00016       typedef bool _playing_type;
00017       _playing_type playing;
00018       typedef ros::Time _stamp_type;
00019       _stamp_type stamp;
00020 
00021     SoundRequestFeedback():
00022       playing(0),
00023       stamp()
00024     {
00025     }
00026 
00027     virtual int serialize(unsigned char *outbuffer) const
00028     {
00029       int offset = 0;
00030       union {
00031         bool real;
00032         uint8_t base;
00033       } u_playing;
00034       u_playing.real = this->playing;
00035       *(outbuffer + offset + 0) = (u_playing.base >> (8 * 0)) & 0xFF;
00036       offset += sizeof(this->playing);
00037       *(outbuffer + offset + 0) = (this->stamp.sec >> (8 * 0)) & 0xFF;
00038       *(outbuffer + offset + 1) = (this->stamp.sec >> (8 * 1)) & 0xFF;
00039       *(outbuffer + offset + 2) = (this->stamp.sec >> (8 * 2)) & 0xFF;
00040       *(outbuffer + offset + 3) = (this->stamp.sec >> (8 * 3)) & 0xFF;
00041       offset += sizeof(this->stamp.sec);
00042       *(outbuffer + offset + 0) = (this->stamp.nsec >> (8 * 0)) & 0xFF;
00043       *(outbuffer + offset + 1) = (this->stamp.nsec >> (8 * 1)) & 0xFF;
00044       *(outbuffer + offset + 2) = (this->stamp.nsec >> (8 * 2)) & 0xFF;
00045       *(outbuffer + offset + 3) = (this->stamp.nsec >> (8 * 3)) & 0xFF;
00046       offset += sizeof(this->stamp.nsec);
00047       return offset;
00048     }
00049 
00050     virtual int deserialize(unsigned char *inbuffer)
00051     {
00052       int offset = 0;
00053       union {
00054         bool real;
00055         uint8_t base;
00056       } u_playing;
00057       u_playing.base = 0;
00058       u_playing.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00059       this->playing = u_playing.real;
00060       offset += sizeof(this->playing);
00061       this->stamp.sec =  ((uint32_t) (*(inbuffer + offset)));
00062       this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00063       this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00064       this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00065       offset += sizeof(this->stamp.sec);
00066       this->stamp.nsec =  ((uint32_t) (*(inbuffer + offset)));
00067       this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00068       this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00069       this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00070       offset += sizeof(this->stamp.nsec);
00071      return offset;
00072     }
00073 
00074     virtual const char * getType(){ return "sound_play/SoundRequestFeedback"; };
00075     virtual const char * getMD5(){ return "237faa3e32b21b083f32acf5260255a4"; };
00076 
00077   };
00078 
00079 }
00080 #endif