summaryrefslogtreecommitdiffstats
path: root/src/AudiomixerService.h
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2023-08-24 15:43:08 -0400
committerScott Murray <scott.murray@konsulko.com>2023-08-24 15:43:28 -0400
commit82c1c0ab04219f9453f1b3a14a9754068e360583 (patch)
treec8ad28a5b7deba660dbddc7de86109d998eaf2e8 /src/AudiomixerService.h
parentfdd9d0964a0fe7aadfcef33c9e9c1f183ca10820 (diff)
Rework to switch to using KUKSA.val databroker
Rework to use the "VAL" gRPC API from the KUKSA.val databroker instead of the older server's WebSocket interface. Some source files have been renamed to match the class naming to provide a bit more consistency. Bug-AGL: SPEC-4762 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I5ded74cfbd6987cd045b7b142fd9f38971aaef66
Diffstat (limited to 'src/AudiomixerService.h')
-rw-r--r--src/AudiomixerService.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/AudiomixerService.h b/src/AudiomixerService.h
new file mode 100644
index 0000000..3cd87c6
--- /dev/null
+++ b/src/AudiomixerService.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2022,2023 Konsulko Group
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#ifndef _AUDIOMIXER_SERVICE_H
+#define _AUDIOMIXER_SERVICE_H
+
+#include <glib.h>
+
+#include "KuksaConfig.h"
+#include "KuksaClient.h"
+#include "audiomixer.h"
+
+class AudiomixerService
+{
+public:
+ AudiomixerService(const KuksaConfig &config, GMainLoop *loop = NULL);
+
+ ~AudiomixerService();
+
+ // Callbacks for WirePlumber API
+
+ static void mixer_control_change_cb(void *data) {
+ if (data)
+ ((AudiomixerService*) data)->HandleMixerControlChange();
+ };
+
+ static void mixer_value_change_cb(void *data,
+ unsigned int change_mask,
+ const struct mixer_control *control) {
+ if (data)
+ ((AudiomixerService*) data)->HandleMixerValueChange(change_mask, control);
+ }
+
+ // Callback for KuksaClient subscribe API reconnect
+
+ static gboolean resubscribe_cb(gpointer data) {
+ struct resubscribe_data *d = (struct resubscribe_data*) data;
+ if (d && d->self) {
+ ((AudiomixerService*) d->self)->Resubscribe(d->request);
+ }
+ return FALSE;
+ }
+
+private:
+ struct resubscribe_data {
+ AudiomixerService *self;
+ const SubscribeRequest *request;
+ };
+
+ GMainLoop *m_loop;
+ KuksaConfig m_config;
+ KuksaClient *m_broker;
+ struct audiomixer *m_audiomixer;
+ struct audiomixer_events m_audiomixer_events;
+
+ void HandleSignalChange(const std::string &path, const Datapoint &dp);
+
+ void HandleSignalSetError(const std::string &path, const Error &error);
+
+ void HandleSubscribeDone(const SubscribeRequest *request, const Status &status);
+
+ void Resubscribe(const SubscribeRequest *request);
+
+ void HandleMixerControlChange(void);
+
+ void HandleMixerValueChange(unsigned int change_mask, const struct mixer_control *control);
+};
+
+#endif // _AUDIOMIXER_SERVICE_H