LedInterface.h
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 /** Internal data storage, do NOT modify! */ 00045 typedef struct { 00046 float intensity; /**< Intensity value. */ 00047 } LedInterface_data_t; 00048 00049 LedInterface_data_t *data; 00050 00051 public: 00052 /* messages */ 00053 class SetIntensityMessage : public Message 00054 { 00055 private: 00056 /** Internal data storage, do NOT modify! */ 00057 typedef struct { 00058 float time_sec; /**< 00059 Time in seconds when to reach the intensity. 00060 */ 00061 float intensity; /**< Intensity value. */ 00062 } SetIntensityMessage_data_t; 00063 00064 SetIntensityMessage_data_t *data; 00065 00066 public: 00067 SetIntensityMessage(const float ini_time_sec, const float ini_intensity); 00068 SetIntensityMessage(); 00069 ~SetIntensityMessage(); 00070 00071 SetIntensityMessage(const SetIntensityMessage *m); 00072 /* Methods */ 00073 float time_sec() const; 00074 void set_time_sec(const float new_time_sec); 00075 size_t maxlenof_time_sec() const; 00076 float intensity() const; 00077 void set_intensity(const float new_intensity); 00078 size_t maxlenof_intensity() const; 00079 virtual Message * clone() const; 00080 }; 00081 00082 class TurnOnMessage : public Message 00083 { 00084 public: 00085 TurnOnMessage(); 00086 ~TurnOnMessage(); 00087 00088 TurnOnMessage(const TurnOnMessage *m); 00089 /* Methods */ 00090 virtual Message * clone() const; 00091 }; 00092 00093 class TurnOffMessage : public Message 00094 { 00095 public: 00096 TurnOffMessage(); 00097 ~TurnOffMessage(); 00098 00099 TurnOffMessage(const TurnOffMessage *m); 00100 /* Methods */ 00101 virtual Message * clone() const; 00102 }; 00103 00104 virtual bool message_valid(const Message *message) const; 00105 private: 00106 LedInterface(); 00107 ~LedInterface(); 00108 00109 public: 00110 /* Methods */ 00111 float intensity() const; 00112 void set_intensity(const float new_intensity); 00113 size_t maxlenof_intensity() const; 00114 virtual Message * create_message(const char *type) const; 00115 00116 virtual void copy_values(const Interface *other); 00117 00118 }; 00119 00120 } // end namespace fawkes 00121 00122 #endif

