static void properties_changed (GDBusProxy *proxy, GVariant *changed_properties, GStrv invalidated_properties, gpointer user_data) { NMBluezDevice *self = NM_BLUEZ_DEVICE (user_data); _set_properties (self, changed_properties); check_emit_usable (self); }
static void get_properties_cb_4 (GObject *source_object, GAsyncResult *res, gpointer user_data) { NMBluezDevice *self = NM_BLUEZ_DEVICE (user_data); NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); GError *err = NULL; GVariant *v_properties, *v_dict; GVariantType *v_type; v_properties = g_dbus_proxy_call_finish (priv->proxy, res, &err); if (!v_properties) { nm_log_warn (LOGD_BT, "bluez[%s] error getting device properties: %s", priv->path, err && err->message ? err->message : "(unknown)"); g_error_free (err); g_signal_emit (self, signals[INITIALIZED], 0, FALSE); goto END; } v_type = g_variant_type_new ("(a{sv})"); if (g_variant_is_of_type (v_properties, v_type)) { v_dict = g_variant_get_child_value (v_properties, 0); _set_properties (self, v_dict); g_variant_unref (v_dict); } else { nm_log_warn (LOGD_BT, "bluez[%s] GetProperties returns unexpected result of type %s", priv->path, g_variant_get_type_string (v_properties)); } g_variant_type_free (v_type); g_variant_unref (v_properties); /* Check if any connections match this device */ load_connections (self); priv->initialized = TRUE; g_signal_emit (self, signals[INITIALIZED], 0, TRUE); check_emit_usable (self); END: g_object_unref (self); }
static int _handle_message(struct mls_el_ctx *ctx, struct mls_elope_packet *req, struct mls_elope_packet **res) { int ret = 0; unsigned char svc, rc; *res = (struct mls_elope_packet*)_res; memset((*res), 0, sizeof(_res)); switch(req->svc) { default: LOG_ERR(MLS_LOG_DEFAULT_MODULE, "invalid svc(%d)\n", req->svc); assert(0); break; /* Request */ case MLS_ELOPE_SVC_GET_REQ: svc = MLS_ELOPE_SVC_GET_RES; (*res)->pdc = UCHAR_MAX; rc = _get_properties(ctx, req, (*res)->data, &((*res)->pdc)); break; case MLS_ELOPE_SVC_SET_REQ: svc = MLS_ELOPE_SVC_SET_RES; (*res)->pdc = 0; rc = _set_properties(ctx, req); break; } /* Response */ (*res)->svc = svc; (*res)->rc = rc; (*res)->deojc = req->deojc; (*res)->epc = req->epc; /* pdc & data set by _*_properties(). */ return ret; }