00001
00002 #ifndef WIIMOTE_MESSAGE_TIMEDSWITCH_H
00003 #define WIIMOTE_MESSAGE_TIMEDSWITCH_H
00004 #include <string>
00005 #include <vector>
00006 #include <ostream>
00007 #include "ros/serialization.h"
00008 #include "ros/builtin_message_traits.h"
00009 #include "ros/message_operations.h"
00010 #include "ros/message.h"
00011 #include "ros/time.h"
00012
00013
00014 namespace wiimote
00015 {
00016 template <class ContainerAllocator>
00017 struct TimedSwitch_ : public ros::Message
00018 {
00019 typedef TimedSwitch_<ContainerAllocator> Type;
00020
00021 TimedSwitch_()
00022 : switch_mode(0)
00023 , num_cycles(0)
00024 , pulse_pattern()
00025 {
00026 }
00027
00028 TimedSwitch_(const ContainerAllocator& _alloc)
00029 : switch_mode(0)
00030 , num_cycles(0)
00031 , pulse_pattern(_alloc)
00032 {
00033 }
00034
00035 typedef int8_t _switch_mode_type;
00036 int8_t switch_mode;
00037
00038 typedef int32_t _num_cycles_type;
00039 int32_t num_cycles;
00040
00041 typedef std::vector<float, typename ContainerAllocator::template rebind<float>::other > _pulse_pattern_type;
00042 std::vector<float, typename ContainerAllocator::template rebind<float>::other > pulse_pattern;
00043
00044 enum { ON = 1 };
00045 enum { OFF = 0 };
00046 enum { NO_CHANGE = -2 };
00047 enum { REPEAT = -1 };
00048 enum { FOREVER = -1 };
00049
00050 ROS_DEPRECATED uint32_t get_pulse_pattern_size() const { return (uint32_t)pulse_pattern.size(); }
00051 ROS_DEPRECATED void set_pulse_pattern_size(uint32_t size) { pulse_pattern.resize((size_t)size); }
00052 ROS_DEPRECATED void get_pulse_pattern_vec(std::vector<float, typename ContainerAllocator::template rebind<float>::other > & vec) const { vec = this->pulse_pattern; }
00053 ROS_DEPRECATED void set_pulse_pattern_vec(const std::vector<float, typename ContainerAllocator::template rebind<float>::other > & vec) { this->pulse_pattern = vec; }
00054 private:
00055 static const char* __s_getDataType_() { return "wiimote/TimedSwitch"; }
00056 public:
00057 ROS_DEPRECATED static const std::string __s_getDataType() { return __s_getDataType_(); }
00058
00059 ROS_DEPRECATED const std::string __getDataType() const { return __s_getDataType_(); }
00060
00061 private:
00062 static const char* __s_getMD5Sum_() { return "e4c8d9327409cef6066fa6c368032c1e"; }
00063 public:
00064 ROS_DEPRECATED static const std::string __s_getMD5Sum() { return __s_getMD5Sum_(); }
00065
00066 ROS_DEPRECATED const std::string __getMD5Sum() const { return __s_getMD5Sum_(); }
00067
00068 private:
00069 static const char* __s_getMessageDefinition_() { return "# TimedSwitch allows sender to:\n\
00070 # o turn a switch on,\n\
00071 # o turn a switch off, and\n\
00072 # o repeat an on/off pattern forever or for a\n\
00073 # given number of times.\n\
00074 # Fields (refer to definitions of constants in the definition body):\n\
00075 # o switch_mode:\n\
00076 # ON: turn on (num_cycles and pulse_pattern fields are ignored)\n\
00077 # OFF: turn off (num_cycles and pulse_pattern fields are ignored)\n\
00078 # NO_CHANGE: leave LED in its current state\n\
00079 # REPEAT: repeat an on/off pattern for as long\n\
00080 # as is indicated in the num_cycles field. The\n\
00081 # pattern is defined in the pulse_pattern field.\n\
00082 #\n\
00083 # o num_cycles:\n\
00084 # n>=0: run the pattern that is defined in pulse_pattern\n\
00085 # n times.\n\
00086 # n==FOREVER: run the pattern that is defined in pulse_pattern\n\
00087 # until a new TimedSwitch message is sent. \n\
00088 #\n\
00089 # o pulse_pattern:\n\
00090 # A series of time durations in fractions of a second. The\n\
00091 # first number is the duration for having the switch on.\n\
00092 # The second number is the duration for which the switch\n\
00093 # is off. The third is an 'on' period again, etc.\n\
00094 # A pattern is terminated with the end of the array.\n\
00095 # \n\
00096 # Example: [1,1] specifies an on-off sequence of 1 second. \n\
00097 \n\
00098 int8 ON = 1\n\
00099 int8 OFF = 0\n\
00100 int8 NO_CHANGE = -2\n\
00101 int8 REPEAT = -1\n\
00102 int8 FOREVER = -1\n\
00103 \n\
00104 int8 switch_mode\n\
00105 int32 num_cycles\n\
00106 float32[] pulse_pattern\n\
00107 \n\
00108 "; }
00109 public:
00110 ROS_DEPRECATED static const std::string __s_getMessageDefinition() { return __s_getMessageDefinition_(); }
00111
00112 ROS_DEPRECATED const std::string __getMessageDefinition() const { return __s_getMessageDefinition_(); }
00113
00114 ROS_DEPRECATED virtual uint8_t *serialize(uint8_t *write_ptr, uint32_t seq) const
00115 {
00116 ros::serialization::OStream stream(write_ptr, 1000000000);
00117 ros::serialization::serialize(stream, switch_mode);
00118 ros::serialization::serialize(stream, num_cycles);
00119 ros::serialization::serialize(stream, pulse_pattern);
00120 return stream.getData();
00121 }
00122
00123 ROS_DEPRECATED virtual uint8_t *deserialize(uint8_t *read_ptr)
00124 {
00125 ros::serialization::IStream stream(read_ptr, 1000000000);
00126 ros::serialization::deserialize(stream, switch_mode);
00127 ros::serialization::deserialize(stream, num_cycles);
00128 ros::serialization::deserialize(stream, pulse_pattern);
00129 return stream.getData();
00130 }
00131
00132 ROS_DEPRECATED virtual uint32_t serializationLength() const
00133 {
00134 uint32_t size = 0;
00135 size += ros::serialization::serializationLength(switch_mode);
00136 size += ros::serialization::serializationLength(num_cycles);
00137 size += ros::serialization::serializationLength(pulse_pattern);
00138 return size;
00139 }
00140
00141 typedef boost::shared_ptr< ::wiimote::TimedSwitch_<ContainerAllocator> > Ptr;
00142 typedef boost::shared_ptr< ::wiimote::TimedSwitch_<ContainerAllocator> const> ConstPtr;
00143 };
00144 typedef ::wiimote::TimedSwitch_<std::allocator<void> > TimedSwitch;
00145
00146 typedef boost::shared_ptr< ::wiimote::TimedSwitch> TimedSwitchPtr;
00147 typedef boost::shared_ptr< ::wiimote::TimedSwitch const> TimedSwitchConstPtr;
00148
00149
00150 template<typename ContainerAllocator>
00151 std::ostream& operator<<(std::ostream& s, const ::wiimote::TimedSwitch_<ContainerAllocator> & v)
00152 {
00153 ros::message_operations::Printer< ::wiimote::TimedSwitch_<ContainerAllocator> >::stream(s, "", v);
00154 return s;}
00155
00156 }
00157
00158 namespace ros
00159 {
00160 namespace message_traits
00161 {
00162 template<class ContainerAllocator>
00163 struct MD5Sum< ::wiimote::TimedSwitch_<ContainerAllocator> > {
00164 static const char* value()
00165 {
00166 return "e4c8d9327409cef6066fa6c368032c1e";
00167 }
00168
00169 static const char* value(const ::wiimote::TimedSwitch_<ContainerAllocator> &) { return value(); }
00170 static const uint64_t static_value1 = 0xe4c8d9327409cef6ULL;
00171 static const uint64_t static_value2 = 0x066fa6c368032c1eULL;
00172 };
00173
00174 template<class ContainerAllocator>
00175 struct DataType< ::wiimote::TimedSwitch_<ContainerAllocator> > {
00176 static const char* value()
00177 {
00178 return "wiimote/TimedSwitch";
00179 }
00180
00181 static const char* value(const ::wiimote::TimedSwitch_<ContainerAllocator> &) { return value(); }
00182 };
00183
00184 template<class ContainerAllocator>
00185 struct Definition< ::wiimote::TimedSwitch_<ContainerAllocator> > {
00186 static const char* value()
00187 {
00188 return "# TimedSwitch allows sender to:\n\
00189 # o turn a switch on,\n\
00190 # o turn a switch off, and\n\
00191 # o repeat an on/off pattern forever or for a\n\
00192 # given number of times.\n\
00193 # Fields (refer to definitions of constants in the definition body):\n\
00194 # o switch_mode:\n\
00195 # ON: turn on (num_cycles and pulse_pattern fields are ignored)\n\
00196 # OFF: turn off (num_cycles and pulse_pattern fields are ignored)\n\
00197 # NO_CHANGE: leave LED in its current state\n\
00198 # REPEAT: repeat an on/off pattern for as long\n\
00199 # as is indicated in the num_cycles field. The\n\
00200 # pattern is defined in the pulse_pattern field.\n\
00201 #\n\
00202 # o num_cycles:\n\
00203 # n>=0: run the pattern that is defined in pulse_pattern\n\
00204 # n times.\n\
00205 # n==FOREVER: run the pattern that is defined in pulse_pattern\n\
00206 # until a new TimedSwitch message is sent. \n\
00207 #\n\
00208 # o pulse_pattern:\n\
00209 # A series of time durations in fractions of a second. The\n\
00210 # first number is the duration for having the switch on.\n\
00211 # The second number is the duration for which the switch\n\
00212 # is off. The third is an 'on' period again, etc.\n\
00213 # A pattern is terminated with the end of the array.\n\
00214 # \n\
00215 # Example: [1,1] specifies an on-off sequence of 1 second. \n\
00216 \n\
00217 int8 ON = 1\n\
00218 int8 OFF = 0\n\
00219 int8 NO_CHANGE = -2\n\
00220 int8 REPEAT = -1\n\
00221 int8 FOREVER = -1\n\
00222 \n\
00223 int8 switch_mode\n\
00224 int32 num_cycles\n\
00225 float32[] pulse_pattern\n\
00226 \n\
00227 ";
00228 }
00229
00230 static const char* value(const ::wiimote::TimedSwitch_<ContainerAllocator> &) { return value(); }
00231 };
00232
00233 }
00234 }
00235
00236 namespace ros
00237 {
00238 namespace serialization
00239 {
00240
00241 template<class ContainerAllocator> struct Serializer< ::wiimote::TimedSwitch_<ContainerAllocator> >
00242 {
00243 template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m)
00244 {
00245 stream.next(m.switch_mode);
00246 stream.next(m.num_cycles);
00247 stream.next(m.pulse_pattern);
00248 }
00249
00250 ROS_DECLARE_ALLINONE_SERIALIZER;
00251 };
00252 }
00253 }
00254
00255 namespace ros
00256 {
00257 namespace message_operations
00258 {
00259
00260 template<class ContainerAllocator>
00261 struct Printer< ::wiimote::TimedSwitch_<ContainerAllocator> >
00262 {
00263 template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::wiimote::TimedSwitch_<ContainerAllocator> & v)
00264 {
00265 s << indent << "switch_mode: ";
00266 Printer<int8_t>::stream(s, indent + " ", v.switch_mode);
00267 s << indent << "num_cycles: ";
00268 Printer<int32_t>::stream(s, indent + " ", v.num_cycles);
00269 s << indent << "pulse_pattern[]" << std::endl;
00270 for (size_t i = 0; i < v.pulse_pattern.size(); ++i)
00271 {
00272 s << indent << " pulse_pattern[" << i << "]: ";
00273 Printer<float>::stream(s, indent + " ", v.pulse_pattern[i]);
00274 }
00275 }
00276 };
00277
00278
00279 }
00280 }
00281
00282 #endif // WIIMOTE_MESSAGE_TIMEDSWITCH_H
00283