@geastack/host 0.1.29 → 0.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,7 @@ static double gCustomMenu = -1;
30
30
  @property(nonatomic, weak) NSWindow *window;
31
31
  @property(nonatomic, strong) NSTimer *timer;
32
32
  @property(nonatomic, strong) NSMenu *menu;
33
+ @property(nonatomic, strong) id keyMonitor;
33
34
  @end
34
35
 
35
36
  @implementation GeaMenuBar
@@ -83,6 +84,20 @@ static double gCustomMenu = -1;
83
84
  quit.target = NSApp;
84
85
  [self.menu addItem:quit];
85
86
 
87
+ // A menu bar app has no menu of its own in the main menu bar, so AppKit never
88
+ // matches its menu's shortcuts (Cmd+D in `shortcut: "Cmd+D"`) while that menu
89
+ // is closed. While the app is active, a key press with Command, Control or
90
+ // Option goes to that menu first, as it would to a regular app's main menu.
91
+ __weak GeaMenuBar *weakSelf = self;
92
+ self.keyMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskKeyDown
93
+ handler:^NSEvent *(NSEvent *event) {
94
+ const NSEventModifierFlags flags = event.modifierFlags & NSEventModifierFlagDeviceIndependentFlagsMask;
95
+ if (!(flags & (NSEventModifierFlagCommand | NSEventModifierFlagControl | NSEventModifierFlagOption))) return event;
96
+ NSMenu *menu = [weakSelf secondaryMenu];
97
+ if (menu && [menu performKeyEquivalent:event]) return nil;
98
+ return event;
99
+ }];
100
+
86
101
  [NSNotificationCenter.defaultCenter addObserver:self
87
102
  selector:@selector(resigned:)
88
103
  name:NSApplicationDidResignActiveNotification
@@ -34,12 +34,16 @@
34
34
  #include "host/profiler.h"
35
35
  #include "host/storage.h"
36
36
  #include "host/battery.h"
37
+ #include "host/background.h"
37
38
  #include "host/crypto.h"
38
39
  #include "host/opus.h"
39
40
  #include "host/files.h"
40
41
  #include "host/menu.h"
41
42
  #include "host/menu_bar.h"
42
43
  #include "host/notify.h"
44
+ #include "host/phone_link.h"
45
+ #include "host/local_notifications.h"
46
+ #include "host/notification_relay.h"
43
47
  #include "host/device_control.h"
44
48
  #include <input.h>
45
49
  #include "host/audio.h"
@@ -23,6 +23,10 @@ public:
23
23
  static double gyroscopeX();
24
24
  static double gyroscopeY();
25
25
  static double gyroscopeZ();
26
+ static double attitudeX();
27
+ static double attitudeY();
28
+ static double attitudeZ();
29
+ static double attitudeW();
26
30
  };
27
31
 
28
32
  } // namespace gea::framework::sensors
@@ -385,6 +389,11 @@ public:
385
389
  static double brightness();
386
390
  static void setBrightness(double brightness);
387
391
  static void setAA(double samples);
392
+ // Panel power. Weak-hooked (gea_display_set_powered / gea_display_powered):
393
+ // a no-op that always reports awake on boards without panel power control.
394
+ static void sleep();
395
+ static void wake();
396
+ static bool awake();
388
397
  static void setFlushConfig(double rows, double depth);
389
398
  // E-paper refresh policy + custom waveforms (weak-hooked: no-op on boards
390
399
  // without an e-paper panel). Negative numbers = leave unchanged. LUTs must
