This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How can i disable a beacon

Im doing a porject using nRF51 DK,nRF51822 Bluetooth Smart Beacon Kit and nRF51 Dongle, with Termite 3,2 to view data. There's a few questions i want to ask.

  1. My program repeat running, i want to stop it with my code, but it stop itself even when i send a 'space' in Termite. My plan was to type 'stop' to stop the program. but my while loop doesn't seem to be working.

  2. i need to disable my beacon, how?

  3. i want to save the data i collected to my PC with my own sql database, is that possible?

Thank you in advance.

Parents
  • It sounds like you want to stop/start advertising. You need to receive the command in your UART event handler, and call relevant softdevice functions when a valid command is received. An example of how this can be done is shown in uart_event_handler in the BLE UART example. You can use something like this to achieve what you want:

    case APP_UART_DATA_READY:
    	UNUSED_VARIABLE(app_uart_get(&data_array[index]));
    	index++;
    
    	if (data_array[index - 1] == '\n')
    	{
    		if(strcmp(data_array,"ACTIVATE") == 0 )
    		{
    			sd_ble_gap_adv_start();
    		}
    		else if(strcmp(data_array,"DEACTIVATE") == 0 )
    		{
    			sd_ble_gap_adv_stop()
    		}
    
    		index = 0;
    	}
    	break;
    

    Note that you should check if advertising is already activated/deactivated before making the softdevice calls.

Reply
  • It sounds like you want to stop/start advertising. You need to receive the command in your UART event handler, and call relevant softdevice functions when a valid command is received. An example of how this can be done is shown in uart_event_handler in the BLE UART example. You can use something like this to achieve what you want:

    case APP_UART_DATA_READY:
    	UNUSED_VARIABLE(app_uart_get(&data_array[index]));
    	index++;
    
    	if (data_array[index - 1] == '\n')
    	{
    		if(strcmp(data_array,"ACTIVATE") == 0 )
    		{
    			sd_ble_gap_adv_start();
    		}
    		else if(strcmp(data_array,"DEACTIVATE") == 0 )
    		{
    			sd_ble_gap_adv_stop()
    		}
    
    		index = 0;
    	}
    	break;
    

    Note that you should check if advertising is already activated/deactivated before making the softdevice calls.

Children
No Data
Related