本文整理汇总了C++中BluetoothInterface::GetBluetoothA2dpInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ BluetoothInterface::GetBluetoothA2dpInterface方法的具体用法?C++ BluetoothInterface::GetBluetoothA2dpInterface怎么用?C++ BluetoothInterface::GetBluetoothA2dpInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BluetoothInterface
的用法示例。
在下文中一共展示了BluetoothInterface::GetBluetoothA2dpInterface方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnErrorProfileResultHandlerRunnable
// static
void
BluetoothA2dpManager::InitA2dpInterface(BluetoothProfileResultHandler* aRes)
{
BluetoothInterface* btInf = BluetoothInterface::GetInstance();
if (NS_WARN_IF(!btInf)) {
// If there's no HFP interface, we dispatch a runnable
// that calls the profile result handler.
nsRefPtr<nsRunnable> r =
new OnErrorProfileResultHandlerRunnable(aRes, NS_ERROR_FAILURE);
if (NS_FAILED(NS_DispatchToMainThread(r))) {
BT_LOGR("Failed to dispatch HFP OnError runnable");
}
return;
}
sBtA2dpInterface = btInf->GetBluetoothA2dpInterface();
if (NS_WARN_IF(!sBtA2dpInterface)) {
// If there's no HFP interface, we dispatch a runnable
// that calls the profile result handler.
nsRefPtr<nsRunnable> r =
new OnErrorProfileResultHandlerRunnable(aRes, NS_ERROR_FAILURE);
if (NS_FAILED(NS_DispatchToMainThread(r))) {
BT_LOGR("Failed to dispatch HFP OnError runnable");
}
return;
}
BluetoothA2dpManager* a2dpManager = BluetoothA2dpManager::Get();
sBtA2dpInterface->Init(a2dpManager, new InitResultHandler(aRes));
}
示例2:
// static
void
BluetoothA2dpManager::InitA2dpInterface(BluetoothProfileResultHandler* aRes)
{
BluetoothInterface* btInf = BluetoothInterface::GetInstance();
if (!btInf) {
BT_LOGR("Error: Bluetooth interface not available");
if (aRes) {
aRes->OnError(NS_ERROR_FAILURE);
}
return;
}
sBtA2dpInterface = btInf->GetBluetoothA2dpInterface();
if (!sBtA2dpInterface) {
BT_LOGR("Error: Bluetooth A2DP interface not available");
if (aRes) {
aRes->OnError(NS_ERROR_FAILURE);
}
return;
}
int ret = sBtA2dpInterface->Init(&sBtA2dpCallbacks);
if (ret != BT_STATUS_SUCCESS) {
BT_LOGR("Warning: failed to init a2dp module");
}
#if ANDROID_VERSION > 17
sBtAvrcpInterface = btInf->GetBluetoothAvrcpInterface();
if (!sBtAvrcpInterface) {
BT_LOGR("Error: Bluetooth AVRCP interface not available");
if (aRes) {
aRes->OnError(NS_ERROR_FAILURE);
}
return;
}
ret = sBtAvrcpInterface->Init(&sBtAvrcpCallbacks);
if (ret != BT_STATUS_SUCCESS) {
BT_LOGR("Warning: failed to init avrcp module");
}
#endif
if (aRes) {
aRes->Init();
}
}