@@ -0,0 +1,34 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ #pragma once
3
+
4
+ #include <string>
5
+
6
+ // Keeping the app running while it is not on screen. On watchOS this is a
7
+ // WKExtendedRuntimeSession; elsewhere the weak defaults in host/background.cpp
8
+ // report "unsupported" and start() returns false.
9
+ namespace gea::platform::background {
10
+
11
+ // type is the platform's session kind ("physical-therapy", "self-care",
12
+ // "mindfulness" or "alarm" on watchOS). Returns false when it cannot start.
13
+ bool start(const char *type);
14
+ void stop();
15
+ // "unsupported", "idle", "starting", "running", "expiring" or "ended".
16
+ const char *state();
17
+
18
+ } // namespace gea::platform::background
19
+
20
+ namespace gea::host {
21
+
22
+ struct BackgroundSessionFacade {
23
+ bool start(const std::string &type) const { return gea::platform::background::start(type.c_str()); }
24
+ void stop() const { gea::platform::background::stop(); }
25
+ std::string state() const { return gea::platform::background::state(); }
26
+ bool active() const {
27
+ const std::string value = gea::platform::background::state();
28
+ return value == "starting" || value == "running" || value == "expiring";
29
+ }
30
+ };
31
+
32
+ inline constexpr BackgroundSessionFacade BackgroundSession{};
33
+
34
+ } // namespace gea::host
@@ -148,6 +148,9 @@ struct DisplayFacade {
148
148
 
149
149
  double getBrightness() const { return gea::framework::display::DisplayBackend::brightness(); }
150
150
  void setBrightness(double brightness) const { gea::framework::display::DisplayBackend::setBrightness(brightness); }
151
+ void sleep() const { gea::framework::display::DisplayBackend::sleep(); }
152
+ void wake() const { gea::framework::display::DisplayBackend::wake(); }
153
+ bool awake() const { return gea::framework::display::DisplayBackend::awake(); }
151
154
  std::string orientation() const { return gea::framework::display::DisplayBackend::orientation(); }
152
155
  std::string getOrientation() const { return orientation(); }
153
156
  void setOrientation(const std::string &orientation) const { gea::framework::display::DisplayBackend::setOrientation(orientation); }
@@ -77,7 +77,9 @@ struct HttpRequest {
77
77
  };
78
78
 
79
79
  // What a handler returns. Either an inline `body`, or a `file` path to stream
80
- // from disk. `download` (when set) turns the response into an attachment.
80
+ // from disk (or "asset://<bundle>/<path>" for a compiled-in bundle, see
81
+ // HttpEmbeddedBundle below). `download` (when set) turns the response into an
82
+ // attachment. `headers` apply to body, file and embedded replies alike.
81
83
  struct HttpReply {
82
84
  int status = 200;
83
85
  std::string contentType = "text/plain";
@@ -87,8 +89,88 @@ struct HttpReply {
87
89
  std::vector<HttpHeader> headers;
88
90
  };
89
91
 
92
+ // One file of a compiled-in static bundle (a web dashboard served by the
93
+ // device). The bytes live in flash `.rodata` and are sent straight from there
94
+ // on the server worker task: nothing is copied into JS, the frame task or the
95
+ // heap. Tables of these are emitted by a build step (see
96
+ // examples/apps/relay/web/scripts/emit-device-assets.mjs).
97
+ struct HttpEmbeddedAsset {
98
+ const char *path; // request path, e.g. "/index.html", "/assets/app-1a2b.js"
99
+ const unsigned char *data;
100
+ std::size_t size;
101
+ const char *contentType; // e.g. "text/javascript; charset=utf-8"
102
+ const char *etag; // strong validator INCLUDING quotes, or nullptr
103
+ bool gzip; // bytes are gzip: send `Content-Encoding: gzip`
104
+ bool immutable; // content-hashed name: cache for a year
105
+ };
106
+
107
+ struct HttpEmbeddedBundle {
108
+ const char *name; // addressed as "asset://<name>/<path>" in HttpReply.file
109
+ const HttpEmbeddedAsset *assets;
110
+ std::size_t count;
111
+ // Served (200) for a path that is not in the bundle and does not look like a
112
+ // file (its last segment has no '.'), so client-side routes reload; nullptr
113
+ // makes every miss a 404.
114
+ const char *fallback;
115
+ };
116
+
90
117
  namespace http {
91
118
 
119
+ // `HttpReply.file` values starting with this scheme are served from a
120
+ // registered HttpEmbeddedBundle instead of the filesystem:
121
+ // { file: "asset://relay-dashboard" + req.path }
122
+ // The bundle decides Content-Type, Content-Encoding, Cache-Control and ETag,
123
+ // and answers a matching If-None-Match with 304.
124
+ inline constexpr std::string_view kEmbeddedAssetScheme = "asset://";
125
+
126
+ inline bool is_embedded_asset_file(std::string_view file) {
127
+ return file.substr(0, kEmbeddedAssetScheme.size()) == kEmbeddedAssetScheme;
128
+ }
129
+
130
+ // Registers a bundle under its name (a later registration of the same name
131
+ // replaces the earlier one). Returns true so a generated table can register
132
+ // itself from a namespace-scope initializer.
133
+ bool register_embedded_bundle(const HttpEmbeddedBundle *bundle);
134
+ const HttpEmbeddedBundle *find_embedded_bundle(std::string_view name);
135
+
136
+ // The transport-independent answer for an embedded-asset reply.
137
+ struct EmbeddedAssetResponse {
138
+ int status = 404; // 200, 304 or 404
139
+ const HttpEmbeddedAsset *asset = nullptr; // set for 200 and 304
140
+ std::vector<HttpHeader> headers; // Content-Encoding, Cache-Control, ETag, Vary
141
+ std::string contentType = "text/plain";
142
+ };
143
+
144
+ // Resolves "asset://<bundle>/<path>" against the registered bundles. `path`
145
+ // "" or "/" maps to "/index.html". `ifNoneMatch` is the request header value
146
+ // ("" when absent).
147
+ EmbeddedAssetResponse resolve_embedded_asset(std::string_view file,
148
+ std::string_view ifNoneMatch);
149
+
150
+ // Case-insensitive request header lookup ("" when absent).
151
+ inline std::string_view find_header(const std::vector<HttpHeader> &headers,
152
+ std::string_view name) {
153
+ for (const auto &header : headers) {
154
+ if (header.name.size() != name.size())
155
+ continue;
156
+ bool same = true;
157
+ for (std::size_t i = 0; i < name.size() && same; ++i) {
158
+ char a = header.name[i], b = name[i];
159
+ if (a >= 'A' && a <= 'Z')
160
+ a = static_cast<char>(a - 'A' + 'a');
161
+ if (b >= 'A' && b <= 'Z')
162
+ b = static_cast<char>(b - 'A' + 'a');
163
+ same = a == b;
164
+ }
165
+ if (same)
166
+ return header.value;
167
+ }
168
+ return {};
169
+ }
170
+
171
+ // Reason phrase for a status code ("OK", "Not Found", ...; "" if unknown).
172
+ const char *status_reason(int status);
173
+
92
174
  // Handler signature on the native side. Runs on the frame task. Pure value
93
175
  // types in the signature (no gea_cpp_value), so this file's non-generated TUs
94
176
  // can store and call it without the dynamic-value runtime.
@@ -0,0 +1,56 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ #pragma once
3
+
4
+ // Notifications posted by the app itself (`LocalNotifications` in
5
+ // @geastack/core): UNUserNotificationCenter on iOS/macOS, NotificationManager
6
+ // on Android. The base driver IS the unsupported one; a platform installs its
7
+ // own with setLocalNotificationsDriver(). Header-only so every target links.
8
+
9
+ #include <string>
10
+
11
+ namespace gea::host {
12
+
13
+ class LocalNotificationsDriver {
14
+ public:
15
+ virtual ~LocalNotificationsDriver() = default;
16
+ // "granted", "denied", "undetermined" or "unsupported".
17
+ virtual std::string permission() { return "unsupported"; }
18
+ virtual void requestPermission() {}
19
+ // Returns the notification id, or 0 when it could not be scheduled.
20
+ virtual double post(const std::string &title, const std::string &body, double delaySeconds) {
21
+ (void)title;
22
+ (void)body;
23
+ (void)delaySeconds;
24
+ return 0;
25
+ }
26
+ virtual void cancelAll() {}
27
+ };
28
+
29
+ namespace local_notifications::detail {
30
+ inline LocalNotificationsDriver *&driverSlot() {
31
+ static LocalNotificationsDriver unsupported;
32
+ static LocalNotificationsDriver *driver = &unsupported;
33
+ return driver;
34
+ }
35
+ } // namespace local_notifications::detail
36
+
37
+ inline void setLocalNotificationsDriver(LocalNotificationsDriver *driver) {
38
+ if (driver) local_notifications::detail::driverSlot() = driver;
39
+ }
40
+
41
+ inline LocalNotificationsDriver &localNotificationsDriver() {
42
+ return *local_notifications::detail::driverSlot();
43
+ }
44
+
45
+ struct LocalNotificationsFacade {
46
+ std::string permission() const { return localNotificationsDriver().permission(); }
47
+ void requestPermission() const { localNotificationsDriver().requestPermission(); }
48
+ double post(const std::string &title, const std::string &body, double delaySeconds = 0) const {
49
+ return localNotificationsDriver().post(title, body, delaySeconds);
50
+ }
51
+ void cancelAll() const { localNotificationsDriver().cancelAll(); }
52
+ };
53
+
54
+ inline constexpr LocalNotificationsFacade LocalNotifications{};
55
+
56
+ } // namespace gea::host
@@ -6,6 +6,7 @@
6
6
  #include <functional>
7
7
  #include <memory>
8
8
  #include <string>
9
+ #include <type_traits>
9
10
  #include <vector>
10
11
  #include "host/video_pixels.h"
11
12
 
@@ -79,6 +80,19 @@ struct MediaRecorderDataEvent {
79
80
  GeaAudioBlob data;
80
81
  };
81
82
 
83
+ // One row of `navigator.mediaDevices.enumerateDevices()`.
84
+ struct MediaDeviceInfo {
85
+ std::string deviceId;
86
+ std::string kind;
87
+ std::string label;
88
+ std::string groupId;
89
+ // Input channels the device has (0 when the platform cannot tell); a Gea extension over the browser's list.
90
+ double channelCount = 0;
91
+
92
+ template <typename Value>
93
+ static MediaDeviceInfo __gea_native_from_value(const Value &) { return {}; }
94
+ };
95
+
82
96
  namespace media {
83
97
  template <typename Options>
84
98
  std::string recorder_path_from_options(const Options &options);
@@ -195,6 +209,10 @@ class TrackPcmReader {
195
209
  };
196
210
 
197
211
  NativeMediaStreamHandle get_user_media_audio();
212
+ // Captures from `deviceId` (an `audioinput` id from enumerate_devices; "" or "default" is the system default).
213
+ NativeMediaStreamHandle get_user_media_audio(const std::string &deviceId);
214
+ // As above, recording only input `channel` (0-based) of that device; a negative channel mixes them all.
215
+ NativeMediaStreamHandle get_user_media_audio(const std::string &deviceId, int channel);
198
216
  NativeMediaRecorderHandle create_recorder(NativeMediaStreamHandle stream, const std::string &path, const std::string &mimeType);
199
217
  std::string recorder_state(NativeMediaRecorderHandle handle);
200
218
  std::string recorder_mime_type(NativeMediaRecorderHandle handle);
@@ -237,13 +255,104 @@ std::string recorder_mime_from_options(const Options &options) {
237
255
  options, [](const auto &record) -> decltype(record.mimeType) { return record.mimeType; }, "audio/wav");
238
256
  }
239
257
 
240
- // Overload accepting a MediaStreamConstraints-shaped record (from
241
- // `navigator.mediaDevices.getUserMedia({...})`). The fields aren't acted on
242
- // yet — there's no per-device picker on the embedded target — but accepting
243
- // the arg lets the geatsc-emitted call site link. The single-arg form
244
- // dispatches to the no-arg implementation.
258
+ // The capture devices this platform has: the system default input first, as deviceId "default", then every
259
+ // audio input. The platform supplies the inputs (platform_input_devices); a target without one returns nothing.
260
+ std::vector<MediaDeviceInfo> enumerate_devices();
261
+ std::vector<MediaDeviceInfo> platform_input_devices();
262
+
263
+ // The input the newest capture asked for ("" is the system default). The platform capture reads it when it
264
+ // starts, and a request for a different device restarts a running capture on that device.
265
+ std::string requested_input_device();
266
+ // The input channel (0-based) the newest capture asked for; negative mixes every channel.
267
+ int requested_input_channel();
268
+ void platform_input_device_changed();
269
+
270
+ // `deviceId` out of a MediaStreamConstraints-shaped value from
271
+ // `navigator.mediaDevices.getUserMedia({...})`, whatever layers geatsc wraps it in: an optional, a record
272
+ // reference, the `boolean | { deviceId, ... }` union of `audio`, and ConstrainDeviceId's
273
+ // `string | { exact, ideal }`. Anything without one is "".
274
+ template <typename Value>
275
+ std::string constraint_device_id(const Value &value);
276
+
277
+ // A tagged union's `is<I>()` names no arm past its last one, so the walk stops at `arity`.
278
+ template <std::size_t Arm, typename Union>
279
+ std::string constraint_device_id_arm(const Union &value) {
280
+ if constexpr (Arm >= Union::arity) {
281
+ return {};
282
+ } else {
283
+ if (value.template is<Arm>()) return constraint_device_id(value.template get<Arm>());
284
+ return constraint_device_id_arm<Arm + 1>(value);
285
+ }
286
+ }
287
+
288
+ template <typename Value>
289
+ std::string constraint_device_id(const Value &value) {
290
+ if constexpr (std::is_same_v<std::decay_t<Value>, bool> || std::is_arithmetic_v<std::decay_t<Value>>) {
291
+ return {};
292
+ } else if constexpr (std::is_constructible_v<std::string, const Value &>) {
293
+ return std::string(value);
294
+ } else if constexpr (requires { value.has_value(); *value; }) {
295
+ return value.has_value() ? constraint_device_id(*value) : std::string();
296
+ } else if constexpr (requires { value.get(); *value; }) {
297
+ return value.get() ? constraint_device_id(*value) : std::string();
298
+ } else if constexpr (requires { std::decay_t<Value>::arity; value.template is<0>(); }) {
299
+ return constraint_device_id_arm<0>(value);
300
+ } else if constexpr (requires { value.audio; }) {
301
+ return constraint_device_id(value.audio);
302
+ } else if constexpr (requires { value.deviceId; }) {
303
+ return constraint_device_id(value.deviceId);
304
+ } else if constexpr (requires { value.exact; value.ideal; }) {
305
+ const auto exact = constraint_device_id(value.exact);
306
+ return exact.empty() ? constraint_device_id(value.ideal) : exact;
307
+ } else if constexpr (requires { value.exact; }) {
308
+ return constraint_device_id(value.exact);
309
+ } else if constexpr (requires { value.ideal; }) {
310
+ return constraint_device_id(value.ideal);
311
+ } else {
312
+ return {};
313
+ }
314
+ }
315
+
316
+ // The `channel` (a Gea extension: the 0-based input channel to record) out of the same constraints; -1 when
317
+ // absent, which mixes every channel.
318
+ template <typename Value>
319
+ int constraint_channel(const Value &value);
320
+
321
+ template <std::size_t Arm, typename Union>
322
+ int constraint_channel_arm(const Union &value) {
323
+ if constexpr (Arm >= Union::arity) {
324
+ return -1;
325
+ } else {
326
+ if (value.template is<Arm>()) return constraint_channel(value.template get<Arm>());
327
+ return constraint_channel_arm<Arm + 1>(value);
328
+ }
329
+ }
330
+
331
+ template <typename Value>
332
+ int constraint_channel(const Value &value) {
333
+ if constexpr (std::is_same_v<std::decay_t<Value>, bool>) {
334
+ return -1;
335
+ } else if constexpr (std::is_arithmetic_v<std::decay_t<Value>>) {
336
+ return value >= 0 ? static_cast<int>(value) : -1;
337
+ } else if constexpr (requires { value.has_value(); *value; }) {
338
+ return value.has_value() ? constraint_channel(*value) : -1;
339
+ } else if constexpr (requires { value.get(); *value; }) {
340
+ return value.get() ? constraint_channel(*value) : -1;
341
+ } else if constexpr (requires { std::decay_t<Value>::arity; value.template is<0>(); }) {
342
+ return constraint_channel_arm<0>(value);
343
+ } else if constexpr (requires { value.audio; }) {
344
+ return constraint_channel(value.audio);
345
+ } else if constexpr (requires { value.channel; }) {
346
+ return constraint_channel(value.channel);
347
+ } else {
348
+ return -1;
349
+ }
350
+ }
351
+
245
352
  template <typename Constraints>
246
- NativeMediaStreamHandle get_user_media_audio(const Constraints &) { return get_user_media_audio(); }
353
+ NativeMediaStreamHandle get_user_media_audio(const Constraints &constraints) {
354
+ return get_user_media_audio(constraint_device_id(constraints), constraint_channel(constraints));
355
+ }
247
356
 
248
357
  } // namespace media
249
358
 
@@ -49,7 +49,11 @@ public:
49
49
  gea::framework::sensors::AccelerometerBackend::accelerationZ),
50
50
  gyroscopeX(gea::framework::sensors::AccelerometerBackend::gyroscopeX),
51
51
  gyroscopeY(gea::framework::sensors::AccelerometerBackend::gyroscopeY),
52
- gyroscopeZ(gea::framework::sensors::AccelerometerBackend::gyroscopeZ) {}
52
+ gyroscopeZ(gea::framework::sensors::AccelerometerBackend::gyroscopeZ),
53
+ attitudeX(gea::framework::sensors::AccelerometerBackend::attitudeX),
54
+ attitudeY(gea::framework::sensors::AccelerometerBackend::attitudeY),
55
+ attitudeZ(gea::framework::sensors::AccelerometerBackend::attitudeZ),
56
+ attitudeW(gea::framework::sensors::AccelerometerBackend::attitudeW) {}
53
57
 
54
58
  void start() const { gea::framework::sensors::AccelerometerBackend::init(); }
55
59
  void init() const { gea::framework::sensors::AccelerometerBackend::init(); }
@@ -69,6 +73,10 @@ public:
69
73
  AccelerometerValueProperty gyroscopeX;
70
74
  AccelerometerValueProperty gyroscopeY;
71
75
  AccelerometerValueProperty gyroscopeZ;
76
+ AccelerometerValueProperty attitudeX;
77
+ AccelerometerValueProperty attitudeY;
78
+ AccelerometerValueProperty attitudeZ;
79
+ AccelerometerValueProperty attitudeW;
72
80
  };
