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.

CCS/CC2564MODA: Spple program

Part Number: CC2564MODA

Tool/software: Code Composer Studio

Sir, thanks for replying.

The spple demo code is working when I tried with command calls as they mentioned in link which you have sent. Now I tried to modify the code as my requirement  that is in one board I configured as server , registered the spple service,and advertisingle which is working.And in another board I configured as client and connectle which is working so when I have tried to configured as discoverspple it is showing as error which means it is showing as no device information but this function when I tried with command calls it is working but it is not working when I tried to change through API calls so can you tell me Do I need to change anything for this function in program.

  • Can, you provide the console log and where exactly it is failing? Typically, for customization we recommend checking with 3rd party vendor Cloud2 gnd.

    Thanks
  • Hi,
    This is client side program
    int InitializeApplication(HCI_DriverInformation_t *HCI_DriverInformation, BTPS_Initialization_t *BTPS_Initialization)
    {
    int ret_val = APPLICATION_ERROR_UNABLE_TO_OPEN_STACK;

    /* Next, makes sure that the Driver Information passed appears to be */
    /* semi-valid. */
    if((HCI_DriverInformation) && (BTPS_Initialization))
    {
    /* Try to Open the stack and check if it was successful. */
    if(!OpenStack(HCI_DriverInformation, BTPS_Initialization))
    {
    /* First, attempt to set the Device to be Connectable. */
    ret_val = SetConnect();

    /* Next, check to see if the Device was successfully made */
    /* Connectable. */
    if(!ret_val)
    {
    /* Now that the device is Connectable attempt to make it */
    /* Discoverable. */
    ret_val = SetDisc();

    /* Next, check to see if the Device was successfully made */
    /* Discoverable. */
    if(!ret_val)
    {
    /* Now that the device is discoverable attempt to make it*/
    /* pairable. */
    ret_val = SetPairable();
    if(!ret_val)
    {
    /* Attempt to register a HCI Event Callback. */
    ret_val = HCI_Register_Event_Callback(BluetoothStackID, HCI_Event_Callback, (unsigned long)NULL);
    if(ret_val > 0)
    {
    /* Restart the User Interface Selection. */
    // UI_Mode = UI_MODE_SELECT;
    UI_Mode = UI_MODE_IS_CLIENT;

    /* Set up the Selection Interface. */
    // UserInterface_Selection();
    UserInterface_Client();

    /* Display the first command prompt. */
    DisplayPrompt();

    /* Return success to the caller. */
    ret_val = (int)BluetoothStackID;
    }
    }
    else
    DisplayFunctionError("SetPairable", ret_val);
    }
    else
    DisplayFunctionError("SetDisc", ret_val);
    }
    else
    DisplayFunctionError("SetDisc", ret_val);

    /* In some error occurred then close the stack. */
    if(ret_val < 0)
    {
    /* Close the Bluetooth Stack. */
    CloseStack();
    }
    }
    else
    {
    /* There was an error while attempting to open the Stack. */
    Display(("Unable to open the stack.\r\n"));
    }
    }
    else
    ret_val = APPLICATION_ERROR_INVALID_PARAMETERS;
    ConnectLE(NULL);
    DiscoverSPPLE(NULL);
    return(ret_val);
    }
    static int ConnectLE(ParameterList_t *TempParam)
    {
    int ret_val;
    BD_ADDR_t BD_ADDR;
    char address[12]="0017e9e578b7";
    GAP_LE_Address_Type_t Address_Type;

    /* First, check that valid Bluetooth Stack ID exists. */
    if(BluetoothStackID)
    {
    /* Next, make sure that a valid device address exists. */
    // if((TempParam) && (TempParam->NumberofParameters > 0) && (TempParam->Params[0].strParam) && (BTPS_StringLength(TempParam->Params[0].strParam) >= (sizeof(BD_ADDR_t)*2)))
    // {
    /* Check to see if the address type is specified. */
    // if(TempParam->NumberofParameters >= 2)
    //{
    // if(TempParam->Params[1].intParam)
    // Address_Type = latRandom;
    //else
    // Address_Type = latPublic;
    // }
    //else
    Address_Type = latPublic;

    /* Convert the parameter to a Bluetooth Device Address. */
    StrToBD_ADDR(address, &BD_ADDR); here I am changing to remote Bluetooth address.

    if(!ConnectLEDevice(BluetoothStackID, Address_Type, BD_ADDR, FALSE))
    ret_val = 0;
    else
    ret_val = FUNCTION_ERROR;
    // }
    //else
    //{
    /* Invalid parameters specified so flag an error to the user. */
    // DisplayUsage("ConnectLE [BD_ADDR] [Address Type (0 = Public/Default, 1 = Random) Optional]");

    /* Flag that an error occurred while submitting the command. */
    //ret_val = INVALID_PARAMETERS_ERROR;
    //}
    }
    else
    {
    /* No valid Bluetooth Stack ID exists. */
    ret_val = INVALID_STACK_ID_ERROR;
    }

    return(ret_val);
    }
    static int DiscoverSPPLE(ParameterList_t *TempParam)
    {
    int ret_val;
    int LEConnectionIndex;
    BD_ADDR_t BD_ADDR;
    GATT_UUID_t UUID[1];
    DeviceInfo_t *DeviceInfo;
    char address[12]="0017e9e578b7";

    /* Next, make sure that a valid device address exists. */
    // if((TempParam) && (TempParam->NumberofParameters > 0) && (TempParam->Params[0].strParam) && (BTPS_StringLength(TempParam->Params[0].strParam) >= (sizeof(BD_ADDR_t)*2)))
    //{
    /* Convert the parameter to a Bluetooth Device Address. */
    StrToBD_ADDR(address, &BD_ADDR);

    /* Find the LE Connection Index for this connection. */
    if((LEConnectionIndex = FindLEIndexByAddress(BD_ADDR)) >= 0)
    {
    /* Get the device info for the connection device. */
    if((DeviceInfo = SearchDeviceInfoEntryByBD_ADDR(&DeviceInfoList, LEContextInfo[LEConnectionIndex].ConnectionBD_ADDR)) != NULL)
    {
    Display(("Attempting to search.\r\n"));

    /* Verify that no service discovery is outstanding for this */
    /* device. */
    if(!(DeviceInfo->Flags & DEVICE_INFO_FLAGS_SERVICE_DISCOVERY_OUTSTANDING))
    {
    /* Configure the filter so that only the SPP LE Service */
    /* is discovered. */
    UUID[0].UUID_Type = guUUID_128;
    SPPLE_ASSIGN_SPPLE_SERVICE_UUID_128(&(UUID[0].UUID.UUID_128));

    /* Start the service discovery process. */
    ret_val = GATT_Start_Service_Discovery(BluetoothStackID, LEContextInfo[LEConnectionIndex].ConnectionID, (sizeof(UUID)/sizeof(GATT_UUID_t)), UUID, GATT_Service_Discovery_Event_Callback, 0);
    if(!ret_val)
    {
    /* Display success message. */
    Display(("GATT_Start_Service_Discovery success.\r\n"));

    /* Flag that a Service Discovery Operation is */
    /* outstanding. */
    DeviceInfo->Flags |= DEVICE_INFO_FLAGS_SERVICE_DISCOVERY_OUTSTANDING;
    }
    else
    {
    /* An error occur so just clean-up. */
    Display(("Error - GATT_Start_Service_Discovery returned %d.\r\n", ret_val));

    ret_val = FUNCTION_ERROR;
    }
    }
    else
    {
    Display(("Service Discovery Operation Outsanding for Device.\r\n"));

    ret_val = FUNCTION_ERROR;
    }
    }
    else
    {
    Display(("No Device Info.\r\n"));

    ret_val = FUNCTION_ERROR;
    }
    }
    else
    {
    /* No matching ConnectionBD_ADDR. */
    Display(("No connection with BD_ADDR %s exists.\r\n", TempParam->Params[0].strParam));

    ret_val = FUNCTION_ERROR;
    }
    // }
    //else
    //{
    /* Invalid parameters specified so flag an error to the user. */
    // Display(("Usage: DiscoverSPPLE [BD_ADDR].\r\n"));

    /* Flag that an error occurred while submitting the command. */
    //ret_val = INVALID_PARAMETERS_ERROR;
    //}

    return(ret_val);
    }
    here this is the client log:
    OpenStack().
    HCI_VS_InitializeAfterHCIReset
    VS_Update_UART_Baud_Rate success.
    HCI_VS_InitializeAfterHCIReset Success
    Bluetooth Stack ID: 1.
    Device Chipset: 4.1.
    BD_ADDR: 0xcc78ab63bdc0

    ******************************************************************
    * Command Options General: Help, GetLocalAddress, SetBaudRate *
    * Quit, *
    * Command Options BR/EDR: Inquiry, DisplayInquiryList, Pair, *
    * EndPairing, PINCodeResponse, *
    * PassKeyResponse, *
    * UserConfirmationResponse, *
    * SetDiscoverabilityMode, *
    * SetConnectabilityMode, *
    * SetPairabilityMode, *
    * ChangeSimplePairingParameters, *
    * GetLocalName, SetLocalName, *
    * GetClassOfDevice, SetClassOfDevice, *
    * GetRemoteName, SniffMode, *
    * ExitSniffMode, Open, Close, Read, *
    * Write, GetConfigParams, *
    * SetConfigParams, GetQueueParams, *
    * DisplayRawModeData, AutomaticReadMode,*
    * SetQueueParams, Loopback, *
    * CBSend. *
    * Command Options GAPLE: SetDiscoverabilityMode, *
    * SetConnectabilityMode, *
    * SetPairabilityMode, *
    * ChangePairingParameters, *
    * AdvertiseLE, StartScanning, *
    * StopScanning, ConnectLE, *
    * DisconnectLE, PairLE, *
    * LEPasskeyResponse, *
    * QueryEncryptionMode, SetPasskey, *
    * DiscoverGAPS, GetLocalName, *
    * SetLocalName, GetLERemoteName, *
    * SetLocalAppearance, *
    * GetLocalAppearance, *
    * GetRemoteAppearance, *
    * Command Options SPPLE: DiscoverSPPLE, RegisterSPPLE, LESend, *
    * ConfigureSPPLE, LERead, Loopback, *
    * DisplayRawModeData, AutomaticReadMode *
    ******************************************************************

    SPP+LE>Connection Request successful.
    No Device Info. //it is showing no device information.

    etLE_Connection_Complete with size 16.
    Status: 0x00.
    Role: Master.
    Address Type: Public.
    BD_ADDR: 0x0017e9e578b7.

    SPP+LE>
    etGATT_Connection_Device_Connection with size 16:
    Connection ID: 1.
    Connection Type: LE.
    Remote Device: 0x0017e9e578b7.
    Connection MTU: 23.

    SPP+LE>
    Exchange MTU Response.
    Connection ID: 1.
    Transaction ID: 1.
    Connection Type: LE.
    BD_ADDR: 0x0017e9e578b7.
    MTU: 131.

    SPP+LE>
    SPP+LE>[A

    this is the server side program:

    int InitializeApplication(HCI_DriverInformation_t *HCI_DriverInformation, BTPS_Initialization_t *BTPS_Initialization)
    {
    int ret_val = APPLICATION_ERROR_UNABLE_TO_OPEN_STACK;

    /* Next, makes sure that the Driver Information passed appears to be */
    /* semi-valid. */
    if((HCI_DriverInformation) && (BTPS_Initialization))
    {
    /* Try to Open the stack and check if it was successful. */
    if(!OpenStack(HCI_DriverInformation, BTPS_Initialization))
    {
    /* First, attempt to set the Device to be Connectable. */
    ret_val = SetConnect();

    /* Next, check to see if the Device was successfully made */
    /* Connectable. */
    if(!ret_val)
    {
    /* Now that the device is Connectable attempt to make it */
    /* Discoverable. */
    ret_val = SetDisc();

    /* Next, check to see if the Device was successfully made */
    /* Discoverable. */
    if(!ret_val)
    {
    /* Now that the device is discoverable attempt to make it*/
    /* pairable. */
    ret_val = SetPairable();
    if(!ret_val)
    {
    /* Attempt to register a HCI Event Callback. */
    ret_val = HCI_Register_Event_Callback(BluetoothStackID, HCI_Event_Callback, (unsigned long)NULL);
    if(ret_val > 0)
    {
    /* Restart the User Interface Selection. */
    // UI_Mode = UI_MODE_SELECT;
    UI_Mode = UI_MODE_IS_CLIENT;

    /* Set up the Selection Interface. */
    // UserInterface_Selection();
    UserInterface_Client();

    /* Display the first command prompt. */
    DisplayPrompt();

    /* Return success to the caller. */
    ret_val = (int)BluetoothStackID;
    }
    }
    else
    DisplayFunctionError("SetPairable", ret_val);
    }
    else
    DisplayFunctionError("SetDisc", ret_val);
    }
    else
    DisplayFunctionError("SetDisc", ret_val);

    /* In some error occurred then close the stack. */
    if(ret_val < 0)
    {
    /* Close the Bluetooth Stack. */
    CloseStack();
    }
    }
    else
    {
    /* There was an error while attempting to open the Stack. */
    Display(("Unable to open the stack.\r\n"));
    }
    }
    else
    ret_val = APPLICATION_ERROR_INVALID_PARAMETERS;
    RegisterSPPLE(NULL);
    AdvertiseLE(NULL);
    return(ret_val);
    }

    the server side log:

    OpenStack().
    HCI_VS_InitializeAfterHCIReset
    VS_Update_UART_Baud_Rate success.
    HCI_VS_InitializeAfterHCIReset Success
    Bluetooth Stack ID: 1.
    Device Chipset: 4.1.
    BD_ADDR: 0xcc78ab63bdc0

    ******************************************************************
    * Command Options General: Help, GetLocalAddress, SetBaudRate *
    * Quit, *
    * Command Options BR/EDR: Inquiry, DisplayInquiryList, Pair, *
    * EndPairing, PINCodeResponse, *
    * PassKeyResponse, *
    * UserConfirmationResponse, *
    * SetDiscoverabilityMode, *
    * SetConnectabilityMode, *
    * SetPairabilityMode, *
    * ChangeSimplePairingParameters, *
    * GetLocalName, SetLocalName, *
    * GetClassOfDevice, SetClassOfDevice, *
    * GetRemoteName, SniffMode, *
    * ExitSniffMode, Open, Close, Read, *
    * Write, GetConfigParams, *
    * SetConfigParams, GetQueueParams, *
    * DisplayRawModeData, AutomaticReadMode,*
    * SetQueueParams, Loopback, *
    * CBSend. *
    * Command Options GAPLE: SetDiscoverabilityMode, *
    * SetConnectabilityMode, *
    * SetPairabilityMode, *
    * ChangePairingParameters, *
    * AdvertiseLE, StartScanning, *
    * StopScanning, ConnectLE, *
    * DisconnectLE, PairLE, *
    * LEPasskeyResponse, *
    * QueryEncryptionMode, SetPasskey, *
    * DiscoverGAPS, GetLocalName, *
    * SetLocalName, GetLERemoteName, *
    * SetLocalAppearance, *
    * GetLocalAppearance, *
    * GetRemoteAppearance, *
    * Command Options SPPLE: DiscoverSPPLE, RegisterSPPLE, LESend, *
    * ConfigureSPPLE, LERead, Loopback, *
    * DisplayRawModeData, AutomaticReadMode *
    ******************************************************************

    SPP+LE>Sucessfully registered SPPLE Service.
    GAP_LE_Advertising_Enable success.

    etLE_Connection_Complete with size 16.
    Status: 0x00.
    Role: Master.
    Address Type: Public.
    BD_ADDR: 0x0017e9e578b7.

    SPP+LE>
    etGATT_Connection_Device_Connection with size 16:
    Connection ID: 1.
    Connection Type: LE.
    Remote Device: 0x0017e9e578b7.
    Connection MTU: 23.

    SPP+LE>
    Exchange MTU Response.
    Connection ID: 1.
    Transaction ID: 1.
    Connection Type: LE.
    BD_ADDR: 0x0017e9e578b7.
    MTU: 131.

    SPP+LE>
    SPP+LE>[A
  • Is it still a problem.. From, your other thread it seems like you are now able to connect, but has some data loss while receiving in the tablet right? If so, let us close this thread..

    Thanks