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.

M3 DK-LM3s9b96 with CC2560 bluetooth wireless kit which can't switch to Non-discoverable mode

Dear TI:

we want to automatic switch LimitedDiscoverable Mode to NonDiscoverable Mode.

We use GAP_Set_Discoverability_Mode(BluetoothStackID, dmLimitedDiscoverableMode, MAXIMUM_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE_MODE), but

it can't switch to NonDiscoverable mode at the end of the specific time.

this function need to extra function setting(about HCI..or other)?

best regards,

S.H.

  • Hsu,

    What is MAXIMUM_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE_MODE defined as?

     

    Regards,
    Gustavo

  • Dear Gustavo:

    it species the length of time (in Seconds) that the Local Bluetooth device is to be placed into the specified Discoverable Mode. And the  MAXIMUM_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE_MODE is defined as 60s in GAPAPI.h.

    So, the BT should be switch to Non-Discoverable mode after 60s. But we can't.

    best regards,

    S.H

  • S.H,

    When you saw you "can't" you mean you still find the device discoverable after 60 seconds?

    Regards,
    Gustavo

  • Gustavo:

    yes, the BT still at discoverable mode after 60 seconds. And the remote device also still find the BT after 60 seconds.

    best regards,

    S.H

  • S.H,

    I have requested that StoneStreet One, who developed the stack, assist in helping you. However, their response will be delayed due to the holidays.

    Regards,
    Gustavo

  • Gustavo:

    OK. Thanks for your help

    best regards,

    S.H

  • Hello,

    We are able to reproduce this and are looking at it and will post our feedback soon.

    Best Regards,

    Stonestreet One. 

  • Hello,

    Please make the changes in BTPS_WaitEvent function in BTPSKRNL.c so that it looks like: 

    Boolean_t BTPSAPI BTPS_WaitEvent(Event_t Event, unsigned long Timeout)
    {
    long Result;
    Boolean_t ret_val = FALSE;
    Byte_t Msg;
    unsigned long WaitTime;

    /* Verify that the parameter passed in appears valid. */
    if(Event)
    {
    if(Timeout == BTPS_INFINITE_WAIT)
    {
    WaitTime = portMAX_DELAY;
    }
    else
    {
    WaitTime = MILLISECONDS_TO_TICKS(Timeout);
    }

    do
    {
    /* Get a packet from the queue. */
    Result = xQueueReceive(((EventHeader_t *)Event)->EventHandle, &Msg, WaitTime);
    }while((Result == errSCHEDULER_IS_SUSPENDED) || ((Timeout == BTPS_INFINITE_WAIT) && (Result == errQUEUE_EMPTY)));

    if((Result != pdPASS) && (Result != errQUEUE_EMPTY))
    DBG_MSG(DBG_ZONE_BTPSKRNL,("Wait Event Error: %d, Timeout %d\n", Result, Timeout));
    else
    {
    /* Only reset the event if the wait was successful. */
    if(Result == pdPASS)
    xQueueSend(((EventHeader_t *)Event)->EventHandle, &Msg, 0);
    }

    ret_val = (Boolean_t)(Result == pdPASS);
    }
    else
    DBG_MSG(DBG_ZONE_BTPSKRNL,("NULL Event"));

    return(ret_val);
    }
    
    
    Best Regards,
    Stonestreet One.
  • Dear Stonestreet One:

    I has modified the BTSP_WaitEvent function. But, use  GAP_Set_Discoverability_Mode still can't switch to non-discoverable mode at timeout, and the BT still found from remote device. Does the other setting for this capabilit?

    Could you attach the sample code for this test? Thanks for your support.

  • Hello,

    Can you please post a code snippet that you are using to set the discoverability mode?

    Thanks,

    Stonestreet One. 

  • Dear Stonestreet One:

    The BT initial and discoverable mode setting are as follows:

    // initialize

    HCI_DRIVER_SET_COMM_INFORMATION(&sDriverInformation, 1, 115200, cpUART);

    BSC_Initialize(&sDriverInformation, 0);

    GAP_Write_Extended_Inquiry_Information(

                                    g_uiBluetoothStackID,

                                    HCI_EXTENDED_INQUIRY_RESPONSE_FEC_REQUIRED,

                                    psEIRData);

    ASSIGN_CLASS_OF_DEVICE(g_sClassOfDevice, 0, 0x1F, 0);

    GAP_Set_Class_Of_Device(g_uiBluetoothStackID, g_sClassOfDevice);

    DISC_Initialize(g_uiBluetoothStackID);

    GAP_Set_Parability_Mode(g_uiBluetoothStackID, pmPairableMode_EnableSecureSimplePairing);

    // discovery mode setting.

    GAP_Set_Discoverability_Mode(g_uiBluetoothStackID, dmGeneralDiscoverableMode, 120); // timeout: 120 sec

    best regards,

    Shihyin Hsu

  • Hello,

    Please make sure that you have rebuilt the application after making the changes to BTPSKRNL.c and you are flashing the new application.

    Also are you making a call to SetLocalDeviceMode from the main app? That can reset the discoverability mode. 

    You can also add the following function to Bluetooth.c and call it on a button press. Once implemented, please press the button after initialization and after about 150 seconds (so that we know that it is more than the 120 seconds timeout) and please add the debug out here.  We will take a look and we can discuss further.

    ------------
    int
    GetDiscoveryMode(void)
    {
    int retval;
    GAP_Discoverability_Mode_t mode;
    unsigned long timeout;

    retval = GAP_Query_Discoverability_Mode(g_uiBluetoothStackID, &mode, &timeout);

    Display(("\r\nDiscovery Mode: %d, "
    "Timeout %d.\r\n", mode, timeout));

    return(0);

    }
    ------------
    Best Regards,
    Nikhil
  • Dear Nikhil:

    Thanks for your help. It can be work for more than 120 seconds timeout.

    best regards,

    Shihyin

  • Hello Shihyin,

    For general discoverability it should work for time duration that is more than 30 seconds.

    I wanted to confirm if it is working for a value of, say 60, for you.

    Please let us know.

    Thanks,

    Stonestreet One.