diff --git a/src/HomeSpan.cpp b/src/HomeSpan.cpp index 645fe87..26cefc5 100644 --- a/src/HomeSpan.cpp +++ b/src/HomeSpan.cpp @@ -618,18 +618,12 @@ void Span::processSerialCommand(const char *c){ } break; - case 'd': { - -// TempBuffer qBuf(sprintfAttributes(NULL)+1); -// sprintfAttributes(qBuf); + case 'd': { printfAttributes(); LOG0("\n*** Attributes Database: size=%d configuration=%d ***\n\n",hapOut.getSize(),hapConfig.configNumber); hapOut.flush(); -// LOG0("\n*** Attributes Database: size=%d configuration=%d ***\n\n",qBuf.len()-1,hapConfig.configNumber); -// prettyPrint(qBuf); - hapOut.setLogLevel(0); printfAttributes(); hapOut.flush(); @@ -638,6 +632,7 @@ void Span::processSerialCommand(const char *c){ break; case 'Q': { + char tBuf[5]; const char *s=c+1+strspn(c+1," "); sscanf(s," %4[0-9A-Za-z]",tBuf); @@ -1255,24 +1250,6 @@ void Span::printfAttributes(int flags){ /////////////////////////////// -int Span::sprintfAttributes(char *cBuf, int flags){ - - int nBytes=0; - - nBytes+=snprintf(cBuf,cBuf?64:0,"{\"accessories\":["); - - for(int i=0;isprintfAttributes(cBuf?(cBuf+nBytes):NULL,flags); - if(i+1sprintfAttributes(cBuf?(cBuf+nBytes):NULL,flags); - if(i+1iid); - if(i+1sprintfAttributes(cBuf?(cBuf+nBytes):NULL,flags); - if(i+1> Services; // vector of pointers to all Services in this Accessory - int sprintfAttributes(char *cBuf, int flags); // prints Accessory JSON database into buf, unless buf=NULL; return number of characters printed, excluding null terminator, even if buf=NULL void printfAttributes(int flags); // writes Accessory JSON to hapOut stream protected: @@ -441,7 +439,6 @@ class SpanService{ boolean isCustom; // flag to indicate this is a Custom Service SpanAccessory *accessory=NULL; // pointer to Accessory containing this Service - int sprintfAttributes(char *cBuf, int flags); // prints Service JSON records into buf; return number of characters printed, excluding null terminator void printfAttributes(int flags); // writes Service JSON to hapOut stream protected: