语言

Menu
Sites
Language
Bluetooth connection

I am a beginner Tizen developer. And I decided to use the Bluetooth to send the data to anroid smartphone. I read the tutorial in Tizen docs and don't understand, how can I descovery devices nearby. Who can help me to solve the problem? And if you have the info about projects-examples, which use Bluetooth connection, can you share with me?

编辑者为: Perov 18 6月, 2020

响应

12 回复
Tizen .NET

Hi, thanks for reaching out.

Could you check the BT guide first? (in particular, "Finding Other Devices" part)

We'll share the simple sample as soon as it's ready.

Thanks.

 


 

Perov

Thank you for sample)

Pyun DoHyun

To support you, we should know which operation you want to do with android phone exactly.

'Use Bluetooth to send the data ' is very abstract.

For example, BT provide several methods to transfer data.

1. Transfer data via BT Socket (RFCOMM)

2. Transfer data using file based via OPP (Object Push Profile)

3. Trasfer data via GATT (BLE)

 

As the selection method, the used BT APIs will be different.

And, the additional application on android is required except of '2. Transfer data using file'

 

Anyway, we can provide the guideline for this.

But for this, we should know the exact situation of you.

Perov

I want to recieve data from android app, than send another data to the app again. And my goal is to exchange data this way.

Pyun DoHyun

Can I know ''android app' information more detail? Did you make new android app or use the app on 'Google play store'?

If you make new app, then which BT APIs use? or if you use the original app, what is the name of app?

Perov

I don't know what APIs is used in the android app. Android app is made by another team of developers.

Pyun DoHyun

To support you, we should know the transfer method of the remote android app. As that method, tizen app also can use the proper BT APIs.

So please inform more detail information about android app

Ricky Kim

Hi !

 

Can I get the GATT server sample code of galaxy watch ?

We want to send the motion sensor data of watch to the android phone.

It's not easy to implement the code only with the documentation.

 

thanks.

Ricky Kim

Hi !

 

Thank you for your quick response.

With your guide,  I 've tried to make a program but not easy.I have several questions.

 

1. Our targets are multi platform.   So, to make easy scan our watch App from mobile,

    can the bluetoothAdapter name (such as "myAppName") be changed during our app running ?

 

2. For data sharing between watch and mobile, we need to add some characteristics to GattService.   

    How can the new charateristics of writewithoutresponse be added to GattService ?

 

   

Pyun DoHyun

1. Our targets are multi platform.   So, to make easy scan our watch App from mobile,

    can the bluetoothAdapter name (such as "myAppName") be changed during our app running ?

>> You can use 'name' property in adapter.

https://samsung.github.io/TizenFX/latest/api/Tizen.Network.Bluetooth.BluetoothAdapter.html

 

254                 /* TEST CODE */
255                 string name = "TizenAdapter";
257                 /* Set test */
258                 BluetoothAdapter.Name = name;

 

 

2. For data sharing between watch and mobile, we need to add some characteristics to GattService.   

    How can the new charateristics of writewithoutresponse be added to GattService ?

>> See under document.

https://samsung.github.io/TizenFX/latest/api/Tizen.Network.Bluetooth.BluetoothGattCharacteristic.html
https://samsung.github.io/TizenFX/latest/api/Tizen.Network.Bluetooth.BluetoothGattProperty.html

 

Fields

Name Description
AuthenticatedSignedWrites

The authenticated signed writes property.

Broadcast

The broadcast property.

ExtendedProperties

The extended properties.

Indicate

The indicate property.

Notify

The notify property.

Read

The read property.

Write

The write property.

WriteWithoutResponse

The write without response property.

 

* sample code

757                     server = BluetoothGattServer.CreateServer();
758                     service = new BluetoothGattService(serviceUuid, BluetoothGattServiceType.Primary);
759                     charc = new BluetoothGattCharacteristic(characteristicUuid, characteristicPermission, characteristicProperties, characteristicValue);
760                     desc = new BluetoothGattDescriptor(descriptorUuid, descriptorPermissions, descriptorValue);
761                     cccdesc = new BluetoothGattDescriptor(cccdescriptorUuid, cccdescriptorPermissions, cccdescriptorValue);
763                     charc.AddDescriptor(desc);
764                     charc.AddDescriptor(cccdesc);
765                     service.AddCharacteristic(charc);
766                     server.RegisterGattService(service);
767                     server.Start();

 

Fields

Name Description
AuthenticatedSignedWrites

The authenticated signed writes property.

Broadcast

The broadcast property.

ExtendedProperties

The extended properties.

Indicate

The indicate property.

Notify

The notify property.

Read

The read property.

Write

The write property.

WriteWithoutResponse

The write without response property.

Ricky Kim

Thanks !!

 

The BLE server starts working.

I was missing GattServer should be started.