author | Jocelyn Liu <joliu@mozilla.com> |
Sat, 21 Mar 2015 06:44:00 -0400 | |
changeset 235157 | 83bf85317796f363535aa9c00c6c009aa78d16c1 |
parent 235156 | d9014469296ea1bcb755b26683c4db1ef835010c |
child 235158 | a1144b3dbb77a14585907ad07b5f56950a7f4868 |
push id | 57353 |
push user | kwierso@gmail.com |
push date | Mon, 23 Mar 2015 23:51:33 +0000 |
treeherder | mozilla-inbound@7f5abc27fd53 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | btian |
bugs | 1114515 |
milestone | 39.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/bluetooth2/BluetoothInterface.h +++ b/dom/bluetooth2/BluetoothInterface.h @@ -686,30 +686,34 @@ public: /* Clear the attribute cache for a given device*/ virtual void Refresh(int aClientIf, const nsAString& aBdAddr, BluetoothGattClientResultHandler* aRes) = 0; /* Enumerate Attributes */ virtual void SearchService(int aConnId, + bool aSearchAll, const BluetoothUuid& aUuid, BluetoothGattClientResultHandler* aRes) = 0; virtual void GetIncludedService( int aConnId, const BluetoothGattServiceId& aServiceId, + bool aFirst, const BluetoothGattServiceId& aStartServiceId, BluetoothGattClientResultHandler* aRes) = 0; virtual void GetCharacteristic(int aConnId, const BluetoothGattServiceId& aServiceId, + bool aFirst, const BluetoothGattId& aStartCharId, BluetoothGattClientResultHandler* aRes) = 0; virtual void GetDescriptor(int aConnId, const BluetoothGattServiceId& aServiceId, const BluetoothGattId& aCharId, + bool aFirst, const BluetoothGattId& aDescriptorId, BluetoothGattClientResultHandler* aRes) = 0; /* Read / Write An Attribute */ virtual void ReadCharacteristic(int aConnId, const BluetoothGattServiceId& aServiceId, const BluetoothGattId& aCharId, int aAuthReq,
--- a/dom/bluetooth2/bluedroid/BluetoothGattHALInterface.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothGattHALInterface.cpp @@ -616,24 +616,26 @@ BluetoothGattClientHALInterface::Refresh DispatchBluetoothGattClientHALResult( aRes, &BluetoothGattClientResultHandler::Refresh, ConvertDefault(status, STATUS_FAIL)); } } void BluetoothGattClientHALInterface::SearchService( - int aConnId, const BluetoothUuid& aUuid, + int aConnId, bool aSearchAll, const BluetoothUuid& aUuid, BluetoothGattClientResultHandler* aRes) { bt_status_t status; #if ANDROID_VERSION >= 19 bt_uuid_t uuid; - if (NS_SUCCEEDED(Convert(aUuid, uuid))) { + if (aSearchAll) { + status = mInterface->search_service(aConnId, 0); + } else if (NS_SUCCEEDED(Convert(aUuid, uuid))) { status = mInterface->search_service(aConnId, &uuid); } else { status = BT_STATUS_PARM_INVALID; } #else status = BT_STATUS_UNSUPPORTED; #endif @@ -642,26 +644,28 @@ BluetoothGattClientHALInterface::SearchS aRes, &BluetoothGattClientResultHandler::SearchService, ConvertDefault(status, STATUS_FAIL)); } } void BluetoothGattClientHALInterface::GetIncludedService( int aConnId, const BluetoothGattServiceId& aServiceId, - const BluetoothGattServiceId& aStartServiceId, + bool aFirst, const BluetoothGattServiceId& aStartServiceId, BluetoothGattClientResultHandler* aRes) { bt_status_t status; #if ANDROID_VERSION >= 19 btgatt_srvc_id_t serviceId; btgatt_srvc_id_t startServiceId; - if (NS_SUCCEEDED(Convert(aServiceId, serviceId)) && - NS_SUCCEEDED(Convert(aStartServiceId, startServiceId))) { + if (aFirst && NS_SUCCEEDED(Convert(aServiceId, serviceId))) { + status = mInterface->get_included_service(aConnId, &serviceId, 0); + } else if (NS_SUCCEEDED(Convert(aServiceId, serviceId)) && + NS_SUCCEEDED(Convert(aStartServiceId, startServiceId))) { status = mInterface->get_included_service(aConnId, &serviceId, &startServiceId); } else { status = BT_STATUS_PARM_INVALID; } #else status = BT_STATUS_UNSUPPORTED; #endif @@ -671,26 +675,28 @@ BluetoothGattClientHALInterface::GetIncl aRes, &BluetoothGattClientResultHandler::GetIncludedService, ConvertDefault(status, STATUS_FAIL)); } } void BluetoothGattClientHALInterface::GetCharacteristic( int aConnId, const BluetoothGattServiceId& aServiceId, - const BluetoothGattId& aStartCharId, + bool aFirst, const BluetoothGattId& aStartCharId, BluetoothGattClientResultHandler* aRes) { bt_status_t status; #if ANDROID_VERSION >= 19 btgatt_srvc_id_t serviceId; btgatt_gatt_id_t startCharId; - if (NS_SUCCEEDED(Convert(aServiceId, serviceId)) && - NS_SUCCEEDED(Convert(aStartCharId, startCharId))) { + if (aFirst && NS_SUCCEEDED(Convert(aServiceId, serviceId))) { + status = mInterface->get_characteristic(aConnId, &serviceId, 0); + } else if (NS_SUCCEEDED(Convert(aServiceId, serviceId)) && + NS_SUCCEEDED(Convert(aStartCharId, startCharId))) { status = mInterface->get_characteristic(aConnId, &serviceId, &startCharId); } else { status = BT_STATUS_PARM_INVALID; } #else status = BT_STATUS_UNSUPPORTED; #endif @@ -699,29 +705,32 @@ BluetoothGattClientHALInterface::GetChar aRes, &BluetoothGattClientResultHandler::GetCharacteristic, ConvertDefault(status, STATUS_FAIL)); } } void BluetoothGattClientHALInterface::GetDescriptor( int aConnId, const BluetoothGattServiceId& aServiceId, - const BluetoothGattId& aCharId, - const BluetoothGattId& aDescriptorId, - BluetoothGattClientResultHandler* aRes) + const BluetoothGattId& aCharId, bool aFirst, + const BluetoothGattId& aDescriptorId, BluetoothGattClientResultHandler* aRes) { bt_status_t status; #if ANDROID_VERSION >= 19 btgatt_srvc_id_t serviceId; btgatt_gatt_id_t charId; btgatt_gatt_id_t descriptorId; - if (NS_SUCCEEDED(Convert(aServiceId, serviceId)) && - NS_SUCCEEDED(Convert(aCharId, charId)) && - NS_SUCCEEDED(Convert(aDescriptorId, descriptorId))) { + if (aFirst && + NS_SUCCEEDED(Convert(aServiceId, serviceId)) && + NS_SUCCEEDED(Convert(aCharId, charId))) { + status = mInterface->get_descriptor(aConnId, &serviceId, &charId, 0); + } else if (NS_SUCCEEDED(Convert(aServiceId, serviceId)) && + NS_SUCCEEDED(Convert(aCharId, charId)) && + NS_SUCCEEDED(Convert(aDescriptorId, descriptorId))) { status = mInterface->get_descriptor(aConnId, &serviceId, &charId, &descriptorId); } else { status = BT_STATUS_PARM_INVALID; } #else status = BT_STATUS_UNSUPPORTED; #endif
--- a/dom/bluetooth2/bluedroid/BluetoothGattHALInterface.h +++ b/dom/bluetooth2/bluedroid/BluetoothGattHALInterface.h @@ -51,29 +51,33 @@ public: /* Clear the attribute cache for a given device*/ void Refresh(int aClientIf, const nsAString& aBdAddr, BluetoothGattClientResultHandler* aRes); /* Enumerate Attributes */ void SearchService(int aConnId, + bool aSearchAll, const BluetoothUuid& aUuid, BluetoothGattClientResultHandler* aRes); void GetIncludedService(int aConnId, const BluetoothGattServiceId& aServiceId, + bool aFirst, const BluetoothGattServiceId& aStartServiceId, BluetoothGattClientResultHandler* aRes); void GetCharacteristic(int aConnId, const BluetoothGattServiceId& aServiceId, + bool aFirst, const BluetoothGattId& aStartCharId, BluetoothGattClientResultHandler* aRes); void GetDescriptor(int aConnId, const BluetoothGattServiceId& aServiceId, const BluetoothGattId& aCharId, + bool aFirst, const BluetoothGattId& aDescriptorId, BluetoothGattClientResultHandler* aRes); /* Read / Write An Attribute */ void ReadCharacteristic(int aConnId, const BluetoothGattServiceId& aServiceId, const BluetoothGattId& aCharId, int aAuthReq,