|
WINCE6.0的系统,支持A2DP, 使用消息队列等待来自蓝牙耳机的命令(播放, 暂停, 下一首,上一首等). 播放器用自己的, 不是Media Player,可以收到暂停, 下一首,上一首的命令,就是收不到播放的命令,另外,耳机端按了暂停之后,耳机端就没声了,主机是收到暂停的命令, 但是我什么都没做,播放器也在播放,但耳机就是没声音,高人给指点一下吧,感觉是不是WINCE系统的BUG.
我的程序如下:
HANDLE hMsgQueue = NULL;
MSGQUEUEOPTIONS option;
AvrcpMsg *avrcpmsgitem;
BOOL readret;
byte receivebuf[BUFFER_SIZE];
DWORD readlen,bflag;
memset ( &option, 0, sizeof ( MSGQUEUEOPTIONS ) );
option.dwSize = sizeof ( MSGQUEUEOPTIONS );
option.dwFlags = MSGQUEUE_ALLOW_BROKEN;
option.dwMaxMessages = 0;
option.cbMaxMessage = BUFFER_SIZE;
option.bReadAccess = TRUE;
hMsgQueue = CreateMsgQueue( szAvrcpMsgQName, &option );
if(hMsgQueue)
{
while (1)
{
WaitForSingleObject(hMsgQueue,INFINITE);
memset(receivebuf,0,BUFFER_SIZE);
readret = ReadMsgQueue(hMsgQueue,&receivebuf,sizeof(AvrcpMsg),&readlen,INFINITE,&bflag);
if(readret==TRUE)
{
avrcpmsgitem = (AvrcpMsg *)receivebuf;
switch(avrcpmsgitem->OpId)
{
case Play_t:
break;
case Stop_t:
break;
case Pause_t:
break;
case Forward_t:
break;
case Backward_t:
break;
default:
}
}
}
}
|
|