This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CC2564MODA:打开两个蓝牙堆栈

Guru**** 654100 points
Other Parts Discussed in Thread: CC2564MODA, CC256XSTBTBLESW
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1006962/cc2564moda-open-two-bluetooth-stack

器件型号:CC2564MODA
主题中讨论的其他器件: CC256XSTBTBLESW

大家好、

我正在进行蓝牙项目,我设法使用了一些协议(HFP、A3DP),实际上,我想知道我是否可以打开两个不同的蓝牙堆栈。 我有打开2个堆栈的测试,第一个堆栈没有任何问题,但第二个堆栈出现错误(BTPS_ERROR_HCI_DRIVER_ERRO罗),此函数为:BSC_Initialize()。 如果我反转2个堆栈、我具有相同的误差。

我正在使用 Bluetopia,我正在使用 SKD,网址 为 www.ti.com/.../CC256XSTBTBLESW

BR、

亚历山大

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Alexandre、

    不能、Bluetopia 库不能多次初始化、因此不能同时运行两个实例。

    如果您尝试同时使用两个或多个配置文件、则需要将应用程序功能合并到一个 Bluetopia 栈应用程序中。 请查看此应用手册、大致了解实施过程的外观:

    https://www.ti.com/lit/swra637/

    如果您需要更多说明或对使用 CC2564MODA 随附的 Bluetopia 协议栈有其他疑问、请告诉我。

    此致、

    Michael

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

     您好、Michael、

    感谢 您的回复、但您的链接似乎对我不起作用。 (未找到 ERR 404)

    BR、

    亚历山大

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我已经找到了 pdf,但我还有一个问题,可以将  A3DP SRC 和 A3DP SNK 的功能组合在 一 个应用程序中吗?

     此致、

    亚历山大

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Alexandre

    可以将其组合到一个应用中、但请记住、不能同时运行 A3DP SRC 和 A3DP SNK。 如果您希望在应用程序中同时运行 SRC 和 SNK、则需要使用无辅助 A2DP 模式。

    此致、

    Michael

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢您的帮助、

    我没有看到使用 A2DP 将器件设置为 SRC 模式的可能性、您知道这是否可行? 或者、我是否需要在 A3DP 中设置 SRC、在 A2DP 中设置 SNK?

     此致、

    亚历山大

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Alexandre、

    可以将 CC2564MODA 设置为 A2DP SRC。 可以在 A3DP 中设置 SRC、在 A2DP 中设置 SNK、但对于这两个角色来说、执行 A2DP 可能更简单。

    在演示 A2DP SRC 的示例中、CC256XSTBTBLESW 附带的 AUDDemo 似乎没有实现 SRC 功能。 我已附上 CC256XM4BTBLESW SDK 中实现 SRC 功能的一些代码。 请参阅完整的 M4 SDK 以获取进一步的参考。

    /cfs-file/__key/communityserver-discussions-components-files/538/A2DPDemo.c

    /cfs-file/__key/communityserver-discussions-components-files/538/AudioEncoder.c

    /cfs-file/__key/communityserver-discussions-components-files/538/AudioEncoder.h

    此致、

    Michael

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢您的帮助、我将看到您的帮助!

    最后一个问题是、如果 在同一 应用中结合 SRC 和 SNK、使用 A2DP、我将能够进行双向通信?

     此致、

    亚历山大

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Alexandre

    您应该能够在同一应用程序中同时运行 A2DP src 和 snk、但我建议不要将其用作双向通信链路、因为使用 A2DP 时的音频延迟非常高。 HFP 是用于双向音频的更好配置文件。

    此致、

    Michael

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    我已经尝试使用 HFP 进行双向通信。 但 HFP Audioggateway 协议有一些问题。 我已经打开了音频网关,但我似乎需要发送来电通知来启用音频流,但“SendCallWaitingNotification”函数返回错误消息“error invalid_operation”。

    您是否有任何机会知道我为什么会出现此错误?

     此致、

    亚历山大

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Alexandre、

    不、我不知道 SendCallWaitingNotification 为什么会导致错误 invalid_operation。 我记得几个月前有一个线程我在研究这个问题、但调试结果没有结果。

    查看 SendCallWaitingNotification 函数的源代码、可以发现导致返回该错误的原因有几种。 请参阅以下内容:

       /* This function is responsible for Sending Call Waiting             */
       /* Notifications to the Remote Device.  This function may only be    */
       /* performed by Audio Gateways which have Call Waiting Notification  */
       /* Enabled and have a valid Service Level Connection.  This function */
       /* accepts as its first input parameter the HFRE Port ID.  The final */
       /* parameter is the Phone Number required as one of the parameters   */
       /* within this response.  This parameter should be a pointer to a    */
       /* NULL terminated string (if specified) and must have a length less */
       /* than HFRE_PHONE_NUMBER_LENGTH_MAXIMUM.  This function returns zero*/
       /* if successful or a negative return error code if there was an     */
       /* error.                                                            */
       /* * NOTE * It is valid to either pass a NULL for the PhoneNumber    */
       /*          parameter of a blank string to specify that there is no  */
       /*          phone number present.                                    */
    int BTPSAPI HFRE_Send_Call_Waiting_Notification(unsigned int BluetoothStackID, unsigned int HFREPortID, char *PhoneNumber)
    {
    #if BTPS_CONFIGURATION_HFRE_SUPPORT_AUDIO_GATEWAY_ROLE
    
       int         ret_val;
       char        OutputBuffer[32+HFRE_PHONE_NUMBER_LENGTH_MAXIMUM];
       HFREInfo_t *HFREInfo;
    
       /* Make sure that the passed in parameters seem semi-valid.          */
       /* * NOTE * It is possible that the Phone Number can be empty so we  */
       /*          need to check for this case.                             */
       if((BluetoothStackID) && (HFREPortID) && ((!PhoneNumber) || ((PhoneNumber) && (BTPS_StringLength(PhoneNumber) <= HFRE_PHONE_NUMBER_LENGTH_MAXIMUM))))
       {
          /* Lock the Bluetooth Stack to gain exclusive access to this      */
          /* Bluetooth Protocol Stack.                                      */
          if(!BSC_LockBluetoothStack(BluetoothStackID))
          {
             /* Wait for access to the Hands-Free profile information list. */
             if(BSC_AcquireListLock())
             {
                if((HFREInfo = SearchHFREEntry(&HFREInfoList, HFREPortID)) != NULL)
                {
                   /* Release the List Lock that we acquired earlier.       */
                   BSC_ReleaseListLock();
    
                   /* This action is only performed by the Audio Gateway.   */
                   if(HFREInfo->AudioGateway)
                   {
                      /* We are an Audio Gateway , now make sure that the   */
                      /* Service Level Connection is in a state such that we*/
                      /* can send this command.                             */
                      if(HFREInfo->ServiceLevelConnectionState == csConnected)
                      {
                         /* We are in a state in which we can send this     */
                         /* command, now check to make sure that Call       */
                         /* Waiting Notification has been activated.        */
                         if(HFREInfo->CallWaitingNotificationActivated)
                         {
                            /* Call Waiting Notification has been activated,*/
                            /* build the packet and send it out.            */
                            BTPS_SprintF(OutputBuffer, "%s%s%s\"%s\",%s,%s%s", HFRE_RESPONSE_PREFIX_SUFFIX,
                                                                               HFRE_CALL_WAITING_NOTIFICATION_COMMAND,
                                                                               HFRE_RESPONSE_MODIFIER_SEMI_SPACE,
                                                                               PhoneNumber?PhoneNumber:"",
                                                                               HFRE_CALL_WAITING_TYPE_OF_ADDRESS,
                                                                               HFRE_CALL_WAITING_CLASS,
                                                                               HFRE_RESPONSE_PREFIX_SUFFIX);
    
                            if((ret_val = SPP_Data_Write(BluetoothStackID, HFREInfo->SPPPortID, (Word_t)BTPS_StringLength(OutputBuffer), (Byte_t *)OutputBuffer)) > 0)
                               ret_val = 0;
                         }
                         else
                            ret_val = BTHFRE_ERROR_INVALID_OPERATION;
                      }
                      else
                         ret_val = BTHFRE_ERROR_INVALID_OPERATION;
                   }
                   else
                      ret_val = BTHFRE_ERROR_INVALID_OPERATION;
                }
                else
                {
                   /* Release the List Lock that we acquired earlier.       */
                   BSC_ReleaseListLock();
    
                   ret_val = BTHFRE_ERROR_NOT_INITIALIZED;
                }
             }
             else
                ret_val = BTHFRE_ERROR_NOT_INITIALIZED;
    
             /* UnLock the previously locked Bluetooth Stack.               */
             BSC_UnLockBluetoothStack(BluetoothStackID);
          }
          else
             ret_val = BTHFRE_ERROR_INVALID_BLUETOOTH_STACK_ID;
       }
       else
          ret_val = BTHFRE_ERROR_INVALID_PARAMETER;
    
       /* Return the result to the caller.                                  */
       return(ret_val);
    
    #else
    
       return(BTPS_ERROR_FEATURE_NOT_AVAILABLE);
    
    #endif
    }

    有道理的两种主要情况是:

    1.启用呼叫等待功能实际上在启用呼叫等待通知方面不成功

    2.音频网关和免提设备之间的服务级别连接未处于连接状态。

    尽管源代码对您不可用、但如果您要在调试模式下运行应用程序、您应该能够在逐步执行应用程序时看到函数符号。 如果在运行 SendCallWaitingNotification 命令时单步执行并调试应用程序,是否可以验证错误 invalid_operation 错误是否确实是从 HFRE_Send_Call_Waiting_Notification ()返回的? 如果您在返回错误时检查并共享设备的调用栈、这会很有帮助。

    此致、

    Michael