This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Is it possible to be GATT server and client at the same time ?

In the demo application  - SimpleBlePeripheral, the keyfob is the GATT server, and the USB dongle is the client.

Is it possible for the keyfob to be also a GATT client - and read / write charachteristics from the USB dongle ? (suppose there is a suitable application there).

Thanks,

Sasha.

 

  • Yes, that is possible. In fact, every BLE device must be a GATT client as per the BT 4.0 spec. Every BLE device contains the GAP service and the GATT service. For example, if you modify the SimpleBLEPeripheral application and have the keyfob perform a read of handle 0x0001 on the USB dongle, you will receive a read response with a return value of "00:18", indicating the start of the GAP service.

  • Thanks Willis. I tried to read the handle by the foloowing code :
    uint16 connectionHandle;
    attReadReq_t readRequest;
    GAPRole_GetParameter(GAPROLE_CONNHANDLE,&connectionHandle);
    readRequest.handle = 1;
    status = GATT_ReadCharValue( connectionHandle , &readRequest,simpleBLEPeripheral_TaskID );
    I got a return value of 0x16 which indicates blePending: A response is pending with this server. My questions are :
    1. What is the meaning of this error ? If I understand correctly, in the normal case the return value is success, but it only means the request was sent and that the response will arrive later (i,e response is pending...) . So what does a response is pending error mean ?
    2. Any idea why it is happening ?
    I have seen in other posts a suggestion that a previous GATT command has not been completed - this is not my case - this is the only GATT call in the program. (I use the SimpleBLEProfile application as a base)
    Thanks, Sasha.
  • I have added a call to GATT_InitClient() before performing the read and now I get error 0x2 = INVALIDPARAMETER
    The connectionHandle is 0, the taskId is 0xB, and the handle in the request struct is 0x1.
    What is wrong with parameters ?
    Thanks.