Fawkes API  Fawkes Development Version
CameraControlInterface.h
1 
2 /***************************************************************************
3  * CameraControlInterface.h - Fawkes BlackBoard Interface - CameraControlInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2014 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 #ifndef __INTERFACES_CAMERACONTROLINTERFACE_H_
25 #define __INTERFACES_CAMERACONTROLINTERFACE_H_
26 
27 #include <interface/interface.h>
28 #include <interface/message.h>
29 #include <interface/field_iterator.h>
30 
31 namespace fawkes {
32 
34 {
35  /// @cond INTERNALS
36  INTERFACE_MGMT_FRIENDS(CameraControlInterface)
37  /// @endcond
38  public:
39  /* constants */
40 
41  /**
42  Enumeration defining the possible effects. A camera must not necessarily
43  implement all.
44  */
45  typedef enum {
46  EFF_NONE /**< No effect. */,
47  EFF_PASTEL /**< Pastel colors. */,
48  EFF_NEGATIVE /**< Negative/Positive Reversal. */,
49  EFF_BW /**< Monochrome Image. */,
50  EFF_SOLARIZE /**< Enhanced Contrast. */
51  } Effect;
52  const char * tostring_Effect(Effect value) const;
53 
54  private:
55  /** Internal data storage, do NOT modify! */
56  typedef struct __attribute__((packed)) {
57  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
58  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
59  int32_t effect; /**< Currently active effect. */
60  bool effect_supported; /**< Are effects supported? */
61  uint32_t zoom; /**< Current zoom setting. */
62  bool zoom_supported; /**< Is zooming supported? */
63  uint32_t zoom_max; /**< Maximum zoom value */
64  uint32_t zoom_min; /**< Minimum zoom */
65  bool mirror; /**< Is the image mirrored? */
66  bool mirror_supported; /**< Is mirroring supported? */
67  } CameraControlInterface_data_t;
68 
69  CameraControlInterface_data_t *data;
70 
71  interface_enum_map_t enum_map_Effect;
72  public:
73  /* messages */
74  class SetEffectMessage : public Message
75  {
76  private:
77  /** Internal data storage, do NOT modify! */
78  typedef struct __attribute__((packed)) {
79  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
80  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
81  int32_t effect; /**< Currently active effect. */
82  } SetEffectMessage_data_t;
83 
84  SetEffectMessage_data_t *data;
85 
86  interface_enum_map_t enum_map_Effect;
87  public:
88  SetEffectMessage(const Effect ini_effect);
91 
93  /* Methods */
94  Effect effect() const;
95  void set_effect(const Effect new_effect);
96  size_t maxlenof_effect() const;
97  virtual Message * clone() const;
98  };
99 
100  class SetZoomMessage : public Message
101  {
102  private:
103  /** Internal data storage, do NOT modify! */
104  typedef struct __attribute__((packed)) {
105  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
106  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
107  uint32_t zoom; /**< Current zoom setting. */
108  } SetZoomMessage_data_t;
109 
110  SetZoomMessage_data_t *data;
111 
112  interface_enum_map_t enum_map_Effect;
113  public:
114  SetZoomMessage(const uint32_t ini_zoom);
115  SetZoomMessage();
116  ~SetZoomMessage();
117 
118  SetZoomMessage(const SetZoomMessage *m);
119  /* Methods */
120  uint32_t zoom() const;
121  void set_zoom(const uint32_t new_zoom);
122  size_t maxlenof_zoom() const;
123  virtual Message * clone() const;
124  };
125 
126  class SetMirrorMessage : public Message
127  {
128  private:
129  /** Internal data storage, do NOT modify! */
130  typedef struct __attribute__((packed)) {
131  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
132  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
133  bool mirror; /**< Is the image mirrored? */
134  } SetMirrorMessage_data_t;
135 
136  SetMirrorMessage_data_t *data;
137 
138  interface_enum_map_t enum_map_Effect;
139  public:
140  SetMirrorMessage(const bool ini_mirror);
142  ~SetMirrorMessage();
143 
145  /* Methods */
146  bool is_mirror() const;
147  void set_mirror(const bool new_mirror);
148  size_t maxlenof_mirror() const;
149  virtual Message * clone() const;
150  };
151 
152  virtual bool message_valid(const Message *message) const;
153  private:
156 
157  public:
158  /* Methods */
159  Effect effect() const;
160  void set_effect(const Effect new_effect);
161  size_t maxlenof_effect() const;
162  bool is_effect_supported() const;
163  void set_effect_supported(const bool new_effect_supported);
164  size_t maxlenof_effect_supported() const;
165  uint32_t zoom() const;
166  void set_zoom(const uint32_t new_zoom);
167  size_t maxlenof_zoom() const;
168  bool is_zoom_supported() const;
169  void set_zoom_supported(const bool new_zoom_supported);
170  size_t maxlenof_zoom_supported() const;
171  uint32_t zoom_max() const;
172  void set_zoom_max(const uint32_t new_zoom_max);
173  size_t maxlenof_zoom_max() const;
174  uint32_t zoom_min() const;
175  void set_zoom_min(const uint32_t new_zoom_min);
176  size_t maxlenof_zoom_min() const;
177  bool is_mirror() const;
178  void set_mirror(const bool new_mirror);
179  size_t maxlenof_mirror() const;
180  bool is_mirror_supported() const;
181  void set_mirror_supported(const bool new_mirror_supported);
182  size_t maxlenof_mirror_supported() const;
183  virtual Message * create_message(const char *type) const;
184 
185  virtual void copy_values(const Interface *other);
186  virtual const char * enum_tostring(const char *enumtype, int val) const;
187 
188 };
189 
190 } // end namespace fawkes
191 
192 #endif
bool is_mirror() const
Get mirror value.
void set_zoom_max(const uint32_t new_zoom_max)
Set zoom_max value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
void set_zoom_min(const uint32_t new_zoom_min)
Set zoom_min value.
void set_effect(const Effect new_effect)
Set effect value.
void set_zoom_supported(const bool new_zoom_supported)
Set zoom_supported value.
bool is_zoom_supported() const
Get zoom_supported value.
void set_mirror_supported(const bool new_mirror_supported)
Set mirror_supported value.
size_t maxlenof_mirror_supported() const
Get maximum length of mirror_supported value.
Fawkes library namespace.
uint32_t zoom_max() const
Get zoom_max value.
CameraControlInterface Fawkes BlackBoard Interface.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
bool is_mirror_supported() const
Get mirror_supported value.
size_t maxlenof_effect() const
Get maximum length of effect value.
size_t maxlenof_mirror() const
Get maximum length of mirror value.
uint32_t zoom_min() const
Get zoom_min value.
SetEffectMessage Fawkes BlackBoard Interface Message.
const char * type() const
Get type of interface.
Definition: interface.cpp:651
size_t maxlenof_zoom() const
Get maximum length of zoom value.
void set_effect_supported(const bool new_effect_supported)
Set effect_supported value.
uint32_t zoom() const
Get zoom value.
void set_zoom(const uint32_t new_zoom)
Set zoom value.
SetZoomMessage Fawkes BlackBoard Interface Message.
void set_mirror(const bool new_mirror)
Set mirror value.
bool is_effect_supported() const
Get effect_supported value.
Effect
Enumeration defining the possible effects.
Effect effect() const
Get effect value.
size_t maxlenof_effect_supported() const
Get maximum length of effect_supported value.
SetMirrorMessage Fawkes BlackBoard Interface Message.
const char * tostring_Effect(Effect value) const
Convert Effect constant to string.
size_t maxlenof_zoom_min() const
Get maximum length of zoom_min value.
size_t maxlenof_zoom_supported() const
Get maximum length of zoom_supported value.
virtual Message * create_message(const char *type) const
Create message based on type name.
size_t maxlenof_zoom_max() const
Get maximum length of zoom_max value.
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.
std::map< int, std::string > interface_enum_map_t
Map of enum integer to string values.
Definition: types.h:53