2 * This file is part of buxton.
4 * Copyright (C) 2013 Intel Corporation
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 void get_cb(BuxtonResponse response, void *data)
37 int32_t* ret = (int32_t*)data;
39 if (buxton_response_status(response) != 0) {
40 printf("Failed to get value\n");
44 *ret = *(int32_t*)buxton_response_value(response);
56 if ((fd = buxton_open(&client)) < 0) {
57 printf("couldn't connect\n");
61 key = buxton_key_create("hello", "test", "user", INT32);
66 if (buxton_get_value(client, key, get_cb,
68 printf("get call failed to run\n");
73 pfd[0].events = POLLIN;
75 r = poll(pfd, 1, 5000);
78 printf("poll error\n");
82 if (!buxton_client_handle_response(client)) {
83 printf("bad response from daemon\n");
88 printf("got value: %d\n", gvalue);
97 * Editor modelines - http://www.wireshark.org/tools/modelines.html
102 * indent-tabs-mode: t
105 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
106 * :indentSize=8:tabSize=8:noTabs=false: