mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1042691: Add A2DP/AVRCP result-handler infrastructure (under bluetooth2/), r=btian
This commit is contained in:
parent
251781f406
commit
19904b0ddd
@ -847,6 +847,37 @@ struct interface_traits<BluetoothA2dpInterface>
|
||||
}
|
||||
};
|
||||
|
||||
typedef
|
||||
BluetoothInterfaceRunnable0<BluetoothA2dpResultHandler, void>
|
||||
BluetoothA2dpResultRunnable;
|
||||
|
||||
typedef
|
||||
BluetoothInterfaceRunnable1<BluetoothA2dpResultHandler, void, bt_status_t>
|
||||
BluetoothA2dpErrorRunnable;
|
||||
|
||||
static nsresult
|
||||
DispatchBluetoothA2dpResult(
|
||||
BluetoothA2dpResultHandler* aRes,
|
||||
void (BluetoothA2dpResultHandler::*aMethod)(),
|
||||
bt_status_t aStatus)
|
||||
{
|
||||
MOZ_ASSERT(aRes);
|
||||
|
||||
nsRunnable* runnable;
|
||||
|
||||
if (aStatus == BT_STATUS_SUCCESS) {
|
||||
runnable = new BluetoothA2dpResultRunnable(aRes, aMethod);
|
||||
} else {
|
||||
runnable = new BluetoothA2dpErrorRunnable(aRes,
|
||||
&BluetoothA2dpResultHandler::OnError, aStatus);
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("NS_DispatchToMainThread failed: %X", rv);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
BluetoothA2dpInterface::BluetoothA2dpInterface(
|
||||
const btav_interface_t* aInterface)
|
||||
: mInterface(aInterface)
|
||||
@ -897,6 +928,37 @@ struct interface_traits<BluetoothAvrcpInterface>
|
||||
}
|
||||
};
|
||||
|
||||
typedef
|
||||
BluetoothInterfaceRunnable0<BluetoothAvrcpResultHandler, void>
|
||||
BluetoothAvrcpResultRunnable;
|
||||
|
||||
typedef
|
||||
BluetoothInterfaceRunnable1<BluetoothAvrcpResultHandler, void, bt_status_t>
|
||||
BluetoothAvrcpErrorRunnable;
|
||||
|
||||
static nsresult
|
||||
DispatchBluetoothAvrcpResult(
|
||||
BluetoothAvrcpResultHandler* aRes,
|
||||
void (BluetoothAvrcpResultHandler::*aMethod)(),
|
||||
bt_status_t aStatus)
|
||||
{
|
||||
MOZ_ASSERT(aRes);
|
||||
|
||||
nsRunnable* runnable;
|
||||
|
||||
if (aStatus == BT_STATUS_SUCCESS) {
|
||||
runnable = new BluetoothAvrcpResultRunnable(aRes, aMethod);
|
||||
} else {
|
||||
runnable = new BluetoothAvrcpErrorRunnable(aRes,
|
||||
&BluetoothAvrcpResultHandler::OnError, aStatus);
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("NS_DispatchToMainThread failed: %X", rv);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
BluetoothAvrcpInterface::BluetoothAvrcpInterface(
|
||||
const btrc_interface_t* aInterface)
|
||||
: mInterface(aInterface)
|
||||
|
@ -181,6 +181,24 @@ private:
|
||||
// Bluetooth Advanced Audio Interface
|
||||
//
|
||||
|
||||
class BluetoothA2dpResultHandler
|
||||
{
|
||||
public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothA2dpResultHandler)
|
||||
|
||||
virtual ~BluetoothA2dpResultHandler() { }
|
||||
|
||||
virtual void OnError(bt_status_t aStatus)
|
||||
{
|
||||
BT_WARNING("received error code %d", (int)aStatus);
|
||||
}
|
||||
|
||||
virtual void Init() { }
|
||||
virtual void Cleanup() { }
|
||||
virtual void Connect() { }
|
||||
virtual void Disconnect() { }
|
||||
};
|
||||
|
||||
class BluetoothA2dpInterface
|
||||
{
|
||||
public:
|
||||
@ -204,6 +222,39 @@ private:
|
||||
// Bluetooth AVRCP Interface
|
||||
//
|
||||
|
||||
class BluetoothAvrcpResultHandler
|
||||
{
|
||||
public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothAvrcpResultHandler)
|
||||
|
||||
virtual ~BluetoothAvrcpResultHandler() { }
|
||||
|
||||
virtual void OnError(bt_status_t aStatus)
|
||||
{
|
||||
BT_WARNING("received error code %d", (int)aStatus);
|
||||
}
|
||||
|
||||
virtual void Init() { }
|
||||
virtual void Cleanup() { }
|
||||
|
||||
virtual void GetPlayStatusRsp() { }
|
||||
|
||||
virtual void ListPlayerAppAttrRsp() { }
|
||||
virtual void ListPlayerAppValueRsp() { }
|
||||
|
||||
virtual void GetPlayerAppValueRsp() { }
|
||||
virtual void GetPlayerAppAttrTextRsp() { }
|
||||
virtual void GetPlayerAppValueTextRsp() { }
|
||||
|
||||
virtual void GetElementAttrRsp() { }
|
||||
|
||||
virtual void SetPlayerAppValueRsp() { }
|
||||
|
||||
virtual void RegisterNotificationRsp() { }
|
||||
|
||||
virtual void SetVolume() { }
|
||||
};
|
||||
|
||||
class BluetoothAvrcpInterface
|
||||
{
|
||||
#if ANDROID_VERSION >= 18
|
||||
|
Loading…
Reference in New Issue
Block a user