diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-02-27 08:54:01 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2006-02-27 08:54:01 +0000 |
commit | cf12a4343611b930c2178b962cd9a4f956a05447 (patch) | |
tree | 16cb4b7595ab7f245aed96b80542cfea17459e76 | |
parent | 20b31004375588fd454b7069acaa714028e48a64 (diff) |
Rename Device into Adapter
-rw-r--r-- | hcid/dbus-device.c | 8 | ||||
-rw-r--r-- | hcid/dbus-manager.c | 8 | ||||
-rw-r--r-- | hcid/dbus.c | 50 | ||||
-rw-r--r-- | hcid/dbus.h | 32 |
4 files changed, 49 insertions, 49 deletions
diff --git a/hcid/dbus-device.c b/hcid/dbus-device.c index 7dc16b0e..050aab69 100644 --- a/hcid/dbus-device.c +++ b/hcid/dbus-device.c @@ -1297,14 +1297,14 @@ DBusHandlerResult msg_func_device(DBusConnection *conn, DBusMessage *msg, void * signature = dbus_message_get_signature(msg); iface = dbus_message_get_interface(msg); - syslog(LOG_INFO, "Device path:%s method:%s", + syslog(LOG_INFO, "Adapter path:%s method:%s", dbus_message_get_path(msg), method); - if (strcmp(DEVICE_INTERFACE, iface)) + if (strcmp(ADAPTER_INTERFACE, iface)) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - if (dbus_data->path_id == DEVICE_ROOT_ID) { - /* Device is down(path unregistered) or the path is wrong */ + if (dbus_data->path_id == ADAPTER_ROOT_ID) { + /* Adapter is down(path unregistered) or the path is wrong */ error = BLUEZ_EDBUS_UNKNOWN_PATH; goto failed; } diff --git a/hcid/dbus-manager.c b/hcid/dbus-manager.c index 64b733e7..6981d9d2 100644 --- a/hcid/dbus-manager.c +++ b/hcid/dbus-manager.c @@ -89,7 +89,7 @@ static DBusMessage *handle_mgr_list_devices_req(DBusMessage *msg, void *data) if (ioctl(sk, HCIGETDEVINFO, &di) < 0) continue; - snprintf(path, sizeof(path), "%s/%s", DEVICE_PATH, di.name); + snprintf(path, sizeof(path), "%s/%s", ADAPTER_PATH, di.name); dbus_message_iter_append_basic(&array_iter, DBUS_TYPE_STRING, &path_ptr); @@ -118,7 +118,7 @@ static DBusMessage *handle_mgr_default_device_req(DBusMessage *msg, void *data) if (!reply) return error_out_of_memory(msg); - snprintf(path, sizeof(path), "%s/hci%d", DEVICE_PATH, default_dev); + snprintf(path, sizeof(path), "%s/hci%d", ADAPTER_PATH, default_dev); dbus_message_append_args(reply, DBUS_TYPE_STRING, &path_ptr, DBUS_TYPE_INVALID); @@ -127,8 +127,8 @@ static DBusMessage *handle_mgr_default_device_req(DBusMessage *msg, void *data) } static const struct service_data mgr_services[] = { - { MGR_LIST_DEVICES, handle_mgr_list_devices_req, MGR_LIST_DEVICES_SIGNATURE }, - { MGR_DEFAULT_DEVICE, handle_mgr_default_device_req, MGR_DEFAULT_DEVICE_SIGNATURE }, + { MGR_LIST_ADAPTERS, handle_mgr_list_devices_req, MGR_LIST_ADAPTERS_SIGNATURE }, + { MGR_DEFAULT_ADAPTER, handle_mgr_default_device_req, MGR_DEFAULT_ADAPTER_SIGNATURE }, { NULL, NULL, NULL } }; diff --git a/hcid/dbus.c b/hcid/dbus.c index fccac0b2..90bbe7ea 100644 --- a/hcid/dbus.c +++ b/hcid/dbus.c @@ -116,9 +116,9 @@ DBusMessage *dev_signal_factory(const int devid, const char *prop_name, const in char path[MAX_PATH_LENGTH]; va_list var_args; - snprintf(path, sizeof(path)-1, "%s/hci%d", DEVICE_PATH, devid); + snprintf(path, sizeof(path)-1, "%s/hci%d", ADAPTER_PATH, devid); - signal = dbus_message_new_signal(path, DEVICE_INTERFACE, + signal = dbus_message_new_signal(path, ADAPTER_INTERFACE, prop_name); if (signal == NULL) { syslog(LOG_ERR, "Can't allocate D-BUS inquiry complete message"); @@ -294,8 +294,8 @@ gboolean hcid_dbus_register_device(uint16_t id) struct hci_request rq; struct hci_dbus_data* pdata; - snprintf(path, sizeof(path), "%s/hci%d", DEVICE_PATH, id); - ret = register_dbus_path(path, DEVICE_PATH_ID, id, &obj_dev_vtable, FALSE); + snprintf(path, sizeof(path), "%s/hci%d", ADAPTER_PATH, id); + ret = register_dbus_path(path, ADAPTER_PATH_ID, id, &obj_dev_vtable, FALSE); dd = hci_open_dev(id); if (dd < 0) { @@ -370,7 +370,7 @@ gboolean hcid_dbus_unregister_device(uint16_t id) char path[MAX_PATH_LENGTH]; char *pptr = path; - snprintf(path, sizeof(path), "%s/hci%d", DEVICE_PATH, id); + snprintf(path, sizeof(path), "%s/hci%d", ADAPTER_PATH, id); message = dbus_message_new_signal(MANAGER_PATH, MANAGER_INTERFACE, BLUEZ_MGR_DEV_REMOVED); @@ -472,7 +472,7 @@ void hcid_dbus_bonding_created_complete(bdaddr_t *local, bdaddr_t *peer, const u goto failed; } - snprintf(path, sizeof(path), "%s/hci%d", DEVICE_PATH, id); + snprintf(path, sizeof(path), "%s/hci%d", ADAPTER_PATH, id); /* * 0x00: authentication request successfully completed @@ -480,7 +480,7 @@ void hcid_dbus_bonding_created_complete(bdaddr_t *local, bdaddr_t *peer, const u */ name = status ? DEV_SIG_BONDING_FAILED : DEV_SIG_BONDING_CREATED; - message = dbus_message_new_signal(path, DEVICE_INTERFACE, name); + message = dbus_message_new_signal(path, ADAPTER_INTERFACE, name); if (message == NULL) { syslog(LOG_ERR, "Can't allocate D-Bus remote name message"); @@ -522,9 +522,9 @@ void hcid_dbus_inquiry_start(bdaddr_t *local) goto failed; } - snprintf(path, sizeof(path), "%s/hci%d", DEVICE_PATH, id); + snprintf(path, sizeof(path), "%s/hci%d", ADAPTER_PATH, id); - message = dbus_message_new_signal(path, DEVICE_INTERFACE, + message = dbus_message_new_signal(path, ADAPTER_INTERFACE, DEV_SIG_DISCOVER_START); if (message == NULL) { syslog(LOG_ERR, "Can't allocate D-Bus inquiry start message"); @@ -559,9 +559,9 @@ void hcid_dbus_inquiry_complete(bdaddr_t *local) goto failed; } - snprintf(path, sizeof(path), "%s/hci%d", DEVICE_PATH, id); + snprintf(path, sizeof(path), "%s/hci%d", ADAPTER_PATH, id); - message = dbus_message_new_signal(path, DEVICE_INTERFACE, + message = dbus_message_new_signal(path, ADAPTER_INTERFACE, DEV_SIG_DISCOVER_COMPLETE); if (message == NULL) { syslog(LOG_ERR, "Can't allocate D-Bus inquiry complete message"); @@ -599,9 +599,9 @@ void hcid_dbus_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class, i goto failed; } - snprintf(path, sizeof(path), "%s/hci%d", DEVICE_PATH, id); + snprintf(path, sizeof(path), "%s/hci%d", ADAPTER_PATH, id); - message = dbus_message_new_signal(path, DEVICE_INTERFACE, + message = dbus_message_new_signal(path, ADAPTER_INTERFACE, DEV_SIG_DISCOVER_RESULT); if (message == NULL) { syslog(LOG_ERR, "Can't allocate D-Bus inquiry result message"); @@ -645,9 +645,9 @@ void hcid_dbus_remote_name(bdaddr_t *local, bdaddr_t *peer, char *name) goto failed; } - snprintf(path, sizeof(path), "%s/hci%d", DEVICE_PATH, id); + snprintf(path, sizeof(path), "%s/hci%d", ADAPTER_PATH, id); - message = dbus_message_new_signal(path, DEVICE_INTERFACE, + message = dbus_message_new_signal(path, ADAPTER_INTERFACE, DEV_SIG_REMOTE_NAME_CHANGED); if (message == NULL) { syslog(LOG_ERR, "Can't allocate D-Bus remote name message"); @@ -786,7 +786,7 @@ gboolean hcid_dbus_init(void) return FALSE; } - if (!register_dbus_path(DEVICE_PATH, DEVICE_ROOT_ID, INVALID_DEV_ID, + if (!register_dbus_path(ADAPTER_PATH, ADAPTER_ROOT_ID, INVALID_DEV_ID, &obj_dev_vtable, TRUE)) return FALSE; @@ -813,14 +813,14 @@ void hcid_dbus_exit(void) if (!dbus_connection_get_is_connected(connection)) return; - /* Unregister all paths in Device path hierarchy */ - if (!dbus_connection_list_registered(connection, DEVICE_PATH, &children)) + /* Unregister all paths in Adapter path hierarchy */ + if (!dbus_connection_list_registered(connection, ADAPTER_PATH, &children)) goto done; for (; children[i]; i++) { char dev_path[MAX_PATH_LENGTH]; - snprintf(dev_path, sizeof(dev_path), "%s/%s", DEVICE_PATH, children[i]); + snprintf(dev_path, sizeof(dev_path), "%s/%s", ADAPTER_PATH, children[i]); unregister_dbus_path(dev_path); } @@ -828,7 +828,7 @@ void hcid_dbus_exit(void) dbus_free_string_array(children); done: - unregister_dbus_path(DEVICE_PATH); + unregister_dbus_path(ADAPTER_PATH); unregister_dbus_path(MANAGER_PATH); dbus_connection_close(connection); @@ -867,7 +867,7 @@ static int discoverable_timeout_handler(void *data) if (hci_send_req(dd, &rq, 100) < 0) { syslog(LOG_ERR, "Sending write scan enable command to hci%d failed: %s (%d)", - dbus_data->dev_id, strerror(errno), errno); + dbus_data->dev_id, strerror(errno), errno); retval = -1; goto failed; } @@ -945,13 +945,13 @@ static void sigalarm_handler(int signum) return; } - if (!dbus_connection_list_registered(connection, DEVICE_PATH, &device)) + if (!dbus_connection_list_registered(connection, ADAPTER_PATH, &device)) goto done; /* check the timer for each registered path */ for (; device[i]; i++) { - snprintf(device_path, sizeof(device_path), "%s/%s", DEVICE_PATH, device[i]); + snprintf(device_path, sizeof(device_path), "%s/%s", ADAPTER_PATH, device[i]); if (!dbus_connection_get_object_path_data(connection, device_path, (void*) &pdata)){ syslog(LOG_ERR, "Getting %s path data failed!", device_path); @@ -1144,7 +1144,7 @@ void hcid_dbus_setscan_enable_complete(bdaddr_t *local) goto failed; } - snprintf(path, sizeof(path), "%s/hci%d", DEVICE_PATH, id); + snprintf(path, sizeof(path), "%s/hci%d", ADAPTER_PATH, id); dd = hci_open_dev(id); if (dd < 0) { @@ -1201,7 +1201,7 @@ void hcid_dbus_setscan_enable_complete(bdaddr_t *local) goto failed; } - message = dbus_message_new_signal(path, DEVICE_INTERFACE, + message = dbus_message_new_signal(path, ADAPTER_INTERFACE, DEV_SIG_MODE_CHANGED); if (message == NULL) { syslog(LOG_ERR, "Can't allocate D-Bus inquiry complete message"); diff --git a/hcid/dbus.h b/hcid/dbus.h index c526e8e7..640c48a7 100644 --- a/hcid/dbus.h +++ b/hcid/dbus.h @@ -29,8 +29,8 @@ #define BASE_PATH "/org/bluez" #define BASE_INTERFACE "org.bluez" -#define DEVICE_PATH BASE_PATH "/Device" -#define DEVICE_INTERFACE BASE_INTERFACE ".Device" +#define ADAPTER_PATH BASE_PATH "/Adapter" +#define ADAPTER_INTERFACE BASE_INTERFACE ".Adapter" #define MANAGER_PATH BASE_PATH "/Manager" #define MANAGER_INTERFACE BASE_INTERFACE ".Manager" @@ -38,16 +38,16 @@ #define ERROR_INTERFACE BASE_INTERFACE ".Error" #define MANAGER_PATH_MASK (1 << 15) -#define DEVICE_PATH_MASK (1 << 14) +#define ADAPTER_PATH_MASK (1 << 14) /* /org/bluez/Manager */ #define MANAGER_ROOT_ID MANAGER_PATH_MASK -/* /org/bluez/Device */ -#define DEVICE_ROOT_ID DEVICE_PATH_MASK +/* /org/bluez/Adapter */ +#define ADAPTER_ROOT_ID ADAPTER_PATH_MASK -/* E.g. /org/bluez/Device/hci0 */ -#define DEVICE_PATH_ID (DEVICE_PATH_MASK | 0x0001) +/* E.g. /org/bluez/Adapter/hci0 */ +#define ADAPTER_PATH_ID (ADAPTER_PATH_MASK | 0x0001) #define INVALID_PATH_ID 0xFFFF #define INVALID_DEV_ID 0xFFFF @@ -95,22 +95,22 @@ DBusMessage *error_no_such_device(DBusMessage *msg); BlueZ D-Bus Manager service definitions "/org/bluez/Manager" *========================================================================*/ -#define MGR_LIST_DEVICES "ListDevices" -#define MGR_DEFAULT_DEVICE "DefaultDevice" +#define MGR_LIST_ADAPTERS "ListAdapters" +#define MGR_DEFAULT_ADAPTER "DefaultAdapter" /* Signals sent in the Manager path */ -#define BLUEZ_MGR_DEV_ADDED "DeviceAdded" -#define BLUEZ_MGR_DEV_REMOVED "DeviceRemoved" +#define BLUEZ_MGR_DEV_ADDED "AdapterAdded" +#define BLUEZ_MGR_DEV_REMOVED "AdapterRemoved" /* Manager Signatures */ -#define MGR_LIST_DEVICES_SIGNATURE __END_SIG__ -#define MGR_DEFAULT_DEVICE_SIGNATURE __END_SIG__ +#define MGR_LIST_ADAPTERS_SIGNATURE __END_SIG__ +#define MGR_DEFAULT_ADAPTER_SIGNATURE __END_SIG__ -#define MGR_REPLY_DEVICE_LIST_SIGNATURE DBUS_TYPE_ARRAY_AS_STRING \ +#define MGR_REPLY_ADAPTER_LIST_SIGNATURE DBUS_TYPE_ARRAY_AS_STRING \ __END_SIG__ /*======================================================================== - BlueZ D-Bus Device path definitions "/org/bluez/Device" + BlueZ D-Bus Adapter path definitions "/org/bluez/Adapter" *========================================================================*/ #define DEV_GET_ADDRESS "GetAddress" #define DEV_GET_VERSION "GetVersion" @@ -151,7 +151,7 @@ DBusMessage *error_no_such_device(DBusMessage *msg); #define DEV_DISCOVER_SERVICE "DiscoverService" /*FIXME: maybe this section can be moved to a internal header file */ -/* Device service signature */ +/* Adapter service signature */ #define DEV_GET_ADDRESS_SIGNATURE __END_SIG__ #define DEV_GET_VERSION_SIGNATURE __END_SIG__ #define DEV_GET_REVISION_SIGNATURE __END_SIG__ |