Fawkes API
Fawkes Development Version
|
24 #include <interfaces/CameraControlInterface.h>
26 #include <core/exceptions/software.h>
45 CameraControlInterface::CameraControlInterface() : Interface()
47 data_size =
sizeof(CameraControlInterface_data_t);
49 data = (CameraControlInterface_data_t *)
data_ptr;
52 enum_map_Effect[(int)EFF_NONE] =
"EFF_NONE";
53 enum_map_Effect[(int)EFF_PASTEL] =
"EFF_PASTEL";
54 enum_map_Effect[(int)EFF_NEGATIVE] =
"EFF_NEGATIVE";
55 enum_map_Effect[(int)EFF_BW] =
"EFF_BW";
56 enum_map_Effect[(int)EFF_SOLARIZE] =
"EFF_SOLARIZE";
68 unsigned char tmp_hash[] = {0xc, 0xc9, 0x4a, 0x24, 0x89, 0xb8, 0x9c, 0xd1, 0x7f, 0xf5, 0xc4, 0xa3, 0x41, 0xca, 0x9a, 0xc1};
73 CameraControlInterface::~CameraControlInterface()
85 case EFF_NONE:
return "EFF_NONE";
86 case EFF_PASTEL:
return "EFF_PASTEL";
87 case EFF_NEGATIVE:
return "EFF_NEGATIVE";
88 case EFF_BW:
return "EFF_BW";
89 case EFF_SOLARIZE:
return "EFF_SOLARIZE";
90 default:
return "UNKNOWN";
121 data->effect = new_effect;
132 return data->effect_supported;
152 data->effect_supported = new_effect_supported;
183 data->zoom = new_zoom;
194 return data->zoom_supported;
214 data->zoom_supported = new_zoom_supported;
225 return data->zoom_max;
245 data->zoom_max = new_zoom_max;
256 return data->zoom_min;
276 data->zoom_min = new_zoom_min;
307 data->mirror = new_mirror;
318 return data->mirror_supported;
338 data->mirror_supported = new_mirror_supported;
346 if ( strncmp(
"SetEffectMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
347 return new SetEffectMessage();
348 }
else if ( strncmp(
"SetZoomMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
349 return new SetZoomMessage();
350 }
else if ( strncmp(
"SetMirrorMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
351 return new SetMirrorMessage();
353 throw UnknownTypeException(
"The given type '%s' does not match any known "
354 "message type for this interface type.",
type);
365 const CameraControlInterface *oi = dynamic_cast<const CameraControlInterface *>(other);
368 type(), other->type());
370 memcpy(data, oi->data,
sizeof(CameraControlInterface_data_t));
376 if (strcmp(enumtype,
"Effect") == 0) {
377 return tostring_Effect((Effect)val);
395 data_size =
sizeof(SetEffectMessage_data_t);
398 data = (SetEffectMessage_data_t *)
data_ptr;
400 data->effect = ini_effect;
401 enum_map_Effect[(int)
EFF_NONE] =
"EFF_NONE";
402 enum_map_Effect[(int)
EFF_PASTEL] =
"EFF_PASTEL";
404 enum_map_Effect[(int)
EFF_BW] =
"EFF_BW";
411 data_size =
sizeof(SetEffectMessage_data_t);
414 data = (SetEffectMessage_data_t *)
data_ptr;
416 enum_map_Effect[(int)
EFF_NONE] =
"EFF_NONE";
417 enum_map_Effect[(int)
EFF_PASTEL] =
"EFF_PASTEL";
419 enum_map_Effect[(int)
EFF_BW] =
"EFF_BW";
438 data = (SetEffectMessage_data_t *)
data_ptr;
470 data->effect = new_effect;
495 data_size =
sizeof(SetZoomMessage_data_t);
498 data = (SetZoomMessage_data_t *)
data_ptr;
500 data->zoom = ini_zoom;
501 enum_map_Effect[(int)
EFF_NONE] =
"EFF_NONE";
502 enum_map_Effect[(int)
EFF_PASTEL] =
"EFF_PASTEL";
504 enum_map_Effect[(int)
EFF_BW] =
"EFF_BW";
511 data_size =
sizeof(SetZoomMessage_data_t);
514 data = (SetZoomMessage_data_t *)
data_ptr;
516 enum_map_Effect[(int)
EFF_NONE] =
"EFF_NONE";
517 enum_map_Effect[(int)
EFF_PASTEL] =
"EFF_PASTEL";
519 enum_map_Effect[(int)
EFF_BW] =
"EFF_BW";
538 data = (SetZoomMessage_data_t *)
data_ptr;
570 data->zoom = new_zoom;
595 data_size =
sizeof(SetMirrorMessage_data_t);
598 data = (SetMirrorMessage_data_t *)
data_ptr;
600 data->mirror = ini_mirror;
601 enum_map_Effect[(int)
EFF_NONE] =
"EFF_NONE";
602 enum_map_Effect[(int)
EFF_PASTEL] =
"EFF_PASTEL";
604 enum_map_Effect[(int)
EFF_BW] =
"EFF_BW";
611 data_size =
sizeof(SetMirrorMessage_data_t);
614 data = (SetMirrorMessage_data_t *)
data_ptr;
616 enum_map_Effect[(int)
EFF_NONE] =
"EFF_NONE";
617 enum_map_Effect[(int)
EFF_PASTEL] =
"EFF_PASTEL";
619 enum_map_Effect[(int)
EFF_BW] =
"EFF_BW";
638 data = (SetMirrorMessage_data_t *)
data_ptr;
670 data->mirror = new_mirror;
690 const SetEffectMessage *m0 = dynamic_cast<const SetEffectMessage *>(message);
694 const SetZoomMessage *m1 = dynamic_cast<const SetZoomMessage *>(message);
698 const SetMirrorMessage *m2 = dynamic_cast<const SetMirrorMessage *>(message);
706 EXPORT_INTERFACE(CameraControlInterface)
Effect effect() const
Get effect value.
~SetZoomMessage()
Destructor.
const char * tostring_Effect(Effect value) const
Convert Effect constant to string.
Negative/Positive Reversal.
size_t maxlenof_zoom_min() const
Get maximum length of zoom_min value.
bool is_mirror() const
Get mirror value.
size_t maxlenof_mirror() const
Get maximum length of mirror value.
void set_zoom_min(const uint32_t new_zoom_min)
Set zoom_min value.
field with interface specific enum type
message_data_ts_t * data_ts
data timestamp aliasing pointer
SetZoomMessage()
Constructor.
32 bit unsigned integer field
virtual const char * enum_tostring(const char *enumtype, int val) const
size_t maxlenof_effect() const
Get maximum length of effect value.
const char * type() const
Get type of interface.
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 field info list.
virtual Message * clone() const
Clone this message.
bool is_mirror() const
Get mirror value.
size_t maxlenof_zoom() const
Get maximum length of zoom value.
interface_data_ts_t * data_ts
uint32_t zoom_min() const
Get zoom_min value.
Effect effect() const
Get effect value.
size_t maxlenof_mirror() const
Get maximum length of mirror value.
uint32_t zoom_max() const
Get zoom_max value.
Timestamp data, must be present and first entries for each interface data structs!...
void set_mirror(const bool new_mirror)
Set mirror value.
void set_zoom_supported(const bool new_zoom_supported)
Set zoom_supported value.
uint32_t zoom() const
Get zoom value.
bool is_mirror_supported() const
Get mirror_supported value.
void set_effect(const Effect new_effect)
Set effect value.
void set_hash(unsigned char *ihash)
Set hash.
virtual Message * create_message(const char *type) const
void set_mirror(const bool new_mirror)
Set mirror value.
bool is_effect_supported() const
Get effect_supported value.
bool is_zoom_supported() const
Get zoom_supported value.
size_t maxlenof_zoom_supported() const
Get maximum length of zoom_supported value.
void set_zoom_max(const uint32_t new_zoom_max)
Set zoom_max value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
void set_effect_supported(const bool new_effect_supported)
Set effect_supported value.
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.
virtual Message * clone() const
Clone this message.
size_t maxlenof_zoom() const
Get maximum length of zoom value.
void set_effect(const Effect new_effect)
Set effect value.
size_t maxlenof_zoom_max() const
Get maximum length of zoom_max value.
size_t maxlenof_effect_supported() const
Get maximum length of effect_supported value.
void set_zoom(const uint32_t new_zoom)
Set zoom value.
SetMirrorMessage()
Constructor.
uint32_t zoom() const
Get zoom value.
SetEffectMessage()
Constructor.
~SetEffectMessage()
Destructor.
size_t maxlenof_effect() const
Get maximum length of effect value.
void add_messageinfo(const char *name)
Add an entry to the message info list.
size_t maxlenof_mirror_supported() const
Get maximum length of mirror_supported value.
virtual Message * clone() const
Clone this message.
Effect
Enumeration defining the possible effects.
void set_zoom(const uint32_t new_zoom)
Set zoom value.
~SetMirrorMessage()
Destructor.
void set_mirror_supported(const bool new_mirror_supported)
Set mirror_supported value.