Bug 1139298: Replace type int with BluetoothGattStatus enum for GATT client callbacks. r=btian

This commit is contained in:
Jocelyn Liu 2015-03-06 17:21:00 +08:00
parent cc74d2cd41
commit b75b4537a5
6 changed files with 109 additions and 75 deletions

View File

@ -534,6 +534,11 @@ struct BluetoothAvrcpPlayerSettings {
uint8_t mValues[256]; uint8_t mValues[256];
}; };
enum BluetoothGattStatus {
GATT_STATUS_SUCCESS,
GATT_STATUS_ERROR
};
struct BluetoothGattAdvData { struct BluetoothGattAdvData {
uint8_t mAdvData[62]; uint8_t mAdvData[62];
}; };

View File

@ -463,7 +463,7 @@ public:
virtual ~BluetoothGattClientNotificationHandler(); virtual ~BluetoothGattClientNotificationHandler();
virtual void virtual void
RegisterClientNotification(int aStatus, RegisterClientNotification(BluetoothGattStatus aStatus,
int aClientIf, int aClientIf,
const BluetoothUuid& aAppUuid) const BluetoothUuid& aAppUuid)
{ } { }
@ -476,20 +476,20 @@ public:
virtual void virtual void
ConnectNotification(int aConnId, ConnectNotification(int aConnId,
int aStatus, BluetoothGattStatus aStatus,
int aClientIf, int aClientIf,
const nsAString& aBdAddr) const nsAString& aBdAddr)
{ } { }
virtual void virtual void
DisconnectNotification(int aConnId, DisconnectNotification(int aConnId,
int aStatus, BluetoothGattStatus aStatus,
int aClientIf, int aClientIf,
const nsAString& aBdAddr) const nsAString& aBdAddr)
{ } { }
virtual void virtual void
SearchCompleteNotification(int aConnId, int aStatus) { } SearchCompleteNotification(int aConnId, BluetoothGattStatus aStatus) { }
virtual void virtual void
SearchResultNotification(int aConnId, SearchResultNotification(int aConnId,
const BluetoothGattServiceId& aServiceId) const BluetoothGattServiceId& aServiceId)
@ -497,7 +497,7 @@ public:
virtual void virtual void
GetCharacteristicNotification(int aConnId, GetCharacteristicNotification(int aConnId,
int aStatus, BluetoothGattStatus aStatus,
const BluetoothGattServiceId& aServiceId, const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId, const BluetoothGattId& aCharId,
int aCharProperty) int aCharProperty)
@ -505,7 +505,7 @@ public:
virtual void virtual void
GetDescriptorNotification(int aConnId, GetDescriptorNotification(int aConnId,
int aStatus, BluetoothGattStatus aStatus,
const BluetoothGattServiceId& aServiceId, const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId, const BluetoothGattId& aCharId,
const BluetoothGattId& aDescriptorId) const BluetoothGattId& aDescriptorId)
@ -513,7 +513,7 @@ public:
virtual void virtual void
GetIncludedServiceNotification(int aConnId, GetIncludedServiceNotification(int aConnId,
int aStatus, BluetoothGattStatus aStatus,
const BluetoothGattServiceId& aServiceId, const BluetoothGattServiceId& aServiceId,
const BluetoothGattServiceId& aIncludedServId) const BluetoothGattServiceId& aIncludedServId)
{ } { }
@ -521,7 +521,7 @@ public:
virtual void virtual void
RegisterNotificationNotification(int aConnId, RegisterNotificationNotification(int aConnId,
int aIsRegister, int aIsRegister,
int aStatus, BluetoothGattStatus aStatus,
const BluetoothGattServiceId& aServiceId, const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId) const BluetoothGattId& aCharId)
{ } { }
@ -532,40 +532,40 @@ public:
virtual void virtual void
ReadCharacteristicNotification(int aConnId, ReadCharacteristicNotification(int aConnId,
int aStatus, BluetoothGattStatus aStatus,
const BluetoothGattReadParam& aReadParam) const BluetoothGattReadParam& aReadParam)
{ } { }
virtual void virtual void
WriteCharacteristicNotification(int aConnId, WriteCharacteristicNotification(int aConnId,
int aStatus, BluetoothGattStatus aStatus,
const BluetoothGattWriteParam& aWriteParam) const BluetoothGattWriteParam& aWriteParam)
{ } { }
virtual void virtual void
ReadDescriptorNotification(int aConnId, ReadDescriptorNotification(int aConnId,
int aStatus, BluetoothGattStatus aStatus,
const BluetoothGattReadParam& aReadParam) const BluetoothGattReadParam& aReadParam)
{ } { }
virtual void virtual void
WriteDescriptorNotification(int aConnId, WriteDescriptorNotification(int aConnId,
int aStatus, BluetoothGattStatus aStatus,
const BluetoothGattWriteParam& aWriteParam) const BluetoothGattWriteParam& aWriteParam)
{ } { }
virtual void virtual void
ExecuteWriteNotification(int aConnId, int aStatus) { } ExecuteWriteNotification(int aConnId, BluetoothGattStatus aStatus) { }
virtual void virtual void
ReadRemoteRssiNotification(int aClientIf, ReadRemoteRssiNotification(int aClientIf,
const nsAString& aBdAddr, const nsAString& aBdAddr,
int aRssi, int aRssi,
int aStatus) BluetoothGattStatus aStatus)
{ } { }
virtual void virtual void
ListenNotification(int aStatus, int aServerIf) { } ListenNotification(BluetoothGattStatus aStatus, int aServerIf) { }
protected: protected:
BluetoothGattClientNotificationHandler() BluetoothGattClientNotificationHandler()

