Fawkes API  Fawkes Development Version
SwitchInterface.cpp
1 
2 /***************************************************************************
3  * SwitchInterface.cpp - Fawkes BlackBoard Interface - SwitchInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2008 Tim Niemueller
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #include <interfaces/SwitchInterface.h>
25 
26 #include <core/exceptions/software.h>
27 
28 #include <map>
29 #include <string>
30 #include <cstring>
31 #include <cstdlib>
32 
33 namespace fawkes {
34 
35 /** @class SwitchInterface <interfaces/SwitchInterface.h>
36  * SwitchInterface Fawkes BlackBoard Interface.
37  *
38  This interface provides access to LEDs. The interface controls
39  an intensity value between 0.0 (off) and 1.0 (on, max
40  intensity). LEDs that do not support intensity setting can only
41  be set to on and off.
42 
43  * @ingroup FawkesInterfaces
44  */
45 
46 
47 
48 /** Constructor */
49 SwitchInterface::SwitchInterface() : Interface()
50 {
51  data_size = sizeof(SwitchInterface_data_t);
52  data_ptr = malloc(data_size);
53  data = (SwitchInterface_data_t *)data_ptr;
54  data_ts = (interface_data_ts_t *)data_ptr;
55  memset(data_ptr, 0, data_size);
56  add_fieldinfo(IFT_BOOL, "enabled", 1, &data->enabled);
57  add_fieldinfo(IFT_FLOAT, "value", 1, &data->value);
58  add_fieldinfo(IFT_FLOAT, "history", 1, &data->history);
59  add_fieldinfo(IFT_UINT32, "short_activations", 1, &data->short_activations);
60  add_fieldinfo(IFT_UINT32, "long_activations", 1, &data->long_activations);
61  add_fieldinfo(IFT_UINT32, "activation_count", 1, &data->activation_count);
62  add_messageinfo("SetMessage");
63  add_messageinfo("EnableSwitchMessage");
64  add_messageinfo("DisableSwitchMessage");
65  add_messageinfo("EnableDurationMessage");
66  unsigned char tmp_hash[] = {0xa7, 0xa4, 0xc, 0x19, 0x66, 0xa4, 0x87, 0x6b, 0xa9, 0x32, 0x95, 0x40, 0xc7, 0x82, 0x75, 0x6d};
67  set_hash(tmp_hash);
68 }
69 
70 /** Destructor */
71 SwitchInterface::~SwitchInterface()
72 {
73  free(data_ptr);
74 }
75 /* Methods */
76 /** Get enabled value.
77  *
78  True if the switch is currently enabled.
79 
80  * @return enabled value
81  */
82 bool
84 {
85  return data->enabled;
86 }
87 
88 /** Get maximum length of enabled value.
89  * @return length of enabled value, can be length of the array or number of
90  * maximum number of characters for a string
91  */
92 size_t
94 {
95  return 1;
96 }
97 
98 /** Set enabled value.
99  *
100  True if the switch is currently enabled.
101 
102  * @param new_enabled new enabled value
103  */
104 void
105 SwitchInterface::set_enabled(const bool new_enabled)
106 {
107  data_changed |= change_field(data->enabled, new_enabled);
108 }
109 
110 /** Get value value.
111  *
112  If switches support multiple states these can be indicated with
113  this value. For example for a switch that notes the intensity it
114  could be a value in the valid range.
115 
116  * @return value value
117  */
118 float
120 {
121  return data->value;
122 }
123 
124 /** Get maximum length of value value.
125  * @return length of value value, can be length of the array or number of
126  * maximum number of characters for a string
127  */
128 size_t
130 {
131  return 1;
132 }
133 
134 /** Set value value.
135  *
136  If switches support multiple states these can be indicated with
137  this value. For example for a switch that notes the intensity it
138  could be a value in the valid range.
139 
140  * @param new_value new value value
141  */
142 void
143 SwitchInterface::set_value(const float new_value)
144 {
145  data_changed |= change_field(data->value, new_value);
146 }
147 
148 /** Get history value.
149  *
150  This value records the number of seconds a switch has been
151  enabled continuously -- or not. The time is recorded in
152  seconds. A positive value indicates time the switch was turned
153  on, a negative value indicates the time (when converted to the
154  absolute value) the button has not been pressed. Zero means
155  "just initialized".
156 
157  * @return history value
158  */
159 float
161 {
162  return data->history;
163 }
164 
165 /** Get maximum length of history value.
166  * @return length of history value, can be length of the array or number of
167  * maximum number of characters for a string
168  */
169 size_t
171 {
172  return 1;
173 }
174 
175 /** Set history value.
176  *
177  This value records the number of seconds a switch has been
178  enabled continuously -- or not. The time is recorded in
179  seconds. A positive value indicates time the switch was turned
180  on, a negative value indicates the time (when converted to the
181  absolute value) the button has not been pressed. Zero means
182  "just initialized".
183 
184  * @param new_history new history value
185  */
186 void
187 SwitchInterface::set_history(const float new_history)
188 {
189  data_changed |= change_field(data->history, new_history);
190 }
191 
192 /** Get short_activations value.
193  *
194  Number of consecutive short clicks (turned on). Can be used to recognize
195  patterns of clicks. This is an optional field.
196 
197  * @return short_activations value
198  */
199 uint32_t
201 {
202  return data->short_activations;
203 }
204 
205 /** Get maximum length of short_activations value.
206  * @return length of short_activations value, can be length of the array or number of
207  * maximum number of characters for a string
208  */
209 size_t
211 {
212  return 1;
213 }
214 
215 /** Set short_activations value.
216  *
217  Number of consecutive short clicks (turned on). Can be used to recognize
218  patterns of clicks. This is an optional field.
219 
220  * @param new_short_activations new short_activations value
221  */
222 void
223 SwitchInterface::set_short_activations(const uint32_t new_short_activations)
224 {
225  data_changed |= change_field(data->short_activations, new_short_activations);
226 }
227 
228 /** Get long_activations value.
229  *
230  Number of consecutive short clicks (turned on). Can be used to recognize
231  patterns of clicks. This is an optional field.
232 
233  * @return long_activations value
234  */
235 uint32_t
237 {
238  return data->long_activations;
239 }
240 
241 /** Get maximum length of long_activations value.
242  * @return length of long_activations value, can be length of the array or number of
243  * maximum number of characters for a string
244  */
245 size_t
247 {
248  return 1;
249 }
250 
251 /** Set long_activations value.
252  *
253  Number of consecutive short clicks (turned on). Can be used to recognize
254  patterns of clicks. This is an optional field.
255 
256  * @param new_long_activations new long_activations value
257  */
258 void
259 SwitchInterface::set_long_activations(const uint32_t new_long_activations)
260 {
261  data_changed |= change_field(data->long_activations, new_long_activations);
262 }
263 
264 /** Get activation_count value.
265  *
266  Number that is to be incremented whenever a short or long activation
267  happened. Can be used to decide if a change in status happened.
268 
269  * @return activation_count value
270  */
271 uint32_t
273 {
274  return data->activation_count;
275 }
276 
277 /** Get maximum length of activation_count value.
278  * @return length of activation_count value, can be length of the array or number of
279  * maximum number of characters for a string
280  */
281 size_t
283 {
284  return 1;
285 }
286 
287 /** Set activation_count value.
288  *
289  Number that is to be incremented whenever a short or long activation
290  happened. Can be used to decide if a change in status happened.
291 
292  * @param new_activation_count new activation_count value
293  */
294 void
295 SwitchInterface::set_activation_count(const uint32_t new_activation_count)
296 {
297  data_changed |= change_field(data->activation_count, new_activation_count);
298 }
299 
300 /* =========== message create =========== */
301 Message *
303 {
304  if ( strncmp("SetMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
305  return new SetMessage();
306  } else if ( strncmp("EnableSwitchMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
307  return new EnableSwitchMessage();
308  } else if ( strncmp("DisableSwitchMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
309  return new DisableSwitchMessage();
310  } else if ( strncmp("EnableDurationMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
311  return new EnableDurationMessage();
312  } else {
313  throw UnknownTypeException("The given type '%s' does not match any known "
314  "message type for this interface type.", type);
315  }
316 }
317 
318 
319 /** Copy values from other interface.
320  * @param other other interface to copy values from
321  */
322 void
324 {
325  const SwitchInterface *oi = dynamic_cast<const SwitchInterface *>(other);
326  if (oi == NULL) {
327  throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)",
328  type(), other->type());
329  }
330  memcpy(data, oi->data, sizeof(SwitchInterface_data_t));
331 }
332 
333 const char *
334 SwitchInterface::enum_tostring(const char *enumtype, int val) const
335 {
336  throw UnknownTypeException("Unknown enum type %s", enumtype);
337 }
338 
339 /* =========== messages =========== */
340 /** @class SwitchInterface::SetMessage <interfaces/SwitchInterface.h>
341  * SetMessage Fawkes BlackBoard Interface Message.
342  *
343 
344  */
345 
346 
347 /** Constructor with initial values.
348  * @param ini_enabled initial value for enabled
349  * @param ini_value initial value for value
350  */
351 SwitchInterface::SetMessage::SetMessage(const bool ini_enabled, const float ini_value) : Message("SetMessage")
352 {
353  data_size = sizeof(SetMessage_data_t);
354  data_ptr = malloc(data_size);
355  memset(data_ptr, 0, data_size);
356  data = (SetMessage_data_t *)data_ptr;
358  data->enabled = ini_enabled;
359  data->value = ini_value;
360  add_fieldinfo(IFT_BOOL, "enabled", 1, &data->enabled);
361  add_fieldinfo(IFT_FLOAT, "value", 1, &data->value);
362 }
363 /** Constructor */
365 {
366  data_size = sizeof(SetMessage_data_t);
367  data_ptr = malloc(data_size);
368  memset(data_ptr, 0, data_size);
369  data = (SetMessage_data_t *)data_ptr;
371  add_fieldinfo(IFT_BOOL, "enabled", 1, &data->enabled);
372  add_fieldinfo(IFT_FLOAT, "value", 1, &data->value);
373 }
374 
375 /** Destructor */
377 {
378  free(data_ptr);
379 }
380 
381 /** Copy constructor.
382  * @param m message to copy from
383  */
385 {
386  data_size = m->data_size;
387  data_ptr = malloc(data_size);
388  memcpy(data_ptr, m->data_ptr, data_size);
389  data = (SetMessage_data_t *)data_ptr;
391 }
392 
393 /* Methods */
394 /** Get enabled value.
395  *
396  True if the switch is currently enabled.
397 
398  * @return enabled value
399  */
400 bool
402 {
403  return data->enabled;
404 }
405 
406 /** Get maximum length of enabled value.
407  * @return length of enabled value, can be length of the array or number of
408  * maximum number of characters for a string
409  */
410 size_t
412 {
413  return 1;
414 }
415 
416 /** Set enabled value.
417  *
418  True if the switch is currently enabled.
419 
420  * @param new_enabled new enabled value
421  */
422 void
424 {
425  change_field(data->enabled, new_enabled);
426 }
427 
428 /** Get value value.
429  *
430  If switches support multiple states these can be indicated with
431  this value. For example for a switch that notes the intensity it
432  could be a value in the valid range.
433 
434  * @return value value
435  */
436 float
438 {
439  return data->value;
440 }
441 
442 /** Get maximum length of value value.
443  * @return length of value value, can be length of the array or number of
444  * maximum number of characters for a string
445  */
446 size_t
448 {
449  return 1;
450 }
451 
452 /** Set value value.
453  *
454  If switches support multiple states these can be indicated with
455  this value. For example for a switch that notes the intensity it
456  could be a value in the valid range.
457 
458  * @param new_value new value value
459  */
460 void
462 {
463  change_field(data->value, new_value);
464 }
465 
466 /** Clone this message.
467  * Produces a message of the same type as this message and copies the
468  * data to the new message.
469  * @return clone of this message
470  */
471 Message *
473 {
474  return new SwitchInterface::SetMessage(this);
475 }
476 /** @class SwitchInterface::EnableSwitchMessage <interfaces/SwitchInterface.h>
477  * EnableSwitchMessage Fawkes BlackBoard Interface Message.
478  *
479 
480  */
481 
482 
483 /** Constructor */
485 {
486  data_size = sizeof(EnableSwitchMessage_data_t);
487  data_ptr = malloc(data_size);
488  memset(data_ptr, 0, data_size);
489  data = (EnableSwitchMessage_data_t *)data_ptr;
491 }
492 
493 /** Destructor */
495 {
496  free(data_ptr);
497 }
498 
499 /** Copy constructor.
500  * @param m message to copy from
501  */
503 {
504  data_size = m->data_size;
505  data_ptr = malloc(data_size);
506  memcpy(data_ptr, m->data_ptr, data_size);
507  data = (EnableSwitchMessage_data_t *)data_ptr;
509 }
510 
511 /* Methods */
512 /** Clone this message.
513  * Produces a message of the same type as this message and copies the
514  * data to the new message.
515  * @return clone of this message
516  */
517 Message *
519 {
520  return new SwitchInterface::EnableSwitchMessage(this);
521 }
522 /** @class SwitchInterface::DisableSwitchMessage <interfaces/SwitchInterface.h>
523  * DisableSwitchMessage Fawkes BlackBoard Interface Message.
524  *
525 
526  */
527 
528 
529 /** Constructor */
531 {
532  data_size = sizeof(DisableSwitchMessage_data_t);
533  data_ptr = malloc(data_size);
534  memset(data_ptr, 0, data_size);
535  data = (DisableSwitchMessage_data_t *)data_ptr;
537 }
538 
539 /** Destructor */
541 {
542  free(data_ptr);
543 }
544 
545 /** Copy constructor.
546  * @param m message to copy from
547  */
549 {
550  data_size = m->data_size;
551  data_ptr = malloc(data_size);
552  memcpy(data_ptr, m->data_ptr, data_size);
553  data = (DisableSwitchMessage_data_t *)data_ptr;
555 }
556 
557 /* Methods */
558 /** Clone this message.
559  * Produces a message of the same type as this message and copies the
560  * data to the new message.
561  * @return clone of this message
562  */
563 Message *
565 {
566  return new SwitchInterface::DisableSwitchMessage(this);
567 }
568 /** @class SwitchInterface::EnableDurationMessage <interfaces/SwitchInterface.h>
569  * EnableDurationMessage Fawkes BlackBoard Interface Message.
570  *
571 
572  */
573 
574 
575 /** Constructor with initial values.
576  * @param ini_duration initial value for duration
577  * @param ini_value initial value for value
578  */
579 SwitchInterface::EnableDurationMessage::EnableDurationMessage(const float ini_duration, const float ini_value) : Message("EnableDurationMessage")
580 {
581  data_size = sizeof(EnableDurationMessage_data_t);
582  data_ptr = malloc(data_size);
583  memset(data_ptr, 0, data_size);
584  data = (EnableDurationMessage_data_t *)data_ptr;
586  data->duration = ini_duration;
587  data->value = ini_value;
588  add_fieldinfo(IFT_FLOAT, "duration", 1, &data->duration);
589  add_fieldinfo(IFT_FLOAT, "value", 1, &data->value);
590 }
591 /** Constructor */
593 {
594  data_size = sizeof(EnableDurationMessage_data_t);
595  data_ptr = malloc(data_size);
596  memset(data_ptr, 0, data_size);
597  data = (EnableDurationMessage_data_t *)data_ptr;
599  add_fieldinfo(IFT_FLOAT, "duration", 1, &data->duration);
600  add_fieldinfo(IFT_FLOAT, "value", 1, &data->value);
601 }
602 
603 /** Destructor */
605 {
606  free(data_ptr);
607 }
608 
609 /** Copy constructor.
610  * @param m message to copy from
611  */
613 {
614  data_size = m->data_size;
615  data_ptr = malloc(data_size);
616  memcpy(data_ptr, m->data_ptr, data_size);
617  data = (EnableDurationMessage_data_t *)data_ptr;
619 }
620 
621 /* Methods */
622 /** Get duration value.
623  * Duration in seconds for which
624  the switch should be enabled.
625  * @return duration value
626  */
627 float
629 {
630  return data->duration;
631 }
632 
633 /** Get maximum length of duration value.
634  * @return length of duration value, can be length of the array or number of
635  * maximum number of characters for a string
636  */
637 size_t
639 {
640  return 1;
641 }
642 
643 /** Set duration value.
644  * Duration in seconds for which
645  the switch should be enabled.
646  * @param new_duration new duration value
647  */
648 void
650 {
651  change_field(data->duration, new_duration);
652 }
653 
654 /** Get value value.
655  *
656  If switches support multiple states these can be indicated with
657  this value. For example for a switch that notes the intensity it
658  could be a value in the valid range.
659 
660  * @return value value
661  */
662 float
664 {
665  return data->value;
666 }
667 
668 /** Get maximum length of value value.
669  * @return length of value value, can be length of the array or number of
670  * maximum number of characters for a string
671  */
672 size_t
674 {
675  return 1;
676 }
677 
678 /** Set value value.
679  *
680  If switches support multiple states these can be indicated with
681  this value. For example for a switch that notes the intensity it
682  could be a value in the valid range.
683 
684  * @param new_value new value value
685  */
686 void
688 {
689  change_field(data->value, new_value);
690 }
691 
692 /** Clone this message.
693  * Produces a message of the same type as this message and copies the
694  * data to the new message.
695  * @return clone of this message
696  */
697 Message *
699 {
701 }
702 /** Check if message is valid and can be enqueued.
703  * @param message Message to check
704  * @return true if the message is valid, false otherwise.
705  */
706 bool
708 {
709  const SetMessage *m0 = dynamic_cast<const SetMessage *>(message);
710  if ( m0 != NULL ) {
711  return true;
712  }
713  const EnableSwitchMessage *m1 = dynamic_cast<const EnableSwitchMessage *>(message);
714  if ( m1 != NULL ) {
715  return true;
716  }
717  const DisableSwitchMessage *m2 = dynamic_cast<const DisableSwitchMessage *>(message);
718  if ( m2 != NULL ) {
719  return true;
720  }
721  const EnableDurationMessage *m3 = dynamic_cast<const EnableDurationMessage *>(message);
722  if ( m3 != NULL ) {
723  return true;
724  }
725  return false;
726 }
727 
728 /// @cond INTERNALS
729 EXPORT_INTERFACE(SwitchInterface)
730 /// @endcond
731 
732 
733 } // end namespace fawkes
fawkes::Interface::data_ptr
void * data_ptr
Pointer to local memory storage.
Definition: interface.h:224
fawkes::SwitchInterface::set_short_activations
void set_short_activations(const uint32_t new_short_activations)
Set short_activations value.
Definition: SwitchInterface.cpp:223
fawkes::SwitchInterface::enum_tostring
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
Definition: SwitchInterface.cpp:334
fawkes::SwitchInterface::maxlenof_value
size_t maxlenof_value() const
Get maximum length of value value.
Definition: SwitchInterface.cpp:129
fawkes::SwitchInterface::SetMessage::maxlenof_value
size_t maxlenof_value() const
Get maximum length of value value.
Definition: SwitchInterface.cpp:447
fawkes::SwitchInterface::long_activations
uint32_t long_activations() const
Get long_activations value.
Definition: SwitchInterface.cpp:236
fawkes::SwitchInterface::create_message
virtual Message * create_message(const char *type) const
Create message based on type name.
Definition: SwitchInterface.cpp:302
fawkes::SwitchInterface::SetMessage
SetMessage Fawkes BlackBoard Interface Message.
Definition: SwitchInterface.h:81
fawkes::SwitchInterface::maxlenof_long_activations
size_t maxlenof_long_activations() const
Get maximum length of long_activations value.
Definition: SwitchInterface.cpp:246
fawkes::SwitchInterface::EnableDurationMessage::maxlenof_duration
size_t maxlenof_duration() const
Get maximum length of duration value.
Definition: SwitchInterface.cpp:638
fawkes::SwitchInterface::EnableDurationMessage::value
float value() const
Get value value.
Definition: SwitchInterface.cpp:663
fawkes::SwitchInterface
SwitchInterface Fawkes BlackBoard Interface.
Definition: SwitchInterface.h:34
fawkes::SwitchInterface::set_value
void set_value(const float new_value)
Set value value.
Definition: SwitchInterface.cpp:143
fawkes::Message
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:45
fawkes::Message::data_ptr
void * data_ptr
Pointer to memory that contains local data.
Definition: message.h:128
fawkes::IFT_BOOL
@ IFT_BOOL
boolean field
Definition: types.h:37
fawkes::IFT_FLOAT
@ IFT_FLOAT
float field
Definition: types.h:46
fawkes::Message::data_ts
message_data_ts_t * data_ts
data timestamp aliasing pointer
Definition: message.h:138
fawkes::IFT_UINT32
@ IFT_UINT32
32 bit unsigned integer field
Definition: types.h:43
fawkes::SwitchInterface::EnableDurationMessage
EnableDurationMessage Fawkes BlackBoard Interface Message.
Definition: SwitchInterface.h:156
fawkes::SwitchInterface::maxlenof_history
size_t maxlenof_history() const
Get maximum length of history value.
Definition: SwitchInterface.cpp:170
fawkes::SwitchInterface::SetMessage::set_enabled
void set_enabled(const bool new_enabled)
Set enabled value.
Definition: SwitchInterface.cpp:423
fawkes::SwitchInterface::message_valid
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Definition: SwitchInterface.cpp:707
fawkes::Interface::type
const char * type() const
Get type of interface.
Definition: interface.cpp:643
fawkes::SwitchInterface::set_activation_count
void set_activation_count(const uint32_t new_activation_count)
Set activation_count value.
Definition: SwitchInterface.cpp:295
fawkes::SwitchInterface::DisableSwitchMessage
DisableSwitchMessage Fawkes BlackBoard Interface Message.
Definition: SwitchInterface.h:136
fawkes::SwitchInterface::copy_values
virtual void copy_values(const Interface *other)
Copy values from other interface.
Definition: SwitchInterface.cpp:323
fawkes::Message::message_data_ts_t
Timestamp data, must be present and first entries for each interface data structs!...
Definition: message.h:134
fawkes::SwitchInterface::history
float history() const
Get history value.
Definition: SwitchInterface.cpp:160
fawkes::SwitchInterface::SetMessage::is_enabled
bool is_enabled() const
Get enabled value.
Definition: SwitchInterface.cpp:401
fawkes::SwitchInterface::EnableDurationMessage::clone
virtual Message * clone() const
Clone this message.
Definition: SwitchInterface.cpp:698
fawkes::TypeMismatchException
Type mismatch.
Definition: software.h:44
fawkes::Interface::data_changed
bool data_changed
Indicator if data has changed.
Definition: interface.h:226
fawkes::SwitchInterface::EnableSwitchMessage
EnableSwitchMessage Fawkes BlackBoard Interface Message.
Definition: SwitchInterface.h:116
fawkes::SwitchInterface::EnableSwitchMessage::EnableSwitchMessage
EnableSwitchMessage()
Constructor.
Definition: SwitchInterface.cpp:484
fawkes::SwitchInterface::EnableSwitchMessage::clone
virtual Message * clone() const
Clone this message.
Definition: SwitchInterface.cpp:518
fawkes::SwitchInterface::maxlenof_enabled
size_t maxlenof_enabled() const
Get maximum length of enabled value.
Definition: SwitchInterface.cpp:93
fawkes::SwitchInterface::set_history
void set_history(const float new_history)
Set history value.
Definition: SwitchInterface.cpp:187
fawkes::UnknownTypeException
Unknown type.
Definition: software.h:50
fawkes::SwitchInterface::activation_count
uint32_t activation_count() const
Get activation_count value.
Definition: SwitchInterface.cpp:272
fawkes::SwitchInterface::set_enabled
void set_enabled(const bool new_enabled)
Set enabled value.
Definition: SwitchInterface.cpp:105
fawkes::SwitchInterface::EnableDurationMessage::~EnableDurationMessage
~EnableDurationMessage()
Destructor.
Definition: SwitchInterface.cpp:604
fawkes::SwitchInterface::DisableSwitchMessage::clone
virtual Message * clone() const
Clone this message.
Definition: SwitchInterface.cpp:564
fawkes
Fawkes library namespace.
fawkes::Interface::set_hash
void set_hash(unsigned char *ihash)
Set hash.
Definition: interface.cpp:316
fawkes::Message::data_size
unsigned int data_size
Size of memory needed to hold all data.
Definition: message.h:129
fawkes::SwitchInterface::EnableDurationMessage::maxlenof_value
size_t maxlenof_value() const
Get maximum length of value value.
Definition: SwitchInterface.cpp:673
fawkes::SwitchInterface::SetMessage::value
float value() const
Get value value.
Definition: SwitchInterface.cpp:437
fawkes::SwitchInterface::SetMessage::maxlenof_enabled
size_t maxlenof_enabled() const
Get maximum length of enabled value.
Definition: SwitchInterface.cpp:411
fawkes::SwitchInterface::value
float value() const
Get value value.
Definition: SwitchInterface.cpp:119
fawkes::Interface
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
fawkes::SwitchInterface::SetMessage::set_value
void set_value(const float new_value)
Set value value.
Definition: SwitchInterface.cpp:461
fawkes::SwitchInterface::DisableSwitchMessage::DisableSwitchMessage
DisableSwitchMessage()
Constructor.
Definition: SwitchInterface.cpp:530
fawkes::Message::add_fieldinfo
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the info list.
Definition: message.cpp:400
fawkes::SwitchInterface::SetMessage::SetMessage
SetMessage()
Constructor.
Definition: SwitchInterface.cpp:364
fawkes::SwitchInterface::EnableSwitchMessage::~EnableSwitchMessage
~EnableSwitchMessage()
Destructor.
Definition: SwitchInterface.cpp:494
fawkes::SwitchInterface::EnableDurationMessage::duration
float duration() const
Get duration value.
Definition: SwitchInterface.cpp:628
fawkes::SwitchInterface::set_long_activations
void set_long_activations(const uint32_t new_long_activations)
Set long_activations value.
Definition: SwitchInterface.cpp:259
fawkes::SwitchInterface::SetMessage::~SetMessage
~SetMessage()
Destructor.
Definition: SwitchInterface.cpp:376
fawkes::SwitchInterface::is_enabled
bool is_enabled() const
Get enabled value.
Definition: SwitchInterface.cpp:83
fawkes::SwitchInterface::maxlenof_activation_count
size_t maxlenof_activation_count() const
Get maximum length of activation_count value.
Definition: SwitchInterface.cpp:282
fawkes::SwitchInterface::EnableDurationMessage::set_value
void set_value(const float new_value)
Set value value.
Definition: SwitchInterface.cpp:687
fawkes::SwitchInterface::maxlenof_short_activations
size_t maxlenof_short_activations() const
Get maximum length of short_activations value.
Definition: SwitchInterface.cpp:210
fawkes::Interface::add_messageinfo
void add_messageinfo(const char *name)
Add an entry to the message info list.
Definition: interface.cpp:375
fawkes::SwitchInterface::DisableSwitchMessage::~DisableSwitchMessage
~DisableSwitchMessage()
Destructor.
Definition: SwitchInterface.cpp:540
fawkes::SwitchInterface::SetMessage::clone
virtual Message * clone() const
Clone this message.
Definition: SwitchInterface.cpp:472
fawkes::change_field
bool change_field(FieldT &field, const DataT &value)
Set a field and return whether it changed.
Definition: message.h:167
fawkes::SwitchInterface::EnableDurationMessage::set_duration
void set_duration(const float new_duration)
Set duration value.
Definition: SwitchInterface.cpp:649
fawkes::SwitchInterface::short_activations
uint32_t short_activations() const
Get short_activations value.
Definition: SwitchInterface.cpp:200
fawkes::SwitchInterface::EnableDurationMessage::EnableDurationMessage
EnableDurationMessage()
Constructor.
Definition: SwitchInterface.cpp:592