diff --git a/src/HomeSpan.cpp b/src/HomeSpan.cpp index 4afb96f..e8153bc 100644 --- a/src/HomeSpan.cpp +++ b/src/HomeSpan.cpp @@ -2007,7 +2007,7 @@ StatusCode SpanCharacteristic::loadUpdate(char *val, char *ev, boolean wr){ case STRING: case DATA: case TLV_ENC: - uvSet(newValue,(const char *)val); + uvSet(newValue,(const char *)stripBackslash(val)); break; default: diff --git a/src/Utils.cpp b/src/Utils.cpp index 0b2e46c..d3711f0 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -73,6 +73,20 @@ char *Utils::readSerial(char *c, int max){ ////////////////////////////////////// +char *Utils::stripBackslash(char *c){ + + size_t n=strlen(c); + char *p=c; + for(int i=0;i<=n;i++){ + *p=c[i]; + if(*p!='\\') + p++; + } + return(c); +} + +////////////////////////////////////// + String Utils::mask(char *c, int n){ String s=""; int len=strlen(c); diff --git a/src/Utils.h b/src/Utils.h index 255d602..26e3db9 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -35,7 +35,7 @@ namespace Utils { char *readSerial(char *c, int max); // read serial port into 'c' until , but storing only first 'max' characters (the rest are discarded) String mask(char *c, int n); // simply utility that creates a String from 'c' with all except the first and last 'n' characters replaced by '*' - +char *stripBackslash(char *c); // strips backslashes out of c (Apple unecessesarily "escapes" forward slashes in JSON) } ///////////////////////////////////////////////// diff --git a/src/src.ino b/src/src.ino index a2a4477..4f57226 100644 --- a/src/src.ino +++ b/src/src.ino @@ -49,7 +49,7 @@ struct HomeSpanTV : Service::Television { for(int i=0;i0) - orderTLV.add(0); + orderTLV.add(6); orderTLV.add(1,sizeof(uint32_t),(uint8_t*)(order+i)); } @@ -117,6 +117,7 @@ struct HomeSpanTV : Service::Television { HomeSpanTV *hsTV=(HomeSpanTV *)arg; hsTV->tvname->setString("New Name"); Serial.printf("Reset TV Name to '%s'\n",hsTV->tvname->getString()); + Serial.printf("Showing displayOrder '%s'\n",hsTV->displayOrder->getString()); } static void changeOrder(const char *buf, void *arg){ @@ -128,12 +129,12 @@ struct HomeSpanTV : Service::Television { orderTLV.print(); orderTLV.wipe(); - uint32_t order[]={12,10,6,2,1,9,11,3,18,5}; + uint8_t order[]={12,10,6,2,1,9,11,3,18,5}; - for(int i=0;i0) orderTLV.add(0); - orderTLV.add(1,sizeof(uint32_t),(uint8_t*)(order+i)); + orderTLV.add(1,sizeof(uint8_t),(uint8_t*)(order+i)); } Serial.printf("AFTER:\n");