mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1029389: Add result-handler class for Bluetooth Handsfree profile, r=shuang
This commit is contained in:
parent
e8b46a74c6
commit
145befb0cb
@ -576,6 +576,37 @@ struct interface_traits<BluetoothHandsfreeInterface>
|
||||
}
|
||||
};
|
||||
|
||||
typedef
|
||||
BluetoothInterfaceRunnable0<BluetoothHandsfreeResultHandler, void>
|
||||
BluetoothHandsfreeResultRunnable;
|
||||
|
||||
typedef
|
||||
BluetoothInterfaceRunnable1<BluetoothHandsfreeResultHandler, void, bt_status_t>
|
||||
BluetoothHandsfreeErrorRunnable;
|
||||
|
||||
static nsresult
|
||||
DispatchBluetoothHandsfreeResult(
|
||||
BluetoothHandsfreeResultHandler* aRes,
|
||||
void (BluetoothHandsfreeResultHandler::*aMethod)(),
|
||||
bt_status_t aStatus)
|
||||
{
|
||||
MOZ_ASSERT(aRes);
|
||||
|
||||
nsRunnable* runnable;
|
||||
|
||||
if (aStatus == BT_STATUS_SUCCESS) {
|
||||
runnable = new BluetoothHandsfreeResultRunnable(aRes, aMethod);
|
||||
} else {
|
||||
runnable = new BluetoothHandsfreeErrorRunnable(aRes,
|
||||
&BluetoothHandsfreeResultHandler::OnError, aStatus);
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("NS_DispatchToMainThread failed: %X", rv);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
BluetoothHandsfreeInterface::BluetoothHandsfreeInterface(
|
||||
const bthf_interface_t* aInterface)
|
||||
: mInterface(aInterface)
|
||||
|
@ -72,6 +72,41 @@ private:
|
||||
// Handsfree Interface
|
||||
//
|
||||
|
||||
class BluetoothHandsfreeResultHandler
|
||||
{
|
||||
public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothHandsfreeResultHandler)
|
||||
|
||||
virtual ~BluetoothHandsfreeResultHandler() { }
|
||||
|
||||
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() { }
|
||||
virtual void ConnectAudio() { }
|
||||
virtual void DisconnectAudio() { }
|
||||
|
||||
virtual void StartVoiceRecognition() { }
|
||||
virtual void StopVoiceRecognition() { }
|
||||
|
||||
virtual void VolumeControl() { }
|
||||
|
||||
virtual void DeviceStatusNotification() { }
|
||||
|
||||
virtual void CopsResponse() { }
|
||||
virtual void CindResponse() { }
|
||||
virtual void FormattedAtResponse() { }
|
||||
virtual void AtResponse() { }
|
||||
virtual void ClccResponse() { }
|
||||
virtual void PhoneStateChange() { }
|
||||
};
|
||||
|
||||
class BluetoothHandsfreeInterface
|
||||
{
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user