ERIS CORE

◆ printDictionary()

void FLASHMEM SvcDataDictionary::printDictionary ( SvcSerialCommandInterface sci)

prints the dictionary to the SvcSerialCommandInterface

Parameters
sci

Definition at line 213 of file svcDataDictionary.cpp.

213  {
214  //todo: print out in JSON format
215  //Serial.flush();
217  sci->print(F("DD {"));
218  uint16_t from, to;
219  from = dd_transmitt_block++ * 16; //block size
220  to = dd_transmitt_block * 16;
221  if (to >= next){
222  to = next;
223  dd_transmitt_block = 0;
224  }
225 
226  for(int i=from;i<to;i++){
227  if (record[i].data_type == DDDT_INT32){
228  sci->printf("\"%s\":%d",record[i].key,record[i].val.int32_val);
229  }else if (record[i].data_type == DDDT_FLOAT32){
230  sci->printf("\"%s\":%f",record[i].key,record[i].val.float32_val);
231  }
232  if (i != to-1) sci->print(",");
233  }
234  sci->println("}");
235  sci->sendLZ4Message();
236  }
237 }
SvcSerialCommandInterface sci
Definition: ErisCore.cpp:22
@ DDDT_FLOAT32
@ DDDT_INT32
svcDataDictionaryRecord record[DATADICT_KEYVALUE_PAIRS]
bool requestStartLZ4Message()
request to start a lz4 compressed message starts the message and returns true if available returns f...
void sendLZ4Message()
Calling this function signals the end of a compressed message. The txBuffer contents are lz4 compres...

References dd_transmitt_block, DDDT_FLOAT32, DDDT_INT32, next, record, SvcSerialCommandInterface::requestStartLZ4Message(), sci, and SvcSerialCommandInterface::sendLZ4Message().

Referenced by SvcSerialCommandInterface::update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: