Read Characteristic in CLIENT from SERVER

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

cross mob
Anonymous
Not applicable

Hi, i have two nodes, one of them, as a SERVER (Pripheral) an other as CLIENT (CENTRAL),  in the SERVER, i update some sensor datas with:

   

 

   

CyBle_GattsWriteAttributeValue();

   

 

   

And i want to read this values in the CLIENT, the connect is succesfully, but i have some problems when i read the data. The connection it is OK, later  discover the GATT client in the server, and when is Discovered:

   

CYBLE_EVT_GATTC_DISCOVERY_COMPLETE:

   

I read the value with:

   

range.endHandle = 0x0030;
                uuid.uuid16 = address;

   

                readByTypeReqParam.range = range;
                readByTypeReqParam.uuid = uuid;
                readByTypeReqParam.uuidFormat = 0x01;
                
                apiResult = CyBle_GattcReadUsingCharacteristicUuid(connHandle, &readByTypeReqParam);

   

 

   

Later i read the value with:

   

 case CYBLE_EVT_GATTC_READ_RSP:
        
        readResponse = *(CYBLE_GATTC_READ_RSP_PARAM_T *) eventParam;

   

 

   

All OK, but if i want to extract this code in a function, it doesn´t work it return to me: apiResult = CyBle_GattcReadUsingCharacteristicUuid(connHandle, &readByTypeReqParam);

   

Anyone know where it is the problem?

   

 

   

Thanks for all

0 Likes
1 Reply
Anonymous
Not applicable

Sorry, it return to me INVALID OPERATION, as API_STATE

   

The function code:

   

http://pastebin.com/gMc8fm0Z

0 Likes