73
81
 
74
82
  using IMU = AccelerometerFacade;
@@ -0,0 +1,84 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ #pragma once
3
+
4
+ // Phone side of Android notification forwarding (`NotificationRelay` in
5
+ // @geastack/core). The forwarding itself runs in a native Android foreground
6
+ // service (NotificationListenerService + CompanionDeviceManager + a BLE GATT
7
+ // client) so it keeps working while the app is closed; this facade configures
8
+ // that service and reports its state. The base driver IS the unsupported one;
9
+ // the Android target installs its own with setNotificationRelayDriver().
10
+
11
+ #include <string>
12
+
13
+ namespace gea::host {
14
+
15
+ class NotificationRelayDriver {
16
+ public:
17
+ virtual ~NotificationRelayDriver() = default;
18
+ virtual bool supported() { return false; }
19
+ virtual bool listenerEnabled() { return false; }
20
+ virtual void openListenerSettings() {}
21
+ virtual void pair() {}
22
+ virtual bool paired() { return false; }
23
+ virtual std::string deviceName() { return ""; }
24
+ virtual void forget() {}
25
+ // "off", "connecting" or "connected".
26
+ virtual std::string link() { return "off"; }
27
+ virtual bool enabled() { return false; }
28
+ virtual void setEnabled(bool enabled) { (void)enabled; }
29
+ virtual std::string mutedApps() { return ""; }
30
+ virtual void setMutedApps(const std::string &packagesCsv) { (void)packagesCsv; }
31
+ virtual double forwardedCount() { return 0; }
32
+ virtual std::string lastForwarded() { return ""; }
33
+ virtual double appCount() { return 0; }
34
+ virtual std::string appIdAt(int index) {
35
+ (void)index;
36
+ return "";
37
+ }
38
+ virtual std::string appNameAt(int index) {
39
+ (void)index;
40
+ return "";
41
+ }
42
+ virtual void sendTest() {}
43
+ };
44
+
45
+ namespace notification_relay::detail {
46
+ inline NotificationRelayDriver *&driverSlot() {
47
+ static NotificationRelayDriver unsupported;
48
+ static NotificationRelayDriver *driver = &unsupported;
49
+ return driver;
50
+ }
51
+ } // namespace notification_relay::detail
52
+
53
+ inline void setNotificationRelayDriver(NotificationRelayDriver *driver) {
54
+ if (driver) notification_relay::detail::driverSlot() = driver;
55
+ }
56
+
57
+ inline NotificationRelayDriver &notificationRelayDriver() {
58
+ return *notification_relay::detail::driverSlot();
59
+ }
60
+
61
+ struct NotificationRelayFacade {
62
+ bool supported() const { return notificationRelayDriver().supported(); }
63
+ bool listenerEnabled() const { return notificationRelayDriver().listenerEnabled(); }
64
+ void openListenerSettings() const { notificationRelayDriver().openListenerSettings(); }
65
+ void pair() const { notificationRelayDriver().pair(); }
66
+ bool paired() const { return notificationRelayDriver().paired(); }
67
+ std::string deviceName() const { return notificationRelayDriver().deviceName(); }
68
+ void forget() const { notificationRelayDriver().forget(); }
69
+ std::string link() const { return notificationRelayDriver().link(); }
70
+ bool enabled() const { return notificationRelayDriver().enabled(); }
71
+ void setEnabled(bool enabled) const { notificationRelayDriver().setEnabled(enabled); }
72
+ std::string mutedApps() const { return notificationRelayDriver().mutedApps(); }
73
+ void setMutedApps(const std::string &packagesCsv) const { notificationRelayDriver().setMutedApps(packagesCsv); }
74
+ double forwardedCount() const { return notificationRelayDriver().forwardedCount(); }
75
+ std::string lastForwarded() const { return notificationRelayDriver().lastForwarded(); }
76
+ double appCount() const { return notificationRelayDriver().appCount(); }
77
+ std::string appIdAt(double index) const { return notificationRelayDriver().appIdAt(static_cast<int>(index)); }
78
+ std::string appNameAt(double index) const { return notificationRelayDriver().appNameAt(static_cast<int>(index)); }
79
+ void sendTest() const { notificationRelayDriver().sendTest(); }
80
+ };
81
+
82
+ inline constexpr NotificationRelayFacade NotificationRelay{};
83
+
84
+ } // namespace gea::host