summaryrefslogtreecommitdiff
path: root/src/tangara/input/input_device.hpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-05-02 19:12:26 +1000
committerjacqueline <me@jacqueline.id.au>2024-05-02 19:12:26 +1000
commit1573a8c4cde1cd9528b422b2dcc598e37ffe94a7 (patch)
treed162822b8fd7054f81bace0c7a65ab4d5e6f93ef /src/tangara/input/input_device.hpp
parenta231fd1c8afedbeb14b0bc77d76bad61db986059 (diff)
downloadtangara-fw-1573a8c4cde1cd9528b422b2dcc598e37ffe94a7.tar.gz
WIP merge cyclically dependent components into one big component
Diffstat (limited to 'src/tangara/input/input_device.hpp')
-rw-r--r--src/tangara/input/input_device.hpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/tangara/input/input_device.hpp b/src/tangara/input/input_device.hpp
new file mode 100644
index 00000000..d944c3bf
--- /dev/null
+++ b/src/tangara/input/input_device.hpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2024 jacqueline <me@jacqueline.id.au>
+ *
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+
+#pragma once
+
+#include <functional>
+#include <string>
+#include <vector>
+
+#include "hal/lv_hal_indev.h"
+#include "input_hook.hpp"
+#include "property.hpp"
+
+namespace input {
+
+/*
+ * Interface for all device input methods. Each 'Input Device' is polled by
+ * LVGL at regular intervals, and can effect the device either via LVGL's input
+ * device driver API, or by emitting events for other parts of the system to
+ * react to (e.g. issuing a play/pause event, or altering the volume).
+ */
+class IInputDevice {
+ public:
+ virtual ~IInputDevice() {}
+
+ virtual auto read(lv_indev_data_t* data) -> void = 0;
+
+ virtual auto name() -> std::string = 0;
+ virtual auto triggers() -> std::vector<std::reference_wrapper<TriggerHooks>> {
+ return {};
+ }
+};
+
+} // namespace input