Added TLV8:printAll()
Recursively prints an entire TLV and all embedded sub-TLVs based on a best-guess if the value of any TLV is a sub-TLV.
This commit is contained in:
parent
48cab1f82b
commit
e4df56293a
14
src/TLV8.cpp
14
src/TLV8.cpp
|
|
@ -272,6 +272,20 @@ void TLV8::print(TLV8_it it1, TLV8_it it2){
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
|
|
||||||
|
void TLV8::printAll_r(String label){
|
||||||
|
|
||||||
|
for(auto it=begin();it!=end();it++){
|
||||||
|
Serial.printf("%s",label.c_str());
|
||||||
|
print(it);
|
||||||
|
TLV8 tlv;
|
||||||
|
if(tlv.unpack(*it,(*it).getLen())==0)
|
||||||
|
tlv.printAll_r(label+String((*it).getTag())+"-");
|
||||||
|
}
|
||||||
|
Serial.printf("%sDONE\n",label.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////
|
||||||
|
|
||||||
void TLV8::osprint(std::ostream& os, TLV8_it it1, TLV8_it it2){
|
void TLV8::osprint(std::ostream& os, TLV8_it it1, TLV8_it it2){
|
||||||
|
|
||||||
for(auto it=it1;it!=it2;it++)
|
for(auto it=it1;it!=it2;it++)
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,8 @@ class TLV8 : public std::list<tlv8_t, Mallocator<tlv8_t>> {
|
||||||
const TLV8_names *names=NULL;
|
const TLV8_names *names=NULL;
|
||||||
int nNames=0;
|
int nNames=0;
|
||||||
|
|
||||||
|
void printAll_r(String label);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TLV8(){};
|
TLV8(){};
|
||||||
|
|
@ -128,6 +130,7 @@ class TLV8 : public std::list<tlv8_t, Mallocator<tlv8_t>> {
|
||||||
void print(TLV8_it it1, TLV8_it it2);
|
void print(TLV8_it it1, TLV8_it it2);
|
||||||
void print(TLV8_it it1){print(it1, std::next(it1));}
|
void print(TLV8_it it1){print(it1, std::next(it1));}
|
||||||
void print(){print(begin(), end());}
|
void print(){print(begin(), end());}
|
||||||
|
void printAll(){printAll_r("");}
|
||||||
|
|
||||||
void osprint(std::ostream& os, TLV8_it it1, TLV8_it it2);
|
void osprint(std::ostream& os, TLV8_it it1, TLV8_it it2);
|
||||||
void osprint(std::ostream& os, TLV8_it it1){osprint(os, it1, std::next(it1));}
|
void osprint(std::ostream& os, TLV8_it it1){osprint(os, it1, std::next(it1));}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue