I think I see why ReadIntValue may not work as I expected. I thought it would read int values from the last-received byte array, but instead it only responds if there is a new byte array it has not read from yet.
I reviewed this doc:
It describes these 4 server/host connection types as part of the BLE communication format:
— Read - This operation is requested by the GATT client on a specific characteristic held by the GATT server such as integers. The server complies by providing the requested value.
— Write - This operation is initiated by the GATT client on a specific characteristic held by the GATT server, providing the server with the new value. The server stores this new value and may or may not send an acknowledgement to the client.
— Notify - This operation is initiated by the GATT server when a new value is written to one of its characteristics, provided that the GATT client has subscribed to notifications on that characteristic. The server returns the new value so that it can be read by the client.
— Indicate - The only difference between this operation and notify is that it is acknowledged.
BLE Heart Rate Service uses the Notify communication approach, so we can't make Read requests to the device.
Here's the Heart Rate Service doc indicating Notify as the communication type:
I believe that the IntValueRead response block is designed to handle responses from Read-type server devices and the IntValueChanged block is designed to handle messages sent from Notify-type server devices. It seems like both are used as responses to ReadIntValue, and depending on the server device type your client is connected with, the appropriate associated response block (IntValueRead or IntValueChanged) is triggered with the return value.