aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-02-28 09:49:31 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2015-02-28 09:49:31 +0100
commitecdaa9c8112746ea2c843523358db253600b1074 (patch)
treeff9c721b0c216597ecf658ce78f7226b96b4ff25
parent58776682e2bf94043dd79d0131c69947ef27dcae (diff)
downloadtrygvisio_soil_moisture-ecdaa9c8112746ea2c843523358db253600b1074.tar.gz
trygvisio_soil_moisture-ecdaa9c8112746ea2c843523358db253600b1074.tar.bz2
trygvisio_soil_moisture-ecdaa9c8112746ea2c843523358db253600b1074.tar.xz
trygvisio_soil_moisture-ecdaa9c8112746ea2c843523358db253600b1074.zip
o When sending a notification, also update the data in the local GATT
server so it is easier to implement synchronous clients.
-rw-r--r--trygvisio_soil_moisture.ino3
1 files changed, 3 insertions, 0 deletions
diff --git a/trygvisio_soil_moisture.ino b/trygvisio_soil_moisture.ino
index 388dd8a..560aef7 100644
--- a/trygvisio_soil_moisture.ino
+++ b/trygvisio_soil_moisture.ino
@@ -400,6 +400,9 @@ void notify_soil_moisture(const struct sm_res& res, uint8_t body_len) {
// Serial.print(F("pipe available="));
// Serial.println(available, DEC);
+ // This should probably be an explicit part of the API, but for now it makes it easier to implement a synchronous interface.
+ lib_aci_set_local_data(&aci_state, pipe_set, (uint8_t *)&res, len);
+
if (available && aci_state.data_credit_available > 0) {
boolean sent = lib_aci_send_data(pipe_tx, data, len);
if (sent) {