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/CC2640R2F: how to connect address in central

Part Number: CC2640R2F

Tool/software: Code Composer Studio

hi ,

I am working  on 2640r2f board  i want to connect peripheral boards to central without prerssing key

i have did without pressing key for 1 one board now i want to  connect another board without pressing key one after one 

i have did that for both connecting but its connect address different as show below in process role event changed some

could you suggest me how connect peripherals address  to central in what condition should place before service uuid  and central address

static void SimpleBLECentral_processRoleEvent(gapCentralRoleEvent_t *pEvent)
{
    // if (scanIdx == -1)
         // {
         //   if (!scanningStarted)
         //   {
           //   scanningStarted = TRUE;
            //  scanRes = 0;


        Display_print0(dispHandle, 1, 0, Util_convertBdAddr2Str(pEvent->initDone.devAddr));

        SimpleBLECentral_startGapDiscovery();
           // }
     //     }

    // DELAY_MS(4000);

        // if filtering device discovery results based on service UUID
        if (DEFAULT_DEV_DISC_BY_SVC_UUID == TRUE)
        {
          if (SimpleBLECentral_findSvcUuid(SUNLIGHT_SERV_UUID,
                                           pEvent->deviceInfo.pEvtData,
                                           pEvent->deviceInfo.dataLen))
          {
            SimpleBLECentral_addDeviceInfo(pEvent->deviceInfo.addr,
                                           pEvent->deviceInfo.addrType);
          }
        }



        // discovery complete
     //  scanningStarted = FALSE;

        // if not filtering device discovery results based on service UUID
     // if (DEFAULT_DEV_DISC_BY_SVC_UUID == FALSE)
      //  {
          // Copy results
       //   scanRes = pEvent->discCmpl.numDevs;
        //  memcpy(devList, pEvent->discCmpl.pDevList,
          //       (sizeof(gapDevRec_t) * scanRes));
      //  }

     //   Display_print1(dispHandle, 2, 0, "Devices Found %d", scanRes);

        if (scanRes > 0)
        {



          SimpleBLECentral_connectToFirstDevice();
        }



           if (pEvent->gap.hdr.status == SUCCESS)
        {
          state = BLE_STATE_CONNECTED;
          connHandle = pEvent->linkCmpl.connectionHandle;
          procedureInProgress = TRUE;

          // If service discovery not performed initiate service discovery
          if (charHdl == 0)
          {
            Util_startClock(&startDiscClock);
          }

          Display_print0(dispHandle, 2, 0, "Connected");
          Display_print0(dispHandle, 3, 0, Util_convertBdAddr2Str(pEvent->linkCmpl.devAddr));

          SimpleBLECentral_Handler(1);


          }
        else
        {
          state = BLE_STATE_IDLE;
          connHandle = GAP_CONNHANDLE_INIT;
          discState = BLE_DISC_STATE_IDLE;

          Display_print0(dispHandle, 2, 0, "Connect Failed");
          Display_print1(dispHandle, 3, 0, "Reason: %d", pEvent->gap.hdr.status);
        }


    if(state == BLE_STATE_DISCONNECTING)
    {
        state = BLE_STATE_IDLE;
        connHandle = GAP_CONNHANDLE_INIT;
        discState = BLE_DISC_STATE_IDLE;
        charHdl = 0;
        procedureInProgress = FALSE;
        keyPressConnOpt = DISCONNECT;


        // Cancel RSSI reads
        SimpleBLECentral_CancelRssi(pEvent->linkTerminate.connectionHandle);

        Display_print0(dispHandle, 2, 0, "Disconnected");
        Display_print1(dispHandle, 3, 0, "Reason: %d", pEvent->linkTerminate.reason);
        Display_clearLine(dispHandle, 4);
        Display_clearLine(dispHandle, 6);

}
}

  • Hi Mitha,

    If I understand you correctly, you want to connect to device who advertise with a specific address? In that case you can use a white list when scanning. See: dev.ti.com/.../gapbondmngr.html
  • thank you for your reply ,
    yes i want to connect peripheral address
    but its connecting error address

    i want to connect this address as shown below

    // if filtering device discovery results based on service UUID
    if (DEFAULT_DEV_DISC_BY_SVC_UUID == TRUE)
    {
    if (SimpleBLECentral_findSvcUuid(SUNLIGHT_SERV_UUID,
    pEvent->deviceInfo.pEvtData,
    pEvent->deviceInfo.dataLen))
    {
    SimpleBLECentral_addDeviceInfo(pEvent->deviceInfo.addr,
    pEvent->deviceInfo.addrType);
    }
    }
    how to connect this address in process role event
  • Hi Mitha,

    SimpleBLECentral is already saving the addresses in SimpleBLECentral_addDeviceInfo(), in the devList array.

    You should wait until simple central is finished with scanning before you start sending connection requests. Then you can use the addresses saved in devList.