Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * LedInterface.h - Fawkes BlackBoard Interface - LedInterface 00004 * 00005 * Templated created: Thu Oct 12 10:49:19 2006 00006 * Copyright 2008 Tim Niemueller 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef __INTERFACES_LEDINTERFACE_H_ 00025 #define __INTERFACES_LEDINTERFACE_H_ 00026 00027 #include <interface/interface.h> 00028 #include <interface/message.h> 00029 #include <interface/field_iterator.h> 00030 00031 namespace fawkes { 00032 00033 class LedInterface : public Interface 00034 { 00035 /// @cond INTERNALS 00036 INTERFACE_MGMT_FRIENDS(LedInterface) 00037 /// @endcond 00038 public: 00039 /* constants */ 00040 static const float ON; 00041 static const float OFF; 00042 00043 private: 00044 #pragma pack(push,4) 00045 /** Internal data storage, do NOT modify! */ 00046 typedef struct { 00047 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00048 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00049 float intensity; /**< Intensity value. */ 00050 } LedInterface_data_t; 00051 #pragma pack(pop) 00052 00053 LedInterface_data_t *data; 00054 00055 public: 00056 /* messages */ 00057 class SetIntensityMessage : public Message 00058 { 00059 private: 00060 #pragma pack(push,4) 00061 /** Internal data storage, do NOT modify! */ 00062 typedef struct { 00063 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00064 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00065 float time_sec; /**< 00066 Time in seconds when to reach the intensity. 00067 */ 00068 float intensity; /**< Intensity value. */ 00069 } SetIntensityMessage_data_t; 00070 #pragma pack(pop) 00071 00072 SetIntensityMessage_data_t *data; 00073 00074 public: 00075 SetIntensityMessage(const float ini_time_sec, const float ini_intensity); 00076 SetIntensityMessage(); 00077 ~SetIntensityMessage(); 00078 00079 SetIntensityMessage(const SetIntensityMessage *m); 00080 /* Methods */ 00081 float time_sec() const; 00082 void set_time_sec(const float new_time_sec); 00083 size_t maxlenof_time_sec() const; 00084 float intensity() const; 00085 void set_intensity(const float new_intensity); 00086 size_t maxlenof_intensity() const; 00087 virtual Message * clone() const; 00088 }; 00089 00090 class TurnOnMessage : public Message 00091 { 00092 private: 00093 #pragma pack(push,4) 00094 /** Internal data storage, do NOT modify! */ 00095 typedef struct { 00096 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00097 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00098 } TurnOnMessage_data_t; 00099 #pragma pack(pop) 00100 00101 TurnOnMessage_data_t *data; 00102 00103 public: 00104 TurnOnMessage(); 00105 ~TurnOnMessage(); 00106 00107 TurnOnMessage(const TurnOnMessage *m); 00108 /* Methods */ 00109 virtual Message * clone() const; 00110 }; 00111 00112 class TurnOffMessage : public Message 00113 { 00114 private: 00115 #pragma pack(push,4) 00116 /** Internal data storage, do NOT modify! */ 00117 typedef struct { 00118 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00119 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00120 } TurnOffMessage_data_t; 00121 #pragma pack(pop) 00122 00123 TurnOffMessage_data_t *data; 00124 00125 public: 00126 TurnOffMessage(); 00127 ~TurnOffMessage(); 00128 00129 TurnOffMessage(const TurnOffMessage *m); 00130 /* Methods */ 00131 virtual Message * clone() const; 00132 }; 00133 00134 virtual bool message_valid(const Message *message) const; 00135 private: 00136 LedInterface(); 00137 ~LedInterface(); 00138 00139 public: 00140 /* Methods */ 00141 float intensity() const; 00142 void set_intensity(const float new_intensity); 00143 size_t maxlenof_intensity() const; 00144 virtual Message * create_message(const char *type) const; 00145 00146 virtual void copy_values(const Interface *other); 00147 virtual const char * enum_tostring(const char *enumtype, int val) const; 00148 00149 }; 00150 00151 } // end namespace fawkes 00152 00153 #endif