Go to the documentation of this file.00001
00002 #ifndef WIIMOTE_MESSAGE_TIMEDSWITCH_H
00003 #define WIIMOTE_MESSAGE_TIMEDSWITCH_H
00004 #include <string>
00005 #include <vector>
00006 #include <map>
00007 #include <ostream>
00008 #include "ros/serialization.h"
00009 #include "ros/builtin_message_traits.h"
00010 #include "ros/message_operations.h"
00011 #include "ros/time.h"
00012
00013 #include "ros/macros.h"
00014
00015 #include "ros/assert.h"
00016
00017
00018 namespace wiimote
00019 {
00020 template <class ContainerAllocator>
00021 struct TimedSwitch_ {
00022 typedef TimedSwitch_<ContainerAllocator> Type;
00023
00024 TimedSwitch_()
00025 : switch_mode(0)
00026 , num_cycles(0)
00027 , pulse_pattern()
00028 {
00029 }
00030
00031 TimedSwitch_(const ContainerAllocator& _alloc)
00032 : switch_mode(0)
00033 , num_cycles(0)
00034 , pulse_pattern(_alloc)
00035 {
00036 }
00037
00038 typedef int8_t _switch_mode_type;
00039 int8_t switch_mode;
00040
00041 typedef int32_t _num_cycles_type;
00042 int32_t num_cycles;
00043
00044 typedef std::vector<float, typename ContainerAllocator::template rebind<float>::other > _pulse_pattern_type;
00045 std::vector<float, typename ContainerAllocator::template rebind<float>::other > pulse_pattern;
00046
00047 enum { ON = 1 };
00048 enum { OFF = 0 };
00049 enum { NO_CHANGE = -2 };
00050 enum { REPEAT = -1 };
00051 enum { FOREVER = -1 };
00052
00053 typedef boost::shared_ptr< ::wiimote::TimedSwitch_<ContainerAllocator> > Ptr;
00054 typedef boost::shared_ptr< ::wiimote::TimedSwitch_<ContainerAllocator> const> ConstPtr;
00055 boost::shared_ptr<std::map<std::string, std::string> > __connection_header;
00056 };
00057 typedef ::wiimote::TimedSwitch_<std::allocator<void> > TimedSwitch;
00058
00059 typedef boost::shared_ptr< ::wiimote::TimedSwitch> TimedSwitchPtr;
00060 typedef boost::shared_ptr< ::wiimote::TimedSwitch const> TimedSwitchConstPtr;
00061
00062
00063 template<typename ContainerAllocator>
00064 std::ostream& operator<<(std::ostream& s, const ::wiimote::TimedSwitch_<ContainerAllocator> & v)
00065 {
00066 ros::message_operations::Printer< ::wiimote::TimedSwitch_<ContainerAllocator> >::stream(s, "", v);
00067 return s;}
00068
00069 }
00070
00071 namespace ros
00072 {
00073 namespace message_traits
00074 {
00075 template<class ContainerAllocator> struct IsMessage< ::wiimote::TimedSwitch_<ContainerAllocator> > : public TrueType {};
00076 template<class ContainerAllocator> struct IsMessage< ::wiimote::TimedSwitch_<ContainerAllocator> const> : public TrueType {};
00077 template<class ContainerAllocator>
00078 struct MD5Sum< ::wiimote::TimedSwitch_<ContainerAllocator> > {
00079 static const char* value()
00080 {
00081 return "e4c8d9327409cef6066fa6c368032c1e";
00082 }
00083
00084 static const char* value(const ::wiimote::TimedSwitch_<ContainerAllocator> &) { return value(); }
00085 static const uint64_t static_value1 = 0xe4c8d9327409cef6ULL;
00086 static const uint64_t static_value2 = 0x066fa6c368032c1eULL;
00087 };
00088
00089 template<class ContainerAllocator>
00090 struct DataType< ::wiimote::TimedSwitch_<ContainerAllocator> > {
00091 static const char* value()
00092 {
00093 return "wiimote/TimedSwitch";
00094 }
00095
00096 static const char* value(const ::wiimote::TimedSwitch_<ContainerAllocator> &) { return value(); }
00097 };
00098
00099 template<class ContainerAllocator>
00100 struct Definition< ::wiimote::TimedSwitch_<ContainerAllocator> > {
00101 static const char* value()
00102 {
00103 return "# TimedSwitch allows sender to:\n\
00104 # o turn a switch on,\n\
00105 # o turn a switch off, and\n\
00106 # o repeat an on/off pattern forever or for a\n\
00107 # given number of times.\n\
00108 # Fields (refer to definitions of constants in the definition body):\n\
00109 # o switch_mode:\n\
00110 # ON: turn on (num_cycles and pulse_pattern fields are ignored)\n\
00111 # OFF: turn off (num_cycles and pulse_pattern fields are ignored)\n\
00112 # NO_CHANGE: leave LED in its current state\n\
00113 # REPEAT: repeat an on/off pattern for as long\n\
00114 # as is indicated in the num_cycles field. The\n\
00115 # pattern is defined in the pulse_pattern field.\n\
00116 #\n\
00117 # o num_cycles:\n\
00118 # n>=0: run the pattern that is defined in pulse_pattern\n\
00119 # n times.\n\
00120 # n==FOREVER: run the pattern that is defined in pulse_pattern\n\
00121 # until a new TimedSwitch message is sent. \n\
00122 #\n\
00123 # o pulse_pattern:\n\
00124 # A series of time durations in fractions of a second. The\n\
00125 # first number is the duration for having the switch on.\n\
00126 # The second number is the duration for which the switch\n\
00127 # is off. The third is an 'on' period again, etc.\n\
00128 # A pattern is terminated with the end of the array.\n\
00129 # \n\
00130 # Example: [1,1] specifies an on-off sequence of 1 second. \n\
00131 \n\
00132 int8 ON = 1\n\
00133 int8 OFF = 0\n\
00134 int8 NO_CHANGE = -2\n\
00135 int8 REPEAT = -1\n\
00136 int8 FOREVER = -1\n\
00137 \n\
00138 int8 switch_mode\n\
00139 int32 num_cycles\n\
00140 float32[] pulse_pattern\n\
00141 \n\
00142 ";
00143 }
00144
00145 static const char* value(const ::wiimote::TimedSwitch_<ContainerAllocator> &) { return value(); }
00146 };
00147
00148 }
00149 }
00150
00151 namespace ros
00152 {
00153 namespace serialization
00154 {
00155
00156 template<class ContainerAllocator> struct Serializer< ::wiimote::TimedSwitch_<ContainerAllocator> >
00157 {
00158 template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m)
00159 {
00160 stream.next(m.switch_mode);
00161 stream.next(m.num_cycles);
00162 stream.next(m.pulse_pattern);
00163 }
00164
00165 ROS_DECLARE_ALLINONE_SERIALIZER;
00166 };
00167 }
00168 }
00169
00170 namespace ros
00171 {
00172 namespace message_operations
00173 {
00174
00175 template<class ContainerAllocator>
00176 struct Printer< ::wiimote::TimedSwitch_<ContainerAllocator> >
00177 {
00178 template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::wiimote::TimedSwitch_<ContainerAllocator> & v)
00179 {
00180 s << indent << "switch_mode: ";
00181 Printer<int8_t>::stream(s, indent + " ", v.switch_mode);
00182 s << indent << "num_cycles: ";
00183 Printer<int32_t>::stream(s, indent + " ", v.num_cycles);
00184 s << indent << "pulse_pattern[]" << std::endl;
00185 for (size_t i = 0; i < v.pulse_pattern.size(); ++i)
00186 {
00187 s << indent << " pulse_pattern[" << i << "]: ";
00188 Printer<float>::stream(s, indent + " ", v.pulse_pattern[i]);
00189 }
00190 }
00191 };
00192
00193
00194 }
00195 }
00196
00197 #endif // WIIMOTE_MESSAGE_TIMEDSWITCH_H
00198