summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hcid/dbus-adapter.c68
-rw-r--r--hcid/dbus-api.txt75
-rw-r--r--hcid/dbus-todo.txt24
3 files changed, 88 insertions, 79 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c
index ecfe0198..e0cce6bb 100644
--- a/hcid/dbus-adapter.c
+++ b/hcid/dbus-adapter.c
@@ -857,14 +857,6 @@ static DBusHandlerResult handle_dev_get_remote_version_req(DBusConnection *conn,
if (ecode < 0)
return error_failed(conn, msg, -ecode);
- snprintf(filename, PATH_MAX, "%s/%s/lastseen", STORAGEDIR, addr);
-
- str = textfile_get(filename, addr_ptr);
- if (!str)
- return error_unknown_address(conn, msg);
-
- free(str);
-
snprintf(filename, PATH_MAX, "%s/%s/manufacturers", STORAGEDIR, addr);
str = textfile_get(filename, addr_ptr);
@@ -944,14 +936,6 @@ static DBusHandlerResult handle_dev_get_remote_revision_req(DBusConnection *conn
if (ecode < 0)
return error_failed(conn, msg, -ecode);
- snprintf(filename, PATH_MAX, "%s/%s/lastseen", STORAGEDIR, addr);
-
- str = textfile_get(filename, addr_ptr);
- if (!str)
- return error_unknown_address(conn, msg);
-
- free(str);
-
snprintf(filename, PATH_MAX, "%s/%s/manufacturers", STORAGEDIR, addr);
str = textfile_get(filename, addr_ptr);
@@ -1004,14 +988,6 @@ static DBusHandlerResult handle_dev_get_remote_manufacturer_req(DBusConnection *
if (ecode < 0)
return error_failed(conn, msg, -ecode);
- snprintf(filename, PATH_MAX, "%s/%s/lastseen", STORAGEDIR, addr);
-
- str = textfile_get(filename, addr_ptr);
- if (!str)
- return error_unknown_address(conn, msg);
-
- free(str);
-
snprintf(filename, PATH_MAX, "%s/%s/manufacturers", STORAGEDIR, addr);
str = textfile_get(filename, addr_ptr);
@@ -1056,7 +1032,7 @@ static DBusHandlerResult handle_dev_get_remote_company_req(DBusConnection *conn,
tmp = ouitocomp(oui);
if (!tmp)
- return error_record_does_not_exist(conn, msg);
+ return error_not_available(conn, msg);
reply = dbus_message_new_method_return(msg);
if (!reply) {
@@ -1108,7 +1084,7 @@ static int get_remote_class(DBusConnection *conn, DBusMessage *msg, void *data,
ecode = read_remote_class(&local, &peer, class);
if (ecode < 0) {
- error_failed(conn, msg, -ecode);
+ error_not_available(conn, msg);
return -1;
}
@@ -1299,7 +1275,7 @@ static DBusHandlerResult handle_dev_get_remote_alias_req(DBusConnection *conn, D
ecode = get_device_alias(dbus_data->dev_id, &bdaddr, str, sizeof(str));
if (ecode < 0)
- return error_failed(conn, msg, -ecode);
+ return error_not_available(conn, msg);
reply = dbus_message_new_method_return(msg);
if (!reply)
@@ -1446,7 +1422,7 @@ static DBusHandlerResult handle_dev_last_seen_req(DBusConnection *conn, DBusMess
str = textfile_get(filename, addr_ptr);
if (!str)
- return error_failed(conn, msg, ENXIO);
+ return error_not_available(conn, msg);
reply = dbus_message_new_method_return(msg);
if (!reply) {
@@ -1494,7 +1470,7 @@ static DBusHandlerResult handle_dev_last_used_req(DBusConnection *conn, DBusMess
str = textfile_get(filename, addr_ptr);
if (!str)
- return error_failed(conn, msg, ENXIO);
+ return error_not_available(conn, msg);
reply = dbus_message_new_method_return(msg);
if (!reply) {
@@ -1520,6 +1496,9 @@ static DBusHandlerResult handle_dev_disconnect_remote_device_req(DBusConnection
const char *peer_addr;
bdaddr_t peer_bdaddr;
+ int dd;
+ struct active_conn_info *dev;
+
dbus_error_init(&err);
dbus_message_get_args(msg, &err,
@@ -1538,24 +1517,23 @@ static DBusHandlerResult handle_dev_disconnect_remote_device_req(DBusConnection
str2ba(peer_addr, &peer_bdaddr);
l = slist_find(l, &peer_bdaddr, active_conn_find_by_bdaddr);
- if (l) {
- int dd;
- struct active_conn_info *dev = l->data;
+ if (!l)
+ return error_not_connected(conn, msg);
- dd = hci_open_dev(dbus_data->dev_id);
- if (dd < 0)
- return error_no_such_adapter(conn, msg);
+ dev = l->data;
- /* Send the HCI disconnect command */
- if (hci_disconnect(dd, dev->handle, HCI_OE_USER_ENDED_CONNECTION, 100) < 0) {
- error("Disconnect failed");
- hci_close_dev(dd);
- return error_failed(conn, msg, errno);
- }
+ dd = hci_open_dev(dbus_data->dev_id);
+ if (dd < 0)
+ return error_no_such_adapter(conn, msg);
+ /* Send the HCI disconnect command */
+ if (hci_disconnect(dd, dev->handle, HCI_OE_USER_ENDED_CONNECTION, 100) < 0) {
+ error("Disconnect failed");
hci_close_dev(dd);
- } else
- return error_not_connected(conn, msg);
+ return error_failed(conn, msg, errno);
+ }
+
+ hci_close_dev(dd);
reply = dbus_message_new_method_return(msg);
if (!reply)
@@ -1981,7 +1959,7 @@ static DBusHandlerResult handle_dev_get_pin_code_length_req(DBusConnection *conn
len = read_pin_length(&local, &peer);
if (len < 0)
- return error_failed(conn, msg, -len);
+ return error_record_does_not_exist(conn, msg);
reply = dbus_message_new_method_return(msg);
@@ -2236,7 +2214,7 @@ static struct service_data dev_services[] = {
{ "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 },
+ { "GetServiceClasses", handle_dev_get_service_classes_req },
{ "GetName", handle_dev_get_name_req },
{ "SetName", handle_dev_set_name_req },
diff --git a/hcid/dbus-api.txt b/hcid/dbus-api.txt
index a5f30101..d2733970 100644
--- a/hcid/dbus-api.txt
+++ b/hcid/dbus-api.txt
@@ -370,14 +370,13 @@ Methods string GetAddress()
data. The base for this string is the LMP version
value and the features for EDR support.
- In case the remote address is unknown, it should
- return the error UnkownAddress and if the data is
- not available it should return NotAvailable.
+ Not available can be received if the remote device was
+ not contacted(connected) previously. Remote data is
+ automatically retrieved in the first connection.
Example: "Bluetooth 2.0 + EDR"
Possible errors: org.bluez.Error.InvalidArguments
- org.bluez.Error.UnknownAddress
org.bluez.Error.NotAvailable
string GetRemoteRevision(string address)
@@ -390,7 +389,6 @@ Methods string GetAddress()
Example: "HCI 19.2"
Possible errors: org.bluez.Error.InvalidArguments
- org.bluez.Error.UnknownAddress
org.bluez.Error.NotAvailable
string GetRemoteManufacturer(string address)
@@ -400,7 +398,6 @@ Methods string GetAddress()
Example: "Nokia Mobile Phones"
Possible errors: org.bluez.Error.InvalidArguments
- org.bluez.Error.UnknownAddress
org.bluez.Error.NotAvailable
string GetRemoteCompany(string address)
@@ -413,8 +410,8 @@ Methods string GetAddress()
Example: "Microsoft Corporation"
- Possible errors: org.bluez.Error.UnknownAddress
- org.bluez.Error.NotAvailable
+ Possible errors: org.bluez.Error.InvalidArguments
+ org.bluez.Error.NotAvailable
string GetRemoteMajorClass(string address)
@@ -422,8 +419,8 @@ Methods string GetAddress()
Example: "computer"
- Possible errors: org.bluez.Error.UnknownAddress
- org.bluez.Error.NotAvailable
+ Possible errors: org.bluez.Error.InvalidArguments
+ org.bluez.Error.NotAvailable
string GetRemoteMinorClass(string address)
@@ -431,8 +428,8 @@ Methods string GetAddress()
Example: "laptop"
- Possible errors: org.bluez.Error.UnknownAddress
- org.bluez.Error.NotAvailable
+ Possible errors: org.bluez.Error.InvalidArguments
+ org.bluez.Error.NotAvailable
array{string] GetRemoteServiceClasses(string address)
@@ -440,7 +437,7 @@ Methods string GetAddress()
Example: ["networking", "object transfer"]
- Possible errors: org.bluez.Error.UnknownAddress
+ Possible errors: org.bluez.Error.InvalidArguments
org.bluez.Error.NotAvailable
string GetRemoteName(string address)
@@ -461,8 +458,8 @@ Methods string GetAddress()
Example: "00:11:22:33:44:55", "Nokia 770"
- Possible errors: org.bluez.Error.UnknownAddress
- org.bluez.Error.NotAvailable
+ Possible errors: org.bluez.Error.InvalidArguments
+ org.bluez.Error.UnknownAddress
org.bluez.Error.RequestDeferred
string GetRemoteAlias(string address)
@@ -473,7 +470,7 @@ Methods string GetAddress()
An alias should supersede the remote name.
- Possible errors: org.bluez.Error.UnknownAddress
+ Possible errors: org.bluez.Error.InvalidArguments
org.bluez.Error.NotAvailable
void SetRemoteAlias(string address, string alias)
@@ -487,7 +484,7 @@ Methods string GetAddress()
name.
Possible errors: org.bluez.Error.Failed
- org.bluez.Error.UnknownAddress
+ org.bluez.Error.InvalidArguments
void ClearRemoteAlias(string address)
@@ -500,7 +497,7 @@ Methods string GetAddress()
a RemoteAliasCleared signal.
Possible errors: org.bluez.Error.Failed
- org.bluez.Error.UnknownAddress
+ org.bluez.Error.InvalidArguments
string LastSeen(string address)
@@ -509,6 +506,9 @@ Methods string GetAddress()
Example: "2006-02-08 12:00:00 GMT"
+ Possible errors: org.bluez.Error.InvalidArguments
+ org.bluez.Error.NotAvailable
+
Question: Can we find a better name?
string LastUsed(string address)
@@ -518,6 +518,9 @@ Methods string GetAddress()
Example: "2006-02-08 12:00:00 GMT"
+ Possible errors: org.bluez.Error.InvalidArguments
+ org.bluez.Error.NotAvailable
+
Question: Can we find a better name?
void DisconnectRemoteDevice(string address)
@@ -528,7 +531,8 @@ Methods string GetAddress()
use only.
Possible errors: org.bluez.Error.Failed
- org.bluez.Error.UnknownAddress
+ org.bluez.Error.NoSuchAdapter
+ org.bluez.Error.InvalidArguments
org.bluez.Error.NotConnected
void CreateBonding(string address)
@@ -551,9 +555,11 @@ Methods string GetAddress()
signal.
Possible errors: org.bluez.Error.Failed
+ org.bluez.Error.InvalidArguments
org.bluez.Error.UnknownAddress
org.bluez.Error.AlreadyExists
org.bluez.Error.InProgress
+ org.bluez.Error.NoSuchAdapter
org.bluez.Error.ConnectionAttemptFailed
org.bluez.Error.AuthenticationFailed
org.bluez.Error.AuthenticationTimeout
@@ -568,7 +574,11 @@ Methods string GetAddress()
AuthenticationCanceled to signal that an attempt to
create a bonding has been canceled.
- Possible errors: org.bluez.Error.UnknownAddress
+ Possible errors: org.bluez.Error.Failed
+ org.bluez.Error.InvalidArguments
+ org.bluez.Error.UnknownAddress
+ org.bluez.Error.NotAuthorized
+ org.bluez.Error.NoSuchAdapter
void RemoveBonding(string address)
@@ -584,14 +594,17 @@ Methods string GetAddress()
After deleting the link key this method will send a
BondingRemoved signal.
- Possible errors: org.bluez.Error.DoesNotExist
+ Possible errors: org.bluez.Error.Failed
+ org.bluez.Error.InvalidArguments
+ org.bluez.Error.NoSuchAdapter
+ org.bluez.Error.DoesNotExist
boolean HasBonding(string address)
Returns true if the remote device is bonded and false
if no link key is available.
- Possible errors: org.bluez.Error.UnknownAddress
+ Possible errors: org.bluez.Error.InvalidArguments
array{string} ListBondings()
@@ -604,7 +617,7 @@ Methods string GetAddress()
Returns the PIN code length that was used in the
pairing process.
- Possible errors: org.bluez.Error.UnknownAddress
+ Possible errors: org.bluez.Error.InvalidArguments
org.bluez.Error.DoesNotExist
uint8 GetEncryptionKeySize(string address)
@@ -614,7 +627,8 @@ Methods string GetAddress()
This method will fail if no connection to the address
has been established.
- Possible errors: org.bluez.Error.UnknownAddress
+ Possible errors: org.bluez.Error.InvalidArguments
+ org.bluez.Error.UnknownAddress
org.bluez.Error.NotConnected
org.bluez.Error.DoesNotExist
@@ -629,7 +643,9 @@ Methods string GetAddress()
RemoteNameUpdated signals. If the procedure has been
finished an DiscoveryCompleted signal will be sent.
- Possible errors: org.bluez.Error.InProgress
+ Possible errors: org.bluez.Error.Failed
+ org.bluez.Error.InProgress
+ org.bluez.Error.NoSuchAdapter
void DiscoverDevicesWithoutNameResolving()
@@ -647,14 +663,19 @@ Methods string GetAddress()
case it will only happen if GetRemoteName has been
called and no previously stored name is available.
- Possible errors: org.bluez.Error.InProgress
+ Possible errors: org.bluez.Error.Failed
+ org.bluez.Error.InProgress
+ org.bluez.Error.NoSuchAdapter
void CancelDiscovery()
This method will cancel any previous DiscoverDevices
or DiscoverDevicesWithoutNameResolving actions.
- Possible errors: org.bluez.Error.InProgress
+ Possible errors: org.bluez.Error.Failed
+ org.bluez.Error.InProgress
+ org.bluez.Error.NotAuthorized
+ org.bluez.Error.NoSuchAdapter
Signals void ModeChanged(string mode)
diff --git a/hcid/dbus-todo.txt b/hcid/dbus-todo.txt
index beec2862..db18c74a 100644
--- a/hcid/dbus-todo.txt
+++ b/hcid/dbus-todo.txt
@@ -1,10 +1,20 @@
-* method rename
+* Memory allocation failure for D-Bus messages
Date: 2006/04/10
-Description: Rename the method GetServicesClasses to GetServiceClasses.
+Description: return DBUS_HANDLER_RESULT_NEED_MEMORY instead of return
+an out of memory error
-* Error return for remote major/minor class
-Date: 2006/04/10
-Description: GetRemoteMajorMajorClass and GetRemoteMinorClass should
-return "org.bluez.Error.NotAvailable" when the "classes" doesn't exists.
-Currently, it's returning no such file or directory.
+* Get encryption key size
+Date: 2006/04/11
+Description: This method is not implemented
+
+* get_device_address
+Date: 2006/04/11
+Description: This function is called frequently. Verify if it's
+possible add a new field in the D-Bus data path structure to
+store this information.
+
+* record doesn't exist and not available
+Date: 2006/04/11
+Description: Review these errors. The usage of "Does not exists"
+and "Not available" are confusing.