summaryrefslogtreecommitdiffhomepage
path: root/tracker-wii
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-02-16 11:07:57 +0100
committerStanislaw Halik <sthalik@misaki.pl>2018-02-16 12:55:48 +0100
commite42a0361c986c39a9456226f1465a7fb721fe111 (patch)
tree67120790e85b977be6c5a5578293a6b3c31888af /tracker-wii
parent5a8c8f1d45997165396502e9404ed371e5ae59fe (diff)
tracker/{pt,wii}: simplify api
Remove useless abstract member functions, simplify some. Issue: #718
Diffstat (limited to 'tracker-wii')
-rw-r--r--tracker-wii/wii_camera.cpp11
-rw-r--r--tracker-wii/wii_camera.h6
2 files changed, 10 insertions, 7 deletions
diff --git a/tracker-wii/wii_camera.cpp b/tracker-wii/wii_camera.cpp
index 251ab33a..2af3eca3 100644
--- a/tracker-wii/wii_camera.cpp
+++ b/tracker-wii/wii_camera.cpp
@@ -33,7 +33,12 @@ WIICamera::WIICamera(const QString& module_name) : s { module_name }
cam_info.res_x = 1024;
cam_info.res_y = 768;
cam_info.fov = 42.0f;
- cam_info.idx = 0;
+ cam_info.idx = 0;
+}
+
+WIICamera::~WIICamera()
+{
+ stop();
}
QString WIICamera::get_desired_name() const
@@ -81,14 +86,14 @@ WIICamera::result WIICamera::get_frame(pt_frame& frame_)
return result(true, cam_info);
}
-pt_camera_open_status WIICamera::start(int idx, int fps, int res_x, int res_y)
+bool WIICamera::start(int idx, int fps, int res_x, int res_y)
{
m_pDev = std::make_unique<wiimote>();
m_pDev->ChangedCallback = on_state_change;
m_pDev->CallbackTriggerFlags = (state_change_flags)(CONNECTED |
EXTENSION_CHANGED |
MOTIONPLUS_CHANGED);
- return cam_open_ok_no_change;
+ return true;
}
void WIICamera::stop()
diff --git a/tracker-wii/wii_camera.h b/tracker-wii/wii_camera.h
index d0d7f6dd..55def206 100644
--- a/tracker-wii/wii_camera.h
+++ b/tracker-wii/wii_camera.h
@@ -29,8 +29,9 @@ namespace pt_module {
struct WIICamera final : pt_camera
{
WIICamera(const QString& module_name);
+ ~WIICamera() override;
- pt_camera_open_status start(int idx, int fps, int res_x, int res_y) override;
+ bool start(int idx, int fps, int res_x, int res_y) override;
void stop() override;
result get_frame(pt_frame& Frame) override;
@@ -40,12 +41,9 @@ struct WIICamera final : pt_camera
QString get_desired_name() const override;
QString get_active_name() const override;
- operator bool() const override { return m_pDev && (!m_pDev->ConnectionLost()); }
-
void set_fov(double value) override {}
void show_camera_settings() override;
-
private:
std::unique_ptr<wiimote> m_pDev;
static void on_state_change(wiimote &remote,