2 Replies Latest reply on Dec 2, 2016 7:56 PM by jalvc_2141211

    How to change the BLE adv data with SDK 3.7.0

      I have wrote an example which is change the ble advertising data over interval base on SDK 3.5.2.But when I run the program in SDK 3.7.0 ,It did't work.It advertise nothing.

        • 1. Re: How to change the BLE adv data with SDK 3.7.0
          JaeyoungY_71

          Hi Jackson,

           

          Are you getting no initial advertisement at all or does it turn on at first and stop advertising after changing the data? Do you mind sharing the basics of the code you used for this process?

           

          Thanks,

          Jaeyoung

          1 of 1 people found this helpful
          • 2. Re: How to change the BLE adv data with SDK 3.7.0

            hi JaeyoungY_71

             

            At first ,The code function is to let my board advertise its device name and I can use aws service to set it as  a Ibeacon/EddyStone.If using SDK 3.5.2 I can use beacon scan tool to find the device .But when using the SDK 3.7.0 ,I couldn't find it.After that ,I change the code to just let my board advertisement as an Ibeacon/EddyStone in the begining and it's also work with 3.5.2 but not work with 3.7.0.here is my code

             

            void application_start( void )

            {

                wiced_init();

                wiced_bt_stack_init( aws_beacon_management_callback ,

                                    &wiced_bt_cfg_settings, wiced_bt_cfg_buf_pools );

                WPRINT_BT_APP_INFO( ( "Aws Beacon Start\n" ) );

             

             

                while(1)

                {

                aws_beacon_set_ib_adv_data();

                wiced_bt_start_advertisements( BTM_BLE_ADVERT_UNDIRECTED_HIGH, 0, NULL );

                wiced_rtos_delay_milliseconds( Adv_Int );

             

               aws_beacon_set_url_adv_data();

               wiced_bt_start_advertisements( BTM_BLE_ADVERT_UNDIRECTED_HIGH, 0, NULL );

               wiced_rtos_delay_milliseconds( Adv_Int );

                }

             

            }

             

            static wiced_result_t aws_beacon_management_callback( wiced_bt_management_evt_t event, wiced_bt_management_evt_data_t *p_event_data )

            {

                wiced_result_t                    result = WICED_BT_SUCCESS;

                wiced_bt_dev_ble_pairing_info_t  *p_info;

                wiced_bt_ble_advert_mode_t       *p_mode;

             

             

                WPRINT_BT_APP_INFO(("aws_beacon_management_callback: %x\n", event ));

             

             

                switch( event )

                {

                /* Bluetooth  stack enabled */

                case BTM_ENABLED_EVT:

                    aws_beacon_application_init();

                    result = command_console_init(STDIO_UART, sizeof(aws_beacon_command_buffer), aws_beacon_command_buffer,

                                              AWS_BEACON_CONSOLE_COMMAND_HISTORY_LENGTH, aws_beacon_command_history_buffer, " ");

             

             

                    if (result != WICED_SUCCESS)

                    {

                        WPRINT_BT_APP_INFO(("Error starting the command console\r\n"));

                    }

                    console_add_cmd_table( aws_beacon_console_command_table );

                    break;

             

             

                case BTM_DISABLED_EVT:

                    break;

             

             

                case BTM_PAIRING_IO_CAPABILITIES_BLE_REQUEST_EVT:

                    p_event_data->pairing_io_capabilities_ble_request.local_io_cap  = BTM_IO_CAPABILITIES_NONE;

                    p_event_data->pairing_io_capabilities_ble_request.oob_data      = BTM_OOB_NONE;

                    p_event_data->pairing_io_capabilities_ble_request.auth_req      = BTM_LE_AUTH_REQ_BOND | BTM_LE_AUTH_REQ_MITM;

                    p_event_data->pairing_io_capabilities_ble_request.max_key_size  = 0x10;

                    p_event_data->pairing_io_capabilities_ble_request.init_keys     = BTM_LE_KEY_PENC | BTM_LE_KEY_PID;

                    p_event_data->pairing_io_capabilities_ble_request.resp_keys     = BTM_LE_KEY_PENC | BTM_LE_KEY_PID;

                    break;

             

             

                case BTM_PAIRING_COMPLETE_EVT:

                    p_info = &p_event_data->pairing_complete.pairing_complete_info.ble;

                    WPRINT_BT_APP_INFO(( "Pairing Complete: %d",p_info->reason));

                    break;

             

             

                case BTM_SECURITY_REQUEST_EVT:

                    wiced_bt_ble_security_grant( p_event_data->security_request.bd_addr, WICED_BT_SUCCESS );

                    break;

             

             

                case BTM_BLE_ADVERT_STATE_CHANGED_EVT:

                    p_mode = &p_event_data->ble_advert_state_changed;

                    WPRINT_BT_APP_INFO(( "Advertisement State Change: %d\n", *p_mode));

                    if ( *p_mode == BTM_BLE_ADVERT_OFF )

                    {

                        aws_beacon_advertisement_stopped();

                    }

                    break;

             

             

                default:

                    break;

                }

             

             

                return result;

            }