mirror of https://github.com/ArduPilot/ardupilot
AP_Camera: add singleton
This commit is contained in:
parent
44fd85ff29
commit
fb786b8d56
|
@ -444,3 +444,15 @@ void AP_Camera::update_trigger()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// singleton instance
|
||||
AP_Camera *AP_Camera::_singleton;
|
||||
|
||||
namespace AP {
|
||||
|
||||
AP_Camera *camera()
|
||||
{
|
||||
return AP_Camera::get_singleton();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,6 +44,10 @@ public:
|
|||
AP_Camera(const AP_Camera &other) = delete;
|
||||
AP_Camera &operator=(const AP_Camera&) = delete;
|
||||
|
||||
// get singleton instance
|
||||
static AP_Camera *get_singleton() {
|
||||
return _singleton;
|
||||
}
|
||||
|
||||
// MAVLink methods
|
||||
void control_msg(const mavlink_message_t* msg);
|
||||
|
@ -71,6 +75,9 @@ public:
|
|||
void set_is_auto_mode(bool enable) { _is_in_auto_mode = enable; }
|
||||
|
||||
private:
|
||||
|
||||
static AP_Camera *_singleton;
|
||||
|
||||
AP_Int8 _trigger_type; // 0:Servo,1:Relay
|
||||
AP_Int8 _trigger_duration; // duration in 10ths of a second that the camera shutter is held open
|
||||
AP_Int8 _relay_on; // relay value to trigger camera
|
||||
|
@ -127,3 +134,7 @@ private:
|
|||
bool using_feedback_pin(void) const { return _feedback_pin > 0; }
|
||||
|
||||
};
|
||||
|
||||
namespace AP {
|
||||
AP_Camera *camera();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue