Nxhclib » History » Version 1
Stefan Mark, 03/07/2021 09:09 AM
1 | 1 | Stefan Mark | h1. C library nxhclib |
---|---|---|---|
2 | |||
3 | <pre><code class="c"> |
||
4 | int nxh_base_dir_filter(const struct dirent *dir); |
||
5 | </code></pre> |
||
6 | |||
7 | Basic filter for scandir: filter '.' and '..'. |
||
8 | |||
9 | <pre><code class="c"> |
||
10 | int nxh_isexecutable(const char *filename); |
||
11 | int nxh_isfifo(const char *filename); |
||
12 | int nxh_fileexists(const char* filename); |
||
13 | int nxh_direxists(const char* dirname); |
||
14 | </code></pre> |
||
15 | |||
16 | Exactly what it says on the tin. Return 1 on full succes, 0 on successful test but unmatched condition and -1 on unsuccessful test. |
||
17 | |||
18 | <pre><code class="c"> |
||
19 | char* nxh_which(const char *cmd); |
||
20 | </code></pre> |
||
21 | |||
22 | Hopefully the same as the shell command `which`. Return has to be freed. NULL if not found. |
||
23 | |||
24 | <pre><code class="c"> |
||
25 | int nxh_has_sysdaemon(); |
||
26 | </code></pre> |
||
27 | |||
28 | Returns 1 if **nxsysdaemon** is running, responsive and has a matching protocol version. 0 else. |
||
29 | |||
30 | <pre><code class="c"> |
||
31 | int nxh_whisper(char *answer, int len, const char *question); |
||
32 | </code></pre> |
||
33 | |||
34 | Whispers a `question` to **nxsysdaemon**, stores the answer (up to `len` characters) in `answer`. Returns number of bytes read on success, -1 else. |
||
35 | |||
36 | <pre><code class="c"> |
||
37 | int nxh_get_curbright(); |
||
38 | </code></pre> |
||
39 | |||
40 | Gets the currently set display brightness (see **nxsysdaemon** for details). |
||
41 | |||
42 | <pre><code class="c"> |
||
43 | int nxh_get_maxbright(); |
||
44 | </code></pre> |
||
45 | |||
46 | Gets the maximum display brightness (see **nxsysdaemon** for details). |
||
47 | |||
48 | <pre><code class="c"> |
||
49 | int nxh_set_bright(); |
||
50 | </code></pre> |
||
51 | |||
52 | Sets the current display brightness (see **nxsysdaemon** for details). |
||
53 | |||
54 | <pre><code class="c"> |
||
55 | int nxh_is_onac(); |
||
56 | </code></pre> |
||
57 | |||
58 | Returns 1 if the system is on AC, 0 otherwise (see **nxsysdaemon** for details). |
||
59 | |||
60 | <pre><code class="c"> |
||
61 | int nxh_is_save_wifi(const char *save_networks); |
||
62 | </code></pre> |
||
63 | |||
64 | Returns 1 if the system is connected to a WiFi network with ESSID `save_networks`. 0 if not. -1 if testing was impossible. |
||
65 | |||
66 | <pre><code class="c"> |
||
67 | int nxh_is_locked(); |
||
68 | </code></pre> |
||
69 | |||
70 | Returns 1 if the system is locked with **nxulock**. 0 if not. -1 if testing was impossible. |
||
71 | |||
72 | <pre><code class="c"> |
||
73 | int nxh_is_docked(const char *pseudo_dock); |
||
74 | </code></pre> |
||
75 | |||
76 | Returns 1 if the system is docked. Either with a classic (kernel supported) dock, or to a USB pseudo dock given by pseudo_dock (VENDOR:DEVICE). |