VSM C++ SDK
Vehicle Specific Modules SDK
camera_trigger_action.h
Go to the documentation of this file.
1 // Copyright (c) 2014, Smart Projects Holdings Ltd
2 // All rights reserved.
3 // See LICENSE file for license details.
4 
8 #ifndef _CAMERA_TRIGGER_ACTION_H_
9 #define _CAMERA_TRIGGER_ACTION_H_
10 
11 #include <ugcs/vsm/action.h>
12 #include <ugcs/vsm/mavlink.h>
13 #include <chrono>
14 
15 namespace ugcs {
16 namespace vsm {
17 
21 
22 public:
23 
25  enum State {
27  ON,
29  OFF,
34  };
35 
37  Camera_trigger_action(State state, std::chrono::milliseconds interval):
38  Action(Type::CAMERA_TRIGGER),
39  state(state), interval(interval) {}
40 
47  Camera_trigger_action(const mavlink::ugcs::Pld_mission_item_ex& item) :
48  Action(Type::CAMERA_TRIGGER),
49  state(Mavlink_to_state(item->param1)),
50  interval(1000) /* Currently not supported by protocol. */
51  {
52  ASSERT(item->command == mavlink::ugcs::MAV_CMD::MAV_CMD_DO_CAMERA_TRIGGER);
53  }
54 
59  Action(Type::CAMERA_TRIGGER),
60  interval(1000) /* Currently not supported by protocol. */
61  {
62  int tmp;
63  p.at("state")->Get_value(tmp);
64  state = Mavlink_to_state(tmp);
65  }
66 
69 
73  std::chrono::milliseconds interval;
74 
75 private:
76 
81  static State
82  Mavlink_to_state(double mav_param);
83 };
84 
86 template<>
90 };
91 
92 } /* namespace vsm */
93 } /* namespace ugcs */
94 
95 #endif /* _CAMERA_TRIGGER_ACTION_H_ */
UGCS root namespace.
Definition: android-linux/ugcs/vsm/platform_sockets.h:27
Definition: property.h:191
Camera_trigger_action(State state, std::chrono::milliseconds interval)
Construct camera trigger action explicitly.
Definition: camera_trigger_action.h:37
State
Camera trigger state.
Definition: camera_trigger_action.h:25
Type
Types of vehicle actions as part of task (mission).
Definition: action.h:30
Stop recording or serial shooting.
Definition: camera_trigger_action.h:29
Generic action.
Definition: action.h:22
#define ASSERT(x)
No action in release.
Definition: debug.h:68
Camera trigger action.
Definition: camera_trigger_action.h:19
Take a series of photos.
Definition: camera_trigger_action.h:33
Generic action.
Map Action type enum value to specific Action type class.
Definition: action.h:117
Camera trigger action ugcs::vsm::Camera_trigger_action.
Camera_trigger_action(const mavlink::ugcs::Pld_mission_item_ex &item)
Construct camera trigger action from Mavlink mission item.
Definition: camera_trigger_action.h:47
Camera_trigger_action type
Real type.
Definition: camera_trigger_action.h:89
State state
Camera trigger state.
Definition: camera_trigger_action.h:68
#define DEFINE_COMMON_CLASS(__class_name,...)
Use this macro to define some common attributes for a class.
Definition: utils.h:25
std::chrono::milliseconds interval
Interval between two consequent camera shots in case of serial triggering (State::SERIAL_PHOTO).
Definition: camera_trigger_action.h:73
Start recording.
Definition: camera_trigger_action.h:27
Camera_trigger_action(const Property_list &p)
Construct action from protobuf command.
Definition: camera_trigger_action.h:58
Take a single photo.
Definition: camera_trigger_action.h:31