Add services into hello_client

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

I'd like to add services into hello_client.

When I did it, I could get message but "conn up" message does not display.

I added log file, could anybody explain which status the client is?

Thank you.

0 Likes
1 Solution
VictorZ_46
Employee
Employee
5 comments on blog 25 sign-ins 250 likes received

it looks that your hello client is scanning and see advertisements from the other guys but it does not do advertisements so it cannot be connected from another client/central device.

The application already have some services described in the hello_client_gatt_database, but you can add more.  Just follow the rules.  Are you trying to connect from another device to the hello_client?  Make sure that your device is sending advertisements.  This is done using bleprofile_Discoverable passing high or low parameter.

View solution in original post

8 Replies
VictorZ_46
Employee
Employee
5 comments on blog 25 sign-ins 250 likes received

it looks that your hello client is scanning and see advertisements from the other guys but it does not do advertisements so it cannot be connected from another client/central device.

The application already have some services described in the hello_client_gatt_database, but you can add more.  Just follow the rules.  Are you trying to connect from another device to the hello_client?  Make sure that your device is sending advertisements.  This is done using bleprofile_Discoverable passing high or low parameter.

Anonymous
Not applicable

Victorz,

Can you please give me an advice about the rules to put characteristic?

I modified hello_sensor and hello_client to add new characteristic referring health_thermometer, but client and sensor do not seem to be paired.

For example,

I put temperature characteristic into hello_client_gatt_database[]

  PRIMARY_SERVICE_UUID16 (0x0028, UUID_SERVICE_HEALTH_THERMOMETER),

  CHARACTERISTIC_UUID16 (0x0029, 0x002a, UUID_CHARACTERISTIC_TEMPERATURE_MEASUREMENT,

                          LEGATTDB_CHAR_PROP_INDICATE, LEGATTDB_PERM_NONE, 5),

        0x01,0x00,0x00,0x00,0x00,    

for sensor,

I put the characteristic as well into  hello_sensor_gatt_database[]

  PRIMARY_SERVICE_UUID16 (0x0028, UUID_SERVICE_HEALTH_THERMOMETER),

CHARACTERISTIC_UUID16 (0x0029, 0x002a, UUID_CHARACTERISTIC_TEMPERATURE_MEASUREMENT,

                          LEGATTDB_CHAR_PROP_INDICATE, LEGATTDB_PERM_NONE, 5),

        0x01,0x00,0x00,0x00,0x00,    

Of course, hello_sensor_cfg  is modified to put service and characteristic.

I don't understand why PRIMARY_SERVICE_UUID16 and CHARACTERISTIC_UUID16 can make problem to gatt database.

Thank you.

0 Likes

The handle values can not be duplicated with existed as remote will get the handles for specific services/characteristics.

For example, your modification for sensor should be changed as below to put the services/characteristics to the last in the database.

PRIMARY_SERVICE_UUID16 (0x0064, UUID_SERVICE_HEALTH_THERMOMETER),

CHARACTERISTIC_UUID16 (0x0065, 0x0066, UUID_CHARACTERISTIC_TEMPERATURE_MEASUREMENT,

                          LEGATTDB_CHAR_PROP_INDICATE, LEGATTDB_PERM_NONE, 5),

        0x01,0x00,0x00,0x00,0x00, 

Anonymous
Not applicable

Could you give more explanation about duplicated with existed?

I am confused if any handle number and handle value can be assigned as any purpose following rules like increasing order.

For example, I compared two examples in SDK2.0.1, health-thermometer and speed-test.

Although 0x0028 is used for handle of thermometer service uuid for health thermometer,

0x0028 is used for handle of speed test service uuid.

Thank you

0 Likes

You can check document How-to-Write-WICED-Smart-Applications.pdf within SDK 2.0.1 to know how to add GATT DB as Victor suggested.

To quickly answer your question, a handle number in a application can only be used ONE time for a service or characteristic. So once you declared 0x0028 for thermometer service you can not use it for any other. The handle number will be used when central is doing service discovery it will get the handle number from the device and get to know which service/characteristic is on which handle so central can read/write characteristic from/to the device by this handle number.

health thermometer and speed test are two different applications so you of course can use 0x0028 in both.

0 Likes
Anonymous
Not applicable

I replaced 0x0028 as health thermometer service in hello client application, but it could not be paired with hello-sensor which was changed 0x0028 although I followed rules you've mentioned.

I just wanted to know if I understood right.

Thank you.

0 Likes

In the SDK, hello client only connects to the server has UUID_HELLO_SERVICE. If you removed the service from hello server. hello client won't connect to it.

Eyan,

You might want to have a look at How To Write BLE Application document which is included in the Doc folder in the SDK.  It does not cover all the details, but it states

Note: According to the Bluetooth specification, the handles in GATT definitions do not need to be consecutive, but should appear in the database in the increasing order.