View File

@ -98,8 +98,8 @@ struct BluetoothGattClientCallback
// GATT Client Notification // GATT Client Notification
typedef BluetoothNotificationHALRunnable3< typedef BluetoothNotificationHALRunnable3<
GattClientNotificationHandlerWrapper, void, GattClientNotificationHandlerWrapper, void,
int, int, BluetoothUuid, BluetoothGattStatus, int, BluetoothUuid,
int, int, const BluetoothUuid&> BluetoothGattStatus, int, const BluetoothUuid&>
RegisterClientNotification; RegisterClientNotification;
typedef BluetoothNotificationHALRunnable3< typedef BluetoothNotificationHALRunnable3<
@ -110,19 +110,19 @@ struct BluetoothGattClientCallback
typedef BluetoothNotificationHALRunnable4< typedef BluetoothNotificationHALRunnable4<
GattClientNotificationHandlerWrapper, void, GattClientNotificationHandlerWrapper, void,
int, int, int, nsString, int, BluetoothGattStatus, int, nsString,
int, int, int, const nsAString&> int, BluetoothGattStatus, int, const nsAString&>
ConnectNotification; ConnectNotification;
typedef BluetoothNotificationHALRunnable4< typedef BluetoothNotificationHALRunnable4<
GattClientNotificationHandlerWrapper, void, GattClientNotificationHandlerWrapper, void,
int, int, int, nsString, int, BluetoothGattStatus, int, nsString,
int, int, int, const nsAString&> int, BluetoothGattStatus, int, const nsAString&>
DisconnectNotification; DisconnectNotification;
typedef BluetoothNotificationHALRunnable2< typedef BluetoothNotificationHALRunnable2<
GattClientNotificationHandlerWrapper, void, GattClientNotificationHandlerWrapper, void,
int, int> int, BluetoothGattStatus>
SearchCompleteNotification; SearchCompleteNotification;
typedef BluetoothNotificationHALRunnable2< typedef BluetoothNotificationHALRunnable2<
@ -133,29 +133,32 @@ struct BluetoothGattClientCallback
typedef BluetoothNotificationHALRunnable5< typedef BluetoothNotificationHALRunnable5<
GattClientNotificationHandlerWrapper, void, GattClientNotificationHandlerWrapper, void,
int, int, BluetoothGattServiceId, BluetoothGattId, int, int, BluetoothGattStatus, BluetoothGattServiceId,
int, int, const BluetoothGattServiceId&, const BluetoothGattId&> BluetoothGattId, int,
int, BluetoothGattStatus, const BluetoothGattServiceId&,
const BluetoothGattId&>
GetCharacteristicNotification; GetCharacteristicNotification;
typedef BluetoothNotificationHALRunnable5< typedef BluetoothNotificationHALRunnable5<
GattClientNotificationHandlerWrapper, void, GattClientNotificationHandlerWrapper, void,
int, int, BluetoothGattServiceId, int, BluetoothGattStatus, BluetoothGattServiceId,
BluetoothGattId, BluetoothGattId, BluetoothGattId, BluetoothGattId,
int, int, const BluetoothGattServiceId&, int, BluetoothGattStatus, const BluetoothGattServiceId&,
const BluetoothGattId&, const BluetoothGattId&> const BluetoothGattId&, const BluetoothGattId&>
GetDescriptorNotification; GetDescriptorNotification;
typedef BluetoothNotificationHALRunnable4< typedef BluetoothNotificationHALRunnable4<
GattClientNotificationHandlerWrapper, void, GattClientNotificationHandlerWrapper, void,
int, int, BluetoothGattServiceId, BluetoothGattServiceId, int, BluetoothGattStatus, BluetoothGattServiceId, BluetoothGattServiceId,
int, int, const BluetoothGattServiceId&, const BluetoothGattServiceId&> int, BluetoothGattStatus, const BluetoothGattServiceId&,
const BluetoothGattServiceId&>
GetIncludedServiceNotification; GetIncludedServiceNotification;
typedef BluetoothNotificationHALRunnable5< typedef BluetoothNotificationHALRunnable5<
GattClientNotificationHandlerWrapper, void, GattClientNotificationHandlerWrapper, void,
int, int, int, int, int, BluetoothGattStatus,
BluetoothGattServiceId, BluetoothGattId, BluetoothGattServiceId, BluetoothGattId,
int, int, int, int, int, BluetoothGattStatus,
const BluetoothGattServiceId&, const BluetoothGattId&> const BluetoothGattServiceId&, const BluetoothGattId&>
RegisterNotificationNotification; RegisterNotificationNotification;
@ -167,42 +170,42 @@ struct BluetoothGattClientCallback
typedef BluetoothNotificationHALRunnable3< typedef BluetoothNotificationHALRunnable3<
GattClientNotificationHandlerWrapper, void, GattClientNotificationHandlerWrapper, void,
int, int, BluetoothGattReadParam, int, BluetoothGattStatus, BluetoothGattReadParam,
int, int, const BluetoothGattReadParam&> int, BluetoothGattStatus, const BluetoothGattReadParam&>
ReadCharacteristicNotification; ReadCharacteristicNotification;
typedef BluetoothNotificationHALRunnable3< typedef BluetoothNotificationHALRunnable3<
GattClientNotificationHandlerWrapper, void, GattClientNotificationHandlerWrapper, void,
int, int, BluetoothGattWriteParam, int, BluetoothGattStatus, BluetoothGattWriteParam,
int, int, const BluetoothGattWriteParam&> int, BluetoothGattStatus, const BluetoothGattWriteParam&>
WriteCharacteristicNotification; WriteCharacteristicNotification;
typedef BluetoothNotificationHALRunnable3< typedef BluetoothNotificationHALRunnable3<
GattClientNotificationHandlerWrapper, void, GattClientNotificationHandlerWrapper, void,
int, int, BluetoothGattReadParam, int, BluetoothGattStatus, BluetoothGattReadParam,
int, int, const BluetoothGattReadParam&> int, BluetoothGattStatus, const BluetoothGattReadParam&>
ReadDescriptorNotification; ReadDescriptorNotification;
typedef BluetoothNotificationHALRunnable3< typedef BluetoothNotificationHALRunnable3<
GattClientNotificationHandlerWrapper, void, GattClientNotificationHandlerWrapper, void,
int, int, BluetoothGattWriteParam, int, BluetoothGattStatus, BluetoothGattWriteParam,
int, int, const BluetoothGattWriteParam&> int, BluetoothGattStatus, const BluetoothGattWriteParam&>
WriteDescriptorNotification; WriteDescriptorNotification;
typedef BluetoothNotificationHALRunnable2< typedef BluetoothNotificationHALRunnable2<
GattClientNotificationHandlerWrapper, void, GattClientNotificationHandlerWrapper, void,
int, int> int, BluetoothGattStatus>
ExecuteWriteNotification; ExecuteWriteNotification;
typedef BluetoothNotificationHALRunnable4< typedef BluetoothNotificationHALRunnable4<
GattClientNotificationHandlerWrapper, void, GattClientNotificationHandlerWrapper, void,
int, nsString, int, int, int, nsString, int, BluetoothGattStatus,
int, const nsAString&, int, int> int, const nsAString&, int, BluetoothGattStatus>
ReadRemoteRssiNotification; ReadRemoteRssiNotification;
typedef BluetoothNotificationHALRunnable2< typedef BluetoothNotificationHALRunnable2<
GattClientNotificationHandlerWrapper, void, GattClientNotificationHandlerWrapper, void,
int, int> BluetoothGattStatus, int>
ListenNotification; ListenNotification;
// Bluedroid GATT client callbacks // Bluedroid GATT client callbacks

