2 .TH "BUXTON_SET_VALUE" "3" "buxton 1" "buxton_set_value"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
17 .\" disable justification (adjust text to left margin only)
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
23 buxton_set_value, buxton_unset_value \- Modify values for BuxtonKeys
32 int buxton_set_value(BuxtonClient \fIclient\fB,
38 BuxtonCallback \fIcallback\fB,
45 int buxton_unset_value(BuxtonClient \fIclient\fB,
49 BuxtonCallback \fIcallback\fB,
59 These functions are used to modify values for a BuxtonKey, referenced
60 by \fIkey\fR, on behalf of the \fIclient\fR.
62 To set the value for a \fIkey\fR, clients should call
63 \fBbuxton_set_value\fR(3), passing a pointer the \fIvalue\fR for the
66 To unset the value for a \fIkey\fR, clients should call
67 \fBbuxton_unset_value\fR(3)\&.
69 Both functions accept optional callback functions to register with
70 the daemon, referenced by the \fIcallback\fR argument; the callback
71 function is called upon completion of the operation\&. The \fIdata\fR
72 argument is a pointer to arbitrary userdata that is passed along to
73 the callback function\&. Additonally, the \fIsync\fR argument
74 controls whether the operation should be synchronous or not; if
75 \fIsync\fR is false, the operation is asynchronous\&.
79 An example for set_value:
91 void set_cb(BuxtonResponse response, void *data)
96 if (buxton_response_status(response) != 0) {
97 printf("Failed to set value\\n");
101 key = buxton_response_key(response);
102 name = buxton_key_get_name(key);
103 printf("Set value for key %s\\n", name);
104 buxton_key_free(key);
112 struct pollfd pfd[1];
117 if ((fd = buxton_open(&client)) < 0) {
118 printf("couldn't connect\\n");
122 key = buxton_key_create("hello", "test", "user", INT32);
129 if (buxton_set_value(client, key, &set, set_cb,
131 printf("set call failed to run\\n");
136 pfd[0].events = POLLIN;
138 r = poll(pfd, 1, 5000);
141 printf("poll error\\n");
145 if (!buxton_client_handle_response(client)) {
146 printf("bad response from daemon\\n");
150 buxton_key_free(key);
151 buxton_close(client);
157 An example for unset_value:
169 void unset_cb(BuxtonResponse response, void *data)
171 if (buxton_response_status(response) != 0) {
172 printf("Failed to unset value\\n");
174 printf("Unset value\\n");
182 struct pollfd pfd[1];
186 if ((fd = buxton_open(&client)) < 0) {
187 printf("couldn't connect\\n");
191 key = buxton_key_create("hello", "test", "user", INT32);
196 if (buxton_unset_value(client, key, unset_cb,
198 printf("unset call failed to run\\n");
203 pfd[0].events = POLLIN;
205 r = poll(pfd, 1, 5000);
208 printf("poll error\\n");
212 if (!buxton_client_handle_response(client)) {
213 printf("bad response from daemon\\n");
217 buxton_key_free(key);
218 buxton_close(client);
225 Returns 0 on success, and a non\-zero value on failure\&.
229 Copyright 2014 Intel Corporation\&. License: Creative Commons
230 Attribution\-ShareAlike 3.0 Unported\s-2\u[1]\d\s+2, with exception
231 for code examples found in the \fBCODE EXAMPLE\fR section, which are
232 licensed under the MIT license provided in the \fIdocs/LICENSE.MIT\fR
233 file from this buxton distribution\&.
243 Creative Commons Attribution\-ShareAlike 3.0 Unported
245 \%http://creativecommons.org/licenses/by-sa/3.0/