aboutsummaryrefslogtreecommitdiffstats
path: root/src/audiomixer-service.hpp
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2022-06-17 20:24:27 -0400
committerScott Murray <scott.murray@konsulko.com>2022-06-17 20:29:19 -0400
commit298bbf445a731b85cb8d5d19a3b595e8870d8701 (patch)
treeffc1e0f3ff78cd160bf6e080c0caa48449499a3e /src/audiomixer-service.hpp
parent75f7a06890b0c02d179a0eb240e7f06b7f0d2220 (diff)
Repurpose into VIS clientmarlin
Repurpose repository for a spiritual successor of the previous binding. The replacement is a daemon that demonstrates servicing the volume actuator from the VSS schema via VIS signals from KUKSA.val. Currently the connection to KUKSA.val is websocket based using the boost::asio framework, but the plan is to migrate to gRPC as that becomes more robust in KUKSA.val. As well, this new code will serve as the base for implementing a gRPC API to expose the full set of WirePlumber controls as was done with the previous binding. Notable changes: - New code is completely C++, partly to leverage using Boost, but also to futureproof future work with gRPC. The WirePlumber interfacing code that has been kept from the old binding is still C for now, converting it to C++ is a planned future rework. - Switch from CMake to meson for ease of development and some degree of futureproofing. - Use with systemd is assumed; behavior follows the systemd daemon guidelines barring the use of journald logging prefixes, which may be addressed with future work. A systemd unit is also installed as part of the build. - SPDX license headers using SPDX "short identifiers" are used in source files rather than the full copyright headers used in the previous codebase. This follows the direction that projects such as the Linux kernel are going in. Bug-AGL: SPEC-4409 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: Ibb7091c4354432bb094147d1419ab475486a4abc
Diffstat (limited to 'src/audiomixer-service.hpp')
-rw-r--r--src/audiomixer-service.hpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/audiomixer-service.hpp b/src/audiomixer-service.hpp
new file mode 100644
index 0000000..cb00584
--- /dev/null
+++ b/src/audiomixer-service.hpp
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: Apache-2.0
+
+#ifndef _AUDIOMIXER_SERVICE_HPP
+#define _AUDIOMIXER_SERVICE_HPP
+
+#include "vis-session.hpp"
+#include "audiomixer.h"
+
+class AudiomixerService : public VisSession
+{
+ struct audiomixer *m_audiomixer;
+
+public:
+ AudiomixerService(const VisConfig &config, net::io_context& ioc, ssl::context& ctx);
+
+ ~AudiomixerService();
+
+ static void audiomixer_control_change_cb(void *data) {
+ if (data)
+ ((AudiomixerService*) data)->handle_control_change();
+ };
+
+ static void audiomixer_value_change_cb(void *data,
+ unsigned int change_mask,
+ const struct mixer_control *control) {
+ if (data)
+ ((AudiomixerService*) data)->handle_value_change(change_mask, control);
+ }
+
+protected:
+ struct audiomixer_events m_audiomixer_events;
+
+ virtual void handle_authorized_response(void) override;
+
+ virtual void handle_get_response(std::string &path, std::string &value, std::string &timestamp) override;
+
+ virtual void handle_notification(std::string &path, std::string &value, std::string &timestamp) override;
+
+ virtual void handle_control_change(void);
+
+ virtual void handle_value_change(unsigned int change_mask, const struct mixer_control *control);
+};
+
+#endif // _AUDIOMIXER_SERVICE_HPP