From 3f833beb74e062dd0cd96b1f43c194162202bdaf Mon Sep 17 00:00:00 2001 From: HomeSpan Date: Tue, 9 Nov 2021 21:08:52 -0600 Subject: [PATCH] Added ability to change permissions for Characteristics New methods for Characteristics: setPerms(uint8_t perms); addPerms(uint8_t dPerms); removePerms(uint8_t dPerms); where perms and dPerms = PR|PW|EV... --- src/HomeSpan.h | 31 +++++++++++++++++++++++++++++++ src/src.ino | 1 + 2 files changed, 32 insertions(+) diff --git a/src/HomeSpan.h b/src/HomeSpan.h index fed75c0..fc0a2fc 100644 --- a/src/HomeSpan.h +++ b/src/HomeSpan.h @@ -566,7 +566,38 @@ struct SpanCharacteristic{ } } // setVal() + + SpanCharacteristic *setPerms(uint8_t perms){ + this->perms=perms; + homeSpan.configLog+=String(" \u2b0c Change Permissions for ") + String(hapName) + " with AID=" + String(aid) + ", IID=" + String(iid) + ":"; + + char pNames[][7]={"PR","PW","EV","AA","TW","HD","WR"}; + char sep=' '; + + for(uint8_t i=0;i<7;i++){ + if(perms & (1<addPerms(PW+AA)->removePerms(EV+PR); } // end of setup()