朋友们、您好!
我正在尝试使用 AUD_Send_Remote_Control_Response 设置音量。 我始终收到错误消息、因为"卷更改事件尚未注册"或"绝对卷不受支持"、这与此错误类似。 我正在使用 blutopia 堆栈并在 Android 手机中试用。
如何解决此问题或任何想法 ?
以下 Setvolume 代码:
int SetVolume (int CurrentVolume)
{
int ret_val;
INT 结果;
AUD_Remote_Control_RESPONSE_Data_t RemoteControlResponseData;
/*首先检查是否存在有效的蓝牙堆栈 ID。 *
if (蓝牙 StackID)
{
/*现在,检查输入参数是否至少显示为*/
/*半有效。 *
if (RemoteControlConnection)
{
if (AbsoluteVolumeVolumeEnabled)(绝对卷已启用)
{
/*作为接收器,卷更改通知将是*/
/*如果已注册,则发送。 *
if (VolumeChangedEventTransactionID >= 0)
{
RemoteControlResponseData.MessageType = amtRegisterNotification;
RemoteControlResponseData.MessageData.RegisterNotificationResponseData.EventID = AVRCP_EVENT_VOLUE_CHANGE;
RemoteControlResponseData.MessageData.RegisterNotificationResponseData.ResponseCode = AVRCP_RESPONSE_CHANGED;
RemoteControlResponseData.MessageData.RegisterNotificationResponseData.NotificationData.VolumeChangedData.AbsoluteVolume = CurrentVolume;
if ((结果= AUD_Send_Remote_Control_Response (BluetoothStackID、ConnectedBD_ADDR、VolumeChangedEventTransactionID、&RemoteControlResponseData)= 0)
{
DisplayFunctionSuccessess ("AUD_Send_Remote_Control_Response");
RET_val = 0;
/*卷更改事件不再注册*/
/*因此使事务 ID 无效。 *
VolumeChangedEventTransactionID =-1;
}
其他
{
DisplayFunctionError ("AUD_Send_Remote_Control_RESPONSE"、结果);
RET_val = function_error;
}
}
其他
{
显示("卷更改事件尚未注册。\r\n);
RET_val = function_error;
}
}
其他
{
显示("不支持绝对卷\r\n);
RET_val = function_error;
}
}
其他
{
显示("未连接远程控制\r\n);
RET_val = function_error;
}
}
其他
{
/*不存在有效的蓝牙堆栈 ID。 *
显示("堆栈 ID 无效。\r\n");
RET_val = INVALID_STACK_ID_ERROR;
}
return (ret_val);
}