Bluetooth Advertising Stopping

Bluetooth Advertising Stopping

BY 07 May 2020 Tizen .NET

I’m not having any luck with getting the Bluetooth advertising to stay running.

I’m using VS.NET 2019 with Tizen 4.0 as the target.  The device I’m deploying to is a Samsung Galaxy Active2 watch.

The advertising starts ok, and I can see a few packets, but then it just stops by itself.

Here is the code (mostly just copied from this guide: docs.tizen.org/application/dotnet/guides/connectivity/bluetooth):

 

            BluetoothLeAdvertiseData advertiseData = new BluetoothLeAdvertiseData();

            advertiseData = new BluetoothLeAdvertiseData();
            advertiseData.AdvertisingMode = BluetoothLeAdvertisingMode.BluetoothLeAdvertisingBalancedMode;
            advertiseData.AdvertisingConnectable = true;
            advertiseData.Appearance = 192;

            BluetoothLePacketType packetType = BluetoothLePacketType.BluetoothLeAdvertisingPacket;
            string serviceUuid = “1805”; /// time_svc_uuid_16
            advertiseData.AddAdvertisingServiceUuid(packetType, serviceUuid);


            /// Add sample service data for testing
            BluetoothServiceData serviceData = new BluetoothServiceData();
            serviceData.Uuid = “1805”;
            serviceData.DataLength = 3;
            serviceData.Data = new byte[3] { 0x01, 0x02, 0x03 };
            advertiseData.AddAdvertisingServiceData(packetType, serviceData);

            advertiseData.IncludeDeviceName = true;
            advertiseData.IncludeTxPowerLevel = true;

            advertiser.StartAdvertising(advertiseData);

 

And here is what I see in the Tizen debug log:

 

05-06 14:53:48.523 : Info / CAPI_NETWORK_BLUETOOTH ( 7064 : 7064 ) : bluetooth-common.c: __bt_event_proxy(2576) > BLUETOOTH_EVENT_ADVERTISING_STARTED
05-06 14:53:48.527 : Info / Tizen.Network.Bluetooth ( 7064 : 7064 ) : BluetoothLeAdapterImpl.cs: StartAdvertising(430) > Setting advertising state changed callback !! 
05-06 14:53:48.663 : Debug / FM_Bluetooth ( 7064 : 7064 ) : FM_Bluetooth.cs: AdvertisingChangedEventHandler(133) > advertising callback… advertisingFlag: True
05-06 14:53:48.731 : Info / BLUETOOTH_FRWK_API ( 7064 : 7073 ) : bt-adapter-le.c: bluetooth_is_advertising(450) >  Sync Request => type=BT_BLUEZ_SERVICE, fn=BT_IS_ADVERTISING(0x23) 
05-06 14:53:48.767 : Info / BLUETOOTH_FRWK_API ( 7064 : 7073 ) : bt-common.c: _bt_print_api_caller_name(1318) > Caller : com.fluid-mobility.Tiz
05-06 14:53:48.767 : Info / BLUETOOTH_FRWK_API ( 7064 : 7073 ) : bt-adapter-le.c: bluetooth_set_advertising(249) >  Sync Request => type=BT_BLUEZ_SERVICE, fn=BT_SET_ADVERTISING(0x1b) 
05-06 14:53:48.791 : Info / POWER_MANAGER ( 2647 : 2647 ) : core.c: proc_condition_lock(1491) > [S_LCDOFF] locked by  3175 with 0 ms
05-06 14:53:48.791 : Info / POWER_MANAGER ( 2647 : 2647 ) : core.c: reset_timeout(973) > Reset Timeout (300 ms)
05-06 14:53:48.799 : Info / BLUETOOTH_FRWK_SERVICE ( 2644 : 2644 ) : bt-service-adapter-le.c: _bt_set_advertising(382) >  ### Set advertising [0], Slot id [2] 
05-06 14:53:48.799 : Info / BLUETOOTH_FRWK_SERVICE ( 2644 : 2644 ) : bt-service-event-sender.c: _bt_send_event_to_dest(591) >  Signal : AdvertisingStopped 
05-06 14:53:48.799 : Info / BLUETOOTH_FRWK_SERVICE ( 2644 : 2644 ) : bt-service-tds.c: _bt_tds_handle_adv_disabled(1187) > sender: :1.316, adv_handle:26187280
05-06 14:53:48.799 : Info / BLUETOOTH_FRWK_SERVICE ( 2644 : 2644 ) : bt-service-tds.c: _bt_tds_handle_adv_disabled(1194) > Provider not found
05-06 14:53:48.799 : Info / POWER_MANAGER ( 2647 : 2647 ) : core.c: proc_condition_unlock(1522) > [S_LCDOFF] unlocked by  3175
05-06 14:53:48.803 : Info / POWER_MANAGER ( 2647 : 2647 ) : core.c: reset_timeout(973) > Reset Timeout (300 ms)
05-06 14:53:48.811 : Info / CAPI_NETWORK_BLUETOOTH ( 7064 : 7064 ) : bluetooth-common.c: __bt_event_proxy(2590) > BLUETOOTH_EVENT_ADVERTISING_STOPPED
05-06 14:53:48.811 : Error / CAPI_NETWORK_BLUETOOTH ( 7064 : 7064 ) : bluetooth-adapter.c: _bt_adapter_le_invoke_advertising_state_cb(2624) > No available advertiser
05-06 14:53:48.907 : Info / BLUETOOTH_FRWK_API ( 7064 : 7073 ) : bt-adapter-le.c: bluetooth_is_advertising(450) >  Sync Request => type=BT_BLUEZ_SERVICE, fn=BT_IS_ADVERTISING(0x23) 
05-06 14:53:48.943 : Info / BLUETOOTH_FRWK_API ( 7064 : 7073 ) : bt-common.c: _bt_print_api_caller_name(1318) > Caller : com.fluid-mobility.Tiz
05-06 14:53:48.943 : Info / BLUETOOTH_FRWK_API ( 7064 : 7073 ) : bt-adapter-le.c: bluetooth_set_advertising(249) >  Sync Request => type=BT_BLUEZ_SERVICE, fn=BT_SET_ADVERTISING(0x1b) 
05-06 14:53:48.955 : Info / BLUETOOTH_FRWK_SERVICE ( 2644 : 2644 ) : bt-request-handler.c: __bt_service_method(350) >  Request is failed [NOT_IN_OPERATION] [0xffffffe6] 
05-06 14:53:48.959 : Error / CAPI_NETWORK_BLUETOOTH ( 7064 : 7073 ) : bluetooth-adapter.c: bt_adapter_le_destroy_advertiser(1699) > NOT_IN_PROGRESS(0xfe400105)

 

Any help would be greatly appreciated!

 

Written by