Fawkes API Fawkes Development Version
|
SwitchInterface Fawkes BlackBoard Interface. More...
#include <>>
Classes | |
class | DisableSwitchMessage |
DisableSwitchMessage Fawkes BlackBoard Interface Message. More... | |
class | EnableDurationMessage |
EnableDurationMessage Fawkes BlackBoard Interface Message. More... | |
class | EnableSwitchMessage |
EnableSwitchMessage Fawkes BlackBoard Interface Message. More... | |
class | SetMessage |
SetMessage Fawkes BlackBoard Interface Message. More... | |
struct | SwitchInterface_data_t |
Internal data storage, do NOT modify! | |
Public Member Functions | |
virtual bool | message_valid (const Message *message) const |
Check if message is valid and can be enqueued. | |
bool | is_enabled () const |
Get enabled value. | |
void | set_enabled (const bool new_enabled) |
Set enabled value. | |
size_t | maxlenof_enabled () const |
Get maximum length of enabled value. | |
float | value () const |
Get value value. | |
void | set_value (const float new_value) |
Set value value. | |
size_t | maxlenof_value () const |
Get maximum length of value value. | |
float | history () const |
Get history value. | |
void | set_history (const float new_history) |
Set history value. | |
size_t | maxlenof_history () const |
Get maximum length of history value. | |
uint32_t | short_activations () const |
Get short_activations value. | |
void | set_short_activations (const uint32_t new_short_activations) |
Set short_activations value. | |
size_t | maxlenof_short_activations () const |
Get maximum length of short_activations value. | |
uint32_t | long_activations () const |
Get long_activations value. | |
void | set_long_activations (const uint32_t new_long_activations) |
Set long_activations value. | |
size_t | maxlenof_long_activations () const |
Get maximum length of long_activations value. | |
uint32_t | activation_count () const |
Get activation_count value. | |
void | set_activation_count (const uint32_t new_activation_count) |
Set activation_count value. | |
size_t | maxlenof_activation_count () const |
Get maximum length of activation_count value. | |
virtual Message * | create_message (const char *type) const |
Create message based on type name. | |
virtual void | copy_values (const Interface *other) |
Copy values from other interface. | |
virtual const char * | enum_tostring (const char *enumtype, int val) const |
Convert arbitrary enum value to string. |
SwitchInterface Fawkes BlackBoard Interface.
This interface provides access to LEDs. The interface controls an intensity value between 0.0 (off) and 1.0 (on, max intensity). LEDs that do not support intensity setting can only be set to on and off.
Definition at line 33 of file SwitchInterface.h.
uint32_t fawkes::SwitchInterface::activation_count | ( | ) | const |
Get activation_count value.
Number that is to be incremented whenever a short or long activation happened. Can be used to decide if a change in status happened.
Definition at line 275 of file SwitchInterface.cpp.
void fawkes::SwitchInterface::copy_values | ( | const Interface * | other | ) | [virtual] |
Copy values from other interface.
other | other interface to copy values from |
Implements fawkes::Interface.
Definition at line 327 of file SwitchInterface.cpp.
References fawkes::Interface::type().
Message * fawkes::SwitchInterface::create_message | ( | const char * | type | ) | const [virtual] |
Create message based on type name.
This will create a new message of the given type. The type must be given without the InterfaceName:: prefix but just the plain class name of the message.
type | message type |
UnknownTypeException | thrown if this interface cannot create a message of the given type. |
Implements fawkes::Interface.
Definition at line 306 of file SwitchInterface.cpp.
const char * fawkes::SwitchInterface::enum_tostring | ( | const char * | enumtype, |
int | val | ||
) | const [virtual] |
Convert arbitrary enum value to string.
Given the string representation of the enum type and the value this method returns the string representation of the specific value, or the string UNKNOWN if the value is not defined. An exception is thrown if the enum type is invalid.
enumtype | enum type as string |
val | value to convert |
UnknownTypeException | thrown if enumtype is not specified for interface. |
Implements fawkes::Interface.
Definition at line 338 of file SwitchInterface.cpp.
float fawkes::SwitchInterface::history | ( | ) | const |
Get history value.
This value records the number of seconds a switch has been enabled continuously -- or not. The time is recorded in seconds. A positive value indicates time the switch was turned on, a negative value indicates the time (when converted to the absolute value) the button has not been pressed. Zero means "just initialized".
Definition at line 160 of file SwitchInterface.cpp.
bool fawkes::SwitchInterface::is_enabled | ( | ) | const |
Get enabled value.
True if the switch is currently enabled.
Definition at line 81 of file SwitchInterface.cpp.
uint32_t fawkes::SwitchInterface::long_activations | ( | ) | const |
Get long_activations value.
Number of consecutive short clicks (turned on). Can be used to recognize patterns of clicks. This is an optional field.
Definition at line 238 of file SwitchInterface.cpp.
size_t fawkes::SwitchInterface::maxlenof_activation_count | ( | ) | const |
Get maximum length of activation_count value.
Definition at line 285 of file SwitchInterface.cpp.
size_t fawkes::SwitchInterface::maxlenof_enabled | ( | ) | const |
Get maximum length of enabled value.
Definition at line 91 of file SwitchInterface.cpp.
size_t fawkes::SwitchInterface::maxlenof_history | ( | ) | const |
Get maximum length of history value.
Definition at line 170 of file SwitchInterface.cpp.
size_t fawkes::SwitchInterface::maxlenof_long_activations | ( | ) | const |
Get maximum length of long_activations value.
Definition at line 248 of file SwitchInterface.cpp.
size_t fawkes::SwitchInterface::maxlenof_short_activations | ( | ) | const |
Get maximum length of short_activations value.
Definition at line 211 of file SwitchInterface.cpp.
size_t fawkes::SwitchInterface::maxlenof_value | ( | ) | const |
Get maximum length of value value.
Definition at line 128 of file SwitchInterface.cpp.
bool fawkes::SwitchInterface::message_valid | ( | const Message * | message | ) | const [virtual] |
Check if message is valid and can be enqueued.
message | Message to check |
Implements fawkes::Interface.
Definition at line 711 of file SwitchInterface.cpp.
void fawkes::SwitchInterface::set_activation_count | ( | const uint32_t | new_activation_count | ) |
Set activation_count value.
Number that is to be incremented whenever a short or long activation happened. Can be used to decide if a change in status happened.
new_activation_count | new activation_count value |
Definition at line 298 of file SwitchInterface.cpp.
References fawkes::Interface::data_changed.
void fawkes::SwitchInterface::set_enabled | ( | const bool | new_enabled | ) |
Set enabled value.
True if the switch is currently enabled.
new_enabled | new enabled value |
Definition at line 103 of file SwitchInterface.cpp.
References fawkes::Interface::data_changed.
Referenced by BBLoggerThread::init().
void fawkes::SwitchInterface::set_history | ( | const float | new_history | ) |
Set history value.
This value records the number of seconds a switch has been enabled continuously -- or not. The time is recorded in seconds. A positive value indicates time the switch was turned on, a negative value indicates the time (when converted to the absolute value) the button has not been pressed. Zero means "just initialized".
new_history | new history value |
Definition at line 187 of file SwitchInterface.cpp.
References fawkes::Interface::data_changed.
void fawkes::SwitchInterface::set_long_activations | ( | const uint32_t | new_long_activations | ) |
Set long_activations value.
Number of consecutive short clicks (turned on). Can be used to recognize patterns of clicks. This is an optional field.
new_long_activations | new long_activations value |
Definition at line 261 of file SwitchInterface.cpp.
References fawkes::Interface::data_changed.
void fawkes::SwitchInterface::set_short_activations | ( | const uint32_t | new_short_activations | ) |
Set short_activations value.
Number of consecutive short clicks (turned on). Can be used to recognize patterns of clicks. This is an optional field.
new_short_activations | new short_activations value |
Definition at line 224 of file SwitchInterface.cpp.
References fawkes::Interface::data_changed.
void fawkes::SwitchInterface::set_value | ( | const float | new_value | ) |
Set value value.
If switches support multiple states these can be indicated with this value. For example for a switch that notes the intensity it could be a value in the valid range.
new_value | new value value |
Definition at line 142 of file SwitchInterface.cpp.
References fawkes::Interface::data_changed.
uint32_t fawkes::SwitchInterface::short_activations | ( | ) | const |
Get short_activations value.
Number of consecutive short clicks (turned on). Can be used to recognize patterns of clicks. This is an optional field.
Definition at line 201 of file SwitchInterface.cpp.
float fawkes::SwitchInterface::value | ( | ) | const |
Get value value.
If switches support multiple states these can be indicated with this value. For example for a switch that notes the intensity it could be a value in the valid range.
Definition at line 118 of file SwitchInterface.cpp.