static void avctp_set_state(struct control *control, avctp_state_t new_state) { GSList *l; struct audio_device *dev = control->dev; avdtp_session_state_t old_state = control->state; gboolean value; switch (new_state) { case AVCTP_STATE_DISCONNECTED: DBG("AVCTP Disconnected"); avctp_disconnected(control->dev); if (old_state != AVCTP_STATE_CONNECTED) break; value = FALSE; g_dbus_emit_signal(dev->conn, dev->path, AUDIO_CONTROL_INTERFACE, "Disconnected", DBUS_TYPE_INVALID); emit_property_changed(dev->conn, dev->path, AUDIO_CONTROL_INTERFACE, "Connected", DBUS_TYPE_BOOLEAN, &value); if (!audio_device_is_active(dev, NULL)) audio_device_set_authorized(dev, FALSE); break; case AVCTP_STATE_CONNECTING: DBG("AVCTP Connecting"); break; case AVCTP_STATE_CONNECTED: DBG("AVCTP Connected"); value = TRUE; g_dbus_emit_signal(control->dev->conn, control->dev->path, AUDIO_CONTROL_INTERFACE, "Connected", DBUS_TYPE_INVALID); emit_property_changed(control->dev->conn, control->dev->path, AUDIO_CONTROL_INTERFACE, "Connected", DBUS_TYPE_BOOLEAN, &value); break; default: error("Invalid AVCTP state %d", new_state); return; } control->state = new_state; for (l = avctp_callbacks; l != NULL; l = l->next) { struct avctp_state_callback *cb = l->data; cb->cb(control->dev, old_state, new_state, cb->user_data); } }
static void technology_removed_signal(struct connman_technology *technology) { g_dbus_emit_signal(connection, CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE, "TechnologyRemoved", DBUS_TYPE_OBJECT_PATH, &technology->path, DBUS_TYPE_INVALID); }
static void avdtp_state_callback(struct audio_device *dev, struct avdtp *session, avdtp_session_state_t old_state, avdtp_session_state_t new_state, void *user_data) { struct sink *sink = dev->sink; if (sink == NULL) return; switch (new_state) { case AVDTP_SESSION_STATE_DISCONNECTED: if (sink->state != SINK_STATE_CONNECTING) { gboolean value = FALSE; g_dbus_emit_signal(dev->conn, dev->path, AUDIO_SINK_INTERFACE, "Disconnected", DBUS_TYPE_INVALID); emit_property_changed(dev->conn, dev->path, AUDIO_SINK_INTERFACE, "Connected", DBUS_TYPE_BOOLEAN, &value); } sink_set_state(dev, SINK_STATE_DISCONNECTED); break; case AVDTP_SESSION_STATE_CONNECTING: sink_set_state(dev, SINK_STATE_CONNECTING); break; case AVDTP_SESSION_STATE_CONNECTED: break; } sink->session_state = new_state; }
static DBusMessage *remove_proxy(DBusConnection *conn, DBusMessage *msg, void *data) { struct serial_adapter *adapter = data; struct serial_proxy *prx; const char *path; GSList *l; if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID)) return NULL; l = g_slist_find_custom(adapter->proxies, path, proxy_pathcmp); if (!l) return does_not_exist(msg, "Invalid proxy path"); g_dbus_emit_signal(conn, adapter_get_path(adapter->btd_adapter), SERIAL_MANAGER_INTERFACE, "ProxyRemoved", DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID); prx = l->data; proxy_delete(&prx->src, prx->address); adapter->proxies = g_slist_remove(adapter->proxies, prx); g_dbus_unregister_interface(conn, path, SERIAL_PROXY_INTERFACE); return dbus_message_new_method_return(msg); }
static void avctp_unref(struct avctp *session) { sessions = g_slist_remove(sessions, session); if (session->state == AVCTP_STATE_CONNECTED) g_dbus_emit_signal(session->dev->conn, session->dev->path, AUDIO_CONTROL_INTERFACE, "Disconnected", DBUS_TYPE_INVALID); if (session->sock >= 0) close(session->sock); if (session->io) g_source_remove(session->io); if (session->dev && session->dev->control) session->dev->control->session = NULL; if (session->uinput >= 0) { ioctl(session->uinput, UI_DEV_DESTROY); close(session->uinput); } g_free(session); }
/******************************************************************************* ** ** Function dtun_sig_ops_access_request ** ** Description Function to emit dtun_sig_ops_access_request ** *******************************************************************************/ void dtun_sig_ops_access_request (tDTUN_DEVICE_SIGNAL *p_data) { debug(__FUNCTION__); char *bdname = p_data->ops_access_request.bdname; char *bdaddr = p_data->ops_access_request.bdaddr; uint16_t oper = (uint16_t)p_data->ops_access_request.oper; uint16_t format = (uint16_t)p_data->ops_access_request.format; char *name = p_data->ops_access_request.name; int64_t obj_size = (int64_t) p_data->ops_access_request.obj_size; debug("AccessReq: peer:%s, addr:%s, oper:%d, format:%d, file:%s, size:%d", bdname, bdaddr, oper, format, name, obj_size); if (!g_dbus_emit_signal( conn, BTLA_OBEX_PATH, BTLA_OBEX_INTERFACE, "OpsAccessRequest", DBUS_TYPE_STRING, &bdname, DBUS_TYPE_STRING, &bdaddr, DBUS_TYPE_UINT16, &oper, DBUS_TYPE_UINT16, &format, DBUS_TYPE_STRING, &name, DBUS_TYPE_INT64, &obj_size, DBUS_TYPE_INVALID)) { error("%s: Failed to emit signal", __FUNCTION__); } }
static void manager_remove_adapter(struct btd_adapter *adapter) { uint16_t dev_id = adapter_get_dev_id(adapter); const gchar *path = adapter_get_path(adapter); adapters = g_slist_remove(adapters, adapter); manager_update_adapters(); if (default_adapter_id == dev_id || default_adapter_id < 0) { int new_default = hci_get_route(NULL); manager_set_default_adapter(new_default); } g_dbus_emit_signal(connection, "/", MANAGER_INTERFACE, "AdapterRemoved", DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID); adapter_remove(adapter); btd_adapter_unref(adapter); if (adapters == NULL) btd_start_exit_timer(); }
void ofono_call_meter_maximum_notify(struct ofono_call_meter *cm) { DBusConnection *conn = ofono_dbus_get_connection(); const char *path = __ofono_atom_get_path(cm->atom); g_dbus_emit_signal(conn, path, OFONO_CALL_METER_INTERFACE, "NearMaximumWarning", DBUS_TYPE_INVALID); }
static void mute_once(struct alert_adapter *aa) { DBG("Emitting MuteOnce signal"); g_dbus_emit_signal(connection, "/", ALERT_INTERFACE, "MuteOnce", DBUS_TYPE_INVALID); }
void manager_add_adapter(struct adapter *adapter) { const char *ptr = adapter->path + ADAPTER_PATH_INDEX; if (hcid_dbus_use_experimental()) { g_dbus_emit_signal(connection, "/", MANAGER_INTERFACE, "AdapterAdded", DBUS_TYPE_OBJECT_PATH, &ptr, DBUS_TYPE_INVALID); } g_dbus_emit_signal(connection, BASE_PATH, MANAGER_INTERFACE, "AdapterAdded", DBUS_TYPE_STRING, &adapter->path, DBUS_TYPE_INVALID); adapters = g_slist_append(adapters, adapter); }
void manager_remove_adapter(struct adapter *adapter) { const char *ptr = adapter->path + ADAPTER_PATH_INDEX; if (hcid_dbus_use_experimental()) { g_dbus_emit_signal(connection, "/", MANAGER_INTERFACE, "AdapterRemoved", DBUS_TYPE_OBJECT_PATH, &ptr, DBUS_TYPE_INVALID); } g_dbus_emit_signal(connection, BASE_PATH, MANAGER_INTERFACE, "AdapterRemoved", DBUS_TYPE_STRING, &adapter->path, DBUS_TYPE_INVALID); if ((default_adapter_id == adapter->dev_id || default_adapter_id < 0)) { int new_default = hci_get_route(NULL); default_adapter_id = new_default; if (new_default >= 0) { if (hcid_dbus_use_experimental()) { g_dbus_emit_signal(connection, "/", MANAGER_INTERFACE, "DefaultAdapterChanged", DBUS_TYPE_OBJECT_PATH, &ptr, DBUS_TYPE_INVALID); } g_dbus_emit_signal(connection, BASE_PATH, MANAGER_INTERFACE, "DefaultAdapterChanged", DBUS_TYPE_STRING, &adapter->path, DBUS_TYPE_INVALID); } else { g_dbus_emit_signal(connection, BASE_PATH, MANAGER_INTERFACE, "DefaultAdapterChanged", DBUS_TYPE_STRING, &adapter->path, DBUS_TYPE_INVALID); } } adapters = g_slist_remove(adapters, adapter); }
static void emit_card_removed(struct ofono_handsfree_card *card) { DBusConnection *conn = ofono_dbus_get_connection(); const char *path = card->path; g_dbus_emit_signal(conn, OFONO_MANAGER_PATH, HFP_AUDIO_MANAGER_INTERFACE, "CardRemoved", DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID); }
static void state_changed(struct audio_device *dev, avctp_state_t old_state, avctp_state_t new_state, void *user_data) { struct control *control = dev->control; gboolean value; switch (new_state) { case AVCTP_STATE_DISCONNECTED: control->session = NULL; if (old_state != AVCTP_STATE_CONNECTED) break; value = FALSE; g_dbus_emit_signal(dev->conn, dev->path, AUDIO_CONTROL_INTERFACE, "Disconnected", DBUS_TYPE_INVALID); emit_property_changed(dev->conn, dev->path, AUDIO_CONTROL_INTERFACE, "Connected", DBUS_TYPE_BOOLEAN, &value); break; case AVCTP_STATE_CONNECTING: if (control->session) break; control->session = avctp_get(&dev->src, &dev->dst); break; case AVCTP_STATE_CONNECTED: value = TRUE; g_dbus_emit_signal(dev->conn, dev->path, AUDIO_CONTROL_INTERFACE, "Connected", DBUS_TYPE_INVALID); emit_property_changed(dev->conn, dev->path, AUDIO_CONTROL_INTERFACE, "Connected", DBUS_TYPE_BOOLEAN, &value); break; default: return; } }
void manager_set_default_adapter(int id) { struct adapter *adapter = manager_find_adapter_by_id(id); const char *ptr = adapter->path + ADAPTER_PATH_INDEX; default_adapter_id = id; if (hcid_dbus_use_experimental()) g_dbus_emit_signal(connection, "/", MANAGER_INTERFACE, "DefaultAdapterChanged", DBUS_TYPE_OBJECT_PATH, &ptr, DBUS_TYPE_INVALID); g_dbus_emit_signal(connection, BASE_PATH, MANAGER_INTERFACE, "DefaultAdapterChanged", DBUS_TYPE_STRING, &adapter->path, DBUS_TYPE_INVALID); }
void message_emit_removed(struct message *m, const char *interface) { DBusConnection *conn = ofono_dbus_get_connection(); const char *atompath = __ofono_atom_get_path(m->atom); const char *path = message_path_from_uuid(m->atom, &m->uuid); g_dbus_emit_signal(conn, atompath, interface, "MessageRemoved", DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID); }
void manager_add_adapter(const char *path) { g_dbus_emit_signal(connection, "/", MANAGER_INTERFACE, "AdapterAdded", DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID); manager_update_adapters(); btd_stop_exit_timer(); }
static void emit_modem_removed(struct ofono_modem *modem) { DBusConnection *conn = ofono_dbus_get_connection(); const char *path = modem->path; DBG("%p", modem); g_dbus_emit_signal(conn, OFONO_MANAGER_PATH, OFONO_MANAGER_INTERFACE, "ModemRemoved", DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID); }
void telephony_voice_dial_req(void *telephony_device, gboolean enable) { DBG("telephony-dummy: got %s voice dial request", enable ? "enable" : "disable"); g_dbus_emit_signal(connection, TELEPHONY_DUMMY_PATH, TELEPHONY_DUMMY_IFACE, "VoiceDial", DBUS_TYPE_INVALID); telephony_voice_dial_rsp(telephony_device, CME_ERROR_NONE); }
void manager_emit_transfer_started(struct obex_session *os) { char *path = g_strdup_printf("/transfer%u", os->id); g_dbus_emit_signal(connection, OBEX_MANAGER_PATH, OBEX_MANAGER_INTERFACE, "TransferStarted", DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID); g_free(path); }
static void emit_transfer_completed(struct obex_session *os, gboolean success) { char *path = g_strdup_printf("/transfer%u", os->id); g_dbus_emit_signal(connection, OBEX_MANAGER_PATH, OBEX_MANAGER_INTERFACE, "TransferCompleted", DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_BOOLEAN, &success, DBUS_TYPE_INVALID); g_free(path); }
/******************************************************************************* ** ** Function dtun_sig_ops_close ** ** Description Function to emit dtun_sig_ops_close ** *******************************************************************************/ void dtun_sig_ops_close (tDTUN_DEVICE_SIGNAL *p_data) { debug(__FUNCTION__); if (!g_dbus_emit_signal( conn, BTLA_OBEX_PATH, BTLA_OBEX_INTERFACE, "OpsClose", DBUS_TYPE_INVALID)) { error("%s: Failed to emit signal", __FUNCTION__); } }
static void avctp_connect_cb(GIOChannel *chan, int err, const bdaddr_t *src, const bdaddr_t *dst, gpointer data) { struct avctp *session = data; struct l2cap_options l2o; socklen_t len; int sk; char address[18]; if (!g_slist_find(sessions, session)) { error("avctp_connect_cb: session no longer exists"); return; } if (err < 0) { avctp_unref(session); error("AVCTP connect(%s): %s (%d)", address, strerror(-err), -err); return; } ba2str(&session->dst, address); debug("AVCTP: connected to %s", address); g_io_channel_set_close_on_unref(chan, FALSE); sk = g_io_channel_unix_get_fd(chan); session->sock = sk; memset(&l2o, 0, sizeof(l2o)); len = sizeof(l2o); if (getsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, &l2o, &len) < 0) { err = errno; avctp_unref(session); error("getsockopt(L2CAP_OPTIONS): %s (%d)", strerror(err), err); return; } init_uinput(session); g_dbus_emit_signal(session->dev->conn, session->dev->path, AUDIO_CONTROL_INTERFACE, "Connected", DBUS_TYPE_INVALID); session->state = AVCTP_STATE_CONNECTED; session->mtu = l2o.imtu; if (session->io) g_source_remove(session->io); session->io = g_io_add_watch(chan, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL, (GIOFunc) session_cb, session); }
static void emit_transfer_progress(struct obex_session *os, uint32_t total, uint32_t transferred) { char *path = g_strdup_printf("/transfer%u", os->id); g_dbus_emit_signal(connection, path, TRANSFER_INTERFACE, "Progress", DBUS_TYPE_INT32, &total, DBUS_TYPE_INT32, &transferred, DBUS_TYPE_INVALID); g_free(path); }
void manager_unregister_session(struct obex_session *os) { char *path = g_strdup_printf("/session%u", GPOINTER_TO_UINT(os)); g_dbus_emit_signal(connection, OBEX_MANAGER_PATH, OBEX_MANAGER_INTERFACE, "SessionRemoved", DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID); g_dbus_unregister_interface(connection, path, SESSION_INTERFACE); g_free(path); }
static void create_path(DBusConnection *conn, DBusMessage *msg, const char *path, const char *sname) { /* emit signal when it is a new path */ if (sname) { g_dbus_emit_signal(conn, NETWORK_PATH, NETWORK_MANAGER_INTERFACE, sname, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID); } g_dbus_send_reply(conn, msg, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID); }
static void connection_owner_exited(void *user_data) { struct rfcomm_node *node = user_data; debug("Connect requestor exited. Releasing %s node", node->device); g_dbus_emit_signal(node->conn, SERIAL_MANAGER_PATH, SERIAL_MANAGER_INTERFACE, "ServiceDisconnected" , DBUS_TYPE_STRING, &node->device, DBUS_TYPE_INVALID); connected_nodes = g_slist_remove(connected_nodes, node); rfcomm_node_free(node); }
/******************************************************************************* ** ** Function dtun_sig_opc_close ** ** Description Function to emit dtun_sig_opc_close ** *******************************************************************************/ void dtun_sig_opc_close (tDTUN_DEVICE_SIGNAL *p_data) { debug(__FUNCTION__); uint16_t status = (uint16_t)p_data->opc_close.status; if (!g_dbus_emit_signal( conn, BTLA_OBEX_PATH, BTLA_OBEX_INTERFACE, "OpcClose", DBUS_TYPE_UINT16, &status, DBUS_TYPE_INVALID)) { error("%s: Failed to emit signal", __FUNCTION__); } }
/******************************************************************************* ** ** Function dtun_sig_op_owner_vcard_not_set ** ** Description Function to emit dtun_sig_op_owner_vcard_not_set ** *******************************************************************************/ void dtun_sig_op_owner_vcard_not_set (tDTUN_DEVICE_SIGNAL *p_data) { debug(__FUNCTION__); char *name = p_data->op_owner_vcard_not_set.name; if (!g_dbus_emit_signal( conn, BTLA_OBEX_PATH, BTLA_OBEX_INTERFACE, "OpOwnerVcardNotSet", DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID)) { error("%s: Failed to emit signal", __FUNCTION__); } }
static int unregister_device(struct dundee_device *device) { DBusConnection *conn = ofono_dbus_get_connection(); DBG("%p path %s", device, device->path); g_dbus_unregister_interface(conn, device->path, DUNDEE_DEVICE_INTERFACE); g_dbus_emit_signal(conn, DUNDEE_MANAGER_PATH, DUNDEE_MANAGER_INTERFACE, "DeviceRemoved", DBUS_TYPE_OBJECT_PATH, &device->path, DBUS_TYPE_INVALID); return 0; }
static gboolean rfcomm_disconnect_cb(GIOChannel *io, GIOCondition cond, struct rfcomm_node *node) { debug("RFCOMM node %s was disconnected", node->device); g_dbus_remove_watch(node->conn, node->listener_id); g_dbus_emit_signal(node->conn, SERIAL_MANAGER_PATH, SERIAL_MANAGER_INTERFACE, "ServiceDisconnected" , DBUS_TYPE_STRING, &node->device, DBUS_TYPE_INVALID); connected_nodes = g_slist_remove(connected_nodes, node); rfcomm_node_free(node); return FALSE; }