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
AudioInfo.h
00001 #ifndef _ROS_audio_common_msgs_AudioInfo_h 00002 #define _ROS_audio_common_msgs_AudioInfo_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 00009 namespace audio_common_msgs 00010 { 00011 00012 class AudioInfo : public ros::Msg 00013 { 00014 public: 00015 typedef uint8_t _channels_type; 00016 _channels_type channels; 00017 typedef uint32_t _sample_rate_type; 00018 _sample_rate_type sample_rate; 00019 typedef const char* _sample_format_type; 00020 _sample_format_type sample_format; 00021 typedef uint32_t _bitrate_type; 00022 _bitrate_type bitrate; 00023 typedef const char* _coding_format_type; 00024 _coding_format_type coding_format; 00025 00026 AudioInfo(): 00027 channels(0), 00028 sample_rate(0), 00029 sample_format(""), 00030 bitrate(0), 00031 coding_format("") 00032 { 00033 } 00034 00035 virtual int serialize(unsigned char *outbuffer) const 00036 { 00037 int offset = 0; 00038 *(outbuffer + offset + 0) = (this->channels >> (8 * 0)) & 0xFF; 00039 offset += sizeof(this->channels); 00040 *(outbuffer + offset + 0) = (this->sample_rate >> (8 * 0)) & 0xFF; 00041 *(outbuffer + offset + 1) = (this->sample_rate >> (8 * 1)) & 0xFF; 00042 *(outbuffer + offset + 2) = (this->sample_rate >> (8 * 2)) & 0xFF; 00043 *(outbuffer + offset + 3) = (this->sample_rate >> (8 * 3)) & 0xFF; 00044 offset += sizeof(this->sample_rate); 00045 uint32_t length_sample_format = strlen(this->sample_format); 00046 varToArr(outbuffer + offset, length_sample_format); 00047 offset += 4; 00048 memcpy(outbuffer + offset, this->sample_format, length_sample_format); 00049 offset += length_sample_format; 00050 *(outbuffer + offset + 0) = (this->bitrate >> (8 * 0)) & 0xFF; 00051 *(outbuffer + offset + 1) = (this->bitrate >> (8 * 1)) & 0xFF; 00052 *(outbuffer + offset + 2) = (this->bitrate >> (8 * 2)) & 0xFF; 00053 *(outbuffer + offset + 3) = (this->bitrate >> (8 * 3)) & 0xFF; 00054 offset += sizeof(this->bitrate); 00055 uint32_t length_coding_format = strlen(this->coding_format); 00056 varToArr(outbuffer + offset, length_coding_format); 00057 offset += 4; 00058 memcpy(outbuffer + offset, this->coding_format, length_coding_format); 00059 offset += length_coding_format; 00060 return offset; 00061 } 00062 00063 virtual int deserialize(unsigned char *inbuffer) 00064 { 00065 int offset = 0; 00066 this->channels = ((uint8_t) (*(inbuffer + offset))); 00067 offset += sizeof(this->channels); 00068 this->sample_rate = ((uint32_t) (*(inbuffer + offset))); 00069 this->sample_rate |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00070 this->sample_rate |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00071 this->sample_rate |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00072 offset += sizeof(this->sample_rate); 00073 uint32_t length_sample_format; 00074 arrToVar(length_sample_format, (inbuffer + offset)); 00075 offset += 4; 00076 for(unsigned int k= offset; k< offset+length_sample_format; ++k){ 00077 inbuffer[k-1]=inbuffer[k]; 00078 } 00079 inbuffer[offset+length_sample_format-1]=0; 00080 this->sample_format = (char *)(inbuffer + offset-1); 00081 offset += length_sample_format; 00082 this->bitrate = ((uint32_t) (*(inbuffer + offset))); 00083 this->bitrate |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00084 this->bitrate |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00085 this->bitrate |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00086 offset += sizeof(this->bitrate); 00087 uint32_t length_coding_format; 00088 arrToVar(length_coding_format, (inbuffer + offset)); 00089 offset += 4; 00090 for(unsigned int k= offset; k< offset+length_coding_format; ++k){ 00091 inbuffer[k-1]=inbuffer[k]; 00092 } 00093 inbuffer[offset+length_coding_format-1]=0; 00094 this->coding_format = (char *)(inbuffer + offset-1); 00095 offset += length_coding_format; 00096 return offset; 00097 } 00098 00099 virtual const char * getType(){ return "audio_common_msgs/AudioInfo"; }; 00100 virtual const char * getMD5(){ return "9413d9b7029680d3b1db6ed0ae535f88"; }; 00101 00102 }; 00103 00104 } 00105 #endif
Generated on Mon Sep 26 2022 13:47:00 by
