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.

CC2564C: Can we run HID and SPP combo profile at the same time?

Part Number: CC2564C

I wonder if we can run both HID and SPP profile at the same time for CC2564B/C? We would like to run both based on Bluetooth Classic, so BLE is not interested in our case.

  • There should not be any problems running both profiles simultaneously on the board.
  • Thanks! BTW Is there any demo project for this combo?
  • There is no demo project for this combination, you would have to approach it by combining SPPDemo and HIDDemo.
  • Dale,

    I tried to combine HID classic and SPP profile together and I always got negative return value (-1) after calling SPP_Register_Generic_SDP_Record. HID is working fine though. I have tried putting both HID and SPP in the same task and in different tasks. Is there anything I need to be aware of when running two profiles at the same time? Can you shed some light to this? Thanks.

  • The SDP records for the devices that support multiple profiles will be concatenated.

    How are you using the SPP_Register_SDP_Record API, and have you made sure all the parameters for the function are correct as defined in the specification?

  • Dale,

    I just used it as it is from the SPPDemo. BluetoothStackID is the same as HID profile. 

       /* The following function is responsible for opening a Serial Port   */
       /* Server on the Local Device.  This function opens the Serial Port  */
       /* Server on the specified RFCOMM Channel.  This function returns    */
       /* zero if successful, or a negative return value if an error        */
       /* occurred.                                                         */
    static int OpenServer(ParameterList_t *TempParam)
    {
       int  ret_val;
       char *ServiceName;
    
       /* First check to see if a valid Bluetooth Stack ID exists.          */
       if(BluetoothStackID)
       {
          /* Make sure that there is not already a Serial Port Server open. */
          if(!ServerPortID)
          {
             /* Next, check to see if the parameters specified are valid.   */
             if((TempParam) && (TempParam->NumberofParameters >= 1) && (TempParam->Params[0].intParam))
             {
                /* Simply attempt to open an Serial Server, on RFCOMM Server*/
                /* Port 1.                                                  */
                ret_val = SPP_Open_Server_Port(BluetoothStackID, TempParam->Params[0].intParam, SPP_Event_Callback, (unsigned long)0);
    
                /* If the Open was successful, then note the Serial Port    */
                /* Server ID.                                               */
                if(ret_val > 0)
                {
                   /* Note the Serial Port Server ID of the opened Serial   */
                   /* Port Server.                                          */
                   ServerPortID = ret_val;
    
                   /* Create a Buffer to hold the Service Name.             */
                   if((ServiceName = BTPS_AllocateMemory(64)) != NULL)
                   {
                      /* The Server was opened successfully, now register a */
                      /* SDP Record indicating that an Serial Port Server   */
                      /* exists. Do this by first creating a Service Name.  */
                      BTPS_SprintF(ServiceName, "Serial Port Server Port %d", (int)(TempParam->Params[0].intParam));
    
                      /* Now that a Service Name has been created try to    */
                      /* Register the SDP Record.                           */
                      ret_val = SPP_Register_Generic_SDP_Record(BluetoothStackID, ServerPortID, ServiceName, &SPPServerSDPHandle);
    
                      /* If there was an error creating the Serial Port     */
                      /* Server's SDP Service Record then go ahead an close */
                      /* down the server an flag an error.                  */
                      if(ret_val < 0)
                      {
                         Display(("Unable to Register Server SDP Record, Error = %d.\r\n", ret_val));
    
                         SPP_Close_Server_Port(BluetoothStackID, ServerPortID);
    
                         /* Flag that there is no longer an Serial Port     */
                         /* Server Open.                                    */
                         ServerPortID = 0;
    
                         /* Flag that we are no longer connected.           */
                         Connected    = FALSE;
    
                         ret_val      = UNABLE_TO_REGISTER_SERVER;
                      }
                      else
                      {
                         /* Simply flag to the user that everything         */
                         /* initialized correctly.                          */
                         Display(("Server Opened: %d.\r\n", TempParam->Params[0].intParam));
    
                         /* Flag success to the caller.                     */
                         ret_val = 0;
                      }
    
                      /* Free the Service Name buffer.                      */
                      BTPS_FreeMemory(ServiceName);
                   }
                   else
                   {
                      Display(("Failed to allocate buffer to hold Service Name in SDP Record.\r\n"));
                   }
                }
                else
                {
                   Display(("Unable to Open Server on: %d, Error = %d.\r\n", TempParam->Params[0].intParam, ret_val));
    
                   ret_val = UNABLE_TO_REGISTER_SERVER;
                }
             }
             else
             {
                DisplayUsage("Open [Port Number]");
    
                ret_val = INVALID_PARAMETERS_ERROR;
             }
          }
          else
          {
             /* A Server is already open, this program only supports one    */
             /* Server or Client at a time.                                 */
             Display(("Server already open.\r\n"));
    
             ret_val = FUNCTION_ERROR;
          }
       }
       else
       {
          /* No valid Bluetooth Stack ID exists.                            */
          ret_val = INVALID_STACK_ID_ERROR;
       }
    
       return(ret_val);
    }

  • Dale,

    What are the dependencies before we can call SPP_Register_Generic_SDP_Record successfully? What configurations we need to set there? What resources need to be separated from HID? Thanks in advanced.

  • Dale,

    It seems we can register only one SDP record. When we try to merge HID Classic and SPP together, only either HID_Register_Device_SDP_Record or SPP_Register_Generic_SDP_Record would run successfully depending on what we put at first in the code. So either HID or SPP would work, but not both of them.

    Do you have any idea how to solve it? Thanks.

    -- J