View File

@ -488,7 +488,7 @@ BluetoothGattManager::Disconnect(const nsAString& aAppUuid,
// Notification Handlers // Notification Handlers
// //
void void
BluetoothGattManager::RegisterClientNotification(int aStatus, BluetoothGattManager::RegisterClientNotification(BluetoothGattStatus aStatus,
int aClientIf, int aClientIf,
const BluetoothUuid& aAppUuid) const BluetoothUuid& aAppUuid)
{ {
@ -505,7 +505,7 @@ BluetoothGattManager::RegisterClientNotification(int aStatus,
BluetoothService* bs = BluetoothService::Get(); BluetoothService* bs = BluetoothService::Get();
NS_ENSURE_TRUE_VOID(bs); NS_ENSURE_TRUE_VOID(bs);
if (aStatus) { // operation failed if (aStatus != GATT_STATUS_SUCCESS) {
BT_API2_LOGR( BT_API2_LOGR(
"RegisterClient failed, clientIf = %d, status = %d, appUuid = %s", "RegisterClient failed, clientIf = %d, status = %d, appUuid = %s",
aClientIf, aStatus, NS_ConvertUTF16toUTF8(uuid).get()); aClientIf, aStatus, NS_ConvertUTF16toUTF8(uuid).get());
@ -550,7 +550,7 @@ BluetoothGattManager::ScanResultNotification(
void void
BluetoothGattManager::ConnectNotification(int aConnId, BluetoothGattManager::ConnectNotification(int aConnId,
int aStatus, BluetoothGattStatus aStatus,
int aClientIf, int aClientIf,
const nsAString& aDeviceAddr) const nsAString& aDeviceAddr)
{ {
@ -565,7 +565,7 @@ BluetoothGattManager::ConnectNotification(int aConnId,
NS_ENSURE_TRUE_VOID(index != sClients->NoIndex); NS_ENSURE_TRUE_VOID(index != sClients->NoIndex);
nsRefPtr<BluetoothGattClient> client = sClients->ElementAt(index); nsRefPtr<BluetoothGattClient> client = sClients->ElementAt(index);
if (aStatus) { // operation failed if (aStatus != GATT_STATUS_SUCCESS) {
BT_API2_LOGR("Connect failed, clientIf = %d, connId = %d, status = %d", BT_API2_LOGR("Connect failed, clientIf = %d, connId = %d, status = %d",
aClientIf, aConnId, aStatus); aClientIf, aConnId, aStatus);
@ -602,7 +602,7 @@ BluetoothGattManager::ConnectNotification(int aConnId,
void void
BluetoothGattManager::DisconnectNotification(int aConnId, BluetoothGattManager::DisconnectNotification(int aConnId,
int aStatus, BluetoothGattStatus aStatus,
int aClientIf, int aClientIf,
const nsAString& aDeviceAddr) const nsAString& aDeviceAddr)
{ {
@ -617,7 +617,7 @@ BluetoothGattManager::DisconnectNotification(int aConnId,
NS_ENSURE_TRUE_VOID(index != sClients->NoIndex); NS_ENSURE_TRUE_VOID(index != sClients->NoIndex);
nsRefPtr<BluetoothGattClient> client = sClients->ElementAt(index); nsRefPtr<BluetoothGattClient> client = sClients->ElementAt(index);
if (aStatus) { // operation failed if (aStatus != GATT_STATUS_SUCCESS) {
// Notify BluetoothGatt that the client remains connected // Notify BluetoothGatt that the client remains connected
bs->DistributeSignal( bs->DistributeSignal(
NS_LITERAL_STRING(GATT_CONNECTION_STATE_CHANGED_ID), NS_LITERAL_STRING(GATT_CONNECTION_STATE_CHANGED_ID),
@ -650,7 +650,8 @@ BluetoothGattManager::DisconnectNotification(int aConnId,
} }
void void
BluetoothGattManager::SearchCompleteNotification(int aConnId, int aStatus) BluetoothGattManager::SearchCompleteNotification(int aConnId,
BluetoothGattStatus aStatus)
{ } { }
void void
@ -660,7 +661,7 @@ BluetoothGattManager::SearchResultNotification(
void void
BluetoothGattManager::GetCharacteristicNotification( BluetoothGattManager::GetCharacteristicNotification(
int aConnId, int aStatus, int aConnId, BluetoothGattStatus aStatus,
const BluetoothGattServiceId& aServiceId, const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId, const BluetoothGattId& aCharId,
int aCharProperty) int aCharProperty)
@ -668,7 +669,7 @@ BluetoothGattManager::GetCharacteristicNotification(
void void
BluetoothGattManager::GetDescriptorNotification( BluetoothGattManager::GetDescriptorNotification(
int aConnId, int aStatus, int aConnId, BluetoothGattStatus aStatus,
const BluetoothGattServiceId& aServiceId, const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId, const BluetoothGattId& aCharId,
const BluetoothGattId& aDescriptorId) const BluetoothGattId& aDescriptorId)
@ -676,14 +677,14 @@ BluetoothGattManager::GetDescriptorNotification(
void void
BluetoothGattManager::GetIncludedServiceNotification( BluetoothGattManager::GetIncludedServiceNotification(
int aConnId, int aStatus, int aConnId, BluetoothGattStatus aStatus,
const BluetoothGattServiceId& aServiceId, const BluetoothGattServiceId& aServiceId,
const BluetoothGattServiceId& aIncludedServId) const BluetoothGattServiceId& aIncludedServId)
{ } { }
void void
BluetoothGattManager::RegisterNotificationNotification( BluetoothGattManager::RegisterNotificationNotification(
int aConnId, int aIsRegister, int aStatus, int aConnId, int aIsRegister, BluetoothGattStatus aStatus,
const BluetoothGattServiceId& aServiceId, const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId) const BluetoothGattId& aCharId)
{ } { }
@ -695,37 +696,42 @@ BluetoothGattManager::NotifyNotification(
void void
BluetoothGattManager::ReadCharacteristicNotification( BluetoothGattManager::ReadCharacteristicNotification(
int aConnId, int aStatus, const BluetoothGattReadParam& aReadParam) int aConnId, BluetoothGattStatus aStatus,
const BluetoothGattReadParam& aReadParam)
{ } { }
void void
BluetoothGattManager::WriteCharacteristicNotification( BluetoothGattManager::WriteCharacteristicNotification(
int aConnId, int aStatus, const BluetoothGattWriteParam& aWriteParam) int aConnId, BluetoothGattStatus aStatus,
const BluetoothGattWriteParam& aWriteParam)
{ } { }
void void
BluetoothGattManager::ReadDescriptorNotification( BluetoothGattManager::ReadDescriptorNotification(
int aConnId, int aStatus, const BluetoothGattReadParam& aReadParam) int aConnId, BluetoothGattStatus aStatus,
const BluetoothGattReadParam& aReadParam)
{ } { }
void void
BluetoothGattManager::WriteDescriptorNotification( BluetoothGattManager::WriteDescriptorNotification(
int aConnId, int aStatus, const BluetoothGattWriteParam& aWriteParam) int aConnId, BluetoothGattStatus aStatus,
const BluetoothGattWriteParam& aWriteParam)
{ } { }
void void
BluetoothGattManager::ExecuteWriteNotification(int aConnId, int aStatus) BluetoothGattManager::ExecuteWriteNotification(int aConnId,
BluetoothGattStatus aStatus)
{ } { }
void void
BluetoothGattManager::ReadRemoteRssiNotification(int aClientIf, BluetoothGattManager::ReadRemoteRssiNotification(int aClientIf,
const nsAString& aBdAddr, const nsAString& aBdAddr,
int aRssi, int aRssi,
int aStatus) BluetoothGattStatus aStatus)
{ } { }
void void
BluetoothGattManager::ListenNotification(int aStatus, BluetoothGattManager::ListenNotification(BluetoothGattStatus aStatus,
int aServerIf) int aServerIf)
{ } { }

View File

@ -51,7 +51,7 @@ private:
void HandleShutdown(); void HandleShutdown();
void RegisterClientNotification(int aStatus, void RegisterClientNotification(BluetoothGattStatus aStatus,
int aClientIf, int aClientIf,
const BluetoothUuid& aAppUuid) MOZ_OVERRIDE; const BluetoothUuid& aAppUuid) MOZ_OVERRIDE;
@ -60,40 +60,41 @@ private:
const BluetoothGattAdvData& aAdvData) MOZ_OVERRIDE; const BluetoothGattAdvData& aAdvData) MOZ_OVERRIDE;
void ConnectNotification(int aConnId, void ConnectNotification(int aConnId,
int aStatus, BluetoothGattStatus aStatus,
int aClientIf, int aClientIf,
const nsAString& aBdAddr) MOZ_OVERRIDE; const nsAString& aBdAddr) MOZ_OVERRIDE;
void DisconnectNotification(int aConnId, void DisconnectNotification(int aConnId,
int aStatus, BluetoothGattStatus aStatus,
int aClientIf, int aClientIf,
const nsAString& aBdAddr) MOZ_OVERRIDE; const nsAString& aBdAddr) MOZ_OVERRIDE;
void SearchCompleteNotification(int aConnId, int aStatus) MOZ_OVERRIDE; void SearchCompleteNotification(int aConnId,
BluetoothGattStatus aStatus) MOZ_OVERRIDE;
void SearchResultNotification(int aConnId, void SearchResultNotification(int aConnId,
const BluetoothGattServiceId& aServiceId) const BluetoothGattServiceId& aServiceId)
MOZ_OVERRIDE; MOZ_OVERRIDE;
void GetCharacteristicNotification( void GetCharacteristicNotification(
int aConnId, int aStatus, int aConnId, BluetoothGattStatus aStatus,
const BluetoothGattServiceId& aServiceId, const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId, const BluetoothGattId& aCharId,
int aCharProperty) MOZ_OVERRIDE; int aCharProperty) MOZ_OVERRIDE;
void GetDescriptorNotification( void GetDescriptorNotification(
int aConnId, int aStatus, int aConnId, BluetoothGattStatus aStatus,
const BluetoothGattServiceId& aServiceId, const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId, const BluetoothGattId& aCharId,
const BluetoothGattId& aDescriptorId) MOZ_OVERRIDE; const BluetoothGattId& aDescriptorId) MOZ_OVERRIDE;
void GetIncludedServiceNotification( void GetIncludedServiceNotification(
int aConnId, int aStatus, int aConnId, BluetoothGattStatus aStatus,
const BluetoothGattServiceId& aServiceId, const BluetoothGattServiceId& aServiceId,
const BluetoothGattServiceId& aIncludedServId) MOZ_OVERRIDE; const BluetoothGattServiceId& aIncludedServId) MOZ_OVERRIDE;
void RegisterNotificationNotification( void RegisterNotificationNotification(
int aConnId, int aIsRegister, int aStatus, int aConnId, int aIsRegister, BluetoothGattStatus aStatus,
const BluetoothGattServiceId& aServiceId, const BluetoothGattServiceId& aServiceId,
const BluetoothGattId& aCharId) MOZ_OVERRIDE; const BluetoothGattId& aCharId) MOZ_OVERRIDE;
@ -102,32 +103,34 @@ private:
MOZ_OVERRIDE; MOZ_OVERRIDE;
void ReadCharacteristicNotification(int aConnId, void ReadCharacteristicNotification(int aConnId,
int aStatus, BluetoothGattStatus aStatus,
const BluetoothGattReadParam& aReadParam) const BluetoothGattReadParam& aReadParam)
MOZ_OVERRIDE; MOZ_OVERRIDE;
void WriteCharacteristicNotification( void WriteCharacteristicNotification(
int aConnId, int aStatus, int aConnId, BluetoothGattStatus aStatus,
const BluetoothGattWriteParam& aWriteParam) MOZ_OVERRIDE; const BluetoothGattWriteParam& aWriteParam) MOZ_OVERRIDE;
void ReadDescriptorNotification(int aConnId, void ReadDescriptorNotification(int aConnId,
int aStatus, BluetoothGattStatus aStatus,
const BluetoothGattReadParam& aReadParam) const BluetoothGattReadParam& aReadParam)
MOZ_OVERRIDE; MOZ_OVERRIDE;
void WriteDescriptorNotification(int aConnId, void WriteDescriptorNotification(int aConnId,
int aStatus, BluetoothGattStatus aStatus,
const BluetoothGattWriteParam& aWriteParam) const BluetoothGattWriteParam& aWriteParam)
MOZ_OVERRIDE; MOZ_OVERRIDE;
void ExecuteWriteNotification(int aConnId, int aStatus) MOZ_OVERRIDE; void ExecuteWriteNotification(int aConnId,
BluetoothGattStatus aStatus) MOZ_OVERRIDE;
void ReadRemoteRssiNotification(int aClientIf, void ReadRemoteRssiNotification(int aClientIf,
const nsAString& aBdAddr, const nsAString& aBdAddr,
int aRssi, int aRssi,
int aStatus) MOZ_OVERRIDE; BluetoothGattStatus aStatus) MOZ_OVERRIDE;
void ListenNotification(int aStatus, int aServerIf) MOZ_OVERRIDE; void ListenNotification(BluetoothGattStatus aStatus,
int aServerIf) MOZ_OVERRIDE;
static bool mInShutdown; static bool mInShutdown;
}; };

View File

@ -766,6 +766,23 @@ Convert(btrc_remote_features_t aIn, unsigned long& aOut)
} }
#endif // ANDROID_VERSION >= 19 #endif // ANDROID_VERSION >= 19
inline nsresult
Convert(int aIn, BluetoothGattStatus& aOut)
{
/**
* Currently we only map bluedroid's GATT status into GATT_STATUS_SUCCESS and
* GATT_STATUS_ERROR. This function needs to be revised if we want to support
* specific error status.
*/
if (!aIn) {
aOut = GATT_STATUS_SUCCESS;
} else {
aOut = GATT_STATUS_ERROR;
}
return NS_OK;
}
nsresult nsresult
Convert(const uint8_t* aIn, BluetoothGattAdvData& aOut); Convert(const uint8_t* aIn, BluetoothGattAdvData& aOut);