It's just terminology. You could call it "receive"/"send" to yourself instead of "read"/"write" if you think that's better.
The original idea is that the value should be attached to the characteristic and simply read/written by the client directly. Or updated by the server followed by a "notification" containing the new value to the client (for example for a temperature sensor).
But this model is not enough for all profiles. For example, firmware updates do not fit well within this model. Neither does HID. So it's allowed to just use the characteristics as a way of transferring data. It's up to each profile to define how to handle reads and writes for the characteristics. For example, the "Name" and "Appearance" characteristics in the GAP service usually returns a constant value, which might stored in the characteristic object. But for HID we have "control point" characteristics where values are actually not stored anywhere.
I have seen these API variants for defining characteristics for different Bluetooth stacks:
- Embed the characteristic value in the characteristic object and let the Bluetooth stack handle reads/writes internally.
- Don't embed any characteristic value but expose read/write handlers.
- Reserve some space in the characteristic object for the value, but have read/write handlers that can process the data before/after writing/reading the characteristic value from the storage.
Option 2 is the most flexible, and is used with for example Android's app-implemented gatt services.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…