diff --git a/src/HomeSpan.h b/src/HomeSpan.h index 919a213..97a102e 100644 --- a/src/HomeSpan.h +++ b/src/HomeSpan.h @@ -736,6 +736,25 @@ class SpanCharacteristic{ } + size_t getTLV(TLV8 &tlv){ + if(format tBuf(olen); // create temporary buffer + + int ret=mbedtls_base64_decode(tBuf,olen,&olen,(uint8_t *)value.STRING,strlen(value.STRING)); + + if(ret==MBEDTLS_ERR_BASE64_INVALID_CHARACTER){ + LOG0("\n*** WARNING: Can't decode Characteristic::%s with getTLV(). Data is not in base-64 format\n\n",hapName); + return(0); + } + + tlv.unpack(tBuf,olen); + return(tlv.pack_size()); + } + void setTLV(TLV8 &tlv, boolean notify=true){ setValCheck(); @@ -793,9 +812,8 @@ class SpanCharacteristic{ template void setVal(T val, boolean notify=true){ - if(updateFlag==1) - LOG0("\n*** WARNING: Attempt to update Characteristic::%s with setVal() within update() while it is being updated by Home App. This may cause device to become non-responsive!\n\n",hapName); - + setValCheck(); + if(!((val >= uvGet(minValue)) && (val <= uvGet(maxValue)))){ LOG0("\n*** WARNING: Attempt to update Characteristic::%s with setVal(%g) is out of range [%g,%g]. This may cause device to become non-responsive!\n\n", hapName,(double)val,uvGet(minValue),uvGet(maxValue)); diff --git a/src/src.ino b/src/src.ino index ef3f4b1..d6ce93f 100644 --- a/src/src.ino +++ b/src/src.ino @@ -122,6 +122,12 @@ struct HomeSpanTV : Service::Television { HomeSpanTV *hsTV=(HomeSpanTV *)arg; TLV8 orderTLV; + + Serial.printf("BEFORE:\n"); + hsTV->displayOrder->getTLV(orderTLV); + orderTLV.print(); + orderTLV.wipe(); + uint32_t order[]={12,10,6,2,1,9,11,3,18,5}; for(int i=0;i