Patrick Williams | 9d3ec7f | 2016-09-27 20:30:58 -0500 | [diff] [blame] | 1 | #include <systemd/sd-bus.h> |
| 2 | |
Lei YU | d35c852 | 2019-12-13 14:48:03 +0800 | [diff] [blame] | 3 | #define UNUSED(x) (void)(x) |
| 4 | |
| 5 | int test_handler(sd_bus_message* m, void* userdata, sd_bus_error* ret_error) |
| 6 | { |
| 7 | UNUSED(m); |
| 8 | UNUSED(userdata); |
| 9 | UNUSED(ret_error); |
| 10 | return 0; |
| 11 | } |
| 12 | int test_get(sd_bus* bus, const char* path, const char* interface, |
| 13 | const char* property, sd_bus_message* reply, void* userdata, |
| 14 | sd_bus_error* ret_error) |
| 15 | { |
| 16 | UNUSED(bus); |
| 17 | UNUSED(path); |
| 18 | UNUSED(interface); |
| 19 | UNUSED(property); |
| 20 | UNUSED(reply); |
| 21 | UNUSED(userdata); |
| 22 | UNUSED(ret_error); |
| 23 | return 0; |
| 24 | } |
| 25 | int test_set(sd_bus* bus, const char* path, const char* interface, |
| 26 | const char* property, sd_bus_message* value, void* userdata, |
| 27 | sd_bus_error* ret_error) |
| 28 | { |
| 29 | UNUSED(bus); |
| 30 | UNUSED(path); |
| 31 | UNUSED(interface); |
| 32 | UNUSED(property); |
| 33 | UNUSED(value); |
| 34 | UNUSED(userdata); |
| 35 | UNUSED(ret_error); |
| 36 | return 0; |
| 37 | } |
| 38 | |
| 39 | typedef int (*sd_bus_message_handler_t)(sd_bus_message* m, void* userdata, |
| 40 | sd_bus_error* ret_error); |
Andrew Geissler | 072da3e | 2018-01-18 07:21:42 -0800 | [diff] [blame] | 41 | const sd_bus_vtable example2[] = { |
| 42 | SD_BUS_VTABLE_START(0), |
Lei YU | d35c852 | 2019-12-13 14:48:03 +0800 | [diff] [blame] | 43 | SD_BUS_METHOD("1", "2", "3", &test_handler, 0), |
| 44 | SD_BUS_SIGNAL("5", "6", 0), |
| 45 | SD_BUS_PROPERTY("7", "8", &test_get, 0, SD_BUS_VTABLE_PROPERTY_CONST), |
| 46 | SD_BUS_WRITABLE_PROPERTY("10", "11", &test_get, &test_set, 0, 0), |
Ed Tanous | da48d20 | 2023-03-08 09:49:55 -0800 | [diff] [blame] | 47 | SD_BUS_PROPERTY("14", "15", &test_get, 16, 0), |
Andrew Geissler | 072da3e | 2018-01-18 07:21:42 -0800 | [diff] [blame] | 48 | SD_BUS_VTABLE_END, |
| 49 | }; |
Patrick Williams | 9d3ec7f | 2016-09-27 20:30:58 -0500 | [diff] [blame] | 50 | |
| 51 | const size_t example2_size = sizeof(example2); |