| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#ifdef HAVE_CONFIG_H |
| 10 |
# include "config.h" |
| 11 |
#endif |
| 12 |
|
| 13 |
#include "generated-gpiodbus.h" |
| 14 |
|
| 15 |
#include <string.h> |
| 16 |
#ifdef G_OS_UNIX |
| 17 |
# include <gio/gunixfdlist.h> |
| 18 |
#endif |
| 19 |
|
| 20 |
#ifdef G_ENABLE_DEBUG |
| 21 |
#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) |
| 22 |
#define g_marshal_value_peek_char(v) g_value_get_schar (v) |
| 23 |
#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) |
| 24 |
#define g_marshal_value_peek_int(v) g_value_get_int (v) |
| 25 |
#define g_marshal_value_peek_uint(v) g_value_get_uint (v) |
| 26 |
#define g_marshal_value_peek_long(v) g_value_get_long (v) |
| 27 |
#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) |
| 28 |
#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) |
| 29 |
#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) |
| 30 |
#define g_marshal_value_peek_enum(v) g_value_get_enum (v) |
| 31 |
#define g_marshal_value_peek_flags(v) g_value_get_flags (v) |
| 32 |
#define g_marshal_value_peek_float(v) g_value_get_float (v) |
| 33 |
#define g_marshal_value_peek_double(v) g_value_get_double (v) |
| 34 |
#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) |
| 35 |
#define g_marshal_value_peek_param(v) g_value_get_param (v) |
| 36 |
#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) |
| 37 |
#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) |
| 38 |
#define g_marshal_value_peek_object(v) g_value_get_object (v) |
| 39 |
#define g_marshal_value_peek_variant(v) g_value_get_variant (v) |
| 40 |
#else |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int |
| 46 |
#define g_marshal_value_peek_char(v) (v)->data[0].v_int |
| 47 |
#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint |
| 48 |
#define g_marshal_value_peek_int(v) (v)->data[0].v_int |
| 49 |
#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint |
| 50 |
#define g_marshal_value_peek_long(v) (v)->data[0].v_long |
| 51 |
#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong |
| 52 |
#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 |
| 53 |
#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 |
| 54 |
#define g_marshal_value_peek_enum(v) (v)->data[0].v_long |
| 55 |
#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong |
| 56 |
#define g_marshal_value_peek_float(v) (v)->data[0].v_float |
| 57 |
#define g_marshal_value_peek_double(v) (v)->data[0].v_double |
| 58 |
#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer |
| 59 |
#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer |
| 60 |
#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer |
| 61 |
#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer |
| 62 |
#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer |
| 63 |
#define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer |
| 64 |
#endif |
| 65 |
|
| 66 |
typedef struct |
| 67 |
{ |
| 68 |
GDBusArgInfo parent_struct; |
| 69 |
gboolean use_gvariant; |
| 70 |
} _ExtendedGDBusArgInfo; |
| 71 |
|
| 72 |
typedef struct |
| 73 |
{ |
| 74 |
GDBusMethodInfo parent_struct; |
| 75 |
const gchar *signal_name; |
| 76 |
gboolean pass_fdlist; |
| 77 |
} _ExtendedGDBusMethodInfo; |
| 78 |
|
| 79 |
typedef struct |
| 80 |
{ |
| 81 |
GDBusSignalInfo parent_struct; |
| 82 |
const gchar *signal_name; |
| 83 |
} _ExtendedGDBusSignalInfo; |
| 84 |
|
| 85 |
typedef struct |
| 86 |
{ |
| 87 |
GDBusPropertyInfo parent_struct; |
| 88 |
const gchar *hyphen_name; |
| 89 |
guint use_gvariant : 1; |
| 90 |
guint emits_changed_signal : 1; |
| 91 |
} _ExtendedGDBusPropertyInfo; |
| 92 |
|
| 93 |
typedef struct |
| 94 |
{ |
| 95 |
GDBusInterfaceInfo parent_struct; |
| 96 |
const gchar *hyphen_name; |
| 97 |
} _ExtendedGDBusInterfaceInfo; |
| 98 |
|
| 99 |
typedef struct |
| 100 |
{ |
| 101 |
const _ExtendedGDBusPropertyInfo *info; |
| 102 |
guint prop_id; |
| 103 |
GValue orig_value; |
| 104 |
} ChangedProperty; |
| 105 |
|
| 106 |
static void |
| 107 |
_changed_property_free (ChangedProperty *data) |
| 108 |
{ |
| 109 |
g_value_unset (&data->orig_value); |
| 110 |
g_free (data); |
| 111 |
} |
| 112 |
|
| 113 |
static gboolean |
| 114 |
_g_strv_equal0 (gchar **a, gchar **b) |
| 115 |
{ |
| 116 |
gboolean ret = FALSE; |
| 117 |
guint n; |
| 118 |
if (a == NULL && b == NULL) |
| 119 |
{ |
| 120 |
ret = TRUE; |
| 121 |
goto out; |
| 122 |
} |
| 123 |
if (a == NULL || b == NULL) |
| 124 |
goto out; |
| 125 |
if (g_strv_length (a) != g_strv_length (b)) |
| 126 |
goto out; |
| 127 |
for (n = 0; a[n] != NULL; n++) |
| 128 |
if (g_strcmp0 (a[n], b[n]) != 0) |
| 129 |
goto out; |
| 130 |
ret = TRUE; |
| 131 |
out: |
| 132 |
return ret; |
| 133 |
} |
| 134 |
|
| 135 |
static gboolean |
| 136 |
_g_variant_equal0 (GVariant *a, GVariant *b) |
| 137 |
{ |
| 138 |
gboolean ret = FALSE; |
| 139 |
if (a == NULL && b == NULL) |
| 140 |
{ |
| 141 |
ret = TRUE; |
| 142 |
goto out; |
| 143 |
} |
| 144 |
if (a == NULL || b == NULL) |
| 145 |
goto out; |
| 146 |
ret = g_variant_equal (a, b); |
| 147 |
out: |
| 148 |
return ret; |
| 149 |
} |
| 150 |
|
| 151 |
G_GNUC_UNUSED static gboolean |
| 152 |
_g_value_equal (const GValue *a, const GValue *b) |
| 153 |
{ |
| 154 |
gboolean ret = FALSE; |
| 155 |
g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); |
| 156 |
switch (G_VALUE_TYPE (a)) |
| 157 |
{ |
| 158 |
case G_TYPE_BOOLEAN: |
| 159 |
ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); |
| 160 |
break; |
| 161 |
case G_TYPE_UCHAR: |
| 162 |
ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); |
| 163 |
break; |
| 164 |
case G_TYPE_INT: |
| 165 |
ret = (g_value_get_int (a) == g_value_get_int (b)); |
| 166 |
break; |
| 167 |
case G_TYPE_UINT: |
| 168 |
ret = (g_value_get_uint (a) == g_value_get_uint (b)); |
| 169 |
break; |
| 170 |
case G_TYPE_INT64: |
| 171 |
ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); |
| 172 |
break; |
| 173 |
case G_TYPE_UINT64: |
| 174 |
ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); |
| 175 |
break; |
| 176 |
case G_TYPE_DOUBLE: |
| 177 |
{ |
| 178 |
|
| 179 |
gdouble da = g_value_get_double (a); |
| 180 |
gdouble db = g_value_get_double (b); |
| 181 |
ret = memcmp (&da, &db, sizeof (gdouble)) == 0; |
| 182 |
} |
| 183 |
break; |
| 184 |
case G_TYPE_STRING: |
| 185 |
ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); |
| 186 |
break; |
| 187 |
case G_TYPE_VARIANT: |
| 188 |
ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); |
| 189 |
break; |
| 190 |
default: |
| 191 |
if (G_VALUE_TYPE (a) == G_TYPE_STRV) |
| 192 |
ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); |
| 193 |
else |
| 194 |
g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); |
| 195 |
break; |
| 196 |
} |
| 197 |
return ret; |
| 198 |
} |
| 199 |
|
| 200 |
static void |
| 201 |
_g_dbus_codegen_marshal_BOOLEAN__OBJECT_VARIANT_VARIANT ( |
| 202 |
GClosure *closure, |
| 203 |
GValue *return_value, |
| 204 |
unsigned int n_param_values, |
| 205 |
const GValue *param_values, |
| 206 |
void *invocation_hint G_GNUC_UNUSED, |
| 207 |
void *marshal_data) |
| 208 |
{ |
| 209 |
typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectVariantVariantFunc) |
| 210 |
(void *data1, |
| 211 |
GDBusMethodInvocation *arg_method_invocation, |
| 212 |
GVariant *arg_line_config, |
| 213 |
GVariant *arg_request_config, |
| 214 |
void *data2); |
| 215 |
_GDbusCodegenMarshalBoolean_ObjectVariantVariantFunc callback; |
| 216 |
GCClosure *cc = (GCClosure*) closure; |
| 217 |
void *data1, *data2; |
| 218 |
gboolean v_return; |
| 219 |
|
| 220 |
g_return_if_fail (return_value != NULL); |
| 221 |
g_return_if_fail (n_param_values == 4); |
| 222 |
|
| 223 |
if (G_CCLOSURE_SWAP_DATA (closure)) |
| 224 |
{ |
| 225 |
data1 = closure->data; |
| 226 |
data2 = g_value_peek_pointer (param_values + 0); |
| 227 |
} |
| 228 |
else |
| 229 |
{ |
| 230 |
data1 = g_value_peek_pointer (param_values + 0); |
| 231 |
data2 = closure->data; |
| 232 |
} |
| 233 |
|
| 234 |
callback = (_GDbusCodegenMarshalBoolean_ObjectVariantVariantFunc) |
| 235 |
(marshal_data ? marshal_data : cc->callback); |
| 236 |
|
| 237 |
v_return = |
| 238 |
callback (data1, |
| 239 |
g_marshal_value_peek_object (param_values + 1), |
| 240 |
g_marshal_value_peek_variant (param_values + 2), |
| 241 |
g_marshal_value_peek_variant (param_values + 3), |
| 242 |
data2); |
| 243 |
|
| 244 |
g_value_set_boolean (return_value, v_return); |
| 245 |
} |
| 246 |
|
| 247 |
static void |
| 248 |
_g_dbus_codegen_marshal_BOOLEAN__OBJECT ( |
| 249 |
GClosure *closure, |
| 250 |
GValue *return_value, |
| 251 |
unsigned int n_param_values, |
| 252 |
const GValue *param_values, |
| 253 |
void *invocation_hint G_GNUC_UNUSED, |
| 254 |
void *marshal_data) |
| 255 |
{ |
| 256 |
typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectFunc) |
| 257 |
(void *data1, |
| 258 |
GDBusMethodInvocation *arg_method_invocation, |
| 259 |
void *data2); |
| 260 |
_GDbusCodegenMarshalBoolean_ObjectFunc callback; |
| 261 |
GCClosure *cc = (GCClosure*) closure; |
| 262 |
void *data1, *data2; |
| 263 |
gboolean v_return; |
| 264 |
|
| 265 |
g_return_if_fail (return_value != NULL); |
| 266 |
g_return_if_fail (n_param_values == 2); |
| 267 |
|
| 268 |
if (G_CCLOSURE_SWAP_DATA (closure)) |
| 269 |
{ |
| 270 |
data1 = closure->data; |
| 271 |
data2 = g_value_peek_pointer (param_values + 0); |
| 272 |
} |
| 273 |
else |
| 274 |
{ |
| 275 |
data1 = g_value_peek_pointer (param_values + 0); |
| 276 |
data2 = closure->data; |
| 277 |
} |
| 278 |
|
| 279 |
callback = (_GDbusCodegenMarshalBoolean_ObjectFunc) |
| 280 |
(marshal_data ? marshal_data : cc->callback); |
| 281 |
|
| 282 |
v_return = |
| 283 |
callback (data1, |
| 284 |
g_marshal_value_peek_object (param_values + 1), |
| 285 |
data2); |
| 286 |
|
| 287 |
g_value_set_boolean (return_value, v_return); |
| 288 |
} |
| 289 |
|
| 290 |
static void |
| 291 |
_g_dbus_codegen_marshal_BOOLEAN__OBJECT_VARIANT ( |
| 292 |
GClosure *closure, |
| 293 |
GValue *return_value, |
| 294 |
unsigned int n_param_values, |
| 295 |
const GValue *param_values, |
| 296 |
void *invocation_hint G_GNUC_UNUSED, |
| 297 |
void *marshal_data) |
| 298 |
{ |
| 299 |
typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectVariantFunc) |
| 300 |
(void *data1, |
| 301 |
GDBusMethodInvocation *arg_method_invocation, |
| 302 |
GVariant *arg_line_config, |
| 303 |
void *data2); |
| 304 |
_GDbusCodegenMarshalBoolean_ObjectVariantFunc callback; |
| 305 |
GCClosure *cc = (GCClosure*) closure; |
| 306 |
void *data1, *data2; |
| 307 |
gboolean v_return; |
| 308 |
|
| 309 |
g_return_if_fail (return_value != NULL); |
| 310 |
g_return_if_fail (n_param_values == 3); |
| 311 |
|
| 312 |
if (G_CCLOSURE_SWAP_DATA (closure)) |
| 313 |
{ |
| 314 |
data1 = closure->data; |
| 315 |
data2 = g_value_peek_pointer (param_values + 0); |
| 316 |
} |
| 317 |
else |
| 318 |
{ |
| 319 |
data1 = g_value_peek_pointer (param_values + 0); |
| 320 |
data2 = closure->data; |
| 321 |
} |
| 322 |
|
| 323 |
callback = (_GDbusCodegenMarshalBoolean_ObjectVariantFunc) |
| 324 |
(marshal_data ? marshal_data : cc->callback); |
| 325 |
|
| 326 |
v_return = |
| 327 |
callback (data1, |
| 328 |
g_marshal_value_peek_object (param_values + 1), |
| 329 |
g_marshal_value_peek_variant (param_values + 2), |
| 330 |
data2); |
| 331 |
|
| 332 |
g_value_set_boolean (return_value, v_return); |
| 333 |
} |
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
static const _ExtendedGDBusArgInfo _gpiodbus_chip_method_info_request_lines_IN_ARG_line_config = |
| 351 |
{ |
| 352 |
{ |
| 353 |
-1, |
| 354 |
(gchar *) "line_config", |
| 355 |
(gchar *) "(a(aua{sv})ai)", |
| 356 |
NULL |
| 357 |
}, |
| 358 |
FALSE |
| 359 |
}; |
| 360 |
|
| 361 |
static const _ExtendedGDBusArgInfo _gpiodbus_chip_method_info_request_lines_IN_ARG_request_config = |
| 362 |
{ |
| 363 |
{ |
| 364 |
-1, |
| 365 |
(gchar *) "request_config", |
| 366 |
(gchar *) "a{sv}", |
| 367 |
NULL |
| 368 |
}, |
| 369 |
FALSE |
| 370 |
}; |
| 371 |
|
| 372 |
static const GDBusArgInfo * const _gpiodbus_chip_method_info_request_lines_IN_ARG_pointers[] = |
| 373 |
{ |
| 374 |
&_gpiodbus_chip_method_info_request_lines_IN_ARG_line_config.parent_struct, |
| 375 |
&_gpiodbus_chip_method_info_request_lines_IN_ARG_request_config.parent_struct, |
| 376 |
NULL |
| 377 |
}; |
| 378 |
|
| 379 |
static const _ExtendedGDBusArgInfo _gpiodbus_chip_method_info_request_lines_OUT_ARG_request_path = |
| 380 |
{ |
| 381 |
{ |
| 382 |
-1, |
| 383 |
(gchar *) "request_path", |
| 384 |
(gchar *) "o", |
| 385 |
NULL |
| 386 |
}, |
| 387 |
FALSE |
| 388 |
}; |
| 389 |
|
| 390 |
static const GDBusArgInfo * const _gpiodbus_chip_method_info_request_lines_OUT_ARG_pointers[] = |
| 391 |
{ |
| 392 |
&_gpiodbus_chip_method_info_request_lines_OUT_ARG_request_path.parent_struct, |
| 393 |
NULL |
| 394 |
}; |
| 395 |
|
| 396 |
static const _ExtendedGDBusMethodInfo _gpiodbus_chip_method_info_request_lines = |
| 397 |
{ |
| 398 |
{ |
| 399 |
-1, |
| 400 |
(gchar *) "RequestLines", |
| 401 |
(GDBusArgInfo **) &_gpiodbus_chip_method_info_request_lines_IN_ARG_pointers, |
| 402 |
(GDBusArgInfo **) &_gpiodbus_chip_method_info_request_lines_OUT_ARG_pointers, |
| 403 |
NULL |
| 404 |
}, |
| 405 |
"handle-request-lines", |
| 406 |
FALSE |
| 407 |
}; |
| 408 |
|
| 409 |
static const GDBusMethodInfo * const _gpiodbus_chip_method_info_pointers[] = |
| 410 |
{ |
| 411 |
&_gpiodbus_chip_method_info_request_lines.parent_struct, |
| 412 |
NULL |
| 413 |
}; |
| 414 |
|
| 415 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_chip_property_info_name = |
| 416 |
{ |
| 417 |
{ |
| 418 |
-1, |
| 419 |
(gchar *) "Name", |
| 420 |
(gchar *) "s", |
| 421 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 422 |
NULL |
| 423 |
}, |
| 424 |
"name", |
| 425 |
FALSE, |
| 426 |
TRUE |
| 427 |
}; |
| 428 |
|
| 429 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_chip_property_info_label = |
| 430 |
{ |
| 431 |
{ |
| 432 |
-1, |
| 433 |
(gchar *) "Label", |
| 434 |
(gchar *) "s", |
| 435 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 436 |
NULL |
| 437 |
}, |
| 438 |
"label", |
| 439 |
FALSE, |
| 440 |
TRUE |
| 441 |
}; |
| 442 |
|
| 443 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_chip_property_info_num_lines = |
| 444 |
{ |
| 445 |
{ |
| 446 |
-1, |
| 447 |
(gchar *) "NumLines", |
| 448 |
(gchar *) "u", |
| 449 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 450 |
NULL |
| 451 |
}, |
| 452 |
"num-lines", |
| 453 |
FALSE, |
| 454 |
TRUE |
| 455 |
}; |
| 456 |
|
| 457 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_chip_property_info_path = |
| 458 |
{ |
| 459 |
{ |
| 460 |
-1, |
| 461 |
(gchar *) "Path", |
| 462 |
(gchar *) "ay", |
| 463 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 464 |
NULL |
| 465 |
}, |
| 466 |
"path", |
| 467 |
FALSE, |
| 468 |
TRUE |
| 469 |
}; |
| 470 |
|
| 471 |
static const GDBusPropertyInfo * const _gpiodbus_chip_property_info_pointers[] = |
| 472 |
{ |
| 473 |
&_gpiodbus_chip_property_info_name.parent_struct, |
| 474 |
&_gpiodbus_chip_property_info_label.parent_struct, |
| 475 |
&_gpiodbus_chip_property_info_num_lines.parent_struct, |
| 476 |
&_gpiodbus_chip_property_info_path.parent_struct, |
| 477 |
NULL |
| 478 |
}; |
| 479 |
|
| 480 |
static const _ExtendedGDBusInterfaceInfo _gpiodbus_chip_interface_info = |
| 481 |
{ |
| 482 |
{ |
| 483 |
-1, |
| 484 |
(gchar *) "io.gpiod1.Chip", |
| 485 |
(GDBusMethodInfo **) &_gpiodbus_chip_method_info_pointers, |
| 486 |
NULL, |
| 487 |
(GDBusPropertyInfo **) &_gpiodbus_chip_property_info_pointers, |
| 488 |
NULL |
| 489 |
}, |
| 490 |
"chip", |
| 491 |
}; |
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
|
| 501 |
GDBusInterfaceInfo * |
| 502 |
gpiodbus_chip_interface_info (void) |
| 503 |
{ |
| 504 |
return (GDBusInterfaceInfo *) &_gpiodbus_chip_interface_info.parent_struct; |
| 505 |
} |
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
guint |
| 518 |
gpiodbus_chip_override_properties (GObjectClass *klass, guint property_id_begin) |
| 519 |
{ |
| 520 |
g_object_class_override_property (klass, property_id_begin++, "name"); |
| 521 |
g_object_class_override_property (klass, property_id_begin++, "label"); |
| 522 |
g_object_class_override_property (klass, property_id_begin++, "num-lines"); |
| 523 |
g_object_class_override_property (klass, property_id_begin++, "path"); |
| 524 |
return property_id_begin - 1; |
| 525 |
} |
| 526 |
|
| 527 |
|
| 528 |
inline static void |
| 529 |
gpiodbus_chip_method_marshal_request_lines ( |
| 530 |
GClosure *closure, |
| 531 |
GValue *return_value, |
| 532 |
unsigned int n_param_values, |
| 533 |
const GValue *param_values, |
| 534 |
void *invocation_hint, |
| 535 |
void *marshal_data) |
| 536 |
{ |
| 537 |
_g_dbus_codegen_marshal_BOOLEAN__OBJECT_VARIANT_VARIANT (closure, |
| 538 |
return_value, n_param_values, param_values, invocation_hint, marshal_data); |
| 539 |
} |
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
typedef GpiodbusChipIface GpiodbusChipInterface; |
| 561 |
G_DEFINE_INTERFACE (GpiodbusChip, gpiodbus_chip, G_TYPE_OBJECT) |
| 562 |
|
| 563 |
static void |
| 564 |
gpiodbus_chip_default_init (GpiodbusChipIface *iface) |
| 565 |
{ |
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
g_signal_new ("handle-request-lines", |
| 581 |
G_TYPE_FROM_INTERFACE (iface), |
| 582 |
G_SIGNAL_RUN_LAST, |
| 583 |
G_STRUCT_OFFSET (GpiodbusChipIface, handle_request_lines), |
| 584 |
g_signal_accumulator_true_handled, |
| 585 |
NULL, |
| 586 |
gpiodbus_chip_method_marshal_request_lines, |
| 587 |
G_TYPE_BOOLEAN, |
| 588 |
3, |
| 589 |
G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT, G_TYPE_VARIANT); |
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
g_object_interface_install_property (iface, |
| 600 |
g_param_spec_string ("name", "Name", "Name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
g_object_interface_install_property (iface, |
| 609 |
g_param_spec_string ("label", "Label", "Label", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
g_object_interface_install_property (iface, |
| 618 |
g_param_spec_uint ("num-lines", "NumLines", "NumLines", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 619 |
|
| 620 |
|
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
g_object_interface_install_property (iface, |
| 627 |
g_param_spec_string ("path", "Path", "Path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 628 |
} |
| 629 |
|
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
|
| 641 |
|
| 642 |
const gchar * |
| 643 |
gpiodbus_chip_get_name (GpiodbusChip *object) |
| 644 |
{ |
| 645 |
g_return_val_if_fail (GPIODBUS_IS_CHIP (object), NULL); |
| 646 |
|
| 647 |
return GPIODBUS_CHIP_GET_IFACE (object)->get_name (object); |
| 648 |
} |
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
|
| 659 |
|
| 660 |
gchar * |
| 661 |
gpiodbus_chip_dup_name (GpiodbusChip *object) |
| 662 |
{ |
| 663 |
gchar *value; |
| 664 |
g_object_get (G_OBJECT (object), "name", &value, NULL); |
| 665 |
return value; |
| 666 |
} |
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
|
| 671 |
|
| 672 |
|
| 673 |
|
| 674 |
|
| 675 |
|
| 676 |
|
| 677 |
void |
| 678 |
gpiodbus_chip_set_name (GpiodbusChip *object, const gchar *value) |
| 679 |
{ |
| 680 |
g_object_set (G_OBJECT (object), "name", value, NULL); |
| 681 |
} |
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
const gchar * |
| 696 |
gpiodbus_chip_get_label (GpiodbusChip *object) |
| 697 |
{ |
| 698 |
g_return_val_if_fail (GPIODBUS_IS_CHIP (object), NULL); |
| 699 |
|
| 700 |
return GPIODBUS_CHIP_GET_IFACE (object)->get_label (object); |
| 701 |
} |
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
|
| 708 |
|
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
gchar * |
| 714 |
gpiodbus_chip_dup_label (GpiodbusChip *object) |
| 715 |
{ |
| 716 |
gchar *value; |
| 717 |
g_object_get (G_OBJECT (object), "label", &value, NULL); |
| 718 |
return value; |
| 719 |
} |
| 720 |
|
| 721 |
|
| 722 |
|
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
|
| 727 |
|
| 728 |
|
| 729 |
|
| 730 |
void |
| 731 |
gpiodbus_chip_set_label (GpiodbusChip *object, const gchar *value) |
| 732 |
{ |
| 733 |
g_object_set (G_OBJECT (object), "label", value, NULL); |
| 734 |
} |
| 735 |
|
| 736 |
|
| 737 |
|
| 738 |
|
| 739 |
|
| 740 |
|
| 741 |
|
| 742 |
|
| 743 |
|
| 744 |
|
| 745 |
|
| 746 |
guint |
| 747 |
gpiodbus_chip_get_num_lines (GpiodbusChip *object) |
| 748 |
{ |
| 749 |
g_return_val_if_fail (GPIODBUS_IS_CHIP (object), 0); |
| 750 |
|
| 751 |
return GPIODBUS_CHIP_GET_IFACE (object)->get_num_lines (object); |
| 752 |
} |
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
|
| 758 |
|
| 759 |
|
| 760 |
|
| 761 |
|
| 762 |
|
| 763 |
void |
| 764 |
gpiodbus_chip_set_num_lines (GpiodbusChip *object, guint value) |
| 765 |
{ |
| 766 |
g_object_set (G_OBJECT (object), "num-lines", value, NULL); |
| 767 |
} |
| 768 |
|
| 769 |
|
| 770 |
|
| 771 |
|
| 772 |
|
| 773 |
|
| 774 |
|
| 775 |
|
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
|
| 781 |
const gchar * |
| 782 |
gpiodbus_chip_get_path (GpiodbusChip *object) |
| 783 |
{ |
| 784 |
g_return_val_if_fail (GPIODBUS_IS_CHIP (object), NULL); |
| 785 |
|
| 786 |
return GPIODBUS_CHIP_GET_IFACE (object)->get_path (object); |
| 787 |
} |
| 788 |
|
| 789 |
|
| 790 |
|
| 791 |
|
| 792 |
|
| 793 |
|
| 794 |
|
| 795 |
|
| 796 |
|
| 797 |
|
| 798 |
|
| 799 |
gchar * |
| 800 |
gpiodbus_chip_dup_path (GpiodbusChip *object) |
| 801 |
{ |
| 802 |
gchar *value; |
| 803 |
g_object_get (G_OBJECT (object), "path", &value, NULL); |
| 804 |
return value; |
| 805 |
} |
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
|
| 810 |
|
| 811 |
|
| 812 |
|
| 813 |
|
| 814 |
|
| 815 |
|
| 816 |
void |
| 817 |
gpiodbus_chip_set_path (GpiodbusChip *object, const gchar *value) |
| 818 |
{ |
| 819 |
g_object_set (G_OBJECT (object), "path", value, NULL); |
| 820 |
} |
| 821 |
|
| 822 |
|
| 823 |
|
| 824 |
|
| 825 |
|
| 826 |
|
| 827 |
|
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
|
| 834 |
|
| 835 |
|
| 836 |
|
| 837 |
|
| 838 |
|
| 839 |
|
| 840 |
|
| 841 |
void |
| 842 |
gpiodbus_chip_call_request_lines ( |
| 843 |
GpiodbusChip *proxy, |
| 844 |
GVariant *arg_line_config, |
| 845 |
GVariant *arg_request_config, |
| 846 |
GDBusCallFlags call_flags, |
| 847 |
gint timeout_msec, |
| 848 |
GCancellable *cancellable, |
| 849 |
GAsyncReadyCallback callback, |
| 850 |
gpointer user_data) |
| 851 |
{ |
| 852 |
g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 853 |
"RequestLines", |
| 854 |
g_variant_new ("(@(a(aua{sv})ai)@a{sv})", |
| 855 |
arg_line_config, |
| 856 |
arg_request_config), |
| 857 |
call_flags, |
| 858 |
timeout_msec, |
| 859 |
cancellable, |
| 860 |
callback, |
| 861 |
user_data); |
| 862 |
} |
| 863 |
|
| 864 |
|
| 865 |
|
| 866 |
|
| 867 |
|
| 868 |
|
| 869 |
|
| 870 |
|
| 871 |
|
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
gboolean |
| 876 |
gpiodbus_chip_call_request_lines_finish ( |
| 877 |
GpiodbusChip *proxy, |
| 878 |
gchar **out_request_path, |
| 879 |
GAsyncResult *res, |
| 880 |
GError **error) |
| 881 |
{ |
| 882 |
GVariant *_ret; |
| 883 |
_ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 884 |
if (_ret == NULL) |
| 885 |
goto _out; |
| 886 |
g_variant_get (_ret, |
| 887 |
"(o)", |
| 888 |
out_request_path); |
| 889 |
g_variant_unref (_ret); |
| 890 |
_out: |
| 891 |
return _ret != NULL; |
| 892 |
} |
| 893 |
|
| 894 |
|
| 895 |
|
| 896 |
|
| 897 |
|
| 898 |
|
| 899 |
|
| 900 |
|
| 901 |
|
| 902 |
|
| 903 |
|
| 904 |
|
| 905 |
|
| 906 |
|
| 907 |
|
| 908 |
|
| 909 |
|
| 910 |
|
| 911 |
|
| 912 |
|
| 913 |
gboolean |
| 914 |
gpiodbus_chip_call_request_lines_sync ( |
| 915 |
GpiodbusChip *proxy, |
| 916 |
GVariant *arg_line_config, |
| 917 |
GVariant *arg_request_config, |
| 918 |
GDBusCallFlags call_flags, |
| 919 |
gint timeout_msec, |
| 920 |
gchar **out_request_path, |
| 921 |
GCancellable *cancellable, |
| 922 |
GError **error) |
| 923 |
{ |
| 924 |
GVariant *_ret; |
| 925 |
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 926 |
"RequestLines", |
| 927 |
g_variant_new ("(@(a(aua{sv})ai)@a{sv})", |
| 928 |
arg_line_config, |
| 929 |
arg_request_config), |
| 930 |
call_flags, |
| 931 |
timeout_msec, |
| 932 |
cancellable, |
| 933 |
error); |
| 934 |
if (_ret == NULL) |
| 935 |
goto _out; |
| 936 |
g_variant_get (_ret, |
| 937 |
"(o)", |
| 938 |
out_request_path); |
| 939 |
g_variant_unref (_ret); |
| 940 |
_out: |
| 941 |
return _ret != NULL; |
| 942 |
} |
| 943 |
|
| 944 |
|
| 945 |
|
| 946 |
|
| 947 |
|
| 948 |
|
| 949 |
|
| 950 |
|
| 951 |
|
| 952 |
|
| 953 |
|
| 954 |
void |
| 955 |
gpiodbus_chip_complete_request_lines ( |
| 956 |
GpiodbusChip *object G_GNUC_UNUSED, |
| 957 |
GDBusMethodInvocation *invocation, |
| 958 |
const gchar *request_path) |
| 959 |
{ |
| 960 |
g_dbus_method_invocation_return_value (invocation, |
| 961 |
g_variant_new ("(o)", |
| 962 |
request_path)); |
| 963 |
} |
| 964 |
|
| 965 |
|
| 966 |
|
| 967 |
|
| 968 |
|
| 969 |
|
| 970 |
|
| 971 |
|
| 972 |
|
| 973 |
|
| 974 |
|
| 975 |
|
| 976 |
|
| 977 |
|
| 978 |
|
| 979 |
|
| 980 |
struct _GpiodbusChipProxyPrivate |
| 981 |
{ |
| 982 |
GData *qdata; |
| 983 |
}; |
| 984 |
|
| 985 |
static void gpiodbus_chip_proxy_iface_init (GpiodbusChipIface *iface); |
| 986 |
|
| 987 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 988 |
G_DEFINE_TYPE_WITH_CODE (GpiodbusChipProxy, gpiodbus_chip_proxy, G_TYPE_DBUS_PROXY, |
| 989 |
G_ADD_PRIVATE (GpiodbusChipProxy) |
| 990 |
G_IMPLEMENT_INTERFACE (GPIODBUS_TYPE_CHIP, gpiodbus_chip_proxy_iface_init)) |
| 991 |
|
| 992 |
#else |
| 993 |
G_DEFINE_TYPE_WITH_CODE (GpiodbusChipProxy, gpiodbus_chip_proxy, G_TYPE_DBUS_PROXY, |
| 994 |
G_IMPLEMENT_INTERFACE (GPIODBUS_TYPE_CHIP, gpiodbus_chip_proxy_iface_init)) |
| 995 |
|
| 996 |
#endif |
| 997 |
static void |
| 998 |
gpiodbus_chip_proxy_finalize (GObject *object) |
| 999 |
{ |
| 1000 |
GpiodbusChipProxy *proxy = GPIODBUS_CHIP_PROXY (object); |
| 1001 |
g_datalist_clear (&proxy->priv->qdata); |
| 1002 |
G_OBJECT_CLASS (gpiodbus_chip_proxy_parent_class)->finalize (object); |
| 1003 |
} |
| 1004 |
|
| 1005 |
static void |
| 1006 |
gpiodbus_chip_proxy_get_property (GObject *object, |
| 1007 |
guint prop_id, |
| 1008 |
GValue *value, |
| 1009 |
GParamSpec *pspec G_GNUC_UNUSED) |
| 1010 |
{ |
| 1011 |
const _ExtendedGDBusPropertyInfo *info; |
| 1012 |
GVariant *variant; |
| 1013 |
g_assert (prop_id != 0 && prop_id - 1 < 4); |
| 1014 |
info = (const _ExtendedGDBusPropertyInfo *) _gpiodbus_chip_property_info_pointers[prop_id - 1]; |
| 1015 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 1016 |
if (info->use_gvariant) |
| 1017 |
{ |
| 1018 |
g_value_set_variant (value, variant); |
| 1019 |
} |
| 1020 |
else |
| 1021 |
{ |
| 1022 |
if (variant != NULL) |
| 1023 |
g_dbus_gvariant_to_gvalue (variant, value); |
| 1024 |
} |
| 1025 |
if (variant != NULL) |
| 1026 |
g_variant_unref (variant); |
| 1027 |
} |
| 1028 |
|
| 1029 |
static void |
| 1030 |
gpiodbus_chip_proxy_set_property_cb (GDBusProxy *proxy, |
| 1031 |
GAsyncResult *res, |
| 1032 |
gpointer user_data) |
| 1033 |
{ |
| 1034 |
const _ExtendedGDBusPropertyInfo *info = user_data; |
| 1035 |
GError *error; |
| 1036 |
GVariant *_ret; |
| 1037 |
error = NULL; |
| 1038 |
_ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 1039 |
if (!_ret) |
| 1040 |
{ |
| 1041 |
g_warning ("Error setting property '%s' on interface io.gpiod1.Chip: %s (%s, %d)", |
| 1042 |
info->parent_struct.name, |
| 1043 |
error->message, g_quark_to_string (error->domain), error->code); |
| 1044 |
g_error_free (error); |
| 1045 |
} |
| 1046 |
else |
| 1047 |
{ |
| 1048 |
g_variant_unref (_ret); |
| 1049 |
} |
| 1050 |
} |
| 1051 |
|
| 1052 |
static void |
| 1053 |
gpiodbus_chip_proxy_set_property (GObject *object, |
| 1054 |
guint prop_id, |
| 1055 |
const GValue *value, |
| 1056 |
GParamSpec *pspec G_GNUC_UNUSED) |
| 1057 |
{ |
| 1058 |
const _ExtendedGDBusPropertyInfo *info; |
| 1059 |
GVariant *variant; |
| 1060 |
g_assert (prop_id != 0 && prop_id - 1 < 4); |
| 1061 |
info = (const _ExtendedGDBusPropertyInfo *) _gpiodbus_chip_property_info_pointers[prop_id - 1]; |
| 1062 |
variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 1063 |
g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 1064 |
"org.freedesktop.DBus.Properties.Set", |
| 1065 |
g_variant_new ("(ssv)", "io.gpiod1.Chip", info->parent_struct.name, variant), |
| 1066 |
G_DBUS_CALL_FLAGS_NONE, |
| 1067 |
-1, |
| 1068 |
NULL, (GAsyncReadyCallback) gpiodbus_chip_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 1069 |
g_variant_unref (variant); |
| 1070 |
} |
| 1071 |
|
| 1072 |
static void |
| 1073 |
gpiodbus_chip_proxy_g_signal (GDBusProxy *proxy, |
| 1074 |
const gchar *sender_name G_GNUC_UNUSED, |
| 1075 |
const gchar *signal_name, |
| 1076 |
GVariant *parameters) |
| 1077 |
{ |
| 1078 |
_ExtendedGDBusSignalInfo *info; |
| 1079 |
GVariantIter iter; |
| 1080 |
GVariant *child; |
| 1081 |
GValue *paramv; |
| 1082 |
gsize num_params; |
| 1083 |
gsize n; |
| 1084 |
guint signal_id; |
| 1085 |
info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gpiodbus_chip_interface_info.parent_struct, signal_name); |
| 1086 |
if (info == NULL) |
| 1087 |
return; |
| 1088 |
num_params = g_variant_n_children (parameters); |
| 1089 |
paramv = g_new0 (GValue, num_params + 1); |
| 1090 |
g_value_init (¶mv[0], GPIODBUS_TYPE_CHIP); |
| 1091 |
g_value_set_object (¶mv[0], proxy); |
| 1092 |
g_variant_iter_init (&iter, parameters); |
| 1093 |
n = 1; |
| 1094 |
while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 1095 |
{ |
| 1096 |
_ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 1097 |
if (arg_info->use_gvariant) |
| 1098 |
{ |
| 1099 |
g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 1100 |
g_value_set_variant (¶mv[n], child); |
| 1101 |
n++; |
| 1102 |
} |
| 1103 |
else |
| 1104 |
g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 1105 |
g_variant_unref (child); |
| 1106 |
} |
| 1107 |
signal_id = g_signal_lookup (info->signal_name, GPIODBUS_TYPE_CHIP); |
| 1108 |
g_signal_emitv (paramv, signal_id, 0, NULL); |
| 1109 |
for (n = 0; n < num_params + 1; n++) |
| 1110 |
g_value_unset (¶mv[n]); |
| 1111 |
g_free (paramv); |
| 1112 |
} |
| 1113 |
|
| 1114 |
static void |
| 1115 |
gpiodbus_chip_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 1116 |
GVariant *changed_properties, |
| 1117 |
const gchar *const *invalidated_properties) |
| 1118 |
{ |
| 1119 |
GpiodbusChipProxy *proxy = GPIODBUS_CHIP_PROXY (_proxy); |
| 1120 |
guint n; |
| 1121 |
const gchar *key; |
| 1122 |
GVariantIter *iter; |
| 1123 |
_ExtendedGDBusPropertyInfo *info; |
| 1124 |
g_variant_get (changed_properties, "a{sv}", &iter); |
| 1125 |
while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 1126 |
{ |
| 1127 |
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gpiodbus_chip_interface_info.parent_struct, key); |
| 1128 |
g_datalist_remove_data (&proxy->priv->qdata, key); |
| 1129 |
if (info != NULL) |
| 1130 |
g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 1131 |
} |
| 1132 |
g_variant_iter_free (iter); |
| 1133 |
for (n = 0; invalidated_properties[n] != NULL; n++) |
| 1134 |
{ |
| 1135 |
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gpiodbus_chip_interface_info.parent_struct, invalidated_properties[n]); |
| 1136 |
g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 1137 |
if (info != NULL) |
| 1138 |
g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 1139 |
} |
| 1140 |
} |
| 1141 |
|
| 1142 |
static const gchar * |
| 1143 |
gpiodbus_chip_proxy_get_name (GpiodbusChip *object) |
| 1144 |
{ |
| 1145 |
GpiodbusChipProxy *proxy = GPIODBUS_CHIP_PROXY (object); |
| 1146 |
GVariant *variant; |
| 1147 |
const gchar *value = NULL; |
| 1148 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Name"); |
| 1149 |
if (variant != NULL) |
| 1150 |
{ |
| 1151 |
value = g_variant_get_string (variant, NULL); |
| 1152 |
g_variant_unref (variant); |
| 1153 |
} |
| 1154 |
return value; |
| 1155 |
} |
| 1156 |
|
| 1157 |
static const gchar * |
| 1158 |
gpiodbus_chip_proxy_get_label (GpiodbusChip *object) |
| 1159 |
{ |
| 1160 |
GpiodbusChipProxy *proxy = GPIODBUS_CHIP_PROXY (object); |
| 1161 |
GVariant *variant; |
| 1162 |
const gchar *value = NULL; |
| 1163 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Label"); |
| 1164 |
if (variant != NULL) |
| 1165 |
{ |
| 1166 |
value = g_variant_get_string (variant, NULL); |
| 1167 |
g_variant_unref (variant); |
| 1168 |
} |
| 1169 |
return value; |
| 1170 |
} |
| 1171 |
|
| 1172 |
static guint |
| 1173 |
gpiodbus_chip_proxy_get_num_lines (GpiodbusChip *object) |
| 1174 |
{ |
| 1175 |
GpiodbusChipProxy *proxy = GPIODBUS_CHIP_PROXY (object); |
| 1176 |
GVariant *variant; |
| 1177 |
guint value = 0; |
| 1178 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "NumLines"); |
| 1179 |
if (variant != NULL) |
| 1180 |
{ |
| 1181 |
value = g_variant_get_uint32 (variant); |
| 1182 |
g_variant_unref (variant); |
| 1183 |
} |
| 1184 |
return value; |
| 1185 |
} |
| 1186 |
|
| 1187 |
static const gchar * |
| 1188 |
gpiodbus_chip_proxy_get_path (GpiodbusChip *object) |
| 1189 |
{ |
| 1190 |
GpiodbusChipProxy *proxy = GPIODBUS_CHIP_PROXY (object); |
| 1191 |
GVariant *variant; |
| 1192 |
const gchar *value = NULL; |
| 1193 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Path"); |
| 1194 |
if (variant != NULL) |
| 1195 |
{ |
| 1196 |
value = g_variant_get_bytestring (variant); |
| 1197 |
g_variant_unref (variant); |
| 1198 |
} |
| 1199 |
return value; |
| 1200 |
} |
| 1201 |
|
| 1202 |
static void |
| 1203 |
gpiodbus_chip_proxy_init (GpiodbusChipProxy *proxy) |
| 1204 |
{ |
| 1205 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 1206 |
proxy->priv = gpiodbus_chip_proxy_get_instance_private (proxy); |
| 1207 |
#else |
| 1208 |
proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, GPIODBUS_TYPE_CHIP_PROXY, GpiodbusChipProxyPrivate); |
| 1209 |
#endif |
| 1210 |
|
| 1211 |
g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gpiodbus_chip_interface_info ()); |
| 1212 |
} |
| 1213 |
|
| 1214 |
static void |
| 1215 |
gpiodbus_chip_proxy_class_init (GpiodbusChipProxyClass *klass) |
| 1216 |
{ |
| 1217 |
GObjectClass *gobject_class; |
| 1218 |
GDBusProxyClass *proxy_class; |
| 1219 |
|
| 1220 |
gobject_class = G_OBJECT_CLASS (klass); |
| 1221 |
gobject_class->finalize = gpiodbus_chip_proxy_finalize; |
| 1222 |
gobject_class->get_property = gpiodbus_chip_proxy_get_property; |
| 1223 |
gobject_class->set_property = gpiodbus_chip_proxy_set_property; |
| 1224 |
|
| 1225 |
proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 1226 |
proxy_class->g_signal = gpiodbus_chip_proxy_g_signal; |
| 1227 |
proxy_class->g_properties_changed = gpiodbus_chip_proxy_g_properties_changed; |
| 1228 |
|
| 1229 |
gpiodbus_chip_override_properties (gobject_class, 1); |
| 1230 |
|
| 1231 |
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 1232 |
g_type_class_add_private (klass, sizeof (GpiodbusChipProxyPrivate)); |
| 1233 |
#endif |
| 1234 |
} |
| 1235 |
|
| 1236 |
static void |
| 1237 |
gpiodbus_chip_proxy_iface_init (GpiodbusChipIface *iface) |
| 1238 |
{ |
| 1239 |
iface->get_name = gpiodbus_chip_proxy_get_name; |
| 1240 |
iface->get_label = gpiodbus_chip_proxy_get_label; |
| 1241 |
iface->get_num_lines = gpiodbus_chip_proxy_get_num_lines; |
| 1242 |
iface->get_path = gpiodbus_chip_proxy_get_path; |
| 1243 |
} |
| 1244 |
|
| 1245 |
|
| 1246 |
|
| 1247 |
|
| 1248 |
|
| 1249 |
|
| 1250 |
|
| 1251 |
|
| 1252 |
|
| 1253 |
|
| 1254 |
|
| 1255 |
|
| 1256 |
|
| 1257 |
|
| 1258 |
|
| 1259 |
|
| 1260 |
|
| 1261 |
|
| 1262 |
void |
| 1263 |
gpiodbus_chip_proxy_new ( |
| 1264 |
GDBusConnection *connection, |
| 1265 |
GDBusProxyFlags flags, |
| 1266 |
const gchar *name, |
| 1267 |
const gchar *object_path, |
| 1268 |
GCancellable *cancellable, |
| 1269 |
GAsyncReadyCallback callback, |
| 1270 |
gpointer user_data) |
| 1271 |
{ |
| 1272 |
g_async_initable_new_async (GPIODBUS_TYPE_CHIP_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "io.gpiod1.Chip", NULL); |
| 1273 |
} |
| 1274 |
|
| 1275 |
|
| 1276 |
|
| 1277 |
|
| 1278 |
|
| 1279 |
|
| 1280 |
|
| 1281 |
|
| 1282 |
|
| 1283 |
|
| 1284 |
GpiodbusChip * |
| 1285 |
gpiodbus_chip_proxy_new_finish ( |
| 1286 |
GAsyncResult *res, |
| 1287 |
GError **error) |
| 1288 |
{ |
| 1289 |
GObject *ret; |
| 1290 |
GObject *source_object; |
| 1291 |
source_object = g_async_result_get_source_object (res); |
| 1292 |
ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 1293 |
g_object_unref (source_object); |
| 1294 |
if (ret != NULL) |
| 1295 |
return GPIODBUS_CHIP (ret); |
| 1296 |
else |
| 1297 |
return NULL; |
| 1298 |
} |
| 1299 |
|
| 1300 |
|
| 1301 |
|
| 1302 |
|
| 1303 |
|
| 1304 |
|
| 1305 |
|
| 1306 |
|
| 1307 |
|
| 1308 |
|
| 1309 |
|
| 1310 |
|
| 1311 |
|
| 1312 |
|
| 1313 |
|
| 1314 |
|
| 1315 |
|
| 1316 |
|
| 1317 |
GpiodbusChip * |
| 1318 |
gpiodbus_chip_proxy_new_sync ( |
| 1319 |
GDBusConnection *connection, |
| 1320 |
GDBusProxyFlags flags, |
| 1321 |
const gchar *name, |
| 1322 |
const gchar *object_path, |
| 1323 |
GCancellable *cancellable, |
| 1324 |
GError **error) |
| 1325 |
{ |
| 1326 |
GInitable *ret; |
| 1327 |
ret = g_initable_new (GPIODBUS_TYPE_CHIP_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "io.gpiod1.Chip", NULL); |
| 1328 |
if (ret != NULL) |
| 1329 |
return GPIODBUS_CHIP (ret); |
| 1330 |
else |
| 1331 |
return NULL; |
| 1332 |
} |
| 1333 |
|
| 1334 |
|
| 1335 |
|
| 1336 |
|
| 1337 |
|
| 1338 |
|
| 1339 |
|
| 1340 |
|
| 1341 |
|
| 1342 |
|
| 1343 |
|
| 1344 |
|
| 1345 |
|
| 1346 |
|
| 1347 |
|
| 1348 |
|
| 1349 |
|
| 1350 |
|
| 1351 |
|
| 1352 |
void |
| 1353 |
gpiodbus_chip_proxy_new_for_bus ( |
| 1354 |
GBusType bus_type, |
| 1355 |
GDBusProxyFlags flags, |
| 1356 |
const gchar *name, |
| 1357 |
const gchar *object_path, |
| 1358 |
GCancellable *cancellable, |
| 1359 |
GAsyncReadyCallback callback, |
| 1360 |
gpointer user_data) |
| 1361 |
{ |
| 1362 |
g_async_initable_new_async (GPIODBUS_TYPE_CHIP_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "io.gpiod1.Chip", NULL); |
| 1363 |
} |
| 1364 |
|
| 1365 |
|
| 1366 |
|
| 1367 |
|
| 1368 |
|
| 1369 |
|
| 1370 |
|
| 1371 |
|
| 1372 |
|
| 1373 |
|
| 1374 |
GpiodbusChip * |
| 1375 |
gpiodbus_chip_proxy_new_for_bus_finish ( |
| 1376 |
GAsyncResult *res, |
| 1377 |
GError **error) |
| 1378 |
{ |
| 1379 |
GObject *ret; |
| 1380 |
GObject *source_object; |
| 1381 |
source_object = g_async_result_get_source_object (res); |
| 1382 |
ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 1383 |
g_object_unref (source_object); |
| 1384 |
if (ret != NULL) |
| 1385 |
return GPIODBUS_CHIP (ret); |
| 1386 |
else |
| 1387 |
return NULL; |
| 1388 |
} |
| 1389 |
|
| 1390 |
|
| 1391 |
|
| 1392 |
|
| 1393 |
|
| 1394 |
|
| 1395 |
|
| 1396 |
|
| 1397 |
|
| 1398 |
|
| 1399 |
|
| 1400 |
|
| 1401 |
|
| 1402 |
|
| 1403 |
|
| 1404 |
|
| 1405 |
|
| 1406 |
|
| 1407 |
GpiodbusChip * |
| 1408 |
gpiodbus_chip_proxy_new_for_bus_sync ( |
| 1409 |
GBusType bus_type, |
| 1410 |
GDBusProxyFlags flags, |
| 1411 |
const gchar *name, |
| 1412 |
const gchar *object_path, |
| 1413 |
GCancellable *cancellable, |
| 1414 |
GError **error) |
| 1415 |
{ |
| 1416 |
GInitable *ret; |
| 1417 |
ret = g_initable_new (GPIODBUS_TYPE_CHIP_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "io.gpiod1.Chip", NULL); |
| 1418 |
if (ret != NULL) |
| 1419 |
return GPIODBUS_CHIP (ret); |
| 1420 |
else |
| 1421 |
return NULL; |
| 1422 |
} |
| 1423 |
|
| 1424 |
|
| 1425 |
|
| 1426 |
|
| 1427 |
|
| 1428 |
|
| 1429 |
|
| 1430 |
|
| 1431 |
|
| 1432 |
|
| 1433 |
|
| 1434 |
|
| 1435 |
|
| 1436 |
|
| 1437 |
|
| 1438 |
|
| 1439 |
|
| 1440 |
struct _GpiodbusChipSkeletonPrivate |
| 1441 |
{ |
| 1442 |
GValue *properties; |
| 1443 |
GList *changed_properties; |
| 1444 |
GSource *changed_properties_idle_source; |
| 1445 |
GMainContext *context; |
| 1446 |
GMutex lock; |
| 1447 |
}; |
| 1448 |
|
| 1449 |
static void |
| 1450 |
_gpiodbus_chip_skeleton_handle_method_call ( |
| 1451 |
GDBusConnection *connection G_GNUC_UNUSED, |
| 1452 |
const gchar *sender G_GNUC_UNUSED, |
| 1453 |
const gchar *object_path G_GNUC_UNUSED, |
| 1454 |
const gchar *interface_name, |
| 1455 |
const gchar *method_name, |
| 1456 |
GVariant *parameters, |
| 1457 |
GDBusMethodInvocation *invocation, |
| 1458 |
gpointer user_data) |
| 1459 |
{ |
| 1460 |
GpiodbusChipSkeleton *skeleton = GPIODBUS_CHIP_SKELETON (user_data); |
| 1461 |
_ExtendedGDBusMethodInfo *info; |
| 1462 |
GVariantIter iter; |
| 1463 |
GVariant *child; |
| 1464 |
GValue *paramv; |
| 1465 |
gsize num_params; |
| 1466 |
guint num_extra; |
| 1467 |
gsize n; |
| 1468 |
guint signal_id; |
| 1469 |
GValue return_value = G_VALUE_INIT; |
| 1470 |
info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 1471 |
g_assert (info != NULL); |
| 1472 |
num_params = g_variant_n_children (parameters); |
| 1473 |
num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 1474 |
n = 0; |
| 1475 |
g_value_init (¶mv[n], GPIODBUS_TYPE_CHIP); |
| 1476 |
g_value_set_object (¶mv[n++], skeleton); |
| 1477 |
g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 1478 |
g_value_set_object (¶mv[n++], invocation); |
| 1479 |
if (info->pass_fdlist) |
| 1480 |
{ |
| 1481 |
#ifdef G_OS_UNIX |
| 1482 |
g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 1483 |
g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 1484 |
#else |
| 1485 |
g_assert_not_reached (); |
| 1486 |
#endif |
| 1487 |
} |
| 1488 |
g_variant_iter_init (&iter, parameters); |
| 1489 |
while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 1490 |
{ |
| 1491 |
_ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 1492 |
if (arg_info->use_gvariant) |
| 1493 |
{ |
| 1494 |
g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 1495 |
g_value_set_variant (¶mv[n], child); |
| 1496 |
n++; |
| 1497 |
} |
| 1498 |
else |
| 1499 |
g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 1500 |
g_variant_unref (child); |
| 1501 |
} |
| 1502 |
signal_id = g_signal_lookup (info->signal_name, GPIODBUS_TYPE_CHIP); |
| 1503 |
g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 1504 |
g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 1505 |
if (!g_value_get_boolean (&return_value)) |
| 1506 |
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name); |
| 1507 |
g_value_unset (&return_value); |
| 1508 |
for (n = 0; n < num_params + num_extra; n++) |
| 1509 |
g_value_unset (¶mv[n]); |
| 1510 |
g_free (paramv); |
| 1511 |
} |
| 1512 |
|
| 1513 |
static GVariant * |
| 1514 |
_gpiodbus_chip_skeleton_handle_get_property ( |
| 1515 |
GDBusConnection *connection G_GNUC_UNUSED, |
| 1516 |
const gchar *sender G_GNUC_UNUSED, |
| 1517 |
const gchar *object_path G_GNUC_UNUSED, |
| 1518 |
const gchar *interface_name G_GNUC_UNUSED, |
| 1519 |
const gchar *property_name, |
| 1520 |
GError **error, |
| 1521 |
gpointer user_data) |
| 1522 |
{ |
| 1523 |
GpiodbusChipSkeleton *skeleton = GPIODBUS_CHIP_SKELETON (user_data); |
| 1524 |
GValue value = G_VALUE_INIT; |
| 1525 |
GParamSpec *pspec; |
| 1526 |
_ExtendedGDBusPropertyInfo *info; |
| 1527 |
GVariant *ret; |
| 1528 |
ret = NULL; |
| 1529 |
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gpiodbus_chip_interface_info.parent_struct, property_name); |
| 1530 |
g_assert (info != NULL); |
| 1531 |
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 1532 |
if (pspec == NULL) |
| 1533 |
{ |
| 1534 |
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 1535 |
} |
| 1536 |
else |
| 1537 |
{ |
| 1538 |
g_value_init (&value, pspec->value_type); |
| 1539 |
g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 1540 |
ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 1541 |
g_value_unset (&value); |
| 1542 |
} |
| 1543 |
return ret; |
| 1544 |
} |
| 1545 |
|
| 1546 |
static gboolean |
| 1547 |
_gpiodbus_chip_skeleton_handle_set_property ( |
| 1548 |
GDBusConnection *connection G_GNUC_UNUSED, |
| 1549 |
const gchar *sender G_GNUC_UNUSED, |
| 1550 |
const gchar *object_path G_GNUC_UNUSED, |
| 1551 |
const gchar *interface_name G_GNUC_UNUSED, |
| 1552 |
const gchar *property_name, |
| 1553 |
GVariant *variant, |
| 1554 |
GError **error, |
| 1555 |
gpointer user_data) |
| 1556 |
{ |
| 1557 |
GpiodbusChipSkeleton *skeleton = GPIODBUS_CHIP_SKELETON (user_data); |
| 1558 |
GValue value = G_VALUE_INIT; |
| 1559 |
GParamSpec *pspec; |
| 1560 |
_ExtendedGDBusPropertyInfo *info; |
| 1561 |
gboolean ret; |
| 1562 |
ret = FALSE; |
| 1563 |
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gpiodbus_chip_interface_info.parent_struct, property_name); |
| 1564 |
g_assert (info != NULL); |
| 1565 |
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 1566 |
if (pspec == NULL) |
| 1567 |
{ |
| 1568 |
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 1569 |
} |
| 1570 |
else |
| 1571 |
{ |
| 1572 |
if (info->use_gvariant) |
| 1573 |
g_value_set_variant (&value, variant); |
| 1574 |
else |
| 1575 |
g_dbus_gvariant_to_gvalue (variant, &value); |
| 1576 |
g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 1577 |
g_value_unset (&value); |
| 1578 |
ret = TRUE; |
| 1579 |
} |
| 1580 |
return ret; |
| 1581 |
} |
| 1582 |
|
| 1583 |
static const GDBusInterfaceVTable _gpiodbus_chip_skeleton_vtable = |
| 1584 |
{ |
| 1585 |
_gpiodbus_chip_skeleton_handle_method_call, |
| 1586 |
_gpiodbus_chip_skeleton_handle_get_property, |
| 1587 |
_gpiodbus_chip_skeleton_handle_set_property, |
| 1588 |
{NULL} |
| 1589 |
}; |
| 1590 |
|
| 1591 |
static GDBusInterfaceInfo * |
| 1592 |
gpiodbus_chip_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 1593 |
{ |
| 1594 |
return gpiodbus_chip_interface_info (); |
| 1595 |
} |
| 1596 |
|
| 1597 |
static GDBusInterfaceVTable * |
| 1598 |
gpiodbus_chip_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 1599 |
{ |
| 1600 |
return (GDBusInterfaceVTable *) &_gpiodbus_chip_skeleton_vtable; |
| 1601 |
} |
| 1602 |
|
| 1603 |
static GVariant * |
| 1604 |
gpiodbus_chip_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 1605 |
{ |
| 1606 |
GpiodbusChipSkeleton *skeleton = GPIODBUS_CHIP_SKELETON (_skeleton); |
| 1607 |
|
| 1608 |
GVariantBuilder builder; |
| 1609 |
guint n; |
| 1610 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_84 |
| 1611 |
g_variant_builder_init_static (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 1612 |
#else |
| 1613 |
g_variant_builder_init(&builder, G_VARIANT_TYPE ("a{sv}")); |
| 1614 |
#endif |
| 1615 |
if (_gpiodbus_chip_interface_info.parent_struct.properties == NULL) |
| 1616 |
goto out; |
| 1617 |
for (n = 0; _gpiodbus_chip_interface_info.parent_struct.properties[n] != NULL; n++) |
| 1618 |
{ |
| 1619 |
GDBusPropertyInfo *info = _gpiodbus_chip_interface_info.parent_struct.properties[n]; |
| 1620 |
if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 1621 |
{ |
| 1622 |
GVariant *value; |
| 1623 |
value = _gpiodbus_chip_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "io.gpiod1.Chip", info->name, NULL, skeleton); |
| 1624 |
if (value != NULL) |
| 1625 |
{ |
| 1626 |
g_variant_take_ref (value); |
| 1627 |
g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 1628 |
g_variant_unref (value); |
| 1629 |
} |
| 1630 |
} |
| 1631 |
} |
| 1632 |
out: |
| 1633 |
return g_variant_builder_end (&builder); |
| 1634 |
} |
| 1635 |
|
| 1636 |
static gboolean _gpiodbus_chip_emit_changed (gpointer user_data); |
| 1637 |
|
| 1638 |
static void |
| 1639 |
gpiodbus_chip_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 1640 |
{ |
| 1641 |
GpiodbusChipSkeleton *skeleton = GPIODBUS_CHIP_SKELETON (_skeleton); |
| 1642 |
gboolean emit_changed = FALSE; |
| 1643 |
|
| 1644 |
g_mutex_lock (&skeleton->priv->lock); |
| 1645 |
if (skeleton->priv->changed_properties_idle_source != NULL) |
| 1646 |
{ |
| 1647 |
g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 1648 |
skeleton->priv->changed_properties_idle_source = NULL; |
| 1649 |
emit_changed = TRUE; |
| 1650 |
} |
| 1651 |
g_mutex_unlock (&skeleton->priv->lock); |
| 1652 |
|
| 1653 |
if (emit_changed) |
| 1654 |
_gpiodbus_chip_emit_changed (skeleton); |
| 1655 |
} |
| 1656 |
|
| 1657 |
static void gpiodbus_chip_skeleton_iface_init (GpiodbusChipIface *iface); |
| 1658 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 1659 |
G_DEFINE_TYPE_WITH_CODE (GpiodbusChipSkeleton, gpiodbus_chip_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 1660 |
G_ADD_PRIVATE (GpiodbusChipSkeleton) |
| 1661 |
G_IMPLEMENT_INTERFACE (GPIODBUS_TYPE_CHIP, gpiodbus_chip_skeleton_iface_init)) |
| 1662 |
|
| 1663 |
#else |
| 1664 |
G_DEFINE_TYPE_WITH_CODE (GpiodbusChipSkeleton, gpiodbus_chip_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 1665 |
G_IMPLEMENT_INTERFACE (GPIODBUS_TYPE_CHIP, gpiodbus_chip_skeleton_iface_init)) |
| 1666 |
|
| 1667 |
#endif |
| 1668 |
static void |
| 1669 |
gpiodbus_chip_skeleton_finalize (GObject *object) |
| 1670 |
{ |
| 1671 |
GpiodbusChipSkeleton *skeleton = GPIODBUS_CHIP_SKELETON (object); |
| 1672 |
guint n; |
| 1673 |
for (n = 0; n < 4; n++) |
| 1674 |
g_value_unset (&skeleton->priv->properties[n]); |
| 1675 |
g_free (skeleton->priv->properties); |
| 1676 |
g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 1677 |
if (skeleton->priv->changed_properties_idle_source != NULL) |
| 1678 |
g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 1679 |
g_main_context_unref (skeleton->priv->context); |
| 1680 |
g_mutex_clear (&skeleton->priv->lock); |
| 1681 |
G_OBJECT_CLASS (gpiodbus_chip_skeleton_parent_class)->finalize (object); |
| 1682 |
} |
| 1683 |
|
| 1684 |
static void |
| 1685 |
gpiodbus_chip_skeleton_get_property (GObject *object, |
| 1686 |
guint prop_id, |
| 1687 |
GValue *value, |
| 1688 |
GParamSpec *pspec G_GNUC_UNUSED) |
| 1689 |
{ |
| 1690 |
GpiodbusChipSkeleton *skeleton = GPIODBUS_CHIP_SKELETON (object); |
| 1691 |
g_assert (prop_id != 0 && prop_id - 1 < 4); |
| 1692 |
g_mutex_lock (&skeleton->priv->lock); |
| 1693 |
g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 1694 |
g_mutex_unlock (&skeleton->priv->lock); |
| 1695 |
} |
| 1696 |
|
| 1697 |
static gboolean |
| 1698 |
_gpiodbus_chip_emit_changed (gpointer user_data) |
| 1699 |
{ |
| 1700 |
GpiodbusChipSkeleton *skeleton = GPIODBUS_CHIP_SKELETON (user_data); |
| 1701 |
GList *l; |
| 1702 |
GVariantBuilder builder; |
| 1703 |
GVariantBuilder invalidated_builder; |
| 1704 |
guint num_changes; |
| 1705 |
|
| 1706 |
g_mutex_lock (&skeleton->priv->lock); |
| 1707 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_84 |
| 1708 |
g_variant_builder_init_static (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 1709 |
g_variant_builder_init_static (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 1710 |
#else |
| 1711 |
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 1712 |
g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 1713 |
#endif |
| 1714 |
for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 1715 |
{ |
| 1716 |
ChangedProperty *cp = l->data; |
| 1717 |
GVariant *variant; |
| 1718 |
const GValue *cur_value; |
| 1719 |
|
| 1720 |
cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 1721 |
if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 1722 |
{ |
| 1723 |
variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 1724 |
g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 1725 |
g_variant_unref (variant); |
| 1726 |
num_changes++; |
| 1727 |
} |
| 1728 |
} |
| 1729 |
if (num_changes > 0) |
| 1730 |
{ |
| 1731 |
GList *connections, *ll; |
| 1732 |
GVariant *signal_variant; |
| 1733 |
signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "io.gpiod1.Chip", |
| 1734 |
&builder, &invalidated_builder)); |
| 1735 |
connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 1736 |
for (ll = connections; ll != NULL; ll = ll->next) |
| 1737 |
{ |
| 1738 |
GDBusConnection *connection = ll->data; |
| 1739 |
|
| 1740 |
g_dbus_connection_emit_signal (connection, |
| 1741 |
NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 1742 |
"org.freedesktop.DBus.Properties", |
| 1743 |
"PropertiesChanged", |
| 1744 |
signal_variant, |
| 1745 |
NULL); |
| 1746 |
} |
| 1747 |
g_variant_unref (signal_variant); |
| 1748 |
g_list_free_full (connections, g_object_unref); |
| 1749 |
} |
| 1750 |
else |
| 1751 |
{ |
| 1752 |
g_variant_builder_clear (&builder); |
| 1753 |
g_variant_builder_clear (&invalidated_builder); |
| 1754 |
} |
| 1755 |
g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 1756 |
skeleton->priv->changed_properties = NULL; |
| 1757 |
skeleton->priv->changed_properties_idle_source = NULL; |
| 1758 |
g_mutex_unlock (&skeleton->priv->lock); |
| 1759 |
return FALSE; |
| 1760 |
} |
| 1761 |
|
| 1762 |
static void |
| 1763 |
_gpiodbus_chip_schedule_emit_changed (GpiodbusChipSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 1764 |
{ |
| 1765 |
ChangedProperty *cp; |
| 1766 |
GList *l; |
| 1767 |
cp = NULL; |
| 1768 |
for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 1769 |
{ |
| 1770 |
ChangedProperty *i_cp = l->data; |
| 1771 |
if (i_cp->info == info) |
| 1772 |
{ |
| 1773 |
cp = i_cp; |
| 1774 |
break; |
| 1775 |
} |
| 1776 |
} |
| 1777 |
if (cp == NULL) |
| 1778 |
{ |
| 1779 |
cp = g_new0 (ChangedProperty, 1); |
| 1780 |
cp->prop_id = prop_id; |
| 1781 |
cp->info = info; |
| 1782 |
skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 1783 |
g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 1784 |
g_value_copy (orig_value, &cp->orig_value); |
| 1785 |
} |
| 1786 |
} |
| 1787 |
|
| 1788 |
static void |
| 1789 |
gpiodbus_chip_skeleton_notify (GObject *object, |
| 1790 |
GParamSpec *pspec G_GNUC_UNUSED) |
| 1791 |
{ |
| 1792 |
GpiodbusChipSkeleton *skeleton = GPIODBUS_CHIP_SKELETON (object); |
| 1793 |
g_mutex_lock (&skeleton->priv->lock); |
| 1794 |
if (skeleton->priv->changed_properties != NULL && |
| 1795 |
skeleton->priv->changed_properties_idle_source == NULL) |
| 1796 |
{ |
| 1797 |
skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 1798 |
g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 1799 |
g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gpiodbus_chip_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 1800 |
g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gpiodbus_chip_emit_changed"); |
| 1801 |
g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 1802 |
g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 1803 |
} |
| 1804 |
g_mutex_unlock (&skeleton->priv->lock); |
| 1805 |
} |
| 1806 |
|
| 1807 |
static void |
| 1808 |
gpiodbus_chip_skeleton_set_property (GObject *object, |
| 1809 |
guint prop_id, |
| 1810 |
const GValue *value, |
| 1811 |
GParamSpec *pspec) |
| 1812 |
{ |
| 1813 |
const _ExtendedGDBusPropertyInfo *info; |
| 1814 |
GpiodbusChipSkeleton *skeleton = GPIODBUS_CHIP_SKELETON (object); |
| 1815 |
g_assert (prop_id != 0 && prop_id - 1 < 4); |
| 1816 |
info = (const _ExtendedGDBusPropertyInfo *) _gpiodbus_chip_property_info_pointers[prop_id - 1]; |
| 1817 |
g_mutex_lock (&skeleton->priv->lock); |
| 1818 |
g_object_freeze_notify (object); |
| 1819 |
if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 1820 |
{ |
| 1821 |
if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL && |
| 1822 |
info->emits_changed_signal) |
| 1823 |
_gpiodbus_chip_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 1824 |
g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 1825 |
g_object_notify_by_pspec (object, pspec); |
| 1826 |
} |
| 1827 |
g_mutex_unlock (&skeleton->priv->lock); |
| 1828 |
g_object_thaw_notify (object); |
| 1829 |
} |
| 1830 |
|
| 1831 |
static void |
| 1832 |
gpiodbus_chip_skeleton_init (GpiodbusChipSkeleton *skeleton) |
| 1833 |
{ |
| 1834 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 1835 |
skeleton->priv = gpiodbus_chip_skeleton_get_instance_private (skeleton); |
| 1836 |
#else |
| 1837 |
skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, GPIODBUS_TYPE_CHIP_SKELETON, GpiodbusChipSkeletonPrivate); |
| 1838 |
#endif |
| 1839 |
|
| 1840 |
g_mutex_init (&skeleton->priv->lock); |
| 1841 |
skeleton->priv->context = g_main_context_ref_thread_default (); |
| 1842 |
skeleton->priv->properties = g_new0 (GValue, 4); |
| 1843 |
g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
| 1844 |
g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 1845 |
g_value_init (&skeleton->priv->properties[2], G_TYPE_UINT); |
| 1846 |
g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING); |
| 1847 |
} |
| 1848 |
|
| 1849 |
static const gchar * |
| 1850 |
gpiodbus_chip_skeleton_get_name (GpiodbusChip *object) |
| 1851 |
{ |
| 1852 |
GpiodbusChipSkeleton *skeleton = GPIODBUS_CHIP_SKELETON (object); |
| 1853 |
const gchar *value; |
| 1854 |
g_mutex_lock (&skeleton->priv->lock); |
| 1855 |
value = g_marshal_value_peek_string (&(skeleton->priv->properties[0])); |
| 1856 |
g_mutex_unlock (&skeleton->priv->lock); |
| 1857 |
return value; |
| 1858 |
} |
| 1859 |
|
| 1860 |
static const gchar * |
| 1861 |
gpiodbus_chip_skeleton_get_label (GpiodbusChip *object) |
| 1862 |
{ |
| 1863 |
GpiodbusChipSkeleton *skeleton = GPIODBUS_CHIP_SKELETON (object); |
| 1864 |
const gchar *value; |
| 1865 |
g_mutex_lock (&skeleton->priv->lock); |
| 1866 |
value = g_marshal_value_peek_string (&(skeleton->priv->properties[1])); |
| 1867 |
g_mutex_unlock (&skeleton->priv->lock); |
| 1868 |
return value; |
| 1869 |
} |
| 1870 |
|
| 1871 |
static guint |
| 1872 |
gpiodbus_chip_skeleton_get_num_lines (GpiodbusChip *object) |
| 1873 |
{ |
| 1874 |
GpiodbusChipSkeleton *skeleton = GPIODBUS_CHIP_SKELETON (object); |
| 1875 |
guint value; |
| 1876 |
g_mutex_lock (&skeleton->priv->lock); |
| 1877 |
value = g_marshal_value_peek_uint (&(skeleton->priv->properties[2])); |
| 1878 |
g_mutex_unlock (&skeleton->priv->lock); |
| 1879 |
return value; |
| 1880 |
} |
| 1881 |
|
| 1882 |
static const gchar * |
| 1883 |
gpiodbus_chip_skeleton_get_path (GpiodbusChip *object) |
| 1884 |
{ |
| 1885 |
GpiodbusChipSkeleton *skeleton = GPIODBUS_CHIP_SKELETON (object); |
| 1886 |
const gchar *value; |
| 1887 |
g_mutex_lock (&skeleton->priv->lock); |
| 1888 |
value = g_marshal_value_peek_string (&(skeleton->priv->properties[3])); |
| 1889 |
g_mutex_unlock (&skeleton->priv->lock); |
| 1890 |
return value; |
| 1891 |
} |
| 1892 |
|
| 1893 |
static void |
| 1894 |
gpiodbus_chip_skeleton_class_init (GpiodbusChipSkeletonClass *klass) |
| 1895 |
{ |
| 1896 |
GObjectClass *gobject_class; |
| 1897 |
GDBusInterfaceSkeletonClass *skeleton_class; |
| 1898 |
|
| 1899 |
gobject_class = G_OBJECT_CLASS (klass); |
| 1900 |
gobject_class->finalize = gpiodbus_chip_skeleton_finalize; |
| 1901 |
gobject_class->get_property = gpiodbus_chip_skeleton_get_property; |
| 1902 |
gobject_class->set_property = gpiodbus_chip_skeleton_set_property; |
| 1903 |
gobject_class->notify = gpiodbus_chip_skeleton_notify; |
| 1904 |
|
| 1905 |
|
| 1906 |
gpiodbus_chip_override_properties (gobject_class, 1); |
| 1907 |
|
| 1908 |
skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 1909 |
skeleton_class->get_info = gpiodbus_chip_skeleton_dbus_interface_get_info; |
| 1910 |
skeleton_class->get_properties = gpiodbus_chip_skeleton_dbus_interface_get_properties; |
| 1911 |
skeleton_class->flush = gpiodbus_chip_skeleton_dbus_interface_flush; |
| 1912 |
skeleton_class->get_vtable = gpiodbus_chip_skeleton_dbus_interface_get_vtable; |
| 1913 |
|
| 1914 |
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 1915 |
g_type_class_add_private (klass, sizeof (GpiodbusChipSkeletonPrivate)); |
| 1916 |
#endif |
| 1917 |
} |
| 1918 |
|
| 1919 |
static void |
| 1920 |
gpiodbus_chip_skeleton_iface_init (GpiodbusChipIface *iface) |
| 1921 |
{ |
| 1922 |
iface->get_name = gpiodbus_chip_skeleton_get_name; |
| 1923 |
iface->get_label = gpiodbus_chip_skeleton_get_label; |
| 1924 |
iface->get_num_lines = gpiodbus_chip_skeleton_get_num_lines; |
| 1925 |
iface->get_path = gpiodbus_chip_skeleton_get_path; |
| 1926 |
} |
| 1927 |
|
| 1928 |
|
| 1929 |
|
| 1930 |
|
| 1931 |
|
| 1932 |
|
| 1933 |
|
| 1934 |
|
| 1935 |
GpiodbusChip * |
| 1936 |
gpiodbus_chip_skeleton_new (void) |
| 1937 |
{ |
| 1938 |
return GPIODBUS_CHIP (g_object_new (GPIODBUS_TYPE_CHIP_SKELETON, NULL)); |
| 1939 |
} |
| 1940 |
|
| 1941 |
|
| 1942 |
|
| 1943 |
|
| 1944 |
|
| 1945 |
|
| 1946 |
|
| 1947 |
|
| 1948 |
|
| 1949 |
|
| 1950 |
|
| 1951 |
|
| 1952 |
|
| 1953 |
|
| 1954 |
enum |
| 1955 |
{ |
| 1956 |
GPIODBUS__LINE_EDGE_EVENT, |
| 1957 |
}; |
| 1958 |
|
| 1959 |
static unsigned GPIODBUS__LINE_SIGNALS[1] = { 0 }; |
| 1960 |
|
| 1961 |
|
| 1962 |
|
| 1963 |
static const _ExtendedGDBusArgInfo _gpiodbus_line_signal_info_edge_event_ARG_event_data = |
| 1964 |
{ |
| 1965 |
{ |
| 1966 |
-1, |
| 1967 |
(gchar *) "event_data", |
| 1968 |
(gchar *) "(ittt)", |
| 1969 |
NULL |
| 1970 |
}, |
| 1971 |
FALSE |
| 1972 |
}; |
| 1973 |
|
| 1974 |
static const GDBusArgInfo * const _gpiodbus_line_signal_info_edge_event_ARG_pointers[] = |
| 1975 |
{ |
| 1976 |
&_gpiodbus_line_signal_info_edge_event_ARG_event_data.parent_struct, |
| 1977 |
NULL |
| 1978 |
}; |
| 1979 |
|
| 1980 |
static const _ExtendedGDBusSignalInfo _gpiodbus_line_signal_info_edge_event = |
| 1981 |
{ |
| 1982 |
{ |
| 1983 |
-1, |
| 1984 |
(gchar *) "EdgeEvent", |
| 1985 |
(GDBusArgInfo **) &_gpiodbus_line_signal_info_edge_event_ARG_pointers, |
| 1986 |
NULL |
| 1987 |
}, |
| 1988 |
"edge-event" |
| 1989 |
}; |
| 1990 |
|
| 1991 |
static const GDBusSignalInfo * const _gpiodbus_line_signal_info_pointers[] = |
| 1992 |
{ |
| 1993 |
&_gpiodbus_line_signal_info_edge_event.parent_struct, |
| 1994 |
NULL |
| 1995 |
}; |
| 1996 |
|
| 1997 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_line_property_info_offset = |
| 1998 |
{ |
| 1999 |
{ |
| 2000 |
-1, |
| 2001 |
(gchar *) "Offset", |
| 2002 |
(gchar *) "u", |
| 2003 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2004 |
NULL |
| 2005 |
}, |
| 2006 |
"offset", |
| 2007 |
FALSE, |
| 2008 |
TRUE |
| 2009 |
}; |
| 2010 |
|
| 2011 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_line_property_info_name = |
| 2012 |
{ |
| 2013 |
{ |
| 2014 |
-1, |
| 2015 |
(gchar *) "Name", |
| 2016 |
(gchar *) "s", |
| 2017 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2018 |
NULL |
| 2019 |
}, |
| 2020 |
"name", |
| 2021 |
FALSE, |
| 2022 |
TRUE |
| 2023 |
}; |
| 2024 |
|
| 2025 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_line_property_info_used = |
| 2026 |
{ |
| 2027 |
{ |
| 2028 |
-1, |
| 2029 |
(gchar *) "Used", |
| 2030 |
(gchar *) "b", |
| 2031 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2032 |
NULL |
| 2033 |
}, |
| 2034 |
"used", |
| 2035 |
FALSE, |
| 2036 |
TRUE |
| 2037 |
}; |
| 2038 |
|
| 2039 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_line_property_info_consumer = |
| 2040 |
{ |
| 2041 |
{ |
| 2042 |
-1, |
| 2043 |
(gchar *) "Consumer", |
| 2044 |
(gchar *) "s", |
| 2045 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2046 |
NULL |
| 2047 |
}, |
| 2048 |
"consumer", |
| 2049 |
FALSE, |
| 2050 |
TRUE |
| 2051 |
}; |
| 2052 |
|
| 2053 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_line_property_info_direction = |
| 2054 |
{ |
| 2055 |
{ |
| 2056 |
-1, |
| 2057 |
(gchar *) "Direction", |
| 2058 |
(gchar *) "s", |
| 2059 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2060 |
NULL |
| 2061 |
}, |
| 2062 |
"direction", |
| 2063 |
FALSE, |
| 2064 |
TRUE |
| 2065 |
}; |
| 2066 |
|
| 2067 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_line_property_info_edge_detection = |
| 2068 |
{ |
| 2069 |
{ |
| 2070 |
-1, |
| 2071 |
(gchar *) "EdgeDetection", |
| 2072 |
(gchar *) "s", |
| 2073 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2074 |
NULL |
| 2075 |
}, |
| 2076 |
"edge-detection", |
| 2077 |
FALSE, |
| 2078 |
TRUE |
| 2079 |
}; |
| 2080 |
|
| 2081 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_line_property_info_bias = |
| 2082 |
{ |
| 2083 |
{ |
| 2084 |
-1, |
| 2085 |
(gchar *) "Bias", |
| 2086 |
(gchar *) "s", |
| 2087 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2088 |
NULL |
| 2089 |
}, |
| 2090 |
"bias", |
| 2091 |
FALSE, |
| 2092 |
TRUE |
| 2093 |
}; |
| 2094 |
|
| 2095 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_line_property_info_drive = |
| 2096 |
{ |
| 2097 |
{ |
| 2098 |
-1, |
| 2099 |
(gchar *) "Drive", |
| 2100 |
(gchar *) "s", |
| 2101 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2102 |
NULL |
| 2103 |
}, |
| 2104 |
"drive", |
| 2105 |
FALSE, |
| 2106 |
TRUE |
| 2107 |
}; |
| 2108 |
|
| 2109 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_line_property_info_active_low = |
| 2110 |
{ |
| 2111 |
{ |
| 2112 |
-1, |
| 2113 |
(gchar *) "ActiveLow", |
| 2114 |
(gchar *) "b", |
| 2115 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2116 |
NULL |
| 2117 |
}, |
| 2118 |
"active-low", |
| 2119 |
FALSE, |
| 2120 |
TRUE |
| 2121 |
}; |
| 2122 |
|
| 2123 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_line_property_info_debounced = |
| 2124 |
{ |
| 2125 |
{ |
| 2126 |
-1, |
| 2127 |
(gchar *) "Debounced", |
| 2128 |
(gchar *) "b", |
| 2129 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2130 |
NULL |
| 2131 |
}, |
| 2132 |
"debounced", |
| 2133 |
FALSE, |
| 2134 |
TRUE |
| 2135 |
}; |
| 2136 |
|
| 2137 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_line_property_info_debounce_period_us = |
| 2138 |
{ |
| 2139 |
{ |
| 2140 |
-1, |
| 2141 |
(gchar *) "DebouncePeriodUs", |
| 2142 |
(gchar *) "t", |
| 2143 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2144 |
NULL |
| 2145 |
}, |
| 2146 |
"debounce-period-us", |
| 2147 |
FALSE, |
| 2148 |
TRUE |
| 2149 |
}; |
| 2150 |
|
| 2151 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_line_property_info_event_clock = |
| 2152 |
{ |
| 2153 |
{ |
| 2154 |
-1, |
| 2155 |
(gchar *) "EventClock", |
| 2156 |
(gchar *) "s", |
| 2157 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2158 |
NULL |
| 2159 |
}, |
| 2160 |
"event-clock", |
| 2161 |
FALSE, |
| 2162 |
TRUE |
| 2163 |
}; |
| 2164 |
|
| 2165 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_line_property_info_managed = |
| 2166 |
{ |
| 2167 |
{ |
| 2168 |
-1, |
| 2169 |
(gchar *) "Managed", |
| 2170 |
(gchar *) "b", |
| 2171 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2172 |
NULL |
| 2173 |
}, |
| 2174 |
"managed", |
| 2175 |
FALSE, |
| 2176 |
TRUE |
| 2177 |
}; |
| 2178 |
|
| 2179 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_line_property_info_request_path = |
| 2180 |
{ |
| 2181 |
{ |
| 2182 |
-1, |
| 2183 |
(gchar *) "RequestPath", |
| 2184 |
(gchar *) "o", |
| 2185 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 2186 |
NULL |
| 2187 |
}, |
| 2188 |
"request-path", |
| 2189 |
FALSE, |
| 2190 |
TRUE |
| 2191 |
}; |
| 2192 |
|
| 2193 |
static const GDBusPropertyInfo * const _gpiodbus_line_property_info_pointers[] = |
| 2194 |
{ |
| 2195 |
&_gpiodbus_line_property_info_offset.parent_struct, |
| 2196 |
&_gpiodbus_line_property_info_name.parent_struct, |
| 2197 |
&_gpiodbus_line_property_info_used.parent_struct, |
| 2198 |
&_gpiodbus_line_property_info_consumer.parent_struct, |
| 2199 |
&_gpiodbus_line_property_info_direction.parent_struct, |
| 2200 |
&_gpiodbus_line_property_info_edge_detection.parent_struct, |
| 2201 |
&_gpiodbus_line_property_info_bias.parent_struct, |
| 2202 |
&_gpiodbus_line_property_info_drive.parent_struct, |
| 2203 |
&_gpiodbus_line_property_info_active_low.parent_struct, |
| 2204 |
&_gpiodbus_line_property_info_debounced.parent_struct, |
| 2205 |
&_gpiodbus_line_property_info_debounce_period_us.parent_struct, |
| 2206 |
&_gpiodbus_line_property_info_event_clock.parent_struct, |
| 2207 |
&_gpiodbus_line_property_info_managed.parent_struct, |
| 2208 |
&_gpiodbus_line_property_info_request_path.parent_struct, |
| 2209 |
NULL |
| 2210 |
}; |
| 2211 |
|
| 2212 |
static const _ExtendedGDBusInterfaceInfo _gpiodbus_line_interface_info = |
| 2213 |
{ |
| 2214 |
{ |
| 2215 |
-1, |
| 2216 |
(gchar *) "io.gpiod1.Line", |
| 2217 |
NULL, |
| 2218 |
(GDBusSignalInfo **) &_gpiodbus_line_signal_info_pointers, |
| 2219 |
(GDBusPropertyInfo **) &_gpiodbus_line_property_info_pointers, |
| 2220 |
NULL |
| 2221 |
}, |
| 2222 |
"line", |
| 2223 |
}; |
| 2224 |
|
| 2225 |
|
| 2226 |
|
| 2227 |
|
| 2228 |
|
| 2229 |
|
| 2230 |
|
| 2231 |
|
| 2232 |
|
| 2233 |
GDBusInterfaceInfo * |
| 2234 |
gpiodbus_line_interface_info (void) |
| 2235 |
{ |
| 2236 |
return (GDBusInterfaceInfo *) &_gpiodbus_line_interface_info.parent_struct; |
| 2237 |
} |
| 2238 |
|
| 2239 |
|
| 2240 |
|
| 2241 |
|
| 2242 |
|
| 2243 |
|
| 2244 |
|
| 2245 |
|
| 2246 |
|
| 2247 |
|
| 2248 |
|
| 2249 |
guint |
| 2250 |
gpiodbus_line_override_properties (GObjectClass *klass, guint property_id_begin) |
| 2251 |
{ |
| 2252 |
g_object_class_override_property (klass, property_id_begin++, "offset"); |
| 2253 |
g_object_class_override_property (klass, property_id_begin++, "name"); |
| 2254 |
g_object_class_override_property (klass, property_id_begin++, "used"); |
| 2255 |
g_object_class_override_property (klass, property_id_begin++, "consumer"); |
| 2256 |
g_object_class_override_property (klass, property_id_begin++, "direction"); |
| 2257 |
g_object_class_override_property (klass, property_id_begin++, "edge-detection"); |
| 2258 |
g_object_class_override_property (klass, property_id_begin++, "bias"); |
| 2259 |
g_object_class_override_property (klass, property_id_begin++, "drive"); |
| 2260 |
g_object_class_override_property (klass, property_id_begin++, "active-low"); |
| 2261 |
g_object_class_override_property (klass, property_id_begin++, "debounced"); |
| 2262 |
g_object_class_override_property (klass, property_id_begin++, "debounce-period-us"); |
| 2263 |
g_object_class_override_property (klass, property_id_begin++, "event-clock"); |
| 2264 |
g_object_class_override_property (klass, property_id_begin++, "managed"); |
| 2265 |
g_object_class_override_property (klass, property_id_begin++, "request-path"); |
| 2266 |
return property_id_begin - 1; |
| 2267 |
} |
| 2268 |
|
| 2269 |
|
| 2270 |
inline static void |
| 2271 |
gpiodbus_line_signal_marshal_edge_event ( |
| 2272 |
GClosure *closure, |
| 2273 |
GValue *return_value, |
| 2274 |
unsigned int n_param_values, |
| 2275 |
const GValue *param_values, |
| 2276 |
void *invocation_hint, |
| 2277 |
void *marshal_data) |
| 2278 |
{ |
| 2279 |
g_cclosure_marshal_VOID__VARIANT (closure, |
| 2280 |
return_value, n_param_values, param_values, invocation_hint, marshal_data); |
| 2281 |
} |
| 2282 |
|
| 2283 |
|
| 2284 |
|
| 2285 |
|
| 2286 |
|
| 2287 |
|
| 2288 |
|
| 2289 |
|
| 2290 |
|
| 2291 |
|
| 2292 |
|
| 2293 |
|
| 2294 |
|
| 2295 |
|
| 2296 |
|
| 2297 |
|
| 2298 |
|
| 2299 |
|
| 2300 |
|
| 2301 |
|
| 2302 |
|
| 2303 |
|
| 2304 |
|
| 2305 |
|
| 2306 |
|
| 2307 |
|
| 2308 |
|
| 2309 |
|
| 2310 |
|
| 2311 |
|
| 2312 |
typedef GpiodbusLineIface GpiodbusLineInterface; |
| 2313 |
G_DEFINE_INTERFACE (GpiodbusLine, gpiodbus_line, G_TYPE_OBJECT) |
| 2314 |
|
| 2315 |
static void |
| 2316 |
gpiodbus_line_default_init (GpiodbusLineIface *iface) |
| 2317 |
{ |
| 2318 |
|
| 2319 |
|
| 2320 |
|
| 2321 |
|
| 2322 |
|
| 2323 |
|
| 2324 |
|
| 2325 |
|
| 2326 |
|
| 2327 |
|
| 2328 |
GPIODBUS__LINE_SIGNALS[GPIODBUS__LINE_EDGE_EVENT] = |
| 2329 |
g_signal_new ("edge-event", |
| 2330 |
G_TYPE_FROM_INTERFACE (iface), |
| 2331 |
G_SIGNAL_RUN_LAST, |
| 2332 |
G_STRUCT_OFFSET (GpiodbusLineIface, edge_event), |
| 2333 |
NULL, |
| 2334 |
NULL, |
| 2335 |
gpiodbus_line_signal_marshal_edge_event, |
| 2336 |
G_TYPE_NONE, |
| 2337 |
1, G_TYPE_VARIANT); |
| 2338 |
|
| 2339 |
|
| 2340 |
|
| 2341 |
|
| 2342 |
|
| 2343 |
|
| 2344 |
|
| 2345 |
|
| 2346 |
|
| 2347 |
g_object_interface_install_property (iface, |
| 2348 |
g_param_spec_uint ("offset", "Offset", "Offset", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2349 |
|
| 2350 |
|
| 2351 |
|
| 2352 |
|
| 2353 |
|
| 2354 |
|
| 2355 |
|
| 2356 |
g_object_interface_install_property (iface, |
| 2357 |
g_param_spec_string ("name", "Name", "Name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2358 |
|
| 2359 |
|
| 2360 |
|
| 2361 |
|
| 2362 |
|
| 2363 |
|
| 2364 |
|
| 2365 |
g_object_interface_install_property (iface, |
| 2366 |
g_param_spec_boolean ("used", "Used", "Used", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2367 |
|
| 2368 |
|
| 2369 |
|
| 2370 |
|
| 2371 |
|
| 2372 |
|
| 2373 |
|
| 2374 |
g_object_interface_install_property (iface, |
| 2375 |
g_param_spec_string ("consumer", "Consumer", "Consumer", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2376 |
|
| 2377 |
|
| 2378 |
|
| 2379 |
|
| 2380 |
|
| 2381 |
|
| 2382 |
|
| 2383 |
g_object_interface_install_property (iface, |
| 2384 |
g_param_spec_string ("direction", "Direction", "Direction", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2385 |
|
| 2386 |
|
| 2387 |
|
| 2388 |
|
| 2389 |
|
| 2390 |
|
| 2391 |
|
| 2392 |
g_object_interface_install_property (iface, |
| 2393 |
g_param_spec_string ("edge-detection", "EdgeDetection", "EdgeDetection", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2394 |
|
| 2395 |
|
| 2396 |
|
| 2397 |
|
| 2398 |
|
| 2399 |
|
| 2400 |
|
| 2401 |
g_object_interface_install_property (iface, |
| 2402 |
g_param_spec_string ("bias", "Bias", "Bias", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2403 |
|
| 2404 |
|
| 2405 |
|
| 2406 |
|
| 2407 |
|
| 2408 |
|
| 2409 |
|
| 2410 |
g_object_interface_install_property (iface, |
| 2411 |
g_param_spec_string ("drive", "Drive", "Drive", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2412 |
|
| 2413 |
|
| 2414 |
|
| 2415 |
|
| 2416 |
|
| 2417 |
|
| 2418 |
|
| 2419 |
g_object_interface_install_property (iface, |
| 2420 |
g_param_spec_boolean ("active-low", "ActiveLow", "ActiveLow", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2421 |
|
| 2422 |
|
| 2423 |
|
| 2424 |
|
| 2425 |
|
| 2426 |
|
| 2427 |
|
| 2428 |
g_object_interface_install_property (iface, |
| 2429 |
g_param_spec_boolean ("debounced", "Debounced", "Debounced", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2430 |
|
| 2431 |
|
| 2432 |
|
| 2433 |
|
| 2434 |
|
| 2435 |
|
| 2436 |
|
| 2437 |
g_object_interface_install_property (iface, |
| 2438 |
g_param_spec_uint64 ("debounce-period-us", "DebouncePeriodUs", "DebouncePeriodUs", 0, G_MAXUINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2439 |
|
| 2440 |
|
| 2441 |
|
| 2442 |
|
| 2443 |
|
| 2444 |
|
| 2445 |
|
| 2446 |
g_object_interface_install_property (iface, |
| 2447 |
g_param_spec_string ("event-clock", "EventClock", "EventClock", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2448 |
|
| 2449 |
|
| 2450 |
|
| 2451 |
|
| 2452 |
|
| 2453 |
|
| 2454 |
|
| 2455 |
g_object_interface_install_property (iface, |
| 2456 |
g_param_spec_boolean ("managed", "Managed", "Managed", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2457 |
|
| 2458 |
|
| 2459 |
|
| 2460 |
|
| 2461 |
|
| 2462 |
|
| 2463 |
|
| 2464 |
g_object_interface_install_property (iface, |
| 2465 |
g_param_spec_string ("request-path", "RequestPath", "RequestPath", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 2466 |
} |
| 2467 |
|
| 2468 |
|
| 2469 |
|
| 2470 |
|
| 2471 |
|
| 2472 |
|
| 2473 |
|
| 2474 |
|
| 2475 |
|
| 2476 |
|
| 2477 |
|
| 2478 |
guint |
| 2479 |
gpiodbus_line_get_offset (GpiodbusLine *object) |
| 2480 |
{ |
| 2481 |
g_return_val_if_fail (GPIODBUS_IS_LINE (object), 0); |
| 2482 |
|
| 2483 |
return GPIODBUS_LINE_GET_IFACE (object)->get_offset (object); |
| 2484 |
} |
| 2485 |
|
| 2486 |
|
| 2487 |
|
| 2488 |
|
| 2489 |
|
| 2490 |
|
| 2491 |
|
| 2492 |
|
| 2493 |
|
| 2494 |
|
| 2495 |
void |
| 2496 |
gpiodbus_line_set_offset (GpiodbusLine *object, guint value) |
| 2497 |
{ |
| 2498 |
g_object_set (G_OBJECT (object), "offset", value, NULL); |
| 2499 |
} |
| 2500 |
|
| 2501 |
|
| 2502 |
|
| 2503 |
|
| 2504 |
|
| 2505 |
|
| 2506 |
|
| 2507 |
|
| 2508 |
|
| 2509 |
|
| 2510 |
|
| 2511 |
|
| 2512 |
|
| 2513 |
const gchar * |
| 2514 |
gpiodbus_line_get_name (GpiodbusLine *object) |
| 2515 |
{ |
| 2516 |
g_return_val_if_fail (GPIODBUS_IS_LINE (object), NULL); |
| 2517 |
|
| 2518 |
return GPIODBUS_LINE_GET_IFACE (object)->get_name (object); |
| 2519 |
} |
| 2520 |
|
| 2521 |
|
| 2522 |
|
| 2523 |
|
| 2524 |
|
| 2525 |
|
| 2526 |
|
| 2527 |
|
| 2528 |
|
| 2529 |
|
| 2530 |
|
| 2531 |
gchar * |
| 2532 |
gpiodbus_line_dup_name (GpiodbusLine *object) |
| 2533 |
{ |
| 2534 |
gchar *value; |
| 2535 |
g_object_get (G_OBJECT (object), "name", &value, NULL); |
| 2536 |
return value; |
| 2537 |
} |
| 2538 |
|
| 2539 |
|
| 2540 |
|
| 2541 |
|
| 2542 |
|
| 2543 |
|
| 2544 |
|
| 2545 |
|
| 2546 |
|
| 2547 |
|
| 2548 |
void |
| 2549 |
gpiodbus_line_set_name (GpiodbusLine *object, const gchar *value) |
| 2550 |
{ |
| 2551 |
g_object_set (G_OBJECT (object), "name", value, NULL); |
| 2552 |
} |
| 2553 |
|
| 2554 |
|
| 2555 |
|
| 2556 |
|
| 2557 |
|
| 2558 |
|
| 2559 |
|
| 2560 |
|
| 2561 |
|
| 2562 |
|
| 2563 |
|
| 2564 |
gboolean |
| 2565 |
gpiodbus_line_get_used (GpiodbusLine *object) |
| 2566 |
{ |
| 2567 |
g_return_val_if_fail (GPIODBUS_IS_LINE (object), FALSE); |
| 2568 |
|
| 2569 |
return GPIODBUS_LINE_GET_IFACE (object)->get_used (object); |
| 2570 |
} |
| 2571 |
|
| 2572 |
|
| 2573 |
|
| 2574 |
|
| 2575 |
|
| 2576 |
|
| 2577 |
|
| 2578 |
|
| 2579 |
|
| 2580 |
|
| 2581 |
void |
| 2582 |
gpiodbus_line_set_used (GpiodbusLine *object, gboolean value) |
| 2583 |
{ |
| 2584 |
g_object_set (G_OBJECT (object), "used", value, NULL); |
| 2585 |
} |
| 2586 |
|
| 2587 |
|
| 2588 |
|
| 2589 |
|
| 2590 |
|
| 2591 |
|
| 2592 |
|
| 2593 |
|
| 2594 |
|
| 2595 |
|
| 2596 |
|
| 2597 |
|
| 2598 |
|
| 2599 |
const gchar * |
| 2600 |
gpiodbus_line_get_consumer (GpiodbusLine *object) |
| 2601 |
{ |
| 2602 |
g_return_val_if_fail (GPIODBUS_IS_LINE (object), NULL); |
| 2603 |
|
| 2604 |
return GPIODBUS_LINE_GET_IFACE (object)->get_consumer (object); |
| 2605 |
} |
| 2606 |
|
| 2607 |
|
| 2608 |
|
| 2609 |
|
| 2610 |
|
| 2611 |
|
| 2612 |
|
| 2613 |
|
| 2614 |
|
| 2615 |
|
| 2616 |
|
| 2617 |
gchar * |
| 2618 |
gpiodbus_line_dup_consumer (GpiodbusLine *object) |
| 2619 |
{ |
| 2620 |
gchar *value; |
| 2621 |
g_object_get (G_OBJECT (object), "consumer", &value, NULL); |
| 2622 |
return value; |
| 2623 |
} |
| 2624 |
|
| 2625 |
|
| 2626 |
|
| 2627 |
|
| 2628 |
|
| 2629 |
|
| 2630 |
|
| 2631 |
|
| 2632 |
|
| 2633 |
|
| 2634 |
void |
| 2635 |
gpiodbus_line_set_consumer (GpiodbusLine *object, const gchar *value) |
| 2636 |
{ |
| 2637 |
g_object_set (G_OBJECT (object), "consumer", value, NULL); |
| 2638 |
} |
| 2639 |
|
| 2640 |
|
| 2641 |
|
| 2642 |
|
| 2643 |
|
| 2644 |
|
| 2645 |
|
| 2646 |
|
| 2647 |
|
| 2648 |
|
| 2649 |
|
| 2650 |
|
| 2651 |
|
| 2652 |
const gchar * |
| 2653 |
gpiodbus_line_get_direction (GpiodbusLine *object) |
| 2654 |
{ |
| 2655 |
g_return_val_if_fail (GPIODBUS_IS_LINE (object), NULL); |
| 2656 |
|
| 2657 |
return GPIODBUS_LINE_GET_IFACE (object)->get_direction (object); |
| 2658 |
} |
| 2659 |
|
| 2660 |
|
| 2661 |
|
| 2662 |
|
| 2663 |
|
| 2664 |
|
| 2665 |
|
| 2666 |
|
| 2667 |
|
| 2668 |
|
| 2669 |
|
| 2670 |
gchar * |
| 2671 |
gpiodbus_line_dup_direction (GpiodbusLine *object) |
| 2672 |
{ |
| 2673 |
gchar *value; |
| 2674 |
g_object_get (G_OBJECT (object), "direction", &value, NULL); |
| 2675 |
return value; |
| 2676 |
} |
| 2677 |
|
| 2678 |
|
| 2679 |
|
| 2680 |
|
| 2681 |
|
| 2682 |
|
| 2683 |
|
| 2684 |
|
| 2685 |
|
| 2686 |
|
| 2687 |
void |
| 2688 |
gpiodbus_line_set_direction (GpiodbusLine *object, const gchar *value) |
| 2689 |
{ |
| 2690 |
g_object_set (G_OBJECT (object), "direction", value, NULL); |
| 2691 |
} |
| 2692 |
|
| 2693 |
|
| 2694 |
|
| 2695 |
|
| 2696 |
|
| 2697 |
|
| 2698 |
|
| 2699 |
|
| 2700 |
|
| 2701 |
|
| 2702 |
|
| 2703 |
|
| 2704 |
|
| 2705 |
const gchar * |
| 2706 |
gpiodbus_line_get_edge_detection (GpiodbusLine *object) |
| 2707 |
{ |
| 2708 |
g_return_val_if_fail (GPIODBUS_IS_LINE (object), NULL); |
| 2709 |
|
| 2710 |
return GPIODBUS_LINE_GET_IFACE (object)->get_edge_detection (object); |
| 2711 |
} |
| 2712 |
|
| 2713 |
|
| 2714 |
|
| 2715 |
|
| 2716 |
|
| 2717 |
|
| 2718 |
|
| 2719 |
|
| 2720 |
|
| 2721 |
|
| 2722 |
|
| 2723 |
gchar * |
| 2724 |
gpiodbus_line_dup_edge_detection (GpiodbusLine *object) |
| 2725 |
{ |
| 2726 |
gchar *value; |
| 2727 |
g_object_get (G_OBJECT (object), "edge-detection", &value, NULL); |
| 2728 |
return value; |
| 2729 |
} |
| 2730 |
|
| 2731 |
|
| 2732 |
|
| 2733 |
|
| 2734 |
|
| 2735 |
|
| 2736 |
|
| 2737 |
|
| 2738 |
|
| 2739 |
|
| 2740 |
void |
| 2741 |
gpiodbus_line_set_edge_detection (GpiodbusLine *object, const gchar *value) |
| 2742 |
{ |
| 2743 |
g_object_set (G_OBJECT (object), "edge-detection", value, NULL); |
| 2744 |
} |
| 2745 |
|
| 2746 |
|
| 2747 |
|
| 2748 |
|
| 2749 |
|
| 2750 |
|
| 2751 |
|
| 2752 |
|
| 2753 |
|
| 2754 |
|
| 2755 |
|
| 2756 |
|
| 2757 |
|
| 2758 |
const gchar * |
| 2759 |
gpiodbus_line_get_bias (GpiodbusLine *object) |
| 2760 |
{ |
| 2761 |
g_return_val_if_fail (GPIODBUS_IS_LINE (object), NULL); |
| 2762 |
|
| 2763 |
return GPIODBUS_LINE_GET_IFACE (object)->get_bias (object); |
| 2764 |
} |
| 2765 |
|
| 2766 |
|
| 2767 |
|
| 2768 |
|
| 2769 |
|
| 2770 |
|
| 2771 |
|
| 2772 |
|
| 2773 |
|
| 2774 |
|
| 2775 |
|
| 2776 |
gchar * |
| 2777 |
gpiodbus_line_dup_bias (GpiodbusLine *object) |
| 2778 |
{ |
| 2779 |
gchar *value; |
| 2780 |
g_object_get (G_OBJECT (object), "bias", &value, NULL); |
| 2781 |
return value; |
| 2782 |
} |
| 2783 |
|
| 2784 |
|
| 2785 |
|
| 2786 |
|
| 2787 |
|
| 2788 |
|
| 2789 |
|
| 2790 |
|
| 2791 |
|
| 2792 |
|
| 2793 |
void |
| 2794 |
gpiodbus_line_set_bias (GpiodbusLine *object, const gchar *value) |
| 2795 |
{ |
| 2796 |
g_object_set (G_OBJECT (object), "bias", value, NULL); |
| 2797 |
} |
| 2798 |
|
| 2799 |
|
| 2800 |
|
| 2801 |
|
| 2802 |
|
| 2803 |
|
| 2804 |
|
| 2805 |
|
| 2806 |
|
| 2807 |
|
| 2808 |
|
| 2809 |
|
| 2810 |
|
| 2811 |
const gchar * |
| 2812 |
gpiodbus_line_get_drive (GpiodbusLine *object) |
| 2813 |
{ |
| 2814 |
g_return_val_if_fail (GPIODBUS_IS_LINE (object), NULL); |
| 2815 |
|
| 2816 |
return GPIODBUS_LINE_GET_IFACE (object)->get_drive (object); |
| 2817 |
} |
| 2818 |
|
| 2819 |
|
| 2820 |
|
| 2821 |
|
| 2822 |
|
| 2823 |
|
| 2824 |
|
| 2825 |
|
| 2826 |
|
| 2827 |
|
| 2828 |
|
| 2829 |
gchar * |
| 2830 |
gpiodbus_line_dup_drive (GpiodbusLine *object) |
| 2831 |
{ |
| 2832 |
gchar *value; |
| 2833 |
g_object_get (G_OBJECT (object), "drive", &value, NULL); |
| 2834 |
return value; |
| 2835 |
} |
| 2836 |
|
| 2837 |
|
| 2838 |
|
| 2839 |
|
| 2840 |
|
| 2841 |
|
| 2842 |
|
| 2843 |
|
| 2844 |
|
| 2845 |
|
| 2846 |
void |
| 2847 |
gpiodbus_line_set_drive (GpiodbusLine *object, const gchar *value) |
| 2848 |
{ |
| 2849 |
g_object_set (G_OBJECT (object), "drive", value, NULL); |
| 2850 |
} |
| 2851 |
|
| 2852 |
|
| 2853 |
|
| 2854 |
|
| 2855 |
|
| 2856 |
|
| 2857 |
|
| 2858 |
|
| 2859 |
|
| 2860 |
|
| 2861 |
|
| 2862 |
gboolean |
| 2863 |
gpiodbus_line_get_active_low (GpiodbusLine *object) |
| 2864 |
{ |
| 2865 |
g_return_val_if_fail (GPIODBUS_IS_LINE (object), FALSE); |
| 2866 |
|
| 2867 |
return GPIODBUS_LINE_GET_IFACE (object)->get_active_low (object); |
| 2868 |
} |
| 2869 |
|
| 2870 |
|
| 2871 |
|
| 2872 |
|
| 2873 |
|
| 2874 |
|
| 2875 |
|
| 2876 |
|
| 2877 |
|
| 2878 |
|
| 2879 |
void |
| 2880 |
gpiodbus_line_set_active_low (GpiodbusLine *object, gboolean value) |
| 2881 |
{ |
| 2882 |
g_object_set (G_OBJECT (object), "active-low", value, NULL); |
| 2883 |
} |
| 2884 |
|
| 2885 |
|
| 2886 |
|
| 2887 |
|
| 2888 |
|
| 2889 |
|
| 2890 |
|
| 2891 |
|
| 2892 |
|
| 2893 |
|
| 2894 |
|
| 2895 |
gboolean |
| 2896 |
gpiodbus_line_get_debounced (GpiodbusLine *object) |
| 2897 |
{ |
| 2898 |
g_return_val_if_fail (GPIODBUS_IS_LINE (object), FALSE); |
| 2899 |
|
| 2900 |
return GPIODBUS_LINE_GET_IFACE (object)->get_debounced (object); |
| 2901 |
} |
| 2902 |
|
| 2903 |
|
| 2904 |
|
| 2905 |
|
| 2906 |
|
| 2907 |
|
| 2908 |
|
| 2909 |
|
| 2910 |
|
| 2911 |
|
| 2912 |
void |
| 2913 |
gpiodbus_line_set_debounced (GpiodbusLine *object, gboolean value) |
| 2914 |
{ |
| 2915 |
g_object_set (G_OBJECT (object), "debounced", value, NULL); |
| 2916 |
} |
| 2917 |
|
| 2918 |
|
| 2919 |
|
| 2920 |
|
| 2921 |
|
| 2922 |
|
| 2923 |
|
| 2924 |
|
| 2925 |
|
| 2926 |
|
| 2927 |
|
| 2928 |
guint64 |
| 2929 |
gpiodbus_line_get_debounce_period_us (GpiodbusLine *object) |
| 2930 |
{ |
| 2931 |
g_return_val_if_fail (GPIODBUS_IS_LINE (object), 0); |
| 2932 |
|
| 2933 |
return GPIODBUS_LINE_GET_IFACE (object)->get_debounce_period_us (object); |
| 2934 |
} |
| 2935 |
|
| 2936 |
|
| 2937 |
|
| 2938 |
|
| 2939 |
|
| 2940 |
|
| 2941 |
|
| 2942 |
|
| 2943 |
|
| 2944 |
|
| 2945 |
void |
| 2946 |
gpiodbus_line_set_debounce_period_us (GpiodbusLine *object, guint64 value) |
| 2947 |
{ |
| 2948 |
g_object_set (G_OBJECT (object), "debounce-period-us", value, NULL); |
| 2949 |
} |
| 2950 |
|
| 2951 |
|
| 2952 |
|
| 2953 |
|
| 2954 |
|
| 2955 |
|
| 2956 |
|
| 2957 |
|
| 2958 |
|
| 2959 |
|
| 2960 |
|
| 2961 |
|
| 2962 |
|
| 2963 |
const gchar * |
| 2964 |
gpiodbus_line_get_event_clock (GpiodbusLine *object) |
| 2965 |
{ |
| 2966 |
g_return_val_if_fail (GPIODBUS_IS_LINE (object), NULL); |
| 2967 |
|
| 2968 |
return GPIODBUS_LINE_GET_IFACE (object)->get_event_clock (object); |
| 2969 |
} |
| 2970 |
|
| 2971 |
|
| 2972 |
|
| 2973 |
|
| 2974 |
|
| 2975 |
|
| 2976 |
|
| 2977 |
|
| 2978 |
|
| 2979 |
|
| 2980 |
|
| 2981 |
gchar * |
| 2982 |
gpiodbus_line_dup_event_clock (GpiodbusLine *object) |
| 2983 |
{ |
| 2984 |
gchar *value; |
| 2985 |
g_object_get (G_OBJECT (object), "event-clock", &value, NULL); |
| 2986 |
return value; |
| 2987 |
} |
| 2988 |
|
| 2989 |
|
| 2990 |
|
| 2991 |
|
| 2992 |
|
| 2993 |
|
| 2994 |
|
| 2995 |
|
| 2996 |
|
| 2997 |
|
| 2998 |
void |
| 2999 |
gpiodbus_line_set_event_clock (GpiodbusLine *object, const gchar *value) |
| 3000 |
{ |
| 3001 |
g_object_set (G_OBJECT (object), "event-clock", value, NULL); |
| 3002 |
} |
| 3003 |
|
| 3004 |
|
| 3005 |
|
| 3006 |
|
| 3007 |
|
| 3008 |
|
| 3009 |
|
| 3010 |
|
| 3011 |
|
| 3012 |
|
| 3013 |
|
| 3014 |
gboolean |
| 3015 |
gpiodbus_line_get_managed (GpiodbusLine *object) |
| 3016 |
{ |
| 3017 |
g_return_val_if_fail (GPIODBUS_IS_LINE (object), FALSE); |
| 3018 |
|
| 3019 |
return GPIODBUS_LINE_GET_IFACE (object)->get_managed (object); |
| 3020 |
} |
| 3021 |
|
| 3022 |
|
| 3023 |
|
| 3024 |
|
| 3025 |
|
| 3026 |
|
| 3027 |
|
| 3028 |
|
| 3029 |
|
| 3030 |
|
| 3031 |
void |
| 3032 |
gpiodbus_line_set_managed (GpiodbusLine *object, gboolean value) |
| 3033 |
{ |
| 3034 |
g_object_set (G_OBJECT (object), "managed", value, NULL); |
| 3035 |
} |
| 3036 |
|
| 3037 |
|
| 3038 |
|
| 3039 |
|
| 3040 |
|
| 3041 |
|
| 3042 |
|
| 3043 |
|
| 3044 |
|
| 3045 |
|
| 3046 |
|
| 3047 |
|
| 3048 |
|
| 3049 |
const gchar * |
| 3050 |
gpiodbus_line_get_request_path (GpiodbusLine *object) |
| 3051 |
{ |
| 3052 |
g_return_val_if_fail (GPIODBUS_IS_LINE (object), NULL); |
| 3053 |
|
| 3054 |
return GPIODBUS_LINE_GET_IFACE (object)->get_request_path (object); |
| 3055 |
} |
| 3056 |
|
| 3057 |
|
| 3058 |
|
| 3059 |
|
| 3060 |
|
| 3061 |
|
| 3062 |
|
| 3063 |
|
| 3064 |
|
| 3065 |
|
| 3066 |
|
| 3067 |
gchar * |
| 3068 |
gpiodbus_line_dup_request_path (GpiodbusLine *object) |
| 3069 |
{ |
| 3070 |
gchar *value; |
| 3071 |
g_object_get (G_OBJECT (object), "request-path", &value, NULL); |
| 3072 |
return value; |
| 3073 |
} |
| 3074 |
|
| 3075 |
|
| 3076 |
|
| 3077 |
|
| 3078 |
|
| 3079 |
|
| 3080 |
|
| 3081 |
|
| 3082 |
|
| 3083 |
|
| 3084 |
void |
| 3085 |
gpiodbus_line_set_request_path (GpiodbusLine *object, const gchar *value) |
| 3086 |
{ |
| 3087 |
g_object_set (G_OBJECT (object), "request-path", value, NULL); |
| 3088 |
} |
| 3089 |
|
| 3090 |
|
| 3091 |
|
| 3092 |
|
| 3093 |
|
| 3094 |
|
| 3095 |
|
| 3096 |
|
| 3097 |
void |
| 3098 |
gpiodbus_line_emit_edge_event ( |
| 3099 |
GpiodbusLine *object, |
| 3100 |
GVariant *arg_event_data) |
| 3101 |
{ |
| 3102 |
g_signal_emit (object, GPIODBUS__LINE_SIGNALS[GPIODBUS__LINE_EDGE_EVENT], 0, arg_event_data); |
| 3103 |
} |
| 3104 |
|
| 3105 |
|
| 3106 |
|
| 3107 |
|
| 3108 |
|
| 3109 |
|
| 3110 |
|
| 3111 |
|
| 3112 |
|
| 3113 |
|
| 3114 |
|
| 3115 |
|
| 3116 |
|
| 3117 |
|
| 3118 |
|
| 3119 |
|
| 3120 |
struct _GpiodbusLineProxyPrivate |
| 3121 |
{ |
| 3122 |
GData *qdata; |
| 3123 |
}; |
| 3124 |
|
| 3125 |
static void gpiodbus_line_proxy_iface_init (GpiodbusLineIface *iface); |
| 3126 |
|
| 3127 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 3128 |
G_DEFINE_TYPE_WITH_CODE (GpiodbusLineProxy, gpiodbus_line_proxy, G_TYPE_DBUS_PROXY, |
| 3129 |
G_ADD_PRIVATE (GpiodbusLineProxy) |
| 3130 |
G_IMPLEMENT_INTERFACE (GPIODBUS_TYPE_LINE, gpiodbus_line_proxy_iface_init)) |
| 3131 |
|
| 3132 |
#else |
| 3133 |
G_DEFINE_TYPE_WITH_CODE (GpiodbusLineProxy, gpiodbus_line_proxy, G_TYPE_DBUS_PROXY, |
| 3134 |
G_IMPLEMENT_INTERFACE (GPIODBUS_TYPE_LINE, gpiodbus_line_proxy_iface_init)) |
| 3135 |
|
| 3136 |
#endif |
| 3137 |
static void |
| 3138 |
gpiodbus_line_proxy_finalize (GObject *object) |
| 3139 |
{ |
| 3140 |
GpiodbusLineProxy *proxy = GPIODBUS_LINE_PROXY (object); |
| 3141 |
g_datalist_clear (&proxy->priv->qdata); |
| 3142 |
G_OBJECT_CLASS (gpiodbus_line_proxy_parent_class)->finalize (object); |
| 3143 |
} |
| 3144 |
|
| 3145 |
static void |
| 3146 |
gpiodbus_line_proxy_get_property (GObject *object, |
| 3147 |
guint prop_id, |
| 3148 |
GValue *value, |
| 3149 |
GParamSpec *pspec G_GNUC_UNUSED) |
| 3150 |
{ |
| 3151 |
const _ExtendedGDBusPropertyInfo *info; |
| 3152 |
GVariant *variant; |
| 3153 |
g_assert (prop_id != 0 && prop_id - 1 < 14); |
| 3154 |
info = (const _ExtendedGDBusPropertyInfo *) _gpiodbus_line_property_info_pointers[prop_id - 1]; |
| 3155 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 3156 |
if (info->use_gvariant) |
| 3157 |
{ |
| 3158 |
g_value_set_variant (value, variant); |
| 3159 |
} |
| 3160 |
else |
| 3161 |
{ |
| 3162 |
if (variant != NULL) |
| 3163 |
g_dbus_gvariant_to_gvalue (variant, value); |
| 3164 |
} |
| 3165 |
if (variant != NULL) |
| 3166 |
g_variant_unref (variant); |
| 3167 |
} |
| 3168 |
|
| 3169 |
static void |
| 3170 |
gpiodbus_line_proxy_set_property_cb (GDBusProxy *proxy, |
| 3171 |
GAsyncResult *res, |
| 3172 |
gpointer user_data) |
| 3173 |
{ |
| 3174 |
const _ExtendedGDBusPropertyInfo *info = user_data; |
| 3175 |
GError *error; |
| 3176 |
GVariant *_ret; |
| 3177 |
error = NULL; |
| 3178 |
_ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 3179 |
if (!_ret) |
| 3180 |
{ |
| 3181 |
g_warning ("Error setting property '%s' on interface io.gpiod1.Line: %s (%s, %d)", |
| 3182 |
info->parent_struct.name, |
| 3183 |
error->message, g_quark_to_string (error->domain), error->code); |
| 3184 |
g_error_free (error); |
| 3185 |
} |
| 3186 |
else |
| 3187 |
{ |
| 3188 |
g_variant_unref (_ret); |
| 3189 |
} |
| 3190 |
} |
| 3191 |
|
| 3192 |
static void |
| 3193 |
gpiodbus_line_proxy_set_property (GObject *object, |
| 3194 |
guint prop_id, |
| 3195 |
const GValue *value, |
| 3196 |
GParamSpec *pspec G_GNUC_UNUSED) |
| 3197 |
{ |
| 3198 |
const _ExtendedGDBusPropertyInfo *info; |
| 3199 |
GVariant *variant; |
| 3200 |
g_assert (prop_id != 0 && prop_id - 1 < 14); |
| 3201 |
info = (const _ExtendedGDBusPropertyInfo *) _gpiodbus_line_property_info_pointers[prop_id - 1]; |
| 3202 |
variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 3203 |
g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 3204 |
"org.freedesktop.DBus.Properties.Set", |
| 3205 |
g_variant_new ("(ssv)", "io.gpiod1.Line", info->parent_struct.name, variant), |
| 3206 |
G_DBUS_CALL_FLAGS_NONE, |
| 3207 |
-1, |
| 3208 |
NULL, (GAsyncReadyCallback) gpiodbus_line_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 3209 |
g_variant_unref (variant); |
| 3210 |
} |
| 3211 |
|
| 3212 |
static void |
| 3213 |
gpiodbus_line_proxy_g_signal (GDBusProxy *proxy, |
| 3214 |
const gchar *sender_name G_GNUC_UNUSED, |
| 3215 |
const gchar *signal_name, |
| 3216 |
GVariant *parameters) |
| 3217 |
{ |
| 3218 |
_ExtendedGDBusSignalInfo *info; |
| 3219 |
GVariantIter iter; |
| 3220 |
GVariant *child; |
| 3221 |
GValue *paramv; |
| 3222 |
gsize num_params; |
| 3223 |
gsize n; |
| 3224 |
guint signal_id; |
| 3225 |
info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gpiodbus_line_interface_info.parent_struct, signal_name); |
| 3226 |
if (info == NULL) |
| 3227 |
return; |
| 3228 |
num_params = g_variant_n_children (parameters); |
| 3229 |
paramv = g_new0 (GValue, num_params + 1); |
| 3230 |
g_value_init (¶mv[0], GPIODBUS_TYPE_LINE); |
| 3231 |
g_value_set_object (¶mv[0], proxy); |
| 3232 |
g_variant_iter_init (&iter, parameters); |
| 3233 |
n = 1; |
| 3234 |
while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 3235 |
{ |
| 3236 |
_ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 3237 |
if (arg_info->use_gvariant) |
| 3238 |
{ |
| 3239 |
g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 3240 |
g_value_set_variant (¶mv[n], child); |
| 3241 |
n++; |
| 3242 |
} |
| 3243 |
else |
| 3244 |
g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 3245 |
g_variant_unref (child); |
| 3246 |
} |
| 3247 |
signal_id = g_signal_lookup (info->signal_name, GPIODBUS_TYPE_LINE); |
| 3248 |
g_signal_emitv (paramv, signal_id, 0, NULL); |
| 3249 |
for (n = 0; n < num_params + 1; n++) |
| 3250 |
g_value_unset (¶mv[n]); |
| 3251 |
g_free (paramv); |
| 3252 |
} |
| 3253 |
|
| 3254 |
static void |
| 3255 |
gpiodbus_line_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 3256 |
GVariant *changed_properties, |
| 3257 |
const gchar *const *invalidated_properties) |
| 3258 |
{ |
| 3259 |
GpiodbusLineProxy *proxy = GPIODBUS_LINE_PROXY (_proxy); |
| 3260 |
guint n; |
| 3261 |
const gchar *key; |
| 3262 |
GVariantIter *iter; |
| 3263 |
_ExtendedGDBusPropertyInfo *info; |
| 3264 |
g_variant_get (changed_properties, "a{sv}", &iter); |
| 3265 |
while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 3266 |
{ |
| 3267 |
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gpiodbus_line_interface_info.parent_struct, key); |
| 3268 |
g_datalist_remove_data (&proxy->priv->qdata, key); |
| 3269 |
if (info != NULL) |
| 3270 |
g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 3271 |
} |
| 3272 |
g_variant_iter_free (iter); |
| 3273 |
for (n = 0; invalidated_properties[n] != NULL; n++) |
| 3274 |
{ |
| 3275 |
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gpiodbus_line_interface_info.parent_struct, invalidated_properties[n]); |
| 3276 |
g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 3277 |
if (info != NULL) |
| 3278 |
g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 3279 |
} |
| 3280 |
} |
| 3281 |
|
| 3282 |
static guint |
| 3283 |
gpiodbus_line_proxy_get_offset (GpiodbusLine *object) |
| 3284 |
{ |
| 3285 |
GpiodbusLineProxy *proxy = GPIODBUS_LINE_PROXY (object); |
| 3286 |
GVariant *variant; |
| 3287 |
guint value = 0; |
| 3288 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Offset"); |
| 3289 |
if (variant != NULL) |
| 3290 |
{ |
| 3291 |
value = g_variant_get_uint32 (variant); |
| 3292 |
g_variant_unref (variant); |
| 3293 |
} |
| 3294 |
return value; |
| 3295 |
} |
| 3296 |
|
| 3297 |
static const gchar * |
| 3298 |
gpiodbus_line_proxy_get_name (GpiodbusLine *object) |
| 3299 |
{ |
| 3300 |
GpiodbusLineProxy *proxy = GPIODBUS_LINE_PROXY (object); |
| 3301 |
GVariant *variant; |
| 3302 |
const gchar *value = NULL; |
| 3303 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Name"); |
| 3304 |
if (variant != NULL) |
| 3305 |
{ |
| 3306 |
value = g_variant_get_string (variant, NULL); |
| 3307 |
g_variant_unref (variant); |
| 3308 |
} |
| 3309 |
return value; |
| 3310 |
} |
| 3311 |
|
| 3312 |
static gboolean |
| 3313 |
gpiodbus_line_proxy_get_used (GpiodbusLine *object) |
| 3314 |
{ |
| 3315 |
GpiodbusLineProxy *proxy = GPIODBUS_LINE_PROXY (object); |
| 3316 |
GVariant *variant; |
| 3317 |
gboolean value = FALSE; |
| 3318 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Used"); |
| 3319 |
if (variant != NULL) |
| 3320 |
{ |
| 3321 |
value = g_variant_get_boolean (variant); |
| 3322 |
g_variant_unref (variant); |
| 3323 |
} |
| 3324 |
return value; |
| 3325 |
} |
| 3326 |
|
| 3327 |
static const gchar * |
| 3328 |
gpiodbus_line_proxy_get_consumer (GpiodbusLine *object) |
| 3329 |
{ |
| 3330 |
GpiodbusLineProxy *proxy = GPIODBUS_LINE_PROXY (object); |
| 3331 |
GVariant *variant; |
| 3332 |
const gchar *value = NULL; |
| 3333 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Consumer"); |
| 3334 |
if (variant != NULL) |
| 3335 |
{ |
| 3336 |
value = g_variant_get_string (variant, NULL); |
| 3337 |
g_variant_unref (variant); |
| 3338 |
} |
| 3339 |
return value; |
| 3340 |
} |
| 3341 |
|
| 3342 |
static const gchar * |
| 3343 |
gpiodbus_line_proxy_get_direction (GpiodbusLine *object) |
| 3344 |
{ |
| 3345 |
GpiodbusLineProxy *proxy = GPIODBUS_LINE_PROXY (object); |
| 3346 |
GVariant *variant; |
| 3347 |
const gchar *value = NULL; |
| 3348 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Direction"); |
| 3349 |
if (variant != NULL) |
| 3350 |
{ |
| 3351 |
value = g_variant_get_string (variant, NULL); |
| 3352 |
g_variant_unref (variant); |
| 3353 |
} |
| 3354 |
return value; |
| 3355 |
} |
| 3356 |
|
| 3357 |
static const gchar * |
| 3358 |
gpiodbus_line_proxy_get_edge_detection (GpiodbusLine *object) |
| 3359 |
{ |
| 3360 |
GpiodbusLineProxy *proxy = GPIODBUS_LINE_PROXY (object); |
| 3361 |
GVariant *variant; |
| 3362 |
const gchar *value = NULL; |
| 3363 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "EdgeDetection"); |
| 3364 |
if (variant != NULL) |
| 3365 |
{ |
| 3366 |
value = g_variant_get_string (variant, NULL); |
| 3367 |
g_variant_unref (variant); |
| 3368 |
} |
| 3369 |
return value; |
| 3370 |
} |
| 3371 |
|
| 3372 |
static const gchar * |
| 3373 |
gpiodbus_line_proxy_get_bias (GpiodbusLine *object) |
| 3374 |
{ |
| 3375 |
GpiodbusLineProxy *proxy = GPIODBUS_LINE_PROXY (object); |
| 3376 |
GVariant *variant; |
| 3377 |
const gchar *value = NULL; |
| 3378 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Bias"); |
| 3379 |
if (variant != NULL) |
| 3380 |
{ |
| 3381 |
value = g_variant_get_string (variant, NULL); |
| 3382 |
g_variant_unref (variant); |
| 3383 |
} |
| 3384 |
return value; |
| 3385 |
} |
| 3386 |
|
| 3387 |
static const gchar * |
| 3388 |
gpiodbus_line_proxy_get_drive (GpiodbusLine *object) |
| 3389 |
{ |
| 3390 |
GpiodbusLineProxy *proxy = GPIODBUS_LINE_PROXY (object); |
| 3391 |
GVariant *variant; |
| 3392 |
const gchar *value = NULL; |
| 3393 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Drive"); |
| 3394 |
if (variant != NULL) |
| 3395 |
{ |
| 3396 |
value = g_variant_get_string (variant, NULL); |
| 3397 |
g_variant_unref (variant); |
| 3398 |
} |
| 3399 |
return value; |
| 3400 |
} |
| 3401 |
|
| 3402 |
static gboolean |
| 3403 |
gpiodbus_line_proxy_get_active_low (GpiodbusLine *object) |
| 3404 |
{ |
| 3405 |
GpiodbusLineProxy *proxy = GPIODBUS_LINE_PROXY (object); |
| 3406 |
GVariant *variant; |
| 3407 |
gboolean value = FALSE; |
| 3408 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ActiveLow"); |
| 3409 |
if (variant != NULL) |
| 3410 |
{ |
| 3411 |
value = g_variant_get_boolean (variant); |
| 3412 |
g_variant_unref (variant); |
| 3413 |
} |
| 3414 |
return value; |
| 3415 |
} |
| 3416 |
|
| 3417 |
static gboolean |
| 3418 |
gpiodbus_line_proxy_get_debounced (GpiodbusLine *object) |
| 3419 |
{ |
| 3420 |
GpiodbusLineProxy *proxy = GPIODBUS_LINE_PROXY (object); |
| 3421 |
GVariant *variant; |
| 3422 |
gboolean value = FALSE; |
| 3423 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Debounced"); |
| 3424 |
if (variant != NULL) |
| 3425 |
{ |
| 3426 |
value = g_variant_get_boolean (variant); |
| 3427 |
g_variant_unref (variant); |
| 3428 |
} |
| 3429 |
return value; |
| 3430 |
} |
| 3431 |
|
| 3432 |
static guint64 |
| 3433 |
gpiodbus_line_proxy_get_debounce_period_us (GpiodbusLine *object) |
| 3434 |
{ |
| 3435 |
GpiodbusLineProxy *proxy = GPIODBUS_LINE_PROXY (object); |
| 3436 |
GVariant *variant; |
| 3437 |
guint64 value = 0; |
| 3438 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "DebouncePeriodUs"); |
| 3439 |
if (variant != NULL) |
| 3440 |
{ |
| 3441 |
value = g_variant_get_uint64 (variant); |
| 3442 |
g_variant_unref (variant); |
| 3443 |
} |
| 3444 |
return value; |
| 3445 |
} |
| 3446 |
|
| 3447 |
static const gchar * |
| 3448 |
gpiodbus_line_proxy_get_event_clock (GpiodbusLine *object) |
| 3449 |
{ |
| 3450 |
GpiodbusLineProxy *proxy = GPIODBUS_LINE_PROXY (object); |
| 3451 |
GVariant *variant; |
| 3452 |
const gchar *value = NULL; |
| 3453 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "EventClock"); |
| 3454 |
if (variant != NULL) |
| 3455 |
{ |
| 3456 |
value = g_variant_get_string (variant, NULL); |
| 3457 |
g_variant_unref (variant); |
| 3458 |
} |
| 3459 |
return value; |
| 3460 |
} |
| 3461 |
|
| 3462 |
static gboolean |
| 3463 |
gpiodbus_line_proxy_get_managed (GpiodbusLine *object) |
| 3464 |
{ |
| 3465 |
GpiodbusLineProxy *proxy = GPIODBUS_LINE_PROXY (object); |
| 3466 |
GVariant *variant; |
| 3467 |
gboolean value = FALSE; |
| 3468 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Managed"); |
| 3469 |
if (variant != NULL) |
| 3470 |
{ |
| 3471 |
value = g_variant_get_boolean (variant); |
| 3472 |
g_variant_unref (variant); |
| 3473 |
} |
| 3474 |
return value; |
| 3475 |
} |
| 3476 |
|
| 3477 |
static const gchar * |
| 3478 |
gpiodbus_line_proxy_get_request_path (GpiodbusLine *object) |
| 3479 |
{ |
| 3480 |
GpiodbusLineProxy *proxy = GPIODBUS_LINE_PROXY (object); |
| 3481 |
GVariant *variant; |
| 3482 |
const gchar *value = NULL; |
| 3483 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "RequestPath"); |
| 3484 |
if (variant != NULL) |
| 3485 |
{ |
| 3486 |
value = g_variant_get_string (variant, NULL); |
| 3487 |
g_variant_unref (variant); |
| 3488 |
} |
| 3489 |
return value; |
| 3490 |
} |
| 3491 |
|
| 3492 |
static void |
| 3493 |
gpiodbus_line_proxy_init (GpiodbusLineProxy *proxy) |
| 3494 |
{ |
| 3495 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 3496 |
proxy->priv = gpiodbus_line_proxy_get_instance_private (proxy); |
| 3497 |
#else |
| 3498 |
proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, GPIODBUS_TYPE_LINE_PROXY, GpiodbusLineProxyPrivate); |
| 3499 |
#endif |
| 3500 |
|
| 3501 |
g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gpiodbus_line_interface_info ()); |
| 3502 |
} |
| 3503 |
|
| 3504 |
static void |
| 3505 |
gpiodbus_line_proxy_class_init (GpiodbusLineProxyClass *klass) |
| 3506 |
{ |
| 3507 |
GObjectClass *gobject_class; |
| 3508 |
GDBusProxyClass *proxy_class; |
| 3509 |
|
| 3510 |
gobject_class = G_OBJECT_CLASS (klass); |
| 3511 |
gobject_class->finalize = gpiodbus_line_proxy_finalize; |
| 3512 |
gobject_class->get_property = gpiodbus_line_proxy_get_property; |
| 3513 |
gobject_class->set_property = gpiodbus_line_proxy_set_property; |
| 3514 |
|
| 3515 |
proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 3516 |
proxy_class->g_signal = gpiodbus_line_proxy_g_signal; |
| 3517 |
proxy_class->g_properties_changed = gpiodbus_line_proxy_g_properties_changed; |
| 3518 |
|
| 3519 |
gpiodbus_line_override_properties (gobject_class, 1); |
| 3520 |
|
| 3521 |
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 3522 |
g_type_class_add_private (klass, sizeof (GpiodbusLineProxyPrivate)); |
| 3523 |
#endif |
| 3524 |
} |
| 3525 |
|
| 3526 |
static void |
| 3527 |
gpiodbus_line_proxy_iface_init (GpiodbusLineIface *iface) |
| 3528 |
{ |
| 3529 |
iface->get_offset = gpiodbus_line_proxy_get_offset; |
| 3530 |
iface->get_name = gpiodbus_line_proxy_get_name; |
| 3531 |
iface->get_used = gpiodbus_line_proxy_get_used; |
| 3532 |
iface->get_consumer = gpiodbus_line_proxy_get_consumer; |
| 3533 |
iface->get_direction = gpiodbus_line_proxy_get_direction; |
| 3534 |
iface->get_edge_detection = gpiodbus_line_proxy_get_edge_detection; |
| 3535 |
iface->get_bias = gpiodbus_line_proxy_get_bias; |
| 3536 |
iface->get_drive = gpiodbus_line_proxy_get_drive; |
| 3537 |
iface->get_active_low = gpiodbus_line_proxy_get_active_low; |
| 3538 |
iface->get_debounced = gpiodbus_line_proxy_get_debounced; |
| 3539 |
iface->get_debounce_period_us = gpiodbus_line_proxy_get_debounce_period_us; |
| 3540 |
iface->get_event_clock = gpiodbus_line_proxy_get_event_clock; |
| 3541 |
iface->get_managed = gpiodbus_line_proxy_get_managed; |
| 3542 |
iface->get_request_path = gpiodbus_line_proxy_get_request_path; |
| 3543 |
} |
| 3544 |
|
| 3545 |
|
| 3546 |
|
| 3547 |
|
| 3548 |
|
| 3549 |
|
| 3550 |
|
| 3551 |
|
| 3552 |
|
| 3553 |
|
| 3554 |
|
| 3555 |
|
| 3556 |
|
| 3557 |
|
| 3558 |
|
| 3559 |
|
| 3560 |
|
| 3561 |
|
| 3562 |
void |
| 3563 |
gpiodbus_line_proxy_new ( |
| 3564 |
GDBusConnection *connection, |
| 3565 |
GDBusProxyFlags flags, |
| 3566 |
const gchar *name, |
| 3567 |
const gchar *object_path, |
| 3568 |
GCancellable *cancellable, |
| 3569 |
GAsyncReadyCallback callback, |
| 3570 |
gpointer user_data) |
| 3571 |
{ |
| 3572 |
g_async_initable_new_async (GPIODBUS_TYPE_LINE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "io.gpiod1.Line", NULL); |
| 3573 |
} |
| 3574 |
|
| 3575 |
|
| 3576 |
|
| 3577 |
|
| 3578 |
|
| 3579 |
|
| 3580 |
|
| 3581 |
|
| 3582 |
|
| 3583 |
|
| 3584 |
GpiodbusLine * |
| 3585 |
gpiodbus_line_proxy_new_finish ( |
| 3586 |
GAsyncResult *res, |
| 3587 |
GError **error) |
| 3588 |
{ |
| 3589 |
GObject *ret; |
| 3590 |
GObject *source_object; |
| 3591 |
source_object = g_async_result_get_source_object (res); |
| 3592 |
ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 3593 |
g_object_unref (source_object); |
| 3594 |
if (ret != NULL) |
| 3595 |
return GPIODBUS_LINE (ret); |
| 3596 |
else |
| 3597 |
return NULL; |
| 3598 |
} |
| 3599 |
|
| 3600 |
|
| 3601 |
|
| 3602 |
|
| 3603 |
|
| 3604 |
|
| 3605 |
|
| 3606 |
|
| 3607 |
|
| 3608 |
|
| 3609 |
|
| 3610 |
|
| 3611 |
|
| 3612 |
|
| 3613 |
|
| 3614 |
|
| 3615 |
|
| 3616 |
|
| 3617 |
GpiodbusLine * |
| 3618 |
gpiodbus_line_proxy_new_sync ( |
| 3619 |
GDBusConnection *connection, |
| 3620 |
GDBusProxyFlags flags, |
| 3621 |
const gchar *name, |
| 3622 |
const gchar *object_path, |
| 3623 |
GCancellable *cancellable, |
| 3624 |
GError **error) |
| 3625 |
{ |
| 3626 |
GInitable *ret; |
| 3627 |
ret = g_initable_new (GPIODBUS_TYPE_LINE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "io.gpiod1.Line", NULL); |
| 3628 |
if (ret != NULL) |
| 3629 |
return GPIODBUS_LINE (ret); |
| 3630 |
else |
| 3631 |
return NULL; |
| 3632 |
} |
| 3633 |
|
| 3634 |
|
| 3635 |
|
| 3636 |
|
| 3637 |
|
| 3638 |
|
| 3639 |
|
| 3640 |
|
| 3641 |
|
| 3642 |
|
| 3643 |
|
| 3644 |
|
| 3645 |
|
| 3646 |
|
| 3647 |
|
| 3648 |
|
| 3649 |
|
| 3650 |
|
| 3651 |
|
| 3652 |
void |
| 3653 |
gpiodbus_line_proxy_new_for_bus ( |
| 3654 |
GBusType bus_type, |
| 3655 |
GDBusProxyFlags flags, |
| 3656 |
const gchar *name, |
| 3657 |
const gchar *object_path, |
| 3658 |
GCancellable *cancellable, |
| 3659 |
GAsyncReadyCallback callback, |
| 3660 |
gpointer user_data) |
| 3661 |
{ |
| 3662 |
g_async_initable_new_async (GPIODBUS_TYPE_LINE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "io.gpiod1.Line", NULL); |
| 3663 |
} |
| 3664 |
|
| 3665 |
|
| 3666 |
|
| 3667 |
|
| 3668 |
|
| 3669 |
|
| 3670 |
|
| 3671 |
|
| 3672 |
|
| 3673 |
|
| 3674 |
GpiodbusLine * |
| 3675 |
gpiodbus_line_proxy_new_for_bus_finish ( |
| 3676 |
GAsyncResult *res, |
| 3677 |
GError **error) |
| 3678 |
{ |
| 3679 |
GObject *ret; |
| 3680 |
GObject *source_object; |
| 3681 |
source_object = g_async_result_get_source_object (res); |
| 3682 |
ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 3683 |
g_object_unref (source_object); |
| 3684 |
if (ret != NULL) |
| 3685 |
return GPIODBUS_LINE (ret); |
| 3686 |
else |
| 3687 |
return NULL; |
| 3688 |
} |
| 3689 |
|
| 3690 |
|
| 3691 |
|
| 3692 |
|
| 3693 |
|
| 3694 |
|
| 3695 |
|
| 3696 |
|
| 3697 |
|
| 3698 |
|
| 3699 |
|
| 3700 |
|
| 3701 |
|
| 3702 |
|
| 3703 |
|
| 3704 |
|
| 3705 |
|
| 3706 |
|
| 3707 |
GpiodbusLine * |
| 3708 |
gpiodbus_line_proxy_new_for_bus_sync ( |
| 3709 |
GBusType bus_type, |
| 3710 |
GDBusProxyFlags flags, |
| 3711 |
const gchar *name, |
| 3712 |
const gchar *object_path, |
| 3713 |
GCancellable *cancellable, |
| 3714 |
GError **error) |
| 3715 |
{ |
| 3716 |
GInitable *ret; |
| 3717 |
ret = g_initable_new (GPIODBUS_TYPE_LINE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "io.gpiod1.Line", NULL); |
| 3718 |
if (ret != NULL) |
| 3719 |
return GPIODBUS_LINE (ret); |
| 3720 |
else |
| 3721 |
return NULL; |
| 3722 |
} |
| 3723 |
|
| 3724 |
|
| 3725 |
|
| 3726 |
|
| 3727 |
|
| 3728 |
|
| 3729 |
|
| 3730 |
|
| 3731 |
|
| 3732 |
|
| 3733 |
|
| 3734 |
|
| 3735 |
|
| 3736 |
|
| 3737 |
|
| 3738 |
|
| 3739 |
|
| 3740 |
struct _GpiodbusLineSkeletonPrivate |
| 3741 |
{ |
| 3742 |
GValue *properties; |
| 3743 |
GList *changed_properties; |
| 3744 |
GSource *changed_properties_idle_source; |
| 3745 |
GMainContext *context; |
| 3746 |
GMutex lock; |
| 3747 |
}; |
| 3748 |
|
| 3749 |
static void |
| 3750 |
_gpiodbus_line_skeleton_handle_method_call ( |
| 3751 |
GDBusConnection *connection G_GNUC_UNUSED, |
| 3752 |
const gchar *sender G_GNUC_UNUSED, |
| 3753 |
const gchar *object_path G_GNUC_UNUSED, |
| 3754 |
const gchar *interface_name, |
| 3755 |
const gchar *method_name, |
| 3756 |
GVariant *parameters, |
| 3757 |
GDBusMethodInvocation *invocation, |
| 3758 |
gpointer user_data) |
| 3759 |
{ |
| 3760 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (user_data); |
| 3761 |
_ExtendedGDBusMethodInfo *info; |
| 3762 |
GVariantIter iter; |
| 3763 |
GVariant *child; |
| 3764 |
GValue *paramv; |
| 3765 |
gsize num_params; |
| 3766 |
guint num_extra; |
| 3767 |
gsize n; |
| 3768 |
guint signal_id; |
| 3769 |
GValue return_value = G_VALUE_INIT; |
| 3770 |
info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 3771 |
g_assert (info != NULL); |
| 3772 |
num_params = g_variant_n_children (parameters); |
| 3773 |
num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 3774 |
n = 0; |
| 3775 |
g_value_init (¶mv[n], GPIODBUS_TYPE_LINE); |
| 3776 |
g_value_set_object (¶mv[n++], skeleton); |
| 3777 |
g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 3778 |
g_value_set_object (¶mv[n++], invocation); |
| 3779 |
if (info->pass_fdlist) |
| 3780 |
{ |
| 3781 |
#ifdef G_OS_UNIX |
| 3782 |
g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 3783 |
g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 3784 |
#else |
| 3785 |
g_assert_not_reached (); |
| 3786 |
#endif |
| 3787 |
} |
| 3788 |
g_variant_iter_init (&iter, parameters); |
| 3789 |
while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 3790 |
{ |
| 3791 |
_ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 3792 |
if (arg_info->use_gvariant) |
| 3793 |
{ |
| 3794 |
g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 3795 |
g_value_set_variant (¶mv[n], child); |
| 3796 |
n++; |
| 3797 |
} |
| 3798 |
else |
| 3799 |
g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 3800 |
g_variant_unref (child); |
| 3801 |
} |
| 3802 |
signal_id = g_signal_lookup (info->signal_name, GPIODBUS_TYPE_LINE); |
| 3803 |
g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 3804 |
g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 3805 |
if (!g_value_get_boolean (&return_value)) |
| 3806 |
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name); |
| 3807 |
g_value_unset (&return_value); |
| 3808 |
for (n = 0; n < num_params + num_extra; n++) |
| 3809 |
g_value_unset (¶mv[n]); |
| 3810 |
g_free (paramv); |
| 3811 |
} |
| 3812 |
|
| 3813 |
static GVariant * |
| 3814 |
_gpiodbus_line_skeleton_handle_get_property ( |
| 3815 |
GDBusConnection *connection G_GNUC_UNUSED, |
| 3816 |
const gchar *sender G_GNUC_UNUSED, |
| 3817 |
const gchar *object_path G_GNUC_UNUSED, |
| 3818 |
const gchar *interface_name G_GNUC_UNUSED, |
| 3819 |
const gchar *property_name, |
| 3820 |
GError **error, |
| 3821 |
gpointer user_data) |
| 3822 |
{ |
| 3823 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (user_data); |
| 3824 |
GValue value = G_VALUE_INIT; |
| 3825 |
GParamSpec *pspec; |
| 3826 |
_ExtendedGDBusPropertyInfo *info; |
| 3827 |
GVariant *ret; |
| 3828 |
ret = NULL; |
| 3829 |
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gpiodbus_line_interface_info.parent_struct, property_name); |
| 3830 |
g_assert (info != NULL); |
| 3831 |
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 3832 |
if (pspec == NULL) |
| 3833 |
{ |
| 3834 |
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 3835 |
} |
| 3836 |
else |
| 3837 |
{ |
| 3838 |
g_value_init (&value, pspec->value_type); |
| 3839 |
g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 3840 |
ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 3841 |
g_value_unset (&value); |
| 3842 |
} |
| 3843 |
return ret; |
| 3844 |
} |
| 3845 |
|
| 3846 |
static gboolean |
| 3847 |
_gpiodbus_line_skeleton_handle_set_property ( |
| 3848 |
GDBusConnection *connection G_GNUC_UNUSED, |
| 3849 |
const gchar *sender G_GNUC_UNUSED, |
| 3850 |
const gchar *object_path G_GNUC_UNUSED, |
| 3851 |
const gchar *interface_name G_GNUC_UNUSED, |
| 3852 |
const gchar *property_name, |
| 3853 |
GVariant *variant, |
| 3854 |
GError **error, |
| 3855 |
gpointer user_data) |
| 3856 |
{ |
| 3857 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (user_data); |
| 3858 |
GValue value = G_VALUE_INIT; |
| 3859 |
GParamSpec *pspec; |
| 3860 |
_ExtendedGDBusPropertyInfo *info; |
| 3861 |
gboolean ret; |
| 3862 |
ret = FALSE; |
| 3863 |
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gpiodbus_line_interface_info.parent_struct, property_name); |
| 3864 |
g_assert (info != NULL); |
| 3865 |
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 3866 |
if (pspec == NULL) |
| 3867 |
{ |
| 3868 |
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 3869 |
} |
| 3870 |
else |
| 3871 |
{ |
| 3872 |
if (info->use_gvariant) |
| 3873 |
g_value_set_variant (&value, variant); |
| 3874 |
else |
| 3875 |
g_dbus_gvariant_to_gvalue (variant, &value); |
| 3876 |
g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 3877 |
g_value_unset (&value); |
| 3878 |
ret = TRUE; |
| 3879 |
} |
| 3880 |
return ret; |
| 3881 |
} |
| 3882 |
|
| 3883 |
static const GDBusInterfaceVTable _gpiodbus_line_skeleton_vtable = |
| 3884 |
{ |
| 3885 |
_gpiodbus_line_skeleton_handle_method_call, |
| 3886 |
_gpiodbus_line_skeleton_handle_get_property, |
| 3887 |
_gpiodbus_line_skeleton_handle_set_property, |
| 3888 |
{NULL} |
| 3889 |
}; |
| 3890 |
|
| 3891 |
static GDBusInterfaceInfo * |
| 3892 |
gpiodbus_line_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 3893 |
{ |
| 3894 |
return gpiodbus_line_interface_info (); |
| 3895 |
} |
| 3896 |
|
| 3897 |
static GDBusInterfaceVTable * |
| 3898 |
gpiodbus_line_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 3899 |
{ |
| 3900 |
return (GDBusInterfaceVTable *) &_gpiodbus_line_skeleton_vtable; |
| 3901 |
} |
| 3902 |
|
| 3903 |
static GVariant * |
| 3904 |
gpiodbus_line_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 3905 |
{ |
| 3906 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (_skeleton); |
| 3907 |
|
| 3908 |
GVariantBuilder builder; |
| 3909 |
guint n; |
| 3910 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_84 |
| 3911 |
g_variant_builder_init_static (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 3912 |
#else |
| 3913 |
g_variant_builder_init(&builder, G_VARIANT_TYPE ("a{sv}")); |
| 3914 |
#endif |
| 3915 |
if (_gpiodbus_line_interface_info.parent_struct.properties == NULL) |
| 3916 |
goto out; |
| 3917 |
for (n = 0; _gpiodbus_line_interface_info.parent_struct.properties[n] != NULL; n++) |
| 3918 |
{ |
| 3919 |
GDBusPropertyInfo *info = _gpiodbus_line_interface_info.parent_struct.properties[n]; |
| 3920 |
if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 3921 |
{ |
| 3922 |
GVariant *value; |
| 3923 |
value = _gpiodbus_line_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "io.gpiod1.Line", info->name, NULL, skeleton); |
| 3924 |
if (value != NULL) |
| 3925 |
{ |
| 3926 |
g_variant_take_ref (value); |
| 3927 |
g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 3928 |
g_variant_unref (value); |
| 3929 |
} |
| 3930 |
} |
| 3931 |
} |
| 3932 |
out: |
| 3933 |
return g_variant_builder_end (&builder); |
| 3934 |
} |
| 3935 |
|
| 3936 |
static gboolean _gpiodbus_line_emit_changed (gpointer user_data); |
| 3937 |
|
| 3938 |
static void |
| 3939 |
gpiodbus_line_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 3940 |
{ |
| 3941 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (_skeleton); |
| 3942 |
gboolean emit_changed = FALSE; |
| 3943 |
|
| 3944 |
g_mutex_lock (&skeleton->priv->lock); |
| 3945 |
if (skeleton->priv->changed_properties_idle_source != NULL) |
| 3946 |
{ |
| 3947 |
g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 3948 |
skeleton->priv->changed_properties_idle_source = NULL; |
| 3949 |
emit_changed = TRUE; |
| 3950 |
} |
| 3951 |
g_mutex_unlock (&skeleton->priv->lock); |
| 3952 |
|
| 3953 |
if (emit_changed) |
| 3954 |
_gpiodbus_line_emit_changed (skeleton); |
| 3955 |
} |
| 3956 |
|
| 3957 |
static void |
| 3958 |
_gpiodbus_line_on_signal_edge_event ( |
| 3959 |
GpiodbusLine *object, |
| 3960 |
GVariant *arg_event_data) |
| 3961 |
{ |
| 3962 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 3963 |
|
| 3964 |
GList *connections, *l; |
| 3965 |
GVariant *signal_variant; |
| 3966 |
connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 3967 |
|
| 3968 |
signal_variant = g_variant_ref_sink (g_variant_new ("(@(ittt))", |
| 3969 |
arg_event_data)); |
| 3970 |
for (l = connections; l != NULL; l = l->next) |
| 3971 |
{ |
| 3972 |
GDBusConnection *connection = l->data; |
| 3973 |
g_dbus_connection_emit_signal (connection, |
| 3974 |
NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "io.gpiod1.Line", "EdgeEvent", |
| 3975 |
signal_variant, NULL); |
| 3976 |
} |
| 3977 |
g_variant_unref (signal_variant); |
| 3978 |
g_list_free_full (connections, g_object_unref); |
| 3979 |
} |
| 3980 |
|
| 3981 |
static void gpiodbus_line_skeleton_iface_init (GpiodbusLineIface *iface); |
| 3982 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 3983 |
G_DEFINE_TYPE_WITH_CODE (GpiodbusLineSkeleton, gpiodbus_line_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 3984 |
G_ADD_PRIVATE (GpiodbusLineSkeleton) |
| 3985 |
G_IMPLEMENT_INTERFACE (GPIODBUS_TYPE_LINE, gpiodbus_line_skeleton_iface_init)) |
| 3986 |
|
| 3987 |
#else |
| 3988 |
G_DEFINE_TYPE_WITH_CODE (GpiodbusLineSkeleton, gpiodbus_line_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 3989 |
G_IMPLEMENT_INTERFACE (GPIODBUS_TYPE_LINE, gpiodbus_line_skeleton_iface_init)) |
| 3990 |
|
| 3991 |
#endif |
| 3992 |
static void |
| 3993 |
gpiodbus_line_skeleton_finalize (GObject *object) |
| 3994 |
{ |
| 3995 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 3996 |
guint n; |
| 3997 |
for (n = 0; n < 14; n++) |
| 3998 |
g_value_unset (&skeleton->priv->properties[n]); |
| 3999 |
g_free (skeleton->priv->properties); |
| 4000 |
g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 4001 |
if (skeleton->priv->changed_properties_idle_source != NULL) |
| 4002 |
g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 4003 |
g_main_context_unref (skeleton->priv->context); |
| 4004 |
g_mutex_clear (&skeleton->priv->lock); |
| 4005 |
G_OBJECT_CLASS (gpiodbus_line_skeleton_parent_class)->finalize (object); |
| 4006 |
} |
| 4007 |
|
| 4008 |
static void |
| 4009 |
gpiodbus_line_skeleton_get_property (GObject *object, |
| 4010 |
guint prop_id, |
| 4011 |
GValue *value, |
| 4012 |
GParamSpec *pspec G_GNUC_UNUSED) |
| 4013 |
{ |
| 4014 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4015 |
g_assert (prop_id != 0 && prop_id - 1 < 14); |
| 4016 |
g_mutex_lock (&skeleton->priv->lock); |
| 4017 |
g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 4018 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4019 |
} |
| 4020 |
|
| 4021 |
static gboolean |
| 4022 |
_gpiodbus_line_emit_changed (gpointer user_data) |
| 4023 |
{ |
| 4024 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (user_data); |
| 4025 |
GList *l; |
| 4026 |
GVariantBuilder builder; |
| 4027 |
GVariantBuilder invalidated_builder; |
| 4028 |
guint num_changes; |
| 4029 |
|
| 4030 |
g_mutex_lock (&skeleton->priv->lock); |
| 4031 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_84 |
| 4032 |
g_variant_builder_init_static (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 4033 |
g_variant_builder_init_static (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 4034 |
#else |
| 4035 |
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 4036 |
g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 4037 |
#endif |
| 4038 |
for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 4039 |
{ |
| 4040 |
ChangedProperty *cp = l->data; |
| 4041 |
GVariant *variant; |
| 4042 |
const GValue *cur_value; |
| 4043 |
|
| 4044 |
cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 4045 |
if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 4046 |
{ |
| 4047 |
variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 4048 |
g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 4049 |
g_variant_unref (variant); |
| 4050 |
num_changes++; |
| 4051 |
} |
| 4052 |
} |
| 4053 |
if (num_changes > 0) |
| 4054 |
{ |
| 4055 |
GList *connections, *ll; |
| 4056 |
GVariant *signal_variant; |
| 4057 |
signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "io.gpiod1.Line", |
| 4058 |
&builder, &invalidated_builder)); |
| 4059 |
connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 4060 |
for (ll = connections; ll != NULL; ll = ll->next) |
| 4061 |
{ |
| 4062 |
GDBusConnection *connection = ll->data; |
| 4063 |
|
| 4064 |
g_dbus_connection_emit_signal (connection, |
| 4065 |
NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 4066 |
"org.freedesktop.DBus.Properties", |
| 4067 |
"PropertiesChanged", |
| 4068 |
signal_variant, |
| 4069 |
NULL); |
| 4070 |
} |
| 4071 |
g_variant_unref (signal_variant); |
| 4072 |
g_list_free_full (connections, g_object_unref); |
| 4073 |
} |
| 4074 |
else |
| 4075 |
{ |
| 4076 |
g_variant_builder_clear (&builder); |
| 4077 |
g_variant_builder_clear (&invalidated_builder); |
| 4078 |
} |
| 4079 |
g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 4080 |
skeleton->priv->changed_properties = NULL; |
| 4081 |
skeleton->priv->changed_properties_idle_source = NULL; |
| 4082 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4083 |
return FALSE; |
| 4084 |
} |
| 4085 |
|
| 4086 |
static void |
| 4087 |
_gpiodbus_line_schedule_emit_changed (GpiodbusLineSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 4088 |
{ |
| 4089 |
ChangedProperty *cp; |
| 4090 |
GList *l; |
| 4091 |
cp = NULL; |
| 4092 |
for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 4093 |
{ |
| 4094 |
ChangedProperty *i_cp = l->data; |
| 4095 |
if (i_cp->info == info) |
| 4096 |
{ |
| 4097 |
cp = i_cp; |
| 4098 |
break; |
| 4099 |
} |
| 4100 |
} |
| 4101 |
if (cp == NULL) |
| 4102 |
{ |
| 4103 |
cp = g_new0 (ChangedProperty, 1); |
| 4104 |
cp->prop_id = prop_id; |
| 4105 |
cp->info = info; |
| 4106 |
skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 4107 |
g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 4108 |
g_value_copy (orig_value, &cp->orig_value); |
| 4109 |
} |
| 4110 |
} |
| 4111 |
|
| 4112 |
static void |
| 4113 |
gpiodbus_line_skeleton_notify (GObject *object, |
| 4114 |
GParamSpec *pspec G_GNUC_UNUSED) |
| 4115 |
{ |
| 4116 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4117 |
g_mutex_lock (&skeleton->priv->lock); |
| 4118 |
if (skeleton->priv->changed_properties != NULL && |
| 4119 |
skeleton->priv->changed_properties_idle_source == NULL) |
| 4120 |
{ |
| 4121 |
skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 4122 |
g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 4123 |
g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gpiodbus_line_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 4124 |
g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gpiodbus_line_emit_changed"); |
| 4125 |
g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 4126 |
g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 4127 |
} |
| 4128 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4129 |
} |
| 4130 |
|
| 4131 |
static void |
| 4132 |
gpiodbus_line_skeleton_set_property (GObject *object, |
| 4133 |
guint prop_id, |
| 4134 |
const GValue *value, |
| 4135 |
GParamSpec *pspec) |
| 4136 |
{ |
| 4137 |
const _ExtendedGDBusPropertyInfo *info; |
| 4138 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4139 |
g_assert (prop_id != 0 && prop_id - 1 < 14); |
| 4140 |
info = (const _ExtendedGDBusPropertyInfo *) _gpiodbus_line_property_info_pointers[prop_id - 1]; |
| 4141 |
g_mutex_lock (&skeleton->priv->lock); |
| 4142 |
g_object_freeze_notify (object); |
| 4143 |
if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 4144 |
{ |
| 4145 |
if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL && |
| 4146 |
info->emits_changed_signal) |
| 4147 |
_gpiodbus_line_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 4148 |
g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 4149 |
g_object_notify_by_pspec (object, pspec); |
| 4150 |
} |
| 4151 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4152 |
g_object_thaw_notify (object); |
| 4153 |
} |
| 4154 |
|
| 4155 |
static void |
| 4156 |
gpiodbus_line_skeleton_init (GpiodbusLineSkeleton *skeleton) |
| 4157 |
{ |
| 4158 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 4159 |
skeleton->priv = gpiodbus_line_skeleton_get_instance_private (skeleton); |
| 4160 |
#else |
| 4161 |
skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, GPIODBUS_TYPE_LINE_SKELETON, GpiodbusLineSkeletonPrivate); |
| 4162 |
#endif |
| 4163 |
|
| 4164 |
g_mutex_init (&skeleton->priv->lock); |
| 4165 |
skeleton->priv->context = g_main_context_ref_thread_default (); |
| 4166 |
skeleton->priv->properties = g_new0 (GValue, 14); |
| 4167 |
g_value_init (&skeleton->priv->properties[0], G_TYPE_UINT); |
| 4168 |
g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
| 4169 |
g_value_init (&skeleton->priv->properties[2], G_TYPE_BOOLEAN); |
| 4170 |
g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING); |
| 4171 |
g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING); |
| 4172 |
g_value_init (&skeleton->priv->properties[5], G_TYPE_STRING); |
| 4173 |
g_value_init (&skeleton->priv->properties[6], G_TYPE_STRING); |
| 4174 |
g_value_init (&skeleton->priv->properties[7], G_TYPE_STRING); |
| 4175 |
g_value_init (&skeleton->priv->properties[8], G_TYPE_BOOLEAN); |
| 4176 |
g_value_init (&skeleton->priv->properties[9], G_TYPE_BOOLEAN); |
| 4177 |
g_value_init (&skeleton->priv->properties[10], G_TYPE_UINT64); |
| 4178 |
g_value_init (&skeleton->priv->properties[11], G_TYPE_STRING); |
| 4179 |
g_value_init (&skeleton->priv->properties[12], G_TYPE_BOOLEAN); |
| 4180 |
g_value_init (&skeleton->priv->properties[13], G_TYPE_STRING); |
| 4181 |
} |
| 4182 |
|
| 4183 |
static guint |
| 4184 |
gpiodbus_line_skeleton_get_offset (GpiodbusLine *object) |
| 4185 |
{ |
| 4186 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4187 |
guint value; |
| 4188 |
g_mutex_lock (&skeleton->priv->lock); |
| 4189 |
value = g_marshal_value_peek_uint (&(skeleton->priv->properties[0])); |
| 4190 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4191 |
return value; |
| 4192 |
} |
| 4193 |
|
| 4194 |
static const gchar * |
| 4195 |
gpiodbus_line_skeleton_get_name (GpiodbusLine *object) |
| 4196 |
{ |
| 4197 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4198 |
const gchar *value; |
| 4199 |
g_mutex_lock (&skeleton->priv->lock); |
| 4200 |
value = g_marshal_value_peek_string (&(skeleton->priv->properties[1])); |
| 4201 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4202 |
return value; |
| 4203 |
} |
| 4204 |
|
| 4205 |
static gboolean |
| 4206 |
gpiodbus_line_skeleton_get_used (GpiodbusLine *object) |
| 4207 |
{ |
| 4208 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4209 |
gboolean value; |
| 4210 |
g_mutex_lock (&skeleton->priv->lock); |
| 4211 |
value = g_marshal_value_peek_boolean (&(skeleton->priv->properties[2])); |
| 4212 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4213 |
return value; |
| 4214 |
} |
| 4215 |
|
| 4216 |
static const gchar * |
| 4217 |
gpiodbus_line_skeleton_get_consumer (GpiodbusLine *object) |
| 4218 |
{ |
| 4219 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4220 |
const gchar *value; |
| 4221 |
g_mutex_lock (&skeleton->priv->lock); |
| 4222 |
value = g_marshal_value_peek_string (&(skeleton->priv->properties[3])); |
| 4223 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4224 |
return value; |
| 4225 |
} |
| 4226 |
|
| 4227 |
static const gchar * |
| 4228 |
gpiodbus_line_skeleton_get_direction (GpiodbusLine *object) |
| 4229 |
{ |
| 4230 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4231 |
const gchar *value; |
| 4232 |
g_mutex_lock (&skeleton->priv->lock); |
| 4233 |
value = g_marshal_value_peek_string (&(skeleton->priv->properties[4])); |
| 4234 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4235 |
return value; |
| 4236 |
} |
| 4237 |
|
| 4238 |
static const gchar * |
| 4239 |
gpiodbus_line_skeleton_get_edge_detection (GpiodbusLine *object) |
| 4240 |
{ |
| 4241 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4242 |
const gchar *value; |
| 4243 |
g_mutex_lock (&skeleton->priv->lock); |
| 4244 |
value = g_marshal_value_peek_string (&(skeleton->priv->properties[5])); |
| 4245 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4246 |
return value; |
| 4247 |
} |
| 4248 |
|
| 4249 |
static const gchar * |
| 4250 |
gpiodbus_line_skeleton_get_bias (GpiodbusLine *object) |
| 4251 |
{ |
| 4252 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4253 |
const gchar *value; |
| 4254 |
g_mutex_lock (&skeleton->priv->lock); |
| 4255 |
value = g_marshal_value_peek_string (&(skeleton->priv->properties[6])); |
| 4256 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4257 |
return value; |
| 4258 |
} |
| 4259 |
|
| 4260 |
static const gchar * |
| 4261 |
gpiodbus_line_skeleton_get_drive (GpiodbusLine *object) |
| 4262 |
{ |
| 4263 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4264 |
const gchar *value; |
| 4265 |
g_mutex_lock (&skeleton->priv->lock); |
| 4266 |
value = g_marshal_value_peek_string (&(skeleton->priv->properties[7])); |
| 4267 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4268 |
return value; |
| 4269 |
} |
| 4270 |
|
| 4271 |
static gboolean |
| 4272 |
gpiodbus_line_skeleton_get_active_low (GpiodbusLine *object) |
| 4273 |
{ |
| 4274 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4275 |
gboolean value; |
| 4276 |
g_mutex_lock (&skeleton->priv->lock); |
| 4277 |
value = g_marshal_value_peek_boolean (&(skeleton->priv->properties[8])); |
| 4278 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4279 |
return value; |
| 4280 |
} |
| 4281 |
|
| 4282 |
static gboolean |
| 4283 |
gpiodbus_line_skeleton_get_debounced (GpiodbusLine *object) |
| 4284 |
{ |
| 4285 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4286 |
gboolean value; |
| 4287 |
g_mutex_lock (&skeleton->priv->lock); |
| 4288 |
value = g_marshal_value_peek_boolean (&(skeleton->priv->properties[9])); |
| 4289 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4290 |
return value; |
| 4291 |
} |
| 4292 |
|
| 4293 |
static guint64 |
| 4294 |
gpiodbus_line_skeleton_get_debounce_period_us (GpiodbusLine *object) |
| 4295 |
{ |
| 4296 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4297 |
guint64 value; |
| 4298 |
g_mutex_lock (&skeleton->priv->lock); |
| 4299 |
value = g_marshal_value_peek_uint64 (&(skeleton->priv->properties[10])); |
| 4300 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4301 |
return value; |
| 4302 |
} |
| 4303 |
|
| 4304 |
static const gchar * |
| 4305 |
gpiodbus_line_skeleton_get_event_clock (GpiodbusLine *object) |
| 4306 |
{ |
| 4307 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4308 |
const gchar *value; |
| 4309 |
g_mutex_lock (&skeleton->priv->lock); |
| 4310 |
value = g_marshal_value_peek_string (&(skeleton->priv->properties[11])); |
| 4311 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4312 |
return value; |
| 4313 |
} |
| 4314 |
|
| 4315 |
static gboolean |
| 4316 |
gpiodbus_line_skeleton_get_managed (GpiodbusLine *object) |
| 4317 |
{ |
| 4318 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4319 |
gboolean value; |
| 4320 |
g_mutex_lock (&skeleton->priv->lock); |
| 4321 |
value = g_marshal_value_peek_boolean (&(skeleton->priv->properties[12])); |
| 4322 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4323 |
return value; |
| 4324 |
} |
| 4325 |
|
| 4326 |
static const gchar * |
| 4327 |
gpiodbus_line_skeleton_get_request_path (GpiodbusLine *object) |
| 4328 |
{ |
| 4329 |
GpiodbusLineSkeleton *skeleton = GPIODBUS_LINE_SKELETON (object); |
| 4330 |
const gchar *value; |
| 4331 |
g_mutex_lock (&skeleton->priv->lock); |
| 4332 |
value = g_marshal_value_peek_string (&(skeleton->priv->properties[13])); |
| 4333 |
g_mutex_unlock (&skeleton->priv->lock); |
| 4334 |
return value; |
| 4335 |
} |
| 4336 |
|
| 4337 |
static void |
| 4338 |
gpiodbus_line_skeleton_class_init (GpiodbusLineSkeletonClass *klass) |
| 4339 |
{ |
| 4340 |
GObjectClass *gobject_class; |
| 4341 |
GDBusInterfaceSkeletonClass *skeleton_class; |
| 4342 |
|
| 4343 |
gobject_class = G_OBJECT_CLASS (klass); |
| 4344 |
gobject_class->finalize = gpiodbus_line_skeleton_finalize; |
| 4345 |
gobject_class->get_property = gpiodbus_line_skeleton_get_property; |
| 4346 |
gobject_class->set_property = gpiodbus_line_skeleton_set_property; |
| 4347 |
gobject_class->notify = gpiodbus_line_skeleton_notify; |
| 4348 |
|
| 4349 |
|
| 4350 |
gpiodbus_line_override_properties (gobject_class, 1); |
| 4351 |
|
| 4352 |
skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 4353 |
skeleton_class->get_info = gpiodbus_line_skeleton_dbus_interface_get_info; |
| 4354 |
skeleton_class->get_properties = gpiodbus_line_skeleton_dbus_interface_get_properties; |
| 4355 |
skeleton_class->flush = gpiodbus_line_skeleton_dbus_interface_flush; |
| 4356 |
skeleton_class->get_vtable = gpiodbus_line_skeleton_dbus_interface_get_vtable; |
| 4357 |
|
| 4358 |
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 4359 |
g_type_class_add_private (klass, sizeof (GpiodbusLineSkeletonPrivate)); |
| 4360 |
#endif |
| 4361 |
} |
| 4362 |
|
| 4363 |
static void |
| 4364 |
gpiodbus_line_skeleton_iface_init (GpiodbusLineIface *iface) |
| 4365 |
{ |
| 4366 |
iface->edge_event = _gpiodbus_line_on_signal_edge_event; |
| 4367 |
iface->get_offset = gpiodbus_line_skeleton_get_offset; |
| 4368 |
iface->get_name = gpiodbus_line_skeleton_get_name; |
| 4369 |
iface->get_used = gpiodbus_line_skeleton_get_used; |
| 4370 |
iface->get_consumer = gpiodbus_line_skeleton_get_consumer; |
| 4371 |
iface->get_direction = gpiodbus_line_skeleton_get_direction; |
| 4372 |
iface->get_edge_detection = gpiodbus_line_skeleton_get_edge_detection; |
| 4373 |
iface->get_bias = gpiodbus_line_skeleton_get_bias; |
| 4374 |
iface->get_drive = gpiodbus_line_skeleton_get_drive; |
| 4375 |
iface->get_active_low = gpiodbus_line_skeleton_get_active_low; |
| 4376 |
iface->get_debounced = gpiodbus_line_skeleton_get_debounced; |
| 4377 |
iface->get_debounce_period_us = gpiodbus_line_skeleton_get_debounce_period_us; |
| 4378 |
iface->get_event_clock = gpiodbus_line_skeleton_get_event_clock; |
| 4379 |
iface->get_managed = gpiodbus_line_skeleton_get_managed; |
| 4380 |
iface->get_request_path = gpiodbus_line_skeleton_get_request_path; |
| 4381 |
} |
| 4382 |
|
| 4383 |
|
| 4384 |
|
| 4385 |
|
| 4386 |
|
| 4387 |
|
| 4388 |
|
| 4389 |
|
| 4390 |
GpiodbusLine * |
| 4391 |
gpiodbus_line_skeleton_new (void) |
| 4392 |
{ |
| 4393 |
return GPIODBUS_LINE (g_object_new (GPIODBUS_TYPE_LINE_SKELETON, NULL)); |
| 4394 |
} |
| 4395 |
|
| 4396 |
|
| 4397 |
|
| 4398 |
|
| 4399 |
|
| 4400 |
|
| 4401 |
|
| 4402 |
|
| 4403 |
|
| 4404 |
|
| 4405 |
|
| 4406 |
|
| 4407 |
|
| 4408 |
|
| 4409 |
|
| 4410 |
|
| 4411 |
static const _ExtendedGDBusMethodInfo _gpiodbus_request_method_info_release = |
| 4412 |
{ |
| 4413 |
{ |
| 4414 |
-1, |
| 4415 |
(gchar *) "Release", |
| 4416 |
NULL, |
| 4417 |
NULL, |
| 4418 |
NULL |
| 4419 |
}, |
| 4420 |
"handle-release", |
| 4421 |
FALSE |
| 4422 |
}; |
| 4423 |
|
| 4424 |
static const _ExtendedGDBusArgInfo _gpiodbus_request_method_info_reconfigure_lines_IN_ARG_line_config = |
| 4425 |
{ |
| 4426 |
{ |
| 4427 |
-1, |
| 4428 |
(gchar *) "line_config", |
| 4429 |
(gchar *) "(a(aua{sv})ai)", |
| 4430 |
NULL |
| 4431 |
}, |
| 4432 |
FALSE |
| 4433 |
}; |
| 4434 |
|
| 4435 |
static const GDBusArgInfo * const _gpiodbus_request_method_info_reconfigure_lines_IN_ARG_pointers[] = |
| 4436 |
{ |
| 4437 |
&_gpiodbus_request_method_info_reconfigure_lines_IN_ARG_line_config.parent_struct, |
| 4438 |
NULL |
| 4439 |
}; |
| 4440 |
|
| 4441 |
static const _ExtendedGDBusMethodInfo _gpiodbus_request_method_info_reconfigure_lines = |
| 4442 |
{ |
| 4443 |
{ |
| 4444 |
-1, |
| 4445 |
(gchar *) "ReconfigureLines", |
| 4446 |
(GDBusArgInfo **) &_gpiodbus_request_method_info_reconfigure_lines_IN_ARG_pointers, |
| 4447 |
NULL, |
| 4448 |
NULL |
| 4449 |
}, |
| 4450 |
"handle-reconfigure-lines", |
| 4451 |
FALSE |
| 4452 |
}; |
| 4453 |
|
| 4454 |
static const _ExtendedGDBusArgInfo _gpiodbus_request_method_info_get_values_IN_ARG_offsets = |
| 4455 |
{ |
| 4456 |
{ |
| 4457 |
-1, |
| 4458 |
(gchar *) "offsets", |
| 4459 |
(gchar *) "au", |
| 4460 |
NULL |
| 4461 |
}, |
| 4462 |
FALSE |
| 4463 |
}; |
| 4464 |
|
| 4465 |
static const GDBusArgInfo * const _gpiodbus_request_method_info_get_values_IN_ARG_pointers[] = |
| 4466 |
{ |
| 4467 |
&_gpiodbus_request_method_info_get_values_IN_ARG_offsets.parent_struct, |
| 4468 |
NULL |
| 4469 |
}; |
| 4470 |
|
| 4471 |
static const _ExtendedGDBusArgInfo _gpiodbus_request_method_info_get_values_OUT_ARG_values = |
| 4472 |
{ |
| 4473 |
{ |
| 4474 |
-1, |
| 4475 |
(gchar *) "values", |
| 4476 |
(gchar *) "ai", |
| 4477 |
NULL |
| 4478 |
}, |
| 4479 |
FALSE |
| 4480 |
}; |
| 4481 |
|
| 4482 |
static const GDBusArgInfo * const _gpiodbus_request_method_info_get_values_OUT_ARG_pointers[] = |
| 4483 |
{ |
| 4484 |
&_gpiodbus_request_method_info_get_values_OUT_ARG_values.parent_struct, |
| 4485 |
NULL |
| 4486 |
}; |
| 4487 |
|
| 4488 |
static const _ExtendedGDBusMethodInfo _gpiodbus_request_method_info_get_values = |
| 4489 |
{ |
| 4490 |
{ |
| 4491 |
-1, |
| 4492 |
(gchar *) "GetValues", |
| 4493 |
(GDBusArgInfo **) &_gpiodbus_request_method_info_get_values_IN_ARG_pointers, |
| 4494 |
(GDBusArgInfo **) &_gpiodbus_request_method_info_get_values_OUT_ARG_pointers, |
| 4495 |
NULL |
| 4496 |
}, |
| 4497 |
"handle-get-values", |
| 4498 |
FALSE |
| 4499 |
}; |
| 4500 |
|
| 4501 |
static const _ExtendedGDBusArgInfo _gpiodbus_request_method_info_set_values_IN_ARG_values = |
| 4502 |
{ |
| 4503 |
{ |
| 4504 |
-1, |
| 4505 |
(gchar *) "values", |
| 4506 |
(gchar *) "a{ui}", |
| 4507 |
NULL |
| 4508 |
}, |
| 4509 |
FALSE |
| 4510 |
}; |
| 4511 |
|
| 4512 |
static const GDBusArgInfo * const _gpiodbus_request_method_info_set_values_IN_ARG_pointers[] = |
| 4513 |
{ |
| 4514 |
&_gpiodbus_request_method_info_set_values_IN_ARG_values.parent_struct, |
| 4515 |
NULL |
| 4516 |
}; |
| 4517 |
|
| 4518 |
static const _ExtendedGDBusMethodInfo _gpiodbus_request_method_info_set_values = |
| 4519 |
{ |
| 4520 |
{ |
| 4521 |
-1, |
| 4522 |
(gchar *) "SetValues", |
| 4523 |
(GDBusArgInfo **) &_gpiodbus_request_method_info_set_values_IN_ARG_pointers, |
| 4524 |
NULL, |
| 4525 |
NULL |
| 4526 |
}, |
| 4527 |
"handle-set-values", |
| 4528 |
FALSE |
| 4529 |
}; |
| 4530 |
|
| 4531 |
static const GDBusMethodInfo * const _gpiodbus_request_method_info_pointers[] = |
| 4532 |
{ |
| 4533 |
&_gpiodbus_request_method_info_release.parent_struct, |
| 4534 |
&_gpiodbus_request_method_info_reconfigure_lines.parent_struct, |
| 4535 |
&_gpiodbus_request_method_info_get_values.parent_struct, |
| 4536 |
&_gpiodbus_request_method_info_set_values.parent_struct, |
| 4537 |
NULL |
| 4538 |
}; |
| 4539 |
|
| 4540 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_request_property_info_chip_path = |
| 4541 |
{ |
| 4542 |
{ |
| 4543 |
-1, |
| 4544 |
(gchar *) "ChipPath", |
| 4545 |
(gchar *) "o", |
| 4546 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 4547 |
NULL |
| 4548 |
}, |
| 4549 |
"chip-path", |
| 4550 |
FALSE, |
| 4551 |
TRUE |
| 4552 |
}; |
| 4553 |
|
| 4554 |
static const _ExtendedGDBusPropertyInfo _gpiodbus_request_property_info_line_paths = |
| 4555 |
{ |
| 4556 |
{ |
| 4557 |
-1, |
| 4558 |
(gchar *) "LinePaths", |
| 4559 |
(gchar *) "ao", |
| 4560 |
G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
| 4561 |
NULL |
| 4562 |
}, |
| 4563 |
"line-paths", |
| 4564 |
FALSE, |
| 4565 |
TRUE |
| 4566 |
}; |
| 4567 |
|
| 4568 |
static const GDBusPropertyInfo * const _gpiodbus_request_property_info_pointers[] = |
| 4569 |
{ |
| 4570 |
&_gpiodbus_request_property_info_chip_path.parent_struct, |
| 4571 |
&_gpiodbus_request_property_info_line_paths.parent_struct, |
| 4572 |
NULL |
| 4573 |
}; |
| 4574 |
|
| 4575 |
static const _ExtendedGDBusInterfaceInfo _gpiodbus_request_interface_info = |
| 4576 |
{ |
| 4577 |
{ |
| 4578 |
-1, |
| 4579 |
(gchar *) "io.gpiod1.Request", |
| 4580 |
(GDBusMethodInfo **) &_gpiodbus_request_method_info_pointers, |
| 4581 |
NULL, |
| 4582 |
(GDBusPropertyInfo **) &_gpiodbus_request_property_info_pointers, |
| 4583 |
NULL |
| 4584 |
}, |
| 4585 |
"request", |
| 4586 |
}; |
| 4587 |
|
| 4588 |
|
| 4589 |
|
| 4590 |
|
| 4591 |
|
| 4592 |
|
| 4593 |
|
| 4594 |
|
| 4595 |
|
| 4596 |
GDBusInterfaceInfo * |
| 4597 |
gpiodbus_request_interface_info (void) |
| 4598 |
{ |
| 4599 |
return (GDBusInterfaceInfo *) &_gpiodbus_request_interface_info.parent_struct; |
| 4600 |
} |
| 4601 |
|
| 4602 |
|
| 4603 |
|
| 4604 |
|
| 4605 |
|
| 4606 |
|
| 4607 |
|
| 4608 |
|
| 4609 |
|
| 4610 |
|
| 4611 |
|
| 4612 |
guint |
| 4613 |
gpiodbus_request_override_properties (GObjectClass *klass, guint property_id_begin) |
| 4614 |
{ |
| 4615 |
g_object_class_override_property (klass, property_id_begin++, "chip-path"); |
| 4616 |
g_object_class_override_property (klass, property_id_begin++, "line-paths"); |
| 4617 |
return property_id_begin - 1; |
| 4618 |
} |
| 4619 |
|
| 4620 |
|
| 4621 |
inline static void |
| 4622 |
gpiodbus_request_method_marshal_release ( |
| 4623 |
GClosure *closure, |
| 4624 |
GValue *return_value, |
| 4625 |
unsigned int n_param_values, |
| 4626 |
const GValue *param_values, |
| 4627 |
void *invocation_hint, |
| 4628 |
void *marshal_data) |
| 4629 |
{ |
| 4630 |
_g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure, |
| 4631 |
return_value, n_param_values, param_values, invocation_hint, marshal_data); |
| 4632 |
} |
| 4633 |
|
| 4634 |
inline static void |
| 4635 |
gpiodbus_request_method_marshal_reconfigure_lines ( |
| 4636 |
GClosure *closure, |
| 4637 |
GValue *return_value, |
| 4638 |
unsigned int n_param_values, |
| 4639 |
const GValue *param_values, |
| 4640 |
void *invocation_hint, |
| 4641 |
void *marshal_data) |
| 4642 |
{ |
| 4643 |
_g_dbus_codegen_marshal_BOOLEAN__OBJECT_VARIANT (closure, |
| 4644 |
return_value, n_param_values, param_values, invocation_hint, marshal_data); |
| 4645 |
} |
| 4646 |
|
| 4647 |
inline static void |
| 4648 |
gpiodbus_request_method_marshal_get_values ( |
| 4649 |
GClosure *closure, |
| 4650 |
GValue *return_value, |
| 4651 |
unsigned int n_param_values, |
| 4652 |
const GValue *param_values, |
| 4653 |
void *invocation_hint, |
| 4654 |
void *marshal_data) |
| 4655 |
{ |
| 4656 |
_g_dbus_codegen_marshal_BOOLEAN__OBJECT_VARIANT (closure, |
| 4657 |
return_value, n_param_values, param_values, invocation_hint, marshal_data); |
| 4658 |
} |
| 4659 |
|
| 4660 |
inline static void |
| 4661 |
gpiodbus_request_method_marshal_set_values ( |
| 4662 |
GClosure *closure, |
| 4663 |
GValue *return_value, |
| 4664 |
unsigned int n_param_values, |
| 4665 |
const GValue *param_values, |
| 4666 |
void *invocation_hint, |
| 4667 |
void *marshal_data) |
| 4668 |
{ |
| 4669 |
_g_dbus_codegen_marshal_BOOLEAN__OBJECT_VARIANT (closure, |
| 4670 |
return_value, n_param_values, param_values, invocation_hint, marshal_data); |
| 4671 |
} |
| 4672 |
|
| 4673 |
|
| 4674 |
|
| 4675 |
|
| 4676 |
|
| 4677 |
|
| 4678 |
|
| 4679 |
|
| 4680 |
|
| 4681 |
|
| 4682 |
|
| 4683 |
|
| 4684 |
|
| 4685 |
|
| 4686 |
|
| 4687 |
|
| 4688 |
|
| 4689 |
|
| 4690 |
|
| 4691 |
|
| 4692 |
|
| 4693 |
typedef GpiodbusRequestIface GpiodbusRequestInterface; |
| 4694 |
G_DEFINE_INTERFACE (GpiodbusRequest, gpiodbus_request, G_TYPE_OBJECT) |
| 4695 |
|
| 4696 |
static void |
| 4697 |
gpiodbus_request_default_init (GpiodbusRequestIface *iface) |
| 4698 |
{ |
| 4699 |
|
| 4700 |
|
| 4701 |
|
| 4702 |
|
| 4703 |
|
| 4704 |
|
| 4705 |
|
| 4706 |
|
| 4707 |
|
| 4708 |
|
| 4709 |
|
| 4710 |
|
| 4711 |
g_signal_new ("handle-release", |
| 4712 |
G_TYPE_FROM_INTERFACE (iface), |
| 4713 |
G_SIGNAL_RUN_LAST, |
| 4714 |
G_STRUCT_OFFSET (GpiodbusRequestIface, handle_release), |
| 4715 |
g_signal_accumulator_true_handled, |
| 4716 |
NULL, |
| 4717 |
gpiodbus_request_method_marshal_release, |
| 4718 |
G_TYPE_BOOLEAN, |
| 4719 |
1, |
| 4720 |
G_TYPE_DBUS_METHOD_INVOCATION); |
| 4721 |
|
| 4722 |
|
| 4723 |
|
| 4724 |
|
| 4725 |
|
| 4726 |
|
| 4727 |
|
| 4728 |
|
| 4729 |
|
| 4730 |
|
| 4731 |
|
| 4732 |
|
| 4733 |
|
| 4734 |
g_signal_new ("handle-reconfigure-lines", |
| 4735 |
G_TYPE_FROM_INTERFACE (iface), |
| 4736 |
G_SIGNAL_RUN_LAST, |
| 4737 |
G_STRUCT_OFFSET (GpiodbusRequestIface, handle_reconfigure_lines), |
| 4738 |
g_signal_accumulator_true_handled, |
| 4739 |
NULL, |
| 4740 |
gpiodbus_request_method_marshal_reconfigure_lines, |
| 4741 |
G_TYPE_BOOLEAN, |
| 4742 |
2, |
| 4743 |
G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); |
| 4744 |
|
| 4745 |
|
| 4746 |
|
| 4747 |
|
| 4748 |
|
| 4749 |
|
| 4750 |
|
| 4751 |
|
| 4752 |
|
| 4753 |
|
| 4754 |
|
| 4755 |
|
| 4756 |
|
| 4757 |
g_signal_new ("handle-get-values", |
| 4758 |
G_TYPE_FROM_INTERFACE (iface), |
| 4759 |
G_SIGNAL_RUN_LAST, |
| 4760 |
G_STRUCT_OFFSET (GpiodbusRequestIface, handle_get_values), |
| 4761 |
g_signal_accumulator_true_handled, |
| 4762 |
NULL, |
| 4763 |
gpiodbus_request_method_marshal_get_values, |
| 4764 |
G_TYPE_BOOLEAN, |
| 4765 |
2, |
| 4766 |
G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); |
| 4767 |
|
| 4768 |
|
| 4769 |
|
| 4770 |
|
| 4771 |
|
| 4772 |
|
| 4773 |
|
| 4774 |
|
| 4775 |
|
| 4776 |
|
| 4777 |
|
| 4778 |
|
| 4779 |
|
| 4780 |
g_signal_new ("handle-set-values", |
| 4781 |
G_TYPE_FROM_INTERFACE (iface), |
| 4782 |
G_SIGNAL_RUN_LAST, |
| 4783 |
G_STRUCT_OFFSET (GpiodbusRequestIface, handle_set_values), |
| 4784 |
g_signal_accumulator_true_handled, |
| 4785 |
NULL, |
| 4786 |
gpiodbus_request_method_marshal_set_values, |
| 4787 |
G_TYPE_BOOLEAN, |
| 4788 |
2, |
| 4789 |
G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); |
| 4790 |
|
| 4791 |
|
| 4792 |
|
| 4793 |
|
| 4794 |
|
| 4795 |
|
| 4796 |
|
| 4797 |
|
| 4798 |
|
| 4799 |
g_object_interface_install_property (iface, |
| 4800 |
g_param_spec_string ("chip-path", "ChipPath", "ChipPath", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 4801 |
|
| 4802 |
|
| 4803 |
|
| 4804 |
|
| 4805 |
|
| 4806 |
|
| 4807 |
|
| 4808 |
g_object_interface_install_property (iface, |
| 4809 |
g_param_spec_boxed ("line-paths", "LinePaths", "LinePaths", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 4810 |
} |
| 4811 |
|
| 4812 |
|
| 4813 |
|
| 4814 |
|
| 4815 |
|
| 4816 |
|
| 4817 |
|
| 4818 |
|
| 4819 |
|
| 4820 |
|
| 4821 |
|
| 4822 |
|
| 4823 |
|
| 4824 |
const gchar * |
| 4825 |
gpiodbus_request_get_chip_path (GpiodbusRequest *object) |
| 4826 |
{ |
| 4827 |
g_return_val_if_fail (GPIODBUS_IS_REQUEST (object), NULL); |
| 4828 |
|
| 4829 |
return GPIODBUS_REQUEST_GET_IFACE (object)->get_chip_path (object); |
| 4830 |
} |
| 4831 |
|
| 4832 |
|
| 4833 |
|
| 4834 |
|
| 4835 |
|
| 4836 |
|
| 4837 |
|
| 4838 |
|
| 4839 |
|
| 4840 |
|
| 4841 |
|
| 4842 |
gchar * |
| 4843 |
gpiodbus_request_dup_chip_path (GpiodbusRequest *object) |
| 4844 |
{ |
| 4845 |
gchar *value; |
| 4846 |
g_object_get (G_OBJECT (object), "chip-path", &value, NULL); |
| 4847 |
return value; |
| 4848 |
} |
| 4849 |
|
| 4850 |
|
| 4851 |
|
| 4852 |
|
| 4853 |
|
| 4854 |
|
| 4855 |
|
| 4856 |
|
| 4857 |
|
| 4858 |
|
| 4859 |
void |
| 4860 |
gpiodbus_request_set_chip_path (GpiodbusRequest *object, const gchar *value) |
| 4861 |
{ |
| 4862 |
g_object_set (G_OBJECT (object), "chip-path", value, NULL); |
| 4863 |
} |
| 4864 |
|
| 4865 |
|
| 4866 |
|
| 4867 |
|
| 4868 |
|
| 4869 |
|
| 4870 |
|
| 4871 |
|
| 4872 |
|
| 4873 |
|
| 4874 |
|
| 4875 |
|
| 4876 |
|
| 4877 |
const gchar *const * |
| 4878 |
gpiodbus_request_get_line_paths (GpiodbusRequest *object) |
| 4879 |
{ |
| 4880 |
g_return_val_if_fail (GPIODBUS_IS_REQUEST (object), NULL); |
| 4881 |
|
| 4882 |
return GPIODBUS_REQUEST_GET_IFACE (object)->get_line_paths (object); |
| 4883 |
} |
| 4884 |
|
| 4885 |
|
| 4886 |
|
| 4887 |
|
| 4888 |
|
| 4889 |
|
| 4890 |
|
| 4891 |
|
| 4892 |
|
| 4893 |
|
| 4894 |
|
| 4895 |
gchar ** |
| 4896 |
gpiodbus_request_dup_line_paths (GpiodbusRequest *object) |
| 4897 |
{ |
| 4898 |
gchar **value; |
| 4899 |
g_object_get (G_OBJECT (object), "line-paths", &value, NULL); |
| 4900 |
return value; |
| 4901 |
} |
| 4902 |
|
| 4903 |
|
| 4904 |
|
| 4905 |
|
| 4906 |
|
| 4907 |
|
| 4908 |
|
| 4909 |
|
| 4910 |
|
| 4911 |
|
| 4912 |
void |
| 4913 |
gpiodbus_request_set_line_paths (GpiodbusRequest *object, const gchar *const *value) |
| 4914 |
{ |
| 4915 |
g_object_set (G_OBJECT (object), "line-paths", value, NULL); |
| 4916 |
} |
| 4917 |
|
| 4918 |
|
| 4919 |
|
| 4920 |
|
| 4921 |
|
| 4922 |
|
| 4923 |
|
| 4924 |
|
| 4925 |
|
| 4926 |
|
| 4927 |
|
| 4928 |
|
| 4929 |
|
| 4930 |
|
| 4931 |
|
| 4932 |
|
| 4933 |
|
| 4934 |
|
| 4935 |
void |
| 4936 |
gpiodbus_request_call_release ( |
| 4937 |
GpiodbusRequest *proxy, |
| 4938 |
GDBusCallFlags call_flags, |
| 4939 |
gint timeout_msec, |
| 4940 |
GCancellable *cancellable, |
| 4941 |
GAsyncReadyCallback callback, |
| 4942 |
gpointer user_data) |
| 4943 |
{ |
| 4944 |
g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 4945 |
"Release", |
| 4946 |
g_variant_new ("()"), |
| 4947 |
call_flags, |
| 4948 |
timeout_msec, |
| 4949 |
cancellable, |
| 4950 |
callback, |
| 4951 |
user_data); |
| 4952 |
} |
| 4953 |
|
| 4954 |
|
| 4955 |
|
| 4956 |
|
| 4957 |
|
| 4958 |
|
| 4959 |
|
| 4960 |
|
| 4961 |
|
| 4962 |
|
| 4963 |
|
| 4964 |
gboolean |
| 4965 |
gpiodbus_request_call_release_finish ( |
| 4966 |
GpiodbusRequest *proxy, |
| 4967 |
GAsyncResult *res, |
| 4968 |
GError **error) |
| 4969 |
{ |
| 4970 |
GVariant *_ret; |
| 4971 |
_ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 4972 |
if (_ret == NULL) |
| 4973 |
goto _out; |
| 4974 |
g_variant_get (_ret, |
| 4975 |
"()"); |
| 4976 |
g_variant_unref (_ret); |
| 4977 |
_out: |
| 4978 |
return _ret != NULL; |
| 4979 |
} |
| 4980 |
|
| 4981 |
|
| 4982 |
|
| 4983 |
|
| 4984 |
|
| 4985 |
|
| 4986 |
|
| 4987 |
|
| 4988 |
|
| 4989 |
|
| 4990 |
|
| 4991 |
|
| 4992 |
|
| 4993 |
|
| 4994 |
|
| 4995 |
|
| 4996 |
|
| 4997 |
gboolean |
| 4998 |
gpiodbus_request_call_release_sync ( |
| 4999 |
GpiodbusRequest *proxy, |
| 5000 |
GDBusCallFlags call_flags, |
| 5001 |
gint timeout_msec, |
| 5002 |
GCancellable *cancellable, |
| 5003 |
GError **error) |
| 5004 |
{ |
| 5005 |
GVariant *_ret; |
| 5006 |
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 5007 |
"Release", |
| 5008 |
g_variant_new ("()"), |
| 5009 |
call_flags, |
| 5010 |
timeout_msec, |
| 5011 |
cancellable, |
| 5012 |
error); |
| 5013 |
if (_ret == NULL) |
| 5014 |
goto _out; |
| 5015 |
g_variant_get (_ret, |
| 5016 |
"()"); |
| 5017 |
g_variant_unref (_ret); |
| 5018 |
_out: |
| 5019 |
return _ret != NULL; |
| 5020 |
} |
| 5021 |
|
| 5022 |
|
| 5023 |
|
| 5024 |
|
| 5025 |
|
| 5026 |
|
| 5027 |
|
| 5028 |
|
| 5029 |
|
| 5030 |
|
| 5031 |
|
| 5032 |
|
| 5033 |
|
| 5034 |
|
| 5035 |
|
| 5036 |
|
| 5037 |
|
| 5038 |
|
| 5039 |
|
| 5040 |
void |
| 5041 |
gpiodbus_request_call_reconfigure_lines ( |
| 5042 |
GpiodbusRequest *proxy, |
| 5043 |
GVariant *arg_line_config, |
| 5044 |
GDBusCallFlags call_flags, |
| 5045 |
gint timeout_msec, |
| 5046 |
GCancellable *cancellable, |
| 5047 |
GAsyncReadyCallback callback, |
| 5048 |
gpointer user_data) |
| 5049 |
{ |
| 5050 |
g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 5051 |
"ReconfigureLines", |
| 5052 |
g_variant_new ("(@(a(aua{sv})ai))", |
| 5053 |
arg_line_config), |
| 5054 |
call_flags, |
| 5055 |
timeout_msec, |
| 5056 |
cancellable, |
| 5057 |
callback, |
| 5058 |
user_data); |
| 5059 |
} |
| 5060 |
|
| 5061 |
|
| 5062 |
|
| 5063 |
|
| 5064 |
|
| 5065 |
|
| 5066 |
|
| 5067 |
|
| 5068 |
|
| 5069 |
|
| 5070 |
|
| 5071 |
gboolean |
| 5072 |
gpiodbus_request_call_reconfigure_lines_finish ( |
| 5073 |
GpiodbusRequest *proxy, |
| 5074 |
GAsyncResult *res, |
| 5075 |
GError **error) |
| 5076 |
{ |
| 5077 |
GVariant *_ret; |
| 5078 |
_ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 5079 |
if (_ret == NULL) |
| 5080 |
goto _out; |
| 5081 |
g_variant_get (_ret, |
| 5082 |
"()"); |
| 5083 |
g_variant_unref (_ret); |
| 5084 |
_out: |
| 5085 |
return _ret != NULL; |
| 5086 |
} |
| 5087 |
|
| 5088 |
|
| 5089 |
|
| 5090 |
|
| 5091 |
|
| 5092 |
|
| 5093 |
|
| 5094 |
|
| 5095 |
|
| 5096 |
|
| 5097 |
|
| 5098 |
|
| 5099 |
|
| 5100 |
|
| 5101 |
|
| 5102 |
|
| 5103 |
|
| 5104 |
|
| 5105 |
gboolean |
| 5106 |
gpiodbus_request_call_reconfigure_lines_sync ( |
| 5107 |
GpiodbusRequest *proxy, |
| 5108 |
GVariant *arg_line_config, |
| 5109 |
GDBusCallFlags call_flags, |
| 5110 |
gint timeout_msec, |
| 5111 |
GCancellable *cancellable, |
| 5112 |
GError **error) |
| 5113 |
{ |
| 5114 |
GVariant *_ret; |
| 5115 |
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 5116 |
"ReconfigureLines", |
| 5117 |
g_variant_new ("(@(a(aua{sv})ai))", |
| 5118 |
arg_line_config), |
| 5119 |
call_flags, |
| 5120 |
timeout_msec, |
| 5121 |
cancellable, |
| 5122 |
error); |
| 5123 |
if (_ret == NULL) |
| 5124 |
goto _out; |
| 5125 |
g_variant_get (_ret, |
| 5126 |
"()"); |
| 5127 |
g_variant_unref (_ret); |
| 5128 |
_out: |
| 5129 |
return _ret != NULL; |
| 5130 |
} |
| 5131 |
|
| 5132 |
|
| 5133 |
|
| 5134 |
|
| 5135 |
|
| 5136 |
|
| 5137 |
|
| 5138 |
|
| 5139 |
|
| 5140 |
|
| 5141 |
|
| 5142 |
|
| 5143 |
|
| 5144 |
|
| 5145 |
|
| 5146 |
|
| 5147 |
|
| 5148 |
|
| 5149 |
|
| 5150 |
void |
| 5151 |
gpiodbus_request_call_get_values ( |
| 5152 |
GpiodbusRequest *proxy, |
| 5153 |
GVariant *arg_offsets, |
| 5154 |
GDBusCallFlags call_flags, |
| 5155 |
gint timeout_msec, |
| 5156 |
GCancellable *cancellable, |
| 5157 |
GAsyncReadyCallback callback, |
| 5158 |
gpointer user_data) |
| 5159 |
{ |
| 5160 |
g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 5161 |
"GetValues", |
| 5162 |
g_variant_new ("(@au)", |
| 5163 |
arg_offsets), |
| 5164 |
call_flags, |
| 5165 |
timeout_msec, |
| 5166 |
cancellable, |
| 5167 |
callback, |
| 5168 |
user_data); |
| 5169 |
} |
| 5170 |
|
| 5171 |
|
| 5172 |
|
| 5173 |
|
| 5174 |
|
| 5175 |
|
| 5176 |
|
| 5177 |
|
| 5178 |
|
| 5179 |
|
| 5180 |
|
| 5181 |
|
| 5182 |
gboolean |
| 5183 |
gpiodbus_request_call_get_values_finish ( |
| 5184 |
GpiodbusRequest *proxy, |
| 5185 |
GVariant **out_values, |
| 5186 |
GAsyncResult *res, |
| 5187 |
GError **error) |
| 5188 |
{ |
| 5189 |
GVariant *_ret; |
| 5190 |
_ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 5191 |
if (_ret == NULL) |
| 5192 |
goto _out; |
| 5193 |
g_variant_get (_ret, |
| 5194 |
"(@ai)", |
| 5195 |
out_values); |
| 5196 |
g_variant_unref (_ret); |
| 5197 |
_out: |
| 5198 |
return _ret != NULL; |
| 5199 |
} |
| 5200 |
|
| 5201 |
|
| 5202 |
|
| 5203 |
|
| 5204 |
|
| 5205 |
|
| 5206 |
|
| 5207 |
|
| 5208 |
|
| 5209 |
|
| 5210 |
|
| 5211 |
|
| 5212 |
|
| 5213 |
|
| 5214 |
|
| 5215 |
|
| 5216 |
|
| 5217 |
|
| 5218 |
|
| 5219 |
gboolean |
| 5220 |
gpiodbus_request_call_get_values_sync ( |
| 5221 |
GpiodbusRequest *proxy, |
| 5222 |
GVariant *arg_offsets, |
| 5223 |
GDBusCallFlags call_flags, |
| 5224 |
gint timeout_msec, |
| 5225 |
GVariant **out_values, |
| 5226 |
GCancellable *cancellable, |
| 5227 |
GError **error) |
| 5228 |
{ |
| 5229 |
GVariant *_ret; |
| 5230 |
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 5231 |
"GetValues", |
| 5232 |
g_variant_new ("(@au)", |
| 5233 |
arg_offsets), |
| 5234 |
call_flags, |
| 5235 |
timeout_msec, |
| 5236 |
cancellable, |
| 5237 |
error); |
| 5238 |
if (_ret == NULL) |
| 5239 |
goto _out; |
| 5240 |
g_variant_get (_ret, |
| 5241 |
"(@ai)", |
| 5242 |
out_values); |
| 5243 |
g_variant_unref (_ret); |
| 5244 |
_out: |
| 5245 |
return _ret != NULL; |
| 5246 |
} |
| 5247 |
|
| 5248 |
|
| 5249 |
|
| 5250 |
|
| 5251 |
|
| 5252 |
|
| 5253 |
|
| 5254 |
|
| 5255 |
|
| 5256 |
|
| 5257 |
|
| 5258 |
|
| 5259 |
|
| 5260 |
|
| 5261 |
|
| 5262 |
|
| 5263 |
|
| 5264 |
|
| 5265 |
|
| 5266 |
void |
| 5267 |
gpiodbus_request_call_set_values ( |
| 5268 |
GpiodbusRequest *proxy, |
| 5269 |
GVariant *arg_values, |
| 5270 |
GDBusCallFlags call_flags, |
| 5271 |
gint timeout_msec, |
| 5272 |
GCancellable *cancellable, |
| 5273 |
GAsyncReadyCallback callback, |
| 5274 |
gpointer user_data) |
| 5275 |
{ |
| 5276 |
g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
| 5277 |
"SetValues", |
| 5278 |
g_variant_new ("(@a{ui})", |
| 5279 |
arg_values), |
| 5280 |
call_flags, |
| 5281 |
timeout_msec, |
| 5282 |
cancellable, |
| 5283 |
callback, |
| 5284 |
user_data); |
| 5285 |
} |
| 5286 |
|
| 5287 |
|
| 5288 |
|
| 5289 |
|
| 5290 |
|
| 5291 |
|
| 5292 |
|
| 5293 |
|
| 5294 |
|
| 5295 |
|
| 5296 |
|
| 5297 |
gboolean |
| 5298 |
gpiodbus_request_call_set_values_finish ( |
| 5299 |
GpiodbusRequest *proxy, |
| 5300 |
GAsyncResult *res, |
| 5301 |
GError **error) |
| 5302 |
{ |
| 5303 |
GVariant *_ret; |
| 5304 |
_ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
| 5305 |
if (_ret == NULL) |
| 5306 |
goto _out; |
| 5307 |
g_variant_get (_ret, |
| 5308 |
"()"); |
| 5309 |
g_variant_unref (_ret); |
| 5310 |
_out: |
| 5311 |
return _ret != NULL; |
| 5312 |
} |
| 5313 |
|
| 5314 |
|
| 5315 |
|
| 5316 |
|
| 5317 |
|
| 5318 |
|
| 5319 |
|
| 5320 |
|
| 5321 |
|
| 5322 |
|
| 5323 |
|
| 5324 |
|
| 5325 |
|
| 5326 |
|
| 5327 |
|
| 5328 |
|
| 5329 |
|
| 5330 |
|
| 5331 |
gboolean |
| 5332 |
gpiodbus_request_call_set_values_sync ( |
| 5333 |
GpiodbusRequest *proxy, |
| 5334 |
GVariant *arg_values, |
| 5335 |
GDBusCallFlags call_flags, |
| 5336 |
gint timeout_msec, |
| 5337 |
GCancellable *cancellable, |
| 5338 |
GError **error) |
| 5339 |
{ |
| 5340 |
GVariant *_ret; |
| 5341 |
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
| 5342 |
"SetValues", |
| 5343 |
g_variant_new ("(@a{ui})", |
| 5344 |
arg_values), |
| 5345 |
call_flags, |
| 5346 |
timeout_msec, |
| 5347 |
cancellable, |
| 5348 |
error); |
| 5349 |
if (_ret == NULL) |
| 5350 |
goto _out; |
| 5351 |
g_variant_get (_ret, |
| 5352 |
"()"); |
| 5353 |
g_variant_unref (_ret); |
| 5354 |
_out: |
| 5355 |
return _ret != NULL; |
| 5356 |
} |
| 5357 |
|
| 5358 |
|
| 5359 |
|
| 5360 |
|
| 5361 |
|
| 5362 |
|
| 5363 |
|
| 5364 |
|
| 5365 |
|
| 5366 |
|
| 5367 |
void |
| 5368 |
gpiodbus_request_complete_release ( |
| 5369 |
GpiodbusRequest *object G_GNUC_UNUSED, |
| 5370 |
GDBusMethodInvocation *invocation) |
| 5371 |
{ |
| 5372 |
g_dbus_method_invocation_return_value (invocation, |
| 5373 |
g_variant_new ("()")); |
| 5374 |
} |
| 5375 |
|
| 5376 |
|
| 5377 |
|
| 5378 |
|
| 5379 |
|
| 5380 |
|
| 5381 |
|
| 5382 |
|
| 5383 |
|
| 5384 |
|
| 5385 |
void |
| 5386 |
gpiodbus_request_complete_reconfigure_lines ( |
| 5387 |
GpiodbusRequest *object G_GNUC_UNUSED, |
| 5388 |
GDBusMethodInvocation *invocation) |
| 5389 |
{ |
| 5390 |
g_dbus_method_invocation_return_value (invocation, |
| 5391 |
g_variant_new ("()")); |
| 5392 |
} |
| 5393 |
|
| 5394 |
|
| 5395 |
|
| 5396 |
|
| 5397 |
|
| 5398 |
|
| 5399 |
|
| 5400 |
|
| 5401 |
|
| 5402 |
|
| 5403 |
|
| 5404 |
void |
| 5405 |
gpiodbus_request_complete_get_values ( |
| 5406 |
GpiodbusRequest *object G_GNUC_UNUSED, |
| 5407 |
GDBusMethodInvocation *invocation, |
| 5408 |
GVariant *values) |
| 5409 |
{ |
| 5410 |
g_dbus_method_invocation_return_value (invocation, |
| 5411 |
g_variant_new ("(@ai)", |
| 5412 |
values)); |
| 5413 |
} |
| 5414 |
|
| 5415 |
|
| 5416 |
|
| 5417 |
|
| 5418 |
|
| 5419 |
|
| 5420 |
|
| 5421 |
|
| 5422 |
|
| 5423 |
|
| 5424 |
void |
| 5425 |
gpiodbus_request_complete_set_values ( |
| 5426 |
GpiodbusRequest *object G_GNUC_UNUSED, |
| 5427 |
GDBusMethodInvocation *invocation) |
| 5428 |
{ |
| 5429 |
g_dbus_method_invocation_return_value (invocation, |
| 5430 |
g_variant_new ("()")); |
| 5431 |
} |
| 5432 |
|
| 5433 |
|
| 5434 |
|
| 5435 |
|
| 5436 |
|
| 5437 |
|
| 5438 |
|
| 5439 |
|
| 5440 |
|
| 5441 |
|
| 5442 |
|
| 5443 |
|
| 5444 |
|
| 5445 |
|
| 5446 |
|
| 5447 |
|
| 5448 |
struct _GpiodbusRequestProxyPrivate |
| 5449 |
{ |
| 5450 |
GData *qdata; |
| 5451 |
}; |
| 5452 |
|
| 5453 |
static void gpiodbus_request_proxy_iface_init (GpiodbusRequestIface *iface); |
| 5454 |
|
| 5455 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5456 |
G_DEFINE_TYPE_WITH_CODE (GpiodbusRequestProxy, gpiodbus_request_proxy, G_TYPE_DBUS_PROXY, |
| 5457 |
G_ADD_PRIVATE (GpiodbusRequestProxy) |
| 5458 |
G_IMPLEMENT_INTERFACE (GPIODBUS_TYPE_REQUEST, gpiodbus_request_proxy_iface_init)) |
| 5459 |
|
| 5460 |
#else |
| 5461 |
G_DEFINE_TYPE_WITH_CODE (GpiodbusRequestProxy, gpiodbus_request_proxy, G_TYPE_DBUS_PROXY, |
| 5462 |
G_IMPLEMENT_INTERFACE (GPIODBUS_TYPE_REQUEST, gpiodbus_request_proxy_iface_init)) |
| 5463 |
|
| 5464 |
#endif |
| 5465 |
static void |
| 5466 |
gpiodbus_request_proxy_finalize (GObject *object) |
| 5467 |
{ |
| 5468 |
GpiodbusRequestProxy *proxy = GPIODBUS_REQUEST_PROXY (object); |
| 5469 |
g_datalist_clear (&proxy->priv->qdata); |
| 5470 |
G_OBJECT_CLASS (gpiodbus_request_proxy_parent_class)->finalize (object); |
| 5471 |
} |
| 5472 |
|
| 5473 |
static void |
| 5474 |
gpiodbus_request_proxy_get_property (GObject *object, |
| 5475 |
guint prop_id, |
| 5476 |
GValue *value, |
| 5477 |
GParamSpec *pspec G_GNUC_UNUSED) |
| 5478 |
{ |
| 5479 |
const _ExtendedGDBusPropertyInfo *info; |
| 5480 |
GVariant *variant; |
| 5481 |
g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 5482 |
info = (const _ExtendedGDBusPropertyInfo *) _gpiodbus_request_property_info_pointers[prop_id - 1]; |
| 5483 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
| 5484 |
if (info->use_gvariant) |
| 5485 |
{ |
| 5486 |
g_value_set_variant (value, variant); |
| 5487 |
} |
| 5488 |
else |
| 5489 |
{ |
| 5490 |
if (variant != NULL) |
| 5491 |
g_dbus_gvariant_to_gvalue (variant, value); |
| 5492 |
} |
| 5493 |
if (variant != NULL) |
| 5494 |
g_variant_unref (variant); |
| 5495 |
} |
| 5496 |
|
| 5497 |
static void |
| 5498 |
gpiodbus_request_proxy_set_property_cb (GDBusProxy *proxy, |
| 5499 |
GAsyncResult *res, |
| 5500 |
gpointer user_data) |
| 5501 |
{ |
| 5502 |
const _ExtendedGDBusPropertyInfo *info = user_data; |
| 5503 |
GError *error; |
| 5504 |
GVariant *_ret; |
| 5505 |
error = NULL; |
| 5506 |
_ret = g_dbus_proxy_call_finish (proxy, res, &error); |
| 5507 |
if (!_ret) |
| 5508 |
{ |
| 5509 |
g_warning ("Error setting property '%s' on interface io.gpiod1.Request: %s (%s, %d)", |
| 5510 |
info->parent_struct.name, |
| 5511 |
error->message, g_quark_to_string (error->domain), error->code); |
| 5512 |
g_error_free (error); |
| 5513 |
} |
| 5514 |
else |
| 5515 |
{ |
| 5516 |
g_variant_unref (_ret); |
| 5517 |
} |
| 5518 |
} |
| 5519 |
|
| 5520 |
static void |
| 5521 |
gpiodbus_request_proxy_set_property (GObject *object, |
| 5522 |
guint prop_id, |
| 5523 |
const GValue *value, |
| 5524 |
GParamSpec *pspec G_GNUC_UNUSED) |
| 5525 |
{ |
| 5526 |
const _ExtendedGDBusPropertyInfo *info; |
| 5527 |
GVariant *variant; |
| 5528 |
g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 5529 |
info = (const _ExtendedGDBusPropertyInfo *) _gpiodbus_request_property_info_pointers[prop_id - 1]; |
| 5530 |
variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 5531 |
g_dbus_proxy_call (G_DBUS_PROXY (object), |
| 5532 |
"org.freedesktop.DBus.Properties.Set", |
| 5533 |
g_variant_new ("(ssv)", "io.gpiod1.Request", info->parent_struct.name, variant), |
| 5534 |
G_DBUS_CALL_FLAGS_NONE, |
| 5535 |
-1, |
| 5536 |
NULL, (GAsyncReadyCallback) gpiodbus_request_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
| 5537 |
g_variant_unref (variant); |
| 5538 |
} |
| 5539 |
|
| 5540 |
static void |
| 5541 |
gpiodbus_request_proxy_g_signal (GDBusProxy *proxy, |
| 5542 |
const gchar *sender_name G_GNUC_UNUSED, |
| 5543 |
const gchar *signal_name, |
| 5544 |
GVariant *parameters) |
| 5545 |
{ |
| 5546 |
_ExtendedGDBusSignalInfo *info; |
| 5547 |
GVariantIter iter; |
| 5548 |
GVariant *child; |
| 5549 |
GValue *paramv; |
| 5550 |
gsize num_params; |
| 5551 |
gsize n; |
| 5552 |
guint signal_id; |
| 5553 |
info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gpiodbus_request_interface_info.parent_struct, signal_name); |
| 5554 |
if (info == NULL) |
| 5555 |
return; |
| 5556 |
num_params = g_variant_n_children (parameters); |
| 5557 |
paramv = g_new0 (GValue, num_params + 1); |
| 5558 |
g_value_init (¶mv[0], GPIODBUS_TYPE_REQUEST); |
| 5559 |
g_value_set_object (¶mv[0], proxy); |
| 5560 |
g_variant_iter_init (&iter, parameters); |
| 5561 |
n = 1; |
| 5562 |
while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 5563 |
{ |
| 5564 |
_ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
| 5565 |
if (arg_info->use_gvariant) |
| 5566 |
{ |
| 5567 |
g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 5568 |
g_value_set_variant (¶mv[n], child); |
| 5569 |
n++; |
| 5570 |
} |
| 5571 |
else |
| 5572 |
g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 5573 |
g_variant_unref (child); |
| 5574 |
} |
| 5575 |
signal_id = g_signal_lookup (info->signal_name, GPIODBUS_TYPE_REQUEST); |
| 5576 |
g_signal_emitv (paramv, signal_id, 0, NULL); |
| 5577 |
for (n = 0; n < num_params + 1; n++) |
| 5578 |
g_value_unset (¶mv[n]); |
| 5579 |
g_free (paramv); |
| 5580 |
} |
| 5581 |
|
| 5582 |
static void |
| 5583 |
gpiodbus_request_proxy_g_properties_changed (GDBusProxy *_proxy, |
| 5584 |
GVariant *changed_properties, |
| 5585 |
const gchar *const *invalidated_properties) |
| 5586 |
{ |
| 5587 |
GpiodbusRequestProxy *proxy = GPIODBUS_REQUEST_PROXY (_proxy); |
| 5588 |
guint n; |
| 5589 |
const gchar *key; |
| 5590 |
GVariantIter *iter; |
| 5591 |
_ExtendedGDBusPropertyInfo *info; |
| 5592 |
g_variant_get (changed_properties, "a{sv}", &iter); |
| 5593 |
while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
| 5594 |
{ |
| 5595 |
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gpiodbus_request_interface_info.parent_struct, key); |
| 5596 |
g_datalist_remove_data (&proxy->priv->qdata, key); |
| 5597 |
if (info != NULL) |
| 5598 |
g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 5599 |
} |
| 5600 |
g_variant_iter_free (iter); |
| 5601 |
for (n = 0; invalidated_properties[n] != NULL; n++) |
| 5602 |
{ |
| 5603 |
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gpiodbus_request_interface_info.parent_struct, invalidated_properties[n]); |
| 5604 |
g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
| 5605 |
if (info != NULL) |
| 5606 |
g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
| 5607 |
} |
| 5608 |
} |
| 5609 |
|
| 5610 |
static const gchar * |
| 5611 |
gpiodbus_request_proxy_get_chip_path (GpiodbusRequest *object) |
| 5612 |
{ |
| 5613 |
GpiodbusRequestProxy *proxy = GPIODBUS_REQUEST_PROXY (object); |
| 5614 |
GVariant *variant; |
| 5615 |
const gchar *value = NULL; |
| 5616 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ChipPath"); |
| 5617 |
if (variant != NULL) |
| 5618 |
{ |
| 5619 |
value = g_variant_get_string (variant, NULL); |
| 5620 |
g_variant_unref (variant); |
| 5621 |
} |
| 5622 |
return value; |
| 5623 |
} |
| 5624 |
|
| 5625 |
static const gchar *const * |
| 5626 |
gpiodbus_request_proxy_get_line_paths (GpiodbusRequest *object) |
| 5627 |
{ |
| 5628 |
GpiodbusRequestProxy *proxy = GPIODBUS_REQUEST_PROXY (object); |
| 5629 |
GVariant *variant; |
| 5630 |
const gchar *const *value = NULL; |
| 5631 |
value = g_datalist_get_data (&proxy->priv->qdata, "LinePaths"); |
| 5632 |
if (value != NULL) |
| 5633 |
return value; |
| 5634 |
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "LinePaths"); |
| 5635 |
if (variant != NULL) |
| 5636 |
{ |
| 5637 |
value = g_variant_get_objv (variant, NULL); |
| 5638 |
g_datalist_set_data_full (&proxy->priv->qdata, "LinePaths", (gpointer) value, g_free); |
| 5639 |
g_variant_unref (variant); |
| 5640 |
} |
| 5641 |
return value; |
| 5642 |
} |
| 5643 |
|
| 5644 |
static void |
| 5645 |
gpiodbus_request_proxy_init (GpiodbusRequestProxy *proxy) |
| 5646 |
{ |
| 5647 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 5648 |
proxy->priv = gpiodbus_request_proxy_get_instance_private (proxy); |
| 5649 |
#else |
| 5650 |
proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, GPIODBUS_TYPE_REQUEST_PROXY, GpiodbusRequestProxyPrivate); |
| 5651 |
#endif |
| 5652 |
|
| 5653 |
g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gpiodbus_request_interface_info ()); |
| 5654 |
} |
| 5655 |
|
| 5656 |
static void |
| 5657 |
gpiodbus_request_proxy_class_init (GpiodbusRequestProxyClass *klass) |
| 5658 |
{ |
| 5659 |
GObjectClass *gobject_class; |
| 5660 |
GDBusProxyClass *proxy_class; |
| 5661 |
|
| 5662 |
gobject_class = G_OBJECT_CLASS (klass); |
| 5663 |
gobject_class->finalize = gpiodbus_request_proxy_finalize; |
| 5664 |
gobject_class->get_property = gpiodbus_request_proxy_get_property; |
| 5665 |
gobject_class->set_property = gpiodbus_request_proxy_set_property; |
| 5666 |
|
| 5667 |
proxy_class = G_DBUS_PROXY_CLASS (klass); |
| 5668 |
proxy_class->g_signal = gpiodbus_request_proxy_g_signal; |
| 5669 |
proxy_class->g_properties_changed = gpiodbus_request_proxy_g_properties_changed; |
| 5670 |
|
| 5671 |
gpiodbus_request_override_properties (gobject_class, 1); |
| 5672 |
|
| 5673 |
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 5674 |
g_type_class_add_private (klass, sizeof (GpiodbusRequestProxyPrivate)); |
| 5675 |
#endif |
| 5676 |
} |
| 5677 |
|
| 5678 |
static void |
| 5679 |
gpiodbus_request_proxy_iface_init (GpiodbusRequestIface *iface) |
| 5680 |
{ |
| 5681 |
iface->get_chip_path = gpiodbus_request_proxy_get_chip_path; |
| 5682 |
iface->get_line_paths = gpiodbus_request_proxy_get_line_paths; |
| 5683 |
} |
| 5684 |
|
| 5685 |
|
| 5686 |
|
| 5687 |
|
| 5688 |
|
| 5689 |
|
| 5690 |
|
| 5691 |
|
| 5692 |
|
| 5693 |
|
| 5694 |
|
| 5695 |
|
| 5696 |
|
| 5697 |
|
| 5698 |
|
| 5699 |
|
| 5700 |
|
| 5701 |
|
| 5702 |
void |
| 5703 |
gpiodbus_request_proxy_new ( |
| 5704 |
GDBusConnection *connection, |
| 5705 |
GDBusProxyFlags flags, |
| 5706 |
const gchar *name, |
| 5707 |
const gchar *object_path, |
| 5708 |
GCancellable *cancellable, |
| 5709 |
GAsyncReadyCallback callback, |
| 5710 |
gpointer user_data) |
| 5711 |
{ |
| 5712 |
g_async_initable_new_async (GPIODBUS_TYPE_REQUEST_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "io.gpiod1.Request", NULL); |
| 5713 |
} |
| 5714 |
|
| 5715 |
|
| 5716 |
|
| 5717 |
|
| 5718 |
|
| 5719 |
|
| 5720 |
|
| 5721 |
|
| 5722 |
|
| 5723 |
|
| 5724 |
GpiodbusRequest * |
| 5725 |
gpiodbus_request_proxy_new_finish ( |
| 5726 |
GAsyncResult *res, |
| 5727 |
GError **error) |
| 5728 |
{ |
| 5729 |
GObject *ret; |
| 5730 |
GObject *source_object; |
| 5731 |
source_object = g_async_result_get_source_object (res); |
| 5732 |
ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 5733 |
g_object_unref (source_object); |
| 5734 |
if (ret != NULL) |
| 5735 |
return GPIODBUS_REQUEST (ret); |
| 5736 |
else |
| 5737 |
return NULL; |
| 5738 |
} |
| 5739 |
|
| 5740 |
|
| 5741 |
|
| 5742 |
|
| 5743 |
|
| 5744 |
|
| 5745 |
|
| 5746 |
|
| 5747 |
|
| 5748 |
|
| 5749 |
|
| 5750 |
|
| 5751 |
|
| 5752 |
|
| 5753 |
|
| 5754 |
|
| 5755 |
|
| 5756 |
|
| 5757 |
GpiodbusRequest * |
| 5758 |
gpiodbus_request_proxy_new_sync ( |
| 5759 |
GDBusConnection *connection, |
| 5760 |
GDBusProxyFlags flags, |
| 5761 |
const gchar *name, |
| 5762 |
const gchar *object_path, |
| 5763 |
GCancellable *cancellable, |
| 5764 |
GError **error) |
| 5765 |
{ |
| 5766 |
GInitable *ret; |
| 5767 |
ret = g_initable_new (GPIODBUS_TYPE_REQUEST_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "io.gpiod1.Request", NULL); |
| 5768 |
if (ret != NULL) |
| 5769 |
return GPIODBUS_REQUEST (ret); |
| 5770 |
else |
| 5771 |
return NULL; |
| 5772 |
} |
| 5773 |
|
| 5774 |
|
| 5775 |
|
| 5776 |
|
| 5777 |
|
| 5778 |
|
| 5779 |
|
| 5780 |
|
| 5781 |
|
| 5782 |
|
| 5783 |
|
| 5784 |
|
| 5785 |
|
| 5786 |
|
| 5787 |
|
| 5788 |
|
| 5789 |
|
| 5790 |
|
| 5791 |
|
| 5792 |
void |
| 5793 |
gpiodbus_request_proxy_new_for_bus ( |
| 5794 |
GBusType bus_type, |
| 5795 |
GDBusProxyFlags flags, |
| 5796 |
const gchar *name, |
| 5797 |
const gchar *object_path, |
| 5798 |
GCancellable *cancellable, |
| 5799 |
GAsyncReadyCallback callback, |
| 5800 |
gpointer user_data) |
| 5801 |
{ |
| 5802 |
g_async_initable_new_async (GPIODBUS_TYPE_REQUEST_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "io.gpiod1.Request", NULL); |
| 5803 |
} |
| 5804 |
|
| 5805 |
|
| 5806 |
|
| 5807 |
|
| 5808 |
|
| 5809 |
|
| 5810 |
|
| 5811 |
|
| 5812 |
|
| 5813 |
|
| 5814 |
GpiodbusRequest * |
| 5815 |
gpiodbus_request_proxy_new_for_bus_finish ( |
| 5816 |
GAsyncResult *res, |
| 5817 |
GError **error) |
| 5818 |
{ |
| 5819 |
GObject *ret; |
| 5820 |
GObject *source_object; |
| 5821 |
source_object = g_async_result_get_source_object (res); |
| 5822 |
ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 5823 |
g_object_unref (source_object); |
| 5824 |
if (ret != NULL) |
| 5825 |
return GPIODBUS_REQUEST (ret); |
| 5826 |
else |
| 5827 |
return NULL; |
| 5828 |
} |
| 5829 |
|
| 5830 |
|
| 5831 |
|
| 5832 |
|
| 5833 |
|
| 5834 |
|
| 5835 |
|
| 5836 |
|
| 5837 |
|
| 5838 |
|
| 5839 |
|
| 5840 |
|
| 5841 |
|
| 5842 |
|
| 5843 |
|
| 5844 |
|
| 5845 |
|
| 5846 |
|
| 5847 |
GpiodbusRequest * |
| 5848 |
gpiodbus_request_proxy_new_for_bus_sync ( |
| 5849 |
GBusType bus_type, |
| 5850 |
GDBusProxyFlags flags, |
| 5851 |
const gchar *name, |
| 5852 |
const gchar *object_path, |
| 5853 |
GCancellable *cancellable, |
| 5854 |
GError **error) |
| 5855 |
{ |
| 5856 |
GInitable *ret; |
| 5857 |
ret = g_initable_new (GPIODBUS_TYPE_REQUEST_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "io.gpiod1.Request", NULL); |
| 5858 |
if (ret != NULL) |
| 5859 |
return GPIODBUS_REQUEST (ret); |
| 5860 |
else |
| 5861 |
return NULL; |
| 5862 |
} |
| 5863 |
|
| 5864 |
|
| 5865 |
|
| 5866 |
|
| 5867 |
|
| 5868 |
|
| 5869 |
|
| 5870 |
|
| 5871 |
|
| 5872 |
|
| 5873 |
|
| 5874 |
|
| 5875 |
|
| 5876 |
|
| 5877 |
|
| 5878 |
|
| 5879 |
|
| 5880 |
struct _GpiodbusRequestSkeletonPrivate |
| 5881 |
{ |
| 5882 |
GValue *properties; |
| 5883 |
GList *changed_properties; |
| 5884 |
GSource *changed_properties_idle_source; |
| 5885 |
GMainContext *context; |
| 5886 |
GMutex lock; |
| 5887 |
}; |
| 5888 |
|
| 5889 |
static void |
| 5890 |
_gpiodbus_request_skeleton_handle_method_call ( |
| 5891 |
GDBusConnection *connection G_GNUC_UNUSED, |
| 5892 |
const gchar *sender G_GNUC_UNUSED, |
| 5893 |
const gchar *object_path G_GNUC_UNUSED, |
| 5894 |
const gchar *interface_name, |
| 5895 |
const gchar *method_name, |
| 5896 |
GVariant *parameters, |
| 5897 |
GDBusMethodInvocation *invocation, |
| 5898 |
gpointer user_data) |
| 5899 |
{ |
| 5900 |
GpiodbusRequestSkeleton *skeleton = GPIODBUS_REQUEST_SKELETON (user_data); |
| 5901 |
_ExtendedGDBusMethodInfo *info; |
| 5902 |
GVariantIter iter; |
| 5903 |
GVariant *child; |
| 5904 |
GValue *paramv; |
| 5905 |
gsize num_params; |
| 5906 |
guint num_extra; |
| 5907 |
gsize n; |
| 5908 |
guint signal_id; |
| 5909 |
GValue return_value = G_VALUE_INIT; |
| 5910 |
info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
| 5911 |
g_assert (info != NULL); |
| 5912 |
num_params = g_variant_n_children (parameters); |
| 5913 |
num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
| 5914 |
n = 0; |
| 5915 |
g_value_init (¶mv[n], GPIODBUS_TYPE_REQUEST); |
| 5916 |
g_value_set_object (¶mv[n++], skeleton); |
| 5917 |
g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
| 5918 |
g_value_set_object (¶mv[n++], invocation); |
| 5919 |
if (info->pass_fdlist) |
| 5920 |
{ |
| 5921 |
#ifdef G_OS_UNIX |
| 5922 |
g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
| 5923 |
g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
| 5924 |
#else |
| 5925 |
g_assert_not_reached (); |
| 5926 |
#endif |
| 5927 |
} |
| 5928 |
g_variant_iter_init (&iter, parameters); |
| 5929 |
while ((child = g_variant_iter_next_value (&iter)) != NULL) |
| 5930 |
{ |
| 5931 |
_ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
| 5932 |
if (arg_info->use_gvariant) |
| 5933 |
{ |
| 5934 |
g_value_init (¶mv[n], G_TYPE_VARIANT); |
| 5935 |
g_value_set_variant (¶mv[n], child); |
| 5936 |
n++; |
| 5937 |
} |
| 5938 |
else |
| 5939 |
g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
| 5940 |
g_variant_unref (child); |
| 5941 |
} |
| 5942 |
signal_id = g_signal_lookup (info->signal_name, GPIODBUS_TYPE_REQUEST); |
| 5943 |
g_value_init (&return_value, G_TYPE_BOOLEAN); |
| 5944 |
g_signal_emitv (paramv, signal_id, 0, &return_value); |
| 5945 |
if (!g_value_get_boolean (&return_value)) |
| 5946 |
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name); |
| 5947 |
g_value_unset (&return_value); |
| 5948 |
for (n = 0; n < num_params + num_extra; n++) |
| 5949 |
g_value_unset (¶mv[n]); |
| 5950 |
g_free (paramv); |
| 5951 |
} |
| 5952 |
|
| 5953 |
static GVariant * |
| 5954 |
_gpiodbus_request_skeleton_handle_get_property ( |
| 5955 |
GDBusConnection *connection G_GNUC_UNUSED, |
| 5956 |
const gchar *sender G_GNUC_UNUSED, |
| 5957 |
const gchar *object_path G_GNUC_UNUSED, |
| 5958 |
const gchar *interface_name G_GNUC_UNUSED, |
| 5959 |
const gchar *property_name, |
| 5960 |
GError **error, |
| 5961 |
gpointer user_data) |
| 5962 |
{ |
| 5963 |
GpiodbusRequestSkeleton *skeleton = GPIODBUS_REQUEST_SKELETON (user_data); |
| 5964 |
GValue value = G_VALUE_INIT; |
| 5965 |
GParamSpec *pspec; |
| 5966 |
_ExtendedGDBusPropertyInfo *info; |
| 5967 |
GVariant *ret; |
| 5968 |
ret = NULL; |
| 5969 |
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gpiodbus_request_interface_info.parent_struct, property_name); |
| 5970 |
g_assert (info != NULL); |
| 5971 |
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 5972 |
if (pspec == NULL) |
| 5973 |
{ |
| 5974 |
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 5975 |
} |
| 5976 |
else |
| 5977 |
{ |
| 5978 |
g_value_init (&value, pspec->value_type); |
| 5979 |
g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 5980 |
ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
| 5981 |
g_value_unset (&value); |
| 5982 |
} |
| 5983 |
return ret; |
| 5984 |
} |
| 5985 |
|
| 5986 |
static gboolean |
| 5987 |
_gpiodbus_request_skeleton_handle_set_property ( |
| 5988 |
GDBusConnection *connection G_GNUC_UNUSED, |
| 5989 |
const gchar *sender G_GNUC_UNUSED, |
| 5990 |
const gchar *object_path G_GNUC_UNUSED, |
| 5991 |
const gchar *interface_name G_GNUC_UNUSED, |
| 5992 |
const gchar *property_name, |
| 5993 |
GVariant *variant, |
| 5994 |
GError **error, |
| 5995 |
gpointer user_data) |
| 5996 |
{ |
| 5997 |
GpiodbusRequestSkeleton *skeleton = GPIODBUS_REQUEST_SKELETON (user_data); |
| 5998 |
GValue value = G_VALUE_INIT; |
| 5999 |
GParamSpec *pspec; |
| 6000 |
_ExtendedGDBusPropertyInfo *info; |
| 6001 |
gboolean ret; |
| 6002 |
ret = FALSE; |
| 6003 |
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gpiodbus_request_interface_info.parent_struct, property_name); |
| 6004 |
g_assert (info != NULL); |
| 6005 |
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
| 6006 |
if (pspec == NULL) |
| 6007 |
{ |
| 6008 |
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
| 6009 |
} |
| 6010 |
else |
| 6011 |
{ |
| 6012 |
if (info->use_gvariant) |
| 6013 |
g_value_set_variant (&value, variant); |
| 6014 |
else |
| 6015 |
g_dbus_gvariant_to_gvalue (variant, &value); |
| 6016 |
g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
| 6017 |
g_value_unset (&value); |
| 6018 |
ret = TRUE; |
| 6019 |
} |
| 6020 |
return ret; |
| 6021 |
} |
| 6022 |
|
| 6023 |
static const GDBusInterfaceVTable _gpiodbus_request_skeleton_vtable = |
| 6024 |
{ |
| 6025 |
_gpiodbus_request_skeleton_handle_method_call, |
| 6026 |
_gpiodbus_request_skeleton_handle_get_property, |
| 6027 |
_gpiodbus_request_skeleton_handle_set_property, |
| 6028 |
{NULL} |
| 6029 |
}; |
| 6030 |
|
| 6031 |
static GDBusInterfaceInfo * |
| 6032 |
gpiodbus_request_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 6033 |
{ |
| 6034 |
return gpiodbus_request_interface_info (); |
| 6035 |
} |
| 6036 |
|
| 6037 |
static GDBusInterfaceVTable * |
| 6038 |
gpiodbus_request_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
| 6039 |
{ |
| 6040 |
return (GDBusInterfaceVTable *) &_gpiodbus_request_skeleton_vtable; |
| 6041 |
} |
| 6042 |
|
| 6043 |
static GVariant * |
| 6044 |
gpiodbus_request_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
| 6045 |
{ |
| 6046 |
GpiodbusRequestSkeleton *skeleton = GPIODBUS_REQUEST_SKELETON (_skeleton); |
| 6047 |
|
| 6048 |
GVariantBuilder builder; |
| 6049 |
guint n; |
| 6050 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_84 |
| 6051 |
g_variant_builder_init_static (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 6052 |
#else |
| 6053 |
g_variant_builder_init(&builder, G_VARIANT_TYPE ("a{sv}")); |
| 6054 |
#endif |
| 6055 |
if (_gpiodbus_request_interface_info.parent_struct.properties == NULL) |
| 6056 |
goto out; |
| 6057 |
for (n = 0; _gpiodbus_request_interface_info.parent_struct.properties[n] != NULL; n++) |
| 6058 |
{ |
| 6059 |
GDBusPropertyInfo *info = _gpiodbus_request_interface_info.parent_struct.properties[n]; |
| 6060 |
if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
| 6061 |
{ |
| 6062 |
GVariant *value; |
| 6063 |
value = _gpiodbus_request_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "io.gpiod1.Request", info->name, NULL, skeleton); |
| 6064 |
if (value != NULL) |
| 6065 |
{ |
| 6066 |
g_variant_take_ref (value); |
| 6067 |
g_variant_builder_add (&builder, "{sv}", info->name, value); |
| 6068 |
g_variant_unref (value); |
| 6069 |
} |
| 6070 |
} |
| 6071 |
} |
| 6072 |
out: |
| 6073 |
return g_variant_builder_end (&builder); |
| 6074 |
} |
| 6075 |
|
| 6076 |
static gboolean _gpiodbus_request_emit_changed (gpointer user_data); |
| 6077 |
|
| 6078 |
static void |
| 6079 |
gpiodbus_request_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
| 6080 |
{ |
| 6081 |
GpiodbusRequestSkeleton *skeleton = GPIODBUS_REQUEST_SKELETON (_skeleton); |
| 6082 |
gboolean emit_changed = FALSE; |
| 6083 |
|
| 6084 |
g_mutex_lock (&skeleton->priv->lock); |
| 6085 |
if (skeleton->priv->changed_properties_idle_source != NULL) |
| 6086 |
{ |
| 6087 |
g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 6088 |
skeleton->priv->changed_properties_idle_source = NULL; |
| 6089 |
emit_changed = TRUE; |
| 6090 |
} |
| 6091 |
g_mutex_unlock (&skeleton->priv->lock); |
| 6092 |
|
| 6093 |
if (emit_changed) |
| 6094 |
_gpiodbus_request_emit_changed (skeleton); |
| 6095 |
} |
| 6096 |
|
| 6097 |
static void gpiodbus_request_skeleton_iface_init (GpiodbusRequestIface *iface); |
| 6098 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 6099 |
G_DEFINE_TYPE_WITH_CODE (GpiodbusRequestSkeleton, gpiodbus_request_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 6100 |
G_ADD_PRIVATE (GpiodbusRequestSkeleton) |
| 6101 |
G_IMPLEMENT_INTERFACE (GPIODBUS_TYPE_REQUEST, gpiodbus_request_skeleton_iface_init)) |
| 6102 |
|
| 6103 |
#else |
| 6104 |
G_DEFINE_TYPE_WITH_CODE (GpiodbusRequestSkeleton, gpiodbus_request_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
| 6105 |
G_IMPLEMENT_INTERFACE (GPIODBUS_TYPE_REQUEST, gpiodbus_request_skeleton_iface_init)) |
| 6106 |
|
| 6107 |
#endif |
| 6108 |
static void |
| 6109 |
gpiodbus_request_skeleton_finalize (GObject *object) |
| 6110 |
{ |
| 6111 |
GpiodbusRequestSkeleton *skeleton = GPIODBUS_REQUEST_SKELETON (object); |
| 6112 |
guint n; |
| 6113 |
for (n = 0; n < 2; n++) |
| 6114 |
g_value_unset (&skeleton->priv->properties[n]); |
| 6115 |
g_free (skeleton->priv->properties); |
| 6116 |
g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 6117 |
if (skeleton->priv->changed_properties_idle_source != NULL) |
| 6118 |
g_source_destroy (skeleton->priv->changed_properties_idle_source); |
| 6119 |
g_main_context_unref (skeleton->priv->context); |
| 6120 |
g_mutex_clear (&skeleton->priv->lock); |
| 6121 |
G_OBJECT_CLASS (gpiodbus_request_skeleton_parent_class)->finalize (object); |
| 6122 |
} |
| 6123 |
|
| 6124 |
static void |
| 6125 |
gpiodbus_request_skeleton_get_property (GObject *object, |
| 6126 |
guint prop_id, |
| 6127 |
GValue *value, |
| 6128 |
GParamSpec *pspec G_GNUC_UNUSED) |
| 6129 |
{ |
| 6130 |
GpiodbusRequestSkeleton *skeleton = GPIODBUS_REQUEST_SKELETON (object); |
| 6131 |
g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 6132 |
g_mutex_lock (&skeleton->priv->lock); |
| 6133 |
g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
| 6134 |
g_mutex_unlock (&skeleton->priv->lock); |
| 6135 |
} |
| 6136 |
|
| 6137 |
static gboolean |
| 6138 |
_gpiodbus_request_emit_changed (gpointer user_data) |
| 6139 |
{ |
| 6140 |
GpiodbusRequestSkeleton *skeleton = GPIODBUS_REQUEST_SKELETON (user_data); |
| 6141 |
GList *l; |
| 6142 |
GVariantBuilder builder; |
| 6143 |
GVariantBuilder invalidated_builder; |
| 6144 |
guint num_changes; |
| 6145 |
|
| 6146 |
g_mutex_lock (&skeleton->priv->lock); |
| 6147 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_84 |
| 6148 |
g_variant_builder_init_static (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 6149 |
g_variant_builder_init_static (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 6150 |
#else |
| 6151 |
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
| 6152 |
g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
| 6153 |
#endif |
| 6154 |
for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
| 6155 |
{ |
| 6156 |
ChangedProperty *cp = l->data; |
| 6157 |
GVariant *variant; |
| 6158 |
const GValue *cur_value; |
| 6159 |
|
| 6160 |
cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
| 6161 |
if (!_g_value_equal (cur_value, &cp->orig_value)) |
| 6162 |
{ |
| 6163 |
variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
| 6164 |
g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
| 6165 |
g_variant_unref (variant); |
| 6166 |
num_changes++; |
| 6167 |
} |
| 6168 |
} |
| 6169 |
if (num_changes > 0) |
| 6170 |
{ |
| 6171 |
GList *connections, *ll; |
| 6172 |
GVariant *signal_variant; |
| 6173 |
signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "io.gpiod1.Request", |
| 6174 |
&builder, &invalidated_builder)); |
| 6175 |
connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
| 6176 |
for (ll = connections; ll != NULL; ll = ll->next) |
| 6177 |
{ |
| 6178 |
GDBusConnection *connection = ll->data; |
| 6179 |
|
| 6180 |
g_dbus_connection_emit_signal (connection, |
| 6181 |
NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
| 6182 |
"org.freedesktop.DBus.Properties", |
| 6183 |
"PropertiesChanged", |
| 6184 |
signal_variant, |
| 6185 |
NULL); |
| 6186 |
} |
| 6187 |
g_variant_unref (signal_variant); |
| 6188 |
g_list_free_full (connections, g_object_unref); |
| 6189 |
} |
| 6190 |
else |
| 6191 |
{ |
| 6192 |
g_variant_builder_clear (&builder); |
| 6193 |
g_variant_builder_clear (&invalidated_builder); |
| 6194 |
} |
| 6195 |
g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
| 6196 |
skeleton->priv->changed_properties = NULL; |
| 6197 |
skeleton->priv->changed_properties_idle_source = NULL; |
| 6198 |
g_mutex_unlock (&skeleton->priv->lock); |
| 6199 |
return FALSE; |
| 6200 |
} |
| 6201 |
|
| 6202 |
static void |
| 6203 |
_gpiodbus_request_schedule_emit_changed (GpiodbusRequestSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
| 6204 |
{ |
| 6205 |
ChangedProperty *cp; |
| 6206 |
GList *l; |
| 6207 |
cp = NULL; |
| 6208 |
for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
| 6209 |
{ |
| 6210 |
ChangedProperty *i_cp = l->data; |
| 6211 |
if (i_cp->info == info) |
| 6212 |
{ |
| 6213 |
cp = i_cp; |
| 6214 |
break; |
| 6215 |
} |
| 6216 |
} |
| 6217 |
if (cp == NULL) |
| 6218 |
{ |
| 6219 |
cp = g_new0 (ChangedProperty, 1); |
| 6220 |
cp->prop_id = prop_id; |
| 6221 |
cp->info = info; |
| 6222 |
skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
| 6223 |
g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
| 6224 |
g_value_copy (orig_value, &cp->orig_value); |
| 6225 |
} |
| 6226 |
} |
| 6227 |
|
| 6228 |
static void |
| 6229 |
gpiodbus_request_skeleton_notify (GObject *object, |
| 6230 |
GParamSpec *pspec G_GNUC_UNUSED) |
| 6231 |
{ |
| 6232 |
GpiodbusRequestSkeleton *skeleton = GPIODBUS_REQUEST_SKELETON (object); |
| 6233 |
g_mutex_lock (&skeleton->priv->lock); |
| 6234 |
if (skeleton->priv->changed_properties != NULL && |
| 6235 |
skeleton->priv->changed_properties_idle_source == NULL) |
| 6236 |
{ |
| 6237 |
skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
| 6238 |
g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
| 6239 |
g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gpiodbus_request_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
| 6240 |
g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gpiodbus_request_emit_changed"); |
| 6241 |
g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
| 6242 |
g_source_unref (skeleton->priv->changed_properties_idle_source); |
| 6243 |
} |
| 6244 |
g_mutex_unlock (&skeleton->priv->lock); |
| 6245 |
} |
| 6246 |
|
| 6247 |
static void |
| 6248 |
gpiodbus_request_skeleton_set_property (GObject *object, |
| 6249 |
guint prop_id, |
| 6250 |
const GValue *value, |
| 6251 |
GParamSpec *pspec) |
| 6252 |
{ |
| 6253 |
const _ExtendedGDBusPropertyInfo *info; |
| 6254 |
GpiodbusRequestSkeleton *skeleton = GPIODBUS_REQUEST_SKELETON (object); |
| 6255 |
g_assert (prop_id != 0 && prop_id - 1 < 2); |
| 6256 |
info = (const _ExtendedGDBusPropertyInfo *) _gpiodbus_request_property_info_pointers[prop_id - 1]; |
| 6257 |
g_mutex_lock (&skeleton->priv->lock); |
| 6258 |
g_object_freeze_notify (object); |
| 6259 |
if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
| 6260 |
{ |
| 6261 |
if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL && |
| 6262 |
info->emits_changed_signal) |
| 6263 |
_gpiodbus_request_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]); |
| 6264 |
g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
| 6265 |
g_object_notify_by_pspec (object, pspec); |
| 6266 |
} |
| 6267 |
g_mutex_unlock (&skeleton->priv->lock); |
| 6268 |
g_object_thaw_notify (object); |
| 6269 |
} |
| 6270 |
|
| 6271 |
static void |
| 6272 |
gpiodbus_request_skeleton_init (GpiodbusRequestSkeleton *skeleton) |
| 6273 |
{ |
| 6274 |
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
| 6275 |
skeleton->priv = gpiodbus_request_skeleton_get_instance_private (skeleton); |
| 6276 |
#else |
| 6277 |
skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, GPIODBUS_TYPE_REQUEST_SKELETON, GpiodbusRequestSkeletonPrivate); |
| 6278 |
#endif |
| 6279 |
|
| 6280 |
g_mutex_init (&skeleton->priv->lock); |
| 6281 |
skeleton->priv->context = g_main_context_ref_thread_default (); |
| 6282 |
skeleton->priv->properties = g_new0 (GValue, 2); |
| 6283 |
g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
| 6284 |
g_value_init (&skeleton->priv->properties[1], G_TYPE_STRV); |
| 6285 |
} |
| 6286 |
|
| 6287 |
static const gchar * |
| 6288 |
gpiodbus_request_skeleton_get_chip_path (GpiodbusRequest *object) |
| 6289 |
{ |
| 6290 |
GpiodbusRequestSkeleton *skeleton = GPIODBUS_REQUEST_SKELETON (object); |
| 6291 |
const gchar *value; |
| 6292 |
g_mutex_lock (&skeleton->priv->lock); |
| 6293 |
value = g_marshal_value_peek_string (&(skeleton->priv->properties[0])); |
| 6294 |
g_mutex_unlock (&skeleton->priv->lock); |
| 6295 |
return value; |
| 6296 |
} |
| 6297 |
|
| 6298 |
static const gchar *const * |
| 6299 |
gpiodbus_request_skeleton_get_line_paths (GpiodbusRequest *object) |
| 6300 |
{ |
| 6301 |
GpiodbusRequestSkeleton *skeleton = GPIODBUS_REQUEST_SKELETON (object); |
| 6302 |
const gchar *const *value; |
| 6303 |
g_mutex_lock (&skeleton->priv->lock); |
| 6304 |
value = g_marshal_value_peek_boxed (&(skeleton->priv->properties[1])); |
| 6305 |
g_mutex_unlock (&skeleton->priv->lock); |
| 6306 |
return value; |
| 6307 |
} |
| 6308 |
|
| 6309 |
static void |
| 6310 |
gpiodbus_request_skeleton_class_init (GpiodbusRequestSkeletonClass *klass) |
| 6311 |
{ |
| 6312 |
GObjectClass *gobject_class; |
| 6313 |
GDBusInterfaceSkeletonClass *skeleton_class; |
| 6314 |
|
| 6315 |
gobject_class = G_OBJECT_CLASS (klass); |
| 6316 |
gobject_class->finalize = gpiodbus_request_skeleton_finalize; |
| 6317 |
gobject_class->get_property = gpiodbus_request_skeleton_get_property; |
| 6318 |
gobject_class->set_property = gpiodbus_request_skeleton_set_property; |
| 6319 |
gobject_class->notify = gpiodbus_request_skeleton_notify; |
| 6320 |
|
| 6321 |
|
| 6322 |
gpiodbus_request_override_properties (gobject_class, 1); |
| 6323 |
|
| 6324 |
skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
| 6325 |
skeleton_class->get_info = gpiodbus_request_skeleton_dbus_interface_get_info; |
| 6326 |
skeleton_class->get_properties = gpiodbus_request_skeleton_dbus_interface_get_properties; |
| 6327 |
skeleton_class->flush = gpiodbus_request_skeleton_dbus_interface_flush; |
| 6328 |
skeleton_class->get_vtable = gpiodbus_request_skeleton_dbus_interface_get_vtable; |
| 6329 |
|
| 6330 |
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
| 6331 |
g_type_class_add_private (klass, sizeof (GpiodbusRequestSkeletonPrivate)); |
| 6332 |
#endif |
| 6333 |
} |
| 6334 |
|
| 6335 |
static void |
| 6336 |
gpiodbus_request_skeleton_iface_init (GpiodbusRequestIface *iface) |
| 6337 |
{ |
| 6338 |
iface->get_chip_path = gpiodbus_request_skeleton_get_chip_path; |
| 6339 |
iface->get_line_paths = gpiodbus_request_skeleton_get_line_paths; |
| 6340 |
} |
| 6341 |
|
| 6342 |
|
| 6343 |
|
| 6344 |
|
| 6345 |
|
| 6346 |
|
| 6347 |
|
| 6348 |
|
| 6349 |
GpiodbusRequest * |
| 6350 |
gpiodbus_request_skeleton_new (void) |
| 6351 |
{ |
| 6352 |
return GPIODBUS_REQUEST (g_object_new (GPIODBUS_TYPE_REQUEST_SKELETON, NULL)); |
| 6353 |
} |
| 6354 |
|
| 6355 |
|
| 6356 |
|
| 6357 |
|
| 6358 |
|
| 6359 |
|
| 6360 |
|
| 6361 |
|
| 6362 |
|
| 6363 |
|
| 6364 |
|
| 6365 |
|
| 6366 |
|
| 6367 |
|
| 6368 |
|
| 6369 |
|
| 6370 |
|
| 6371 |
|
| 6372 |
|
| 6373 |
|
| 6374 |
|
| 6375 |
|
| 6376 |
|
| 6377 |
|
| 6378 |
|
| 6379 |
|
| 6380 |
|
| 6381 |
typedef GpiodbusObjectIface GpiodbusObjectInterface; |
| 6382 |
G_DEFINE_INTERFACE_WITH_CODE (GpiodbusObject, gpiodbus_object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT);) |
| 6383 |
|
| 6384 |
static void |
| 6385 |
gpiodbus_object_default_init (GpiodbusObjectIface *iface) |
| 6386 |
{ |
| 6387 |
|
| 6388 |
|
| 6389 |
|
| 6390 |
|
| 6391 |
|
| 6392 |
|
| 6393 |
|
| 6394 |
g_object_interface_install_property (iface, g_param_spec_object ("chip", "chip", "chip", GPIODBUS_TYPE_CHIP, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6395 |
|
| 6396 |
|
| 6397 |
|
| 6398 |
|
| 6399 |
|
| 6400 |
|
| 6401 |
|
| 6402 |
|
| 6403 |
g_object_interface_install_property (iface, g_param_spec_object ("line", "line", "line", GPIODBUS_TYPE_LINE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6404 |
|
| 6405 |
|
| 6406 |
|
| 6407 |
|
| 6408 |
|
| 6409 |
|
| 6410 |
|
| 6411 |
|
| 6412 |
g_object_interface_install_property (iface, g_param_spec_object ("request", "request", "request", GPIODBUS_TYPE_REQUEST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 6413 |
|
| 6414 |
} |
| 6415 |
|
| 6416 |
|
| 6417 |
|
| 6418 |
|
| 6419 |
|
| 6420 |
|
| 6421 |
|
| 6422 |
|
| 6423 |
|
| 6424 |
GpiodbusChip *gpiodbus_object_get_chip (GpiodbusObject *object) |
| 6425 |
{ |
| 6426 |
GDBusInterface *ret; |
| 6427 |
ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "io.gpiod1.Chip"); |
| 6428 |
if (ret == NULL) |
| 6429 |
return NULL; |
| 6430 |
return GPIODBUS_CHIP (ret); |
| 6431 |
} |
| 6432 |
|
| 6433 |
|
| 6434 |
|
| 6435 |
|
| 6436 |
|
| 6437 |
|
| 6438 |
|
| 6439 |
|
| 6440 |
|
| 6441 |
GpiodbusLine *gpiodbus_object_get_line (GpiodbusObject *object) |
| 6442 |
{ |
| 6443 |
GDBusInterface *ret; |
| 6444 |
ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "io.gpiod1.Line"); |
| 6445 |
if (ret == NULL) |
| 6446 |
return NULL; |
| 6447 |
return GPIODBUS_LINE (ret); |
| 6448 |
} |
| 6449 |
|
| 6450 |
|
| 6451 |
|
| 6452 |
|
| 6453 |
|
| 6454 |
|
| 6455 |
|
| 6456 |
|
| 6457 |
|
| 6458 |
GpiodbusRequest *gpiodbus_object_get_request (GpiodbusObject *object) |
| 6459 |
{ |
| 6460 |
GDBusInterface *ret; |
| 6461 |
ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "io.gpiod1.Request"); |
| 6462 |
if (ret == NULL) |
| 6463 |
return NULL; |
| 6464 |
return GPIODBUS_REQUEST (ret); |
| 6465 |
} |
| 6466 |
|
| 6467 |
|
| 6468 |
|
| 6469 |
|
| 6470 |
|
| 6471 |
|
| 6472 |
|
| 6473 |
|
| 6474 |
|
| 6475 |
|
| 6476 |
|
| 6477 |
|
| 6478 |
GpiodbusChip *gpiodbus_object_peek_chip (GpiodbusObject *object) |
| 6479 |
{ |
| 6480 |
GDBusInterface *ret; |
| 6481 |
ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "io.gpiod1.Chip"); |
| 6482 |
if (ret == NULL) |
| 6483 |
return NULL; |
| 6484 |
g_object_unref (ret); |
| 6485 |
return GPIODBUS_CHIP (ret); |
| 6486 |
} |
| 6487 |
|
| 6488 |
|
| 6489 |
|
| 6490 |
|
| 6491 |
|
| 6492 |
|
| 6493 |
|
| 6494 |
|
| 6495 |
|
| 6496 |
|
| 6497 |
|
| 6498 |
GpiodbusLine *gpiodbus_object_peek_line (GpiodbusObject *object) |
| 6499 |
{ |
| 6500 |
GDBusInterface *ret; |
| 6501 |
ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "io.gpiod1.Line"); |
| 6502 |
if (ret == NULL) |
| 6503 |
return NULL; |
| 6504 |
g_object_unref (ret); |
| 6505 |
return GPIODBUS_LINE (ret); |
| 6506 |
} |
| 6507 |
|
| 6508 |
|
| 6509 |
|
| 6510 |
|
| 6511 |
|
| 6512 |
|
| 6513 |
|
| 6514 |
|
| 6515 |
|
| 6516 |
|
| 6517 |
|
| 6518 |
GpiodbusRequest *gpiodbus_object_peek_request (GpiodbusObject *object) |
| 6519 |
{ |
| 6520 |
GDBusInterface *ret; |
| 6521 |
ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "io.gpiod1.Request"); |
| 6522 |
if (ret == NULL) |
| 6523 |
return NULL; |
| 6524 |
g_object_unref (ret); |
| 6525 |
return GPIODBUS_REQUEST (ret); |
| 6526 |
} |
| 6527 |
|
| 6528 |
|
| 6529 |
static void |
| 6530 |
gpiodbus_object_notify (GDBusObject *object, GDBusInterface *interface) |
| 6531 |
{ |
| 6532 |
_ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface); |
| 6533 |
|
| 6534 |
|
| 6535 |
|
| 6536 |
if (info != NULL) |
| 6537 |
g_object_notify (G_OBJECT (object), info->hyphen_name); |
| 6538 |
} |
| 6539 |
|
| 6540 |
|
| 6541 |
|
| 6542 |
|
| 6543 |
|
| 6544 |
|
| 6545 |
|
| 6546 |
|
| 6547 |
|
| 6548 |
|
| 6549 |
|
| 6550 |
|
| 6551 |
|
| 6552 |
|
| 6553 |
static void |
| 6554 |
gpiodbus_object_proxy__gpiodbus_object_iface_init (GpiodbusObjectIface *iface G_GNUC_UNUSED) |
| 6555 |
{ |
| 6556 |
} |
| 6557 |
|
| 6558 |
static void |
| 6559 |
gpiodbus_object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 6560 |
{ |
| 6561 |
iface->interface_added = gpiodbus_object_notify; |
| 6562 |
iface->interface_removed = gpiodbus_object_notify; |
| 6563 |
} |
| 6564 |
|
| 6565 |
|
| 6566 |
G_DEFINE_TYPE_WITH_CODE (GpiodbusObjectProxy, gpiodbus_object_proxy, G_TYPE_DBUS_OBJECT_PROXY, |
| 6567 |
G_IMPLEMENT_INTERFACE (GPIODBUS_TYPE_OBJECT, gpiodbus_object_proxy__gpiodbus_object_iface_init) |
| 6568 |
G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, gpiodbus_object_proxy__g_dbus_object_iface_init)) |
| 6569 |
|
| 6570 |
static void |
| 6571 |
gpiodbus_object_proxy_init (GpiodbusObjectProxy *object G_GNUC_UNUSED) |
| 6572 |
{ |
| 6573 |
} |
| 6574 |
|
| 6575 |
static void |
| 6576 |
gpiodbus_object_proxy_set_property (GObject *gobject, |
| 6577 |
guint prop_id, |
| 6578 |
const GValue *value G_GNUC_UNUSED, |
| 6579 |
GParamSpec *pspec) |
| 6580 |
{ |
| 6581 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 6582 |
} |
| 6583 |
|
| 6584 |
static void |
| 6585 |
gpiodbus_object_proxy_get_property (GObject *gobject, |
| 6586 |
guint prop_id, |
| 6587 |
GValue *value, |
| 6588 |
GParamSpec *pspec) |
| 6589 |
{ |
| 6590 |
GpiodbusObjectProxy *object = GPIODBUS_OBJECT_PROXY (gobject); |
| 6591 |
GDBusInterface *interface; |
| 6592 |
|
| 6593 |
switch (prop_id) |
| 6594 |
{ |
| 6595 |
case 1: |
| 6596 |
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "io.gpiod1.Chip"); |
| 6597 |
g_value_take_object (value, interface); |
| 6598 |
break; |
| 6599 |
|
| 6600 |
case 2: |
| 6601 |
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "io.gpiod1.Line"); |
| 6602 |
g_value_take_object (value, interface); |
| 6603 |
break; |
| 6604 |
|
| 6605 |
case 3: |
| 6606 |
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "io.gpiod1.Request"); |
| 6607 |
g_value_take_object (value, interface); |
| 6608 |
break; |
| 6609 |
|
| 6610 |
default: |
| 6611 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 6612 |
break; |
| 6613 |
} |
| 6614 |
} |
| 6615 |
|
| 6616 |
static void |
| 6617 |
gpiodbus_object_proxy_class_init (GpiodbusObjectProxyClass *klass) |
| 6618 |
{ |
| 6619 |
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 6620 |
|
| 6621 |
gobject_class->set_property = gpiodbus_object_proxy_set_property; |
| 6622 |
gobject_class->get_property = gpiodbus_object_proxy_get_property; |
| 6623 |
|
| 6624 |
g_object_class_override_property (gobject_class, 1, "chip"); |
| 6625 |
g_object_class_override_property (gobject_class, 2, "line"); |
| 6626 |
g_object_class_override_property (gobject_class, 3, "request"); |
| 6627 |
} |
| 6628 |
|
| 6629 |
|
| 6630 |
|
| 6631 |
|
| 6632 |
|
| 6633 |
|
| 6634 |
|
| 6635 |
|
| 6636 |
|
| 6637 |
|
| 6638 |
GpiodbusObjectProxy * |
| 6639 |
gpiodbus_object_proxy_new (GDBusConnection *connection, |
| 6640 |
const gchar *object_path) |
| 6641 |
{ |
| 6642 |
g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); |
| 6643 |
g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 6644 |
return GPIODBUS_OBJECT_PROXY (g_object_new (GPIODBUS_TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL)); |
| 6645 |
} |
| 6646 |
|
| 6647 |
|
| 6648 |
|
| 6649 |
|
| 6650 |
|
| 6651 |
|
| 6652 |
|
| 6653 |
|
| 6654 |
|
| 6655 |
|
| 6656 |
|
| 6657 |
|
| 6658 |
|
| 6659 |
|
| 6660 |
static void |
| 6661 |
gpiodbus_object_skeleton__gpiodbus_object_iface_init (GpiodbusObjectIface *iface G_GNUC_UNUSED) |
| 6662 |
{ |
| 6663 |
} |
| 6664 |
|
| 6665 |
|
| 6666 |
static void |
| 6667 |
gpiodbus_object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface) |
| 6668 |
{ |
| 6669 |
iface->interface_added = gpiodbus_object_notify; |
| 6670 |
iface->interface_removed = gpiodbus_object_notify; |
| 6671 |
} |
| 6672 |
|
| 6673 |
G_DEFINE_TYPE_WITH_CODE (GpiodbusObjectSkeleton, gpiodbus_object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON, |
| 6674 |
G_IMPLEMENT_INTERFACE (GPIODBUS_TYPE_OBJECT, gpiodbus_object_skeleton__gpiodbus_object_iface_init) |
| 6675 |
G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, gpiodbus_object_skeleton__g_dbus_object_iface_init)) |
| 6676 |
|
| 6677 |
static void |
| 6678 |
gpiodbus_object_skeleton_init (GpiodbusObjectSkeleton *object G_GNUC_UNUSED) |
| 6679 |
{ |
| 6680 |
} |
| 6681 |
|
| 6682 |
static void |
| 6683 |
gpiodbus_object_skeleton_set_property (GObject *gobject, |
| 6684 |
guint prop_id, |
| 6685 |
const GValue *value, |
| 6686 |
GParamSpec *pspec) |
| 6687 |
{ |
| 6688 |
GpiodbusObjectSkeleton *object = GPIODBUS_OBJECT_SKELETON (gobject); |
| 6689 |
GDBusInterfaceSkeleton *interface; |
| 6690 |
|
| 6691 |
switch (prop_id) |
| 6692 |
{ |
| 6693 |
case 1: |
| 6694 |
interface = g_value_get_object (value); |
| 6695 |
if (interface != NULL) |
| 6696 |
{ |
| 6697 |
g_warn_if_fail (GPIODBUS_IS_CHIP (interface)); |
| 6698 |
g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 6699 |
} |
| 6700 |
else |
| 6701 |
{ |
| 6702 |
g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "io.gpiod1.Chip"); |
| 6703 |
} |
| 6704 |
break; |
| 6705 |
|
| 6706 |
case 2: |
| 6707 |
interface = g_value_get_object (value); |
| 6708 |
if (interface != NULL) |
| 6709 |
{ |
| 6710 |
g_warn_if_fail (GPIODBUS_IS_LINE (interface)); |
| 6711 |
g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 6712 |
} |
| 6713 |
else |
| 6714 |
{ |
| 6715 |
g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "io.gpiod1.Line"); |
| 6716 |
} |
| 6717 |
break; |
| 6718 |
|
| 6719 |
case 3: |
| 6720 |
interface = g_value_get_object (value); |
| 6721 |
if (interface != NULL) |
| 6722 |
{ |
| 6723 |
g_warn_if_fail (GPIODBUS_IS_REQUEST (interface)); |
| 6724 |
g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); |
| 6725 |
} |
| 6726 |
else |
| 6727 |
{ |
| 6728 |
g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "io.gpiod1.Request"); |
| 6729 |
} |
| 6730 |
break; |
| 6731 |
|
| 6732 |
default: |
| 6733 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 6734 |
break; |
| 6735 |
} |
| 6736 |
} |
| 6737 |
|
| 6738 |
static void |
| 6739 |
gpiodbus_object_skeleton_get_property (GObject *gobject, |
| 6740 |
guint prop_id, |
| 6741 |
GValue *value, |
| 6742 |
GParamSpec *pspec) |
| 6743 |
{ |
| 6744 |
GpiodbusObjectSkeleton *object = GPIODBUS_OBJECT_SKELETON (gobject); |
| 6745 |
GDBusInterface *interface; |
| 6746 |
|
| 6747 |
switch (prop_id) |
| 6748 |
{ |
| 6749 |
case 1: |
| 6750 |
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "io.gpiod1.Chip"); |
| 6751 |
g_value_take_object (value, interface); |
| 6752 |
break; |
| 6753 |
|
| 6754 |
case 2: |
| 6755 |
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "io.gpiod1.Line"); |
| 6756 |
g_value_take_object (value, interface); |
| 6757 |
break; |
| 6758 |
|
| 6759 |
case 3: |
| 6760 |
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "io.gpiod1.Request"); |
| 6761 |
g_value_take_object (value, interface); |
| 6762 |
break; |
| 6763 |
|
| 6764 |
default: |
| 6765 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); |
| 6766 |
break; |
| 6767 |
} |
| 6768 |
} |
| 6769 |
|
| 6770 |
static void |
| 6771 |
gpiodbus_object_skeleton_class_init (GpiodbusObjectSkeletonClass *klass) |
| 6772 |
{ |
| 6773 |
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 6774 |
|
| 6775 |
gobject_class->set_property = gpiodbus_object_skeleton_set_property; |
| 6776 |
gobject_class->get_property = gpiodbus_object_skeleton_get_property; |
| 6777 |
|
| 6778 |
g_object_class_override_property (gobject_class, 1, "chip"); |
| 6779 |
g_object_class_override_property (gobject_class, 2, "line"); |
| 6780 |
g_object_class_override_property (gobject_class, 3, "request"); |
| 6781 |
} |
| 6782 |
|
| 6783 |
|
| 6784 |
|
| 6785 |
|
| 6786 |
|
| 6787 |
|
| 6788 |
|
| 6789 |
|
| 6790 |
|
| 6791 |
GpiodbusObjectSkeleton * |
| 6792 |
gpiodbus_object_skeleton_new (const gchar *object_path) |
| 6793 |
{ |
| 6794 |
g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); |
| 6795 |
return GPIODBUS_OBJECT_SKELETON (g_object_new (GPIODBUS_TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL)); |
| 6796 |
} |
| 6797 |
|
| 6798 |
|
| 6799 |
|
| 6800 |
|
| 6801 |
|
| 6802 |
|
| 6803 |
|
| 6804 |
|
| 6805 |
void gpiodbus_object_skeleton_set_chip (GpiodbusObjectSkeleton *object, GpiodbusChip *interface_) |
| 6806 |
{ |
| 6807 |
g_object_set (G_OBJECT (object), "chip", interface_, NULL); |
| 6808 |
} |
| 6809 |
|
| 6810 |
|
| 6811 |
|
| 6812 |
|
| 6813 |
|
| 6814 |
|
| 6815 |
|
| 6816 |
|
| 6817 |
void gpiodbus_object_skeleton_set_line (GpiodbusObjectSkeleton *object, GpiodbusLine *interface_) |
| 6818 |
{ |
| 6819 |
g_object_set (G_OBJECT (object), "line", interface_, NULL); |
| 6820 |
} |
| 6821 |
|
| 6822 |
|
| 6823 |
|
| 6824 |
|
| 6825 |
|
| 6826 |
|
| 6827 |
|
| 6828 |
|
| 6829 |
void gpiodbus_object_skeleton_set_request (GpiodbusObjectSkeleton *object, GpiodbusRequest *interface_) |
| 6830 |
{ |
| 6831 |
g_object_set (G_OBJECT (object), "request", interface_, NULL); |
| 6832 |
} |
| 6833 |
|
| 6834 |
|
| 6835 |
|
| 6836 |
|
| 6837 |
|
| 6838 |
|
| 6839 |
|
| 6840 |
|
| 6841 |
|
| 6842 |
|
| 6843 |
|
| 6844 |
|
| 6845 |
|
| 6846 |
|
| 6847 |
|
| 6848 |
|
| 6849 |
|
| 6850 |
|
| 6851 |
|
| 6852 |
|
| 6853 |
|
| 6854 |
|
| 6855 |
|
| 6856 |
|
| 6857 |
|
| 6858 |
|
| 6859 |
|
| 6860 |
|
| 6861 |
G_DEFINE_TYPE (GpiodbusObjectManagerClient, gpiodbus_object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT) |
| 6862 |
|
| 6863 |
static void |
| 6864 |
gpiodbus_object_manager_client_init (GpiodbusObjectManagerClient *manager G_GNUC_UNUSED) |
| 6865 |
{ |
| 6866 |
} |
| 6867 |
|
| 6868 |
static void |
| 6869 |
gpiodbus_object_manager_client_class_init (GpiodbusObjectManagerClientClass *klass G_GNUC_UNUSED) |
| 6870 |
{ |
| 6871 |
} |
| 6872 |
|
| 6873 |
|
| 6874 |
|
| 6875 |
|
| 6876 |
|
| 6877 |
|
| 6878 |
|
| 6879 |
|
| 6880 |
|
| 6881 |
|
| 6882 |
|
| 6883 |
|
| 6884 |
GType |
| 6885 |
gpiodbus_object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, gpointer user_data G_GNUC_UNUSED) |
| 6886 |
{ |
| 6887 |
static gsize once_init_value = 0; |
| 6888 |
static GHashTable *lookup_hash; |
| 6889 |
GType ret; |
| 6890 |
|
| 6891 |
if (interface_name == NULL) |
| 6892 |
return GPIODBUS_TYPE_OBJECT_PROXY; |
| 6893 |
if (g_once_init_enter (&once_init_value)) |
| 6894 |
{ |
| 6895 |
lookup_hash = g_hash_table_new (g_str_hash, g_str_equal); |
| 6896 |
g_hash_table_insert (lookup_hash, (gpointer) "io.gpiod1.Chip", (gpointer) (guintptr) (GPIODBUS_TYPE_CHIP_PROXY)); |
| 6897 |
g_hash_table_insert (lookup_hash, (gpointer) "io.gpiod1.Line", (gpointer) (guintptr) (GPIODBUS_TYPE_LINE_PROXY)); |
| 6898 |
g_hash_table_insert (lookup_hash, (gpointer) "io.gpiod1.Request", (gpointer) (guintptr) (GPIODBUS_TYPE_REQUEST_PROXY)); |
| 6899 |
g_once_init_leave (&once_init_value, 1); |
| 6900 |
} |
| 6901 |
ret = (GType) (guintptr) (g_hash_table_lookup (lookup_hash, interface_name)); |
| 6902 |
if (ret == (GType) 0) |
| 6903 |
ret = G_TYPE_DBUS_PROXY; |
| 6904 |
return ret; |
| 6905 |
} |
| 6906 |
|
| 6907 |
|
| 6908 |
|
| 6909 |
|
| 6910 |
|
| 6911 |
|
| 6912 |
|
| 6913 |
|
| 6914 |
|
| 6915 |
|
| 6916 |
|
| 6917 |
|
| 6918 |
|
| 6919 |
|
| 6920 |
|
| 6921 |
|
| 6922 |
|
| 6923 |
|
| 6924 |
void |
| 6925 |
gpiodbus_object_manager_client_new ( |
| 6926 |
GDBusConnection *connection, |
| 6927 |
GDBusObjectManagerClientFlags flags, |
| 6928 |
const gchar *name, |
| 6929 |
const gchar *object_path, |
| 6930 |
GCancellable *cancellable, |
| 6931 |
GAsyncReadyCallback callback, |
| 6932 |
gpointer user_data) |
| 6933 |
{ |
| 6934 |
g_async_initable_new_async (GPIODBUS_TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", gpiodbus_object_manager_client_get_proxy_type, NULL); |
| 6935 |
} |
| 6936 |
|
| 6937 |
|
| 6938 |
|
| 6939 |
|
| 6940 |
|
| 6941 |
|
| 6942 |
|
| 6943 |
|
| 6944 |
|
| 6945 |
|
| 6946 |
GDBusObjectManager * |
| 6947 |
gpiodbus_object_manager_client_new_finish ( |
| 6948 |
GAsyncResult *res, |
| 6949 |
GError **error) |
| 6950 |
{ |
| 6951 |
GObject *ret; |
| 6952 |
GObject *source_object; |
| 6953 |
source_object = g_async_result_get_source_object (res); |
| 6954 |
ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 6955 |
g_object_unref (source_object); |
| 6956 |
if (ret != NULL) |
| 6957 |
return G_DBUS_OBJECT_MANAGER (ret); |
| 6958 |
else |
| 6959 |
return NULL; |
| 6960 |
} |
| 6961 |
|
| 6962 |
|
| 6963 |
|
| 6964 |
|
| 6965 |
|
| 6966 |
|
| 6967 |
|
| 6968 |
|
| 6969 |
|
| 6970 |
|
| 6971 |
|
| 6972 |
|
| 6973 |
|
| 6974 |
|
| 6975 |
|
| 6976 |
|
| 6977 |
|
| 6978 |
|
| 6979 |
GDBusObjectManager * |
| 6980 |
gpiodbus_object_manager_client_new_sync ( |
| 6981 |
GDBusConnection *connection, |
| 6982 |
GDBusObjectManagerClientFlags flags, |
| 6983 |
const gchar *name, |
| 6984 |
const gchar *object_path, |
| 6985 |
GCancellable *cancellable, |
| 6986 |
GError **error) |
| 6987 |
{ |
| 6988 |
GInitable *ret; |
| 6989 |
ret = g_initable_new (GPIODBUS_TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", gpiodbus_object_manager_client_get_proxy_type, NULL); |
| 6990 |
if (ret != NULL) |
| 6991 |
return G_DBUS_OBJECT_MANAGER (ret); |
| 6992 |
else |
| 6993 |
return NULL; |
| 6994 |
} |
| 6995 |
|
| 6996 |
|
| 6997 |
|
| 6998 |
|
| 6999 |
|
| 7000 |
|
| 7001 |
|
| 7002 |
|
| 7003 |
|
| 7004 |
|
| 7005 |
|
| 7006 |
|
| 7007 |
|
| 7008 |
|
| 7009 |
|
| 7010 |
|
| 7011 |
|
| 7012 |
|
| 7013 |
|
| 7014 |
void |
| 7015 |
gpiodbus_object_manager_client_new_for_bus ( |
| 7016 |
GBusType bus_type, |
| 7017 |
GDBusObjectManagerClientFlags flags, |
| 7018 |
const gchar *name, |
| 7019 |
const gchar *object_path, |
| 7020 |
GCancellable *cancellable, |
| 7021 |
GAsyncReadyCallback callback, |
| 7022 |
gpointer user_data) |
| 7023 |
{ |
| 7024 |
g_async_initable_new_async (GPIODBUS_TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", gpiodbus_object_manager_client_get_proxy_type, NULL); |
| 7025 |
} |
| 7026 |
|
| 7027 |
|
| 7028 |
|
| 7029 |
|
| 7030 |
|
| 7031 |
|
| 7032 |
|
| 7033 |
|
| 7034 |
|
| 7035 |
|
| 7036 |
GDBusObjectManager * |
| 7037 |
gpiodbus_object_manager_client_new_for_bus_finish ( |
| 7038 |
GAsyncResult *res, |
| 7039 |
GError **error) |
| 7040 |
{ |
| 7041 |
GObject *ret; |
| 7042 |
GObject *source_object; |
| 7043 |
source_object = g_async_result_get_source_object (res); |
| 7044 |
ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
| 7045 |
g_object_unref (source_object); |
| 7046 |
if (ret != NULL) |
| 7047 |
return G_DBUS_OBJECT_MANAGER (ret); |
| 7048 |
else |
| 7049 |
return NULL; |
| 7050 |
} |
| 7051 |
|
| 7052 |
|
| 7053 |
|
| 7054 |
|
| 7055 |
|
| 7056 |
|
| 7057 |
|
| 7058 |
|
| 7059 |
|
| 7060 |
|
| 7061 |
|
| 7062 |
|
| 7063 |
|
| 7064 |
|
| 7065 |
|
| 7066 |
|
| 7067 |
|
| 7068 |
|
| 7069 |
GDBusObjectManager * |
| 7070 |
gpiodbus_object_manager_client_new_for_bus_sync ( |
| 7071 |
GBusType bus_type, |
| 7072 |
GDBusObjectManagerClientFlags flags, |
| 7073 |
const gchar *name, |
| 7074 |
const gchar *object_path, |
| 7075 |
GCancellable *cancellable, |
| 7076 |
GError **error) |
| 7077 |
{ |
| 7078 |
GInitable *ret; |
| 7079 |
ret = g_initable_new (GPIODBUS_TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", gpiodbus_object_manager_client_get_proxy_type, NULL); |
| 7080 |
if (ret != NULL) |
| 7081 |
return G_DBUS_OBJECT_MANAGER (ret); |
| 7082 |
else |
| 7083 |
return NULL; |
| 7084 |
} |
| 7085 |
|
| 7086 |
|