|
@@ -0,0 +1,49 @@
|
|
1
|
+
|
|
2
|
+#include "impl/util.h"
|
|
3
|
+#include "light.h"
|
|
4
|
+#include "helpers.h"
|
|
5
|
+
|
|
6
|
+#include <stdio.h> //snprintf
|
|
7
|
+#include <stdlib.h> // malloc, free
|
|
8
|
+#include <dirent.h> // opendir, readdir
|
|
9
|
+#include <inttypes.h> // PRIu64
|
|
10
|
+
|
|
11
|
+bool impl_util_init(light_device_enumerator_t *enumerator)
|
|
12
|
+{
|
|
13
|
+ light_device_t *util_device = light_create_device(enumerator, "test", NULL);
|
|
14
|
+ light_create_device_target(util_device, "dryrun", impl_util_dryrun_set, impl_util_dryrun_get, impl_util_dryrun_getmax, impl_util_dryrun_command, NULL);
|
|
15
|
+ return true;
|
|
16
|
+}
|
|
17
|
+
|
|
18
|
+bool impl_util_free(light_device_enumerator_t *enumerator)
|
|
19
|
+{
|
|
20
|
+ return true;
|
|
21
|
+}
|
|
22
|
+
|
|
23
|
+bool impl_util_dryrun_set(light_device_target_t *target, uint64_t in_value)
|
|
24
|
+{
|
|
25
|
+ LIGHT_NOTE("impl_util_dryrun_set: writing brightness %" PRIu64 " to utility target %s", in_value, target->name);
|
|
26
|
+ return true;
|
|
27
|
+}
|
|
28
|
+
|
|
29
|
+bool impl_util_dryrun_get(light_device_target_t *target, uint64_t *out_value)
|
|
30
|
+{
|
|
31
|
+ LIGHT_NOTE("impl_util_dryrun_get: reading brightness (0) from utility target %s", target->name);
|
|
32
|
+ *out_value = 0;
|
|
33
|
+ return true;
|
|
34
|
+}
|
|
35
|
+
|
|
36
|
+bool impl_util_dryrun_getmax(light_device_target_t *target, uint64_t *out_value)
|
|
37
|
+{
|
|
38
|
+ LIGHT_NOTE("impl_util_dryrun_getmax: reading max. brightness (255) from utility target %s", target->name);
|
|
39
|
+ *out_value = 255;
|
|
40
|
+ return true;
|
|
41
|
+}
|
|
42
|
+
|
|
43
|
+bool impl_util_dryrun_command(light_device_target_t *target, char const *command_string)
|
|
44
|
+{
|
|
45
|
+ LIGHT_NOTE("impl_util_dryrun_command: running custom command on utility target %s: \"%s\"", target->name, command_string);
|
|
46
|
+ return true;
|
|
47
|
+}
|
|
48
|
+
|
|
49
|
+
|