hello_client(server?client?) hello_sensor(server?client?)

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

cross mob
Anonymous
Not applicable

SDK:2.2.2

APP:hello_sensor and hello_client

EVB:Tag3 and wiced sense

The server can send the notification to the client in BLE spec.I would like to check the relationship between server and client in hello_client and hello_sensor.

I tested two ways to confirm the client and server.

1.The hello_sensor send notification to the hello_client.

2.The hello_client send notification to the hello_sensor.

I used the original program(hello_sensor and hello_client) in method 1.


I add a service in GATT database of hello_sensor and the notification callback function in the method 2.

PRIMARY_SERVICE_UUID128 (HDLS_client_not, __UUID_client_not),

CHARACTERISTIC_UUID128 (HDLC_client_not_A1UUID,

                                                  HDLC_client_not_A1UUID_VALUE,

                                                  __UUID_client_not_A1UUID,

                                                  LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_NOTIFY

                                                  | LEGATTDB_CHAR_PROP_INDICATE,

                                                  LEGATTDB_PERM_READABLE, 11),

                                                  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

CHAR_DESCRIPTOR_UUID16_WRITABLE (HDLD_client_not_A1UUID_CLIENT_CONFIGURATION,

                                                                          UUID_DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION,

                                                                          LEGATTDB_PERM_READABLE |

                                                                           LEGATTDB_PERM_WRITE_REQ

                                                                           | LEGATTDB_PERM_AUTH_WRITABLE,

                                                                           2),

                                                                           BIT16_TO_8(CCC_NOTIFICATION | CCC_INDICATION),     

void hello_sensor_create(void){

     ........

     leatt_regNotificationCb((LEATT_TRIPLE_PARAM_CB) hello_client_notification_handler);//add notification callback

     ........

}

The hello_client will use the timer to send the notification.

void hello_client_fine_timeout(UINT32 count){

     char abc[5]={'A','B','C','D','E'};

     bleprofile_sendNotification(HDLC_client_not_A1UUID_VALUE, &abc,sizeof(abc));

}

The receiver can receive the notification by transmitter(hello_sensor and hello_client) in method 1 and method 2.

Is the client and server dynamic in hello_sensor or hello_client?


          notification or writeReq.

Hello_client   ===>  Hello_sensor   (Hello_client is server, Hello_sensor is client)??


          notification or writeReq.

Hello_client  <===  Hello_sensor   (Hello_client is client, Hello_sensor is server)??


If I call the API like bleprofile_sendNotification or bleprofile_sendWriteReq,and it will change the role(server or client) in stack.Is it right?

0 Likes
1 Solution
Anonymous
Not applicable

A server is a device that has a GATT database and sends out notifications, which are received by the client. A device can be a server, or a client, or both. There is no set protocol for switching between the roles.

View solution in original post

0 Likes
5 Replies
BoonT_56
Employee
Employee
500 likes received 250 likes received 100 likes received

Our device can function in both master and slave modes. Below is a classic blog on this topic.

Testing Master and Slave Roles

0 Likes
Anonymous
Not applicable

Hi boont,

Thank for your comment.

I have already seen the article.

The Master and slave is determine in the link layer,but the server and client isn't.

The request(write request or read request) is send by the client,and the server will receive the request form the client.

So the hello_sensor send the request(write request or read request) to the hello_client.The hello_sensor is the client.But the hello_client also can send the request(write request or read request) to the hello_senor.I can't distinguish who is the client or server.

Is the client or server always change in the stack?

=>When the hello_sensor would like to send the request(write request or read request),and the hello_sensor will change to the client. The hello_client will change to the server.

=>When the hello_client would like to send the request(write request or read request),and the hello_client will change to the client. The hello_sensor will change to the server.

Or it's determine when the hello_client and hello_sensor is connect.

=>When the hello_client is connect to the hello_sensor,and the hello_client is the client.The hello_sensor is the server.


Michele

0 Likes
Anonymous
Not applicable

Can someone help me?

0 Likes
Anonymous
Not applicable

A server is a device that has a GATT database and sends out notifications, which are received by the client. A device can be a server, or a client, or both. There is no set protocol for switching between the roles.

0 Likes
Anonymous
Not applicable

Hi Lucy,

Thank for your comment.

This helps clear things up tremendously.

0 Likes