summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-03-11 01:54:04 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-03-11 01:54:04 +0000
commitb36fe9a374cdd29d1cb3a84ab56bcc98ecfcda2e (patch)
tree6e493f613f5e5c8efe0f5529e3404af7e0d4413d
parent1e7336e0c4d4b47d5390fc4df76008d4c0694227 (diff)
Remove more unneeded definitions
-rw-r--r--hcid/dbus-adapter.c217
-rw-r--r--hcid/dbus-manager.c4
-rw-r--r--hcid/dbus.c4
-rw-r--r--hcid/dbus.h53
4 files changed, 96 insertions, 182 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c
index 7c06eab7..6c38597d 100644
--- a/hcid/dbus-adapter.c
+++ b/hcid/dbus-adapter.c
@@ -177,26 +177,6 @@ static DBusHandlerResult handle_dev_get_company_req(DBusConnection *conn, DBusMe
return send_reply_and_unref(conn, reply);
}
-static DBusHandlerResult handle_dev_get_features_req(DBusConnection *conn, DBusMessage *msg, void *data)
-{
- DBusMessage *reply;
- DBusMessageIter iter;
- DBusMessageIter array_iter;
-
- reply = dbus_message_new_method_return(msg);
- if (!reply)
- return error_out_of_memory(conn, msg);
-
- dbus_message_iter_init_append(reply, &iter);
-
- dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
- DBUS_TYPE_STRING_AS_STRING, &array_iter);
-
- dbus_message_iter_close_container(&iter, &array_iter);
-
- return send_reply_and_unref(conn, reply);
-}
-
static DBusHandlerResult handle_dev_get_mode_req(DBusConnection *conn, DBusMessage *msg, void *data)
{
const struct hci_dbus_data *dbus_data = data;
@@ -231,60 +211,6 @@ static DBusHandlerResult handle_dev_get_mode_req(DBusConnection *conn, DBusMessa
return send_reply_and_unref(conn, reply);
}
-static DBusHandlerResult handle_dev_list_minor_classes_req(DBusConnection *conn, DBusMessage *msg, void *data)
-{
- const struct hci_dbus_data *dbus_data = data;
- DBusMessage *reply = NULL;
- DBusMessageIter iter;
- DBusMessageIter array_iter;
- const char **minor_ptr;
- uint8_t cls[3];
- uint8_t major_class;
- int dd, size, i;
-
- dd = hci_open_dev(dbus_data->dev_id);
- if (dd < 0)
- return error_no_such_adapter(conn, msg);
-
- if (hci_read_class_of_dev(dd, cls, 1000) < 0) {
- error("Can't read class of device on hci%d: %s(%d)",
- dbus_data->dev_id, strerror(errno), errno);
- hci_close_dev(dd);
- return error_failed(conn, msg, errno);
- }
-
- hci_close_dev(dd);
-
- major_class = cls[1] & 0x1F;
-
- switch (major_class) {
- case 1: /* computer */
- minor_ptr = computer_minor_cls;
- size = sizeof(computer_minor_cls) / sizeof(*computer_minor_cls);
- break;
- case 2: /* phone */
- minor_ptr = phone_minor_cls;
- size = sizeof(phone_minor_cls) / sizeof(*phone_minor_cls);
- break;
- default:
- return error_unsupported_major_class(conn, msg);
- }
-
- reply = dbus_message_new_method_return(msg);
- if (!reply)
- return error_out_of_memory(conn, msg);
-
- dbus_message_iter_init_append(reply, &iter);
- dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
- DBUS_TYPE_STRING_AS_STRING, &array_iter);
- for (i = 0; i < size; i++)
- dbus_message_iter_append_basic(&array_iter, DBUS_TYPE_STRING, &minor_ptr[i]);
-
- dbus_message_iter_close_container(&iter, &array_iter);
-
- return send_reply_and_unref(conn, reply);
-}
-
static DBusHandlerResult handle_dev_set_mode_req(DBusConnection *conn, DBusMessage *msg, void *data)
{
const struct hci_dbus_data *dbus_data = data;
@@ -439,6 +365,60 @@ static DBusHandlerResult handle_dev_get_major_class_req(DBusConnection *conn, DB
return send_reply_and_unref(conn, reply);
}
+static DBusHandlerResult handle_dev_list_minor_classes_req(DBusConnection *conn, DBusMessage *msg, void *data)
+{
+ const struct hci_dbus_data *dbus_data = data;
+ DBusMessage *reply = NULL;
+ DBusMessageIter iter;
+ DBusMessageIter array_iter;
+ const char **minor_ptr;
+ uint8_t cls[3];
+ uint8_t major_class;
+ int dd, size, i;
+
+ dd = hci_open_dev(dbus_data->dev_id);
+ if (dd < 0)
+ return error_no_such_adapter(conn, msg);
+
+ if (hci_read_class_of_dev(dd, cls, 1000) < 0) {
+ error("Can't read class of device on hci%d: %s(%d)",
+ dbus_data->dev_id, strerror(errno), errno);
+ hci_close_dev(dd);
+ return error_failed(conn, msg, errno);
+ }
+
+ hci_close_dev(dd);
+
+ major_class = cls[1] & 0x1F;
+
+ switch (major_class) {
+ case 1: /* computer */
+ minor_ptr = computer_minor_cls;
+ size = sizeof(computer_minor_cls) / sizeof(*computer_minor_cls);
+ break;
+ case 2: /* phone */
+ minor_ptr = phone_minor_cls;
+ size = sizeof(phone_minor_cls) / sizeof(*phone_minor_cls);
+ break;
+ default:
+ return error_unsupported_major_class(conn, msg);
+ }
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return error_out_of_memory(conn, msg);
+
+ dbus_message_iter_init_append(reply, &iter);
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ DBUS_TYPE_STRING_AS_STRING, &array_iter);
+ for (i = 0; i < size; i++)
+ dbus_message_iter_append_basic(&array_iter, DBUS_TYPE_STRING, &minor_ptr[i]);
+
+ dbus_message_iter_close_container(&iter, &array_iter);
+
+ return send_reply_and_unref(conn, reply);
+}
+
static DBusHandlerResult handle_dev_get_minor_class_req(DBusConnection *conn, DBusMessage *msg, void *data)
{
struct hci_dbus_data *dbus_data = data;
@@ -1285,59 +1265,46 @@ static DBusHandlerResult handle_dev_cancel_discovery_req(DBusConnection *conn, D
return send_reply_and_unref(conn, reply);
}
-static DBusHandlerResult handle_dev_discover_cache_req(DBusConnection *conn, DBusMessage *msg, void *data)
-{
- return error_not_implemented(conn, msg);
-}
-
-static DBusHandlerResult handle_dev_discover_service_req(DBusConnection *conn, DBusMessage *msg, void *data)
-{
- return error_not_implemented(conn, msg);
-}
-
static struct service_data dev_services[] = {
- { DEV_GET_ADDRESS, handle_dev_get_address_req, },
- { DEV_GET_VERSION, handle_dev_get_version_req, },
- { DEV_GET_REVISION, handle_dev_get_revision_req, },
- { DEV_GET_MANUFACTURER, handle_dev_get_manufacturer_req, },
- { DEV_GET_COMPANY, handle_dev_get_company_req, },
- { DEV_GET_FEATURES, handle_dev_get_features_req, },
- { DEV_GET_MODE, handle_dev_get_mode_req, },
- { DEV_LIST_MINOR_CLASSES, handle_dev_list_minor_classes_req, },
- { DEV_SET_MODE, handle_dev_set_mode_req, },
- { DEV_GET_DISCOVERABLE_TO, handle_dev_get_discoverable_to_req, },
- { DEV_SET_DISCOVERABLE_TO, handle_dev_set_discoverable_to_req, },
- { DEV_IS_CONNECTABLE, handle_dev_is_connectable_req, },
- { DEV_IS_DISCOVERABLE, handle_dev_is_discoverable_req, },
- { DEV_GET_MAJOR_CLASS, handle_dev_get_major_class_req, },
- { DEV_GET_MINOR_CLASS, handle_dev_get_minor_class_req, },
- { DEV_SET_MINOR_CLASS, handle_dev_set_minor_class_req, },
- { DEV_GET_SERVICE_CLASSES, handle_dev_get_service_classes_req, },
- { DEV_GET_NAME, handle_dev_get_name_req, },
- { DEV_SET_NAME, handle_dev_set_name_req, },
+ { "GetAddress", handle_dev_get_address_req, },
+ { "GetVersion", handle_dev_get_version_req, },
+ { "GetRevision", handle_dev_get_revision_req, },
+ { "GetManufacturer", handle_dev_get_manufacturer_req, },
+ { "GetCompany", handle_dev_get_company_req, },
+ { "GetMode", handle_dev_get_mode_req, },
+ { "SetMode", handle_dev_set_mode_req, },
+ { "GetDiscoverableTimeout", handle_dev_get_discoverable_to_req, },
+ { "SetDiscoverableTimeout", handle_dev_set_discoverable_to_req, },
+ { "IsConnectable", handle_dev_is_connectable_req, },
+ { "IsDiscoverable", handle_dev_is_discoverable_req, },
+ { "GetMajorClass", handle_dev_get_major_class_req, },
+ { "ListAvailableMinorClasses", handle_dev_list_minor_classes_req, },
+ { "GetMinorClass", handle_dev_get_minor_class_req, },
+ { "SetMinorClass", handle_dev_set_minor_class_req, },
+ { "GetServicesClasses", handle_dev_get_service_classes_req, },
+ { "GetName", handle_dev_get_name_req, },
+ { "SetName", handle_dev_set_name_req, },
- { DEV_GET_REMOTE_VERSION, handle_dev_get_remote_version_req, },
- { DEV_GET_REMOTE_REVISION, handle_dev_get_remote_revision_req, },
- { DEV_GET_REMOTE_MANUFACTURER, handle_dev_get_remote_manufacturer_req, },
- { DEV_GET_REMOTE_COMPANY, handle_dev_get_remote_company_req, },
- { DEV_GET_REMOTE_NAME, handle_dev_get_remote_name_req, },
- { DEV_GET_REMOTE_ALIAS, handle_dev_get_remote_alias_req, },
- { DEV_SET_REMOTE_ALIAS, handle_dev_set_remote_alias_req, },
-
- { DEV_LAST_SEEN, handle_dev_last_seen_req, },
- { DEV_LAST_USED, handle_dev_last_used_req, },
-
- { DEV_CREATE_BONDING, handle_dev_create_bonding_req, },
- { DEV_REMOVE_BONDING, handle_dev_remove_bonding_req, },
- { DEV_HAS_BONDING_NAME, handle_dev_has_bonding_req, },
- { DEV_LIST_BONDINGS, handle_dev_list_bondings_req, },
- { DEV_GET_PIN_CODE_LENGTH, handle_dev_get_pin_code_length_req, },
- { DEV_GET_ENCRYPTION_KEY_SIZE, handle_dev_get_encryption_key_size_req, },
-
- { DEV_DISCOVER_DEVICES, handle_dev_discover_devices_req, },
- { DEV_CANCEL_DISCOVERY, handle_dev_cancel_discovery_req, },
- { DEV_DISCOVER_CACHE, handle_dev_discover_cache_req, },
- { DEV_DISCOVER_SERVICE, handle_dev_discover_service_req, },
+ { "GetRemoteVersion", handle_dev_get_remote_version_req, },
+ { "GetRemoteRevision", handle_dev_get_remote_revision_req, },
+ { "GetRemoteManufacturer", handle_dev_get_remote_manufacturer_req, },
+ { "GetRemoteCompany", handle_dev_get_remote_company_req, },
+ { "GetRemoteName", handle_dev_get_remote_name_req, },
+ { "GetRemoteAlias", handle_dev_get_remote_alias_req, },
+ { "SetRemoteAlias", handle_dev_set_remote_alias_req, },
+
+ { "LastSeen", handle_dev_last_seen_req, },
+ { "LastUsed", handle_dev_last_used_req, },
+
+ { "CreateBonding", handle_dev_create_bonding_req, },
+ { "RemoveBonding", handle_dev_remove_bonding_req, },
+ { "HasBonding", handle_dev_has_bonding_req, },
+ { "ListBondings", handle_dev_list_bondings_req, },
+ { "GetPinCodeLength", handle_dev_get_pin_code_length_req, },
+ { "GetEncryptionKeySize", handle_dev_get_encryption_key_size_req, },
+
+ { "DiscoverDevices", handle_dev_discover_devices_req, },
+ { "CancelDiscovery", handle_dev_cancel_discovery_req, },
{ NULL, NULL }
};
diff --git a/hcid/dbus-manager.c b/hcid/dbus-manager.c
index f86fb1b3..c6d3cc35 100644
--- a/hcid/dbus-manager.c
+++ b/hcid/dbus-manager.c
@@ -128,8 +128,8 @@ static DBusHandlerResult handle_mgr_default_adapter_req(DBusConnection *conn, DB
}
static struct service_data mgr_services[] = {
- { MGR_LIST_ADAPTERS, handle_mgr_list_devices_req },
- { MGR_DEFAULT_ADAPTER, handle_mgr_default_adapter_req },
+ { "ListAdapters", handle_mgr_list_devices_req },
+ { "DefaultAdapter", handle_mgr_default_adapter_req },
{ NULL, NULL }
};
diff --git a/hcid/dbus.c b/hcid/dbus.c
index b1e7a30f..2eb93c7b 100644
--- a/hcid/dbus.c
+++ b/hcid/dbus.c
@@ -380,7 +380,7 @@ gboolean hcid_dbus_register_device(uint16_t id)
pdata->timeout_handler = &discoverable_timeout_handler;
message = dbus_message_new_signal(MANAGER_PATH, MANAGER_INTERFACE,
- BLUEZ_MGR_DEV_ADDED);
+ "AdapterAdded");
if (message == NULL) {
syslog(LOG_ERR, "Can't allocate D-BUS remote name message");
goto failed;
@@ -421,7 +421,7 @@ gboolean hcid_dbus_unregister_device(uint16_t id)
snprintf(path, sizeof(path), "%s/hci%d", ADAPTER_PATH, id);
message = dbus_message_new_signal(MANAGER_PATH, MANAGER_INTERFACE,
- BLUEZ_MGR_DEV_REMOVED);
+ "AdapterRemoved");
if (message == NULL) {
syslog(LOG_ERR, "Can't allocate D-Bus remote name message");
goto failed;
diff --git a/hcid/dbus.h b/hcid/dbus.h
index 67f45bea..42cb528e 100644
--- a/hcid/dbus.h
+++ b/hcid/dbus.h
@@ -138,59 +138,6 @@ static inline DBusHandlerResult send_reply_and_unref(DBusConnection *conn, DBusM
return DBUS_HANDLER_RESULT_HANDLED;
}
-/*========================================================================
- BlueZ D-Bus Manager service definitions "/org/bluez/Manager"
- *========================================================================*/
-
-#define MGR_LIST_ADAPTERS "ListAdapters"
-#define MGR_DEFAULT_ADAPTER "DefaultAdapter"
-
-/* Signals sent in the Manager path */
-#define BLUEZ_MGR_DEV_ADDED "AdapterAdded"
-#define BLUEZ_MGR_DEV_REMOVED "AdapterRemoved"
-
-/*========================================================================
- BlueZ D-Bus Adapter path definitions "/org/bluez/Adapter"
- *========================================================================*/
-#define DEV_GET_ADDRESS "GetAddress"
-#define DEV_GET_VERSION "GetVersion"
-#define DEV_GET_REVISION "GetRevision"
-#define DEV_GET_MANUFACTURER "GetManufacturer"
-#define DEV_GET_COMPANY "GetCompany"
-#define DEV_GET_FEATURES "GetFeatures"
-#define DEV_GET_MODE "GetMode"
-#define DEV_LIST_MINOR_CLASSES "ListAvailableMinorClasses"
-#define DEV_SET_MODE "SetMode"
-#define DEV_GET_DISCOVERABLE_TO "GetDiscoverableTimeout"
-#define DEV_SET_DISCOVERABLE_TO "SetDiscoverableTimeout"
-#define DEV_IS_CONNECTABLE "IsConnectable"
-#define DEV_IS_DISCOVERABLE "IsDiscoverable"
-#define DEV_GET_MAJOR_CLASS "GetMajorClass"
-#define DEV_GET_MINOR_CLASS "GetMinorClass"
-#define DEV_SET_MINOR_CLASS "SetMinorClass"
-#define DEV_GET_SERVICE_CLASSES "GetServiceClasses"
-#define DEV_GET_NAME "GetName"
-#define DEV_SET_NAME "SetName"
-#define DEV_GET_REMOTE_VERSION "GetRemoteVersion"
-#define DEV_GET_REMOTE_REVISION "GetRemoteRevision"
-#define DEV_GET_REMOTE_MANUFACTURER "GetRemoteManufacturer"
-#define DEV_GET_REMOTE_COMPANY "GetRemoteCompany"
-#define DEV_GET_REMOTE_NAME "GetRemoteName"
-#define DEV_GET_REMOTE_ALIAS "GetRemoteAlias"
-#define DEV_SET_REMOTE_ALIAS "SetRemoteAlias"
-#define DEV_LAST_SEEN "LastSeen"
-#define DEV_LAST_USED "LastUsed"
-#define DEV_CREATE_BONDING "CreateBonding"
-#define DEV_REMOVE_BONDING "RemoveBonding"
-#define DEV_HAS_BONDING_NAME "HasBonding"
-#define DEV_LIST_BONDINGS "ListBondings"
-#define DEV_GET_PIN_CODE_LENGTH "GetPinCodeLength"
-#define DEV_GET_ENCRYPTION_KEY_SIZE "GetEncryptionKeySize"
-#define DEV_DISCOVER_DEVICES "DiscoverDevices"
-#define DEV_CANCEL_DISCOVERY "CancelDiscovery"
-#define DEV_DISCOVER_CACHE "DiscoverCache"
-#define DEV_DISCOVER_SERVICE "DiscoverService"
-
/* Signals sent in the adapter based path /org/bluez/Adapter/{hci0, hci1, ...} */
#define DEV_SIG_MODE_CHANGED "ModeChanged"
#define DEV_SIG_NAME_CHANGED "NameChanged"