rm debug output
This commit is contained in:
@@ -10,7 +10,7 @@ namespace JsonParser
|
||||
{
|
||||
void init();
|
||||
void add_text(const uint8_t* buf, size_t size);
|
||||
int json_printer(const char* bytes, size_t len, void* data);
|
||||
// int json_printer(const char* bytes, size_t len, void* data);
|
||||
|
||||
class HandlerBase
|
||||
{
|
||||
@@ -33,26 +33,32 @@ class Handler: public HandlerBase
|
||||
const int64_t _all_fields;
|
||||
|
||||
public:
|
||||
Handler(Struct default_s, const json_obj_descr (&da)[DESC_SIZE], Fct fct, bool allow_partial=false):
|
||||
Handler(
|
||||
Struct default_s,
|
||||
const json_obj_descr (&da)[DESC_SIZE],
|
||||
Fct fct,
|
||||
bool allow_partial = false):
|
||||
_s {default_s},
|
||||
_da {da},
|
||||
_fct {fct},
|
||||
_allow_partial{allow_partial},
|
||||
_allow_partial {allow_partial},
|
||||
_all_fields {(1 << DESC_SIZE) - 1}
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void print( const Struct& s) { json_obj_encode(_da, DESC_SIZE, &s, json_printer, NULL); }
|
||||
// void print(const Struct& s)
|
||||
// {
|
||||
// json_obj_encode(_da, DESC_SIZE, &s, json_printer, NULL);
|
||||
// }
|
||||
|
||||
bool handle(const char* buf, size_t size) override
|
||||
{
|
||||
Struct s{_s};
|
||||
Struct s {_s};
|
||||
int64_t ret = json_obj_parse((char*)buf, size, _da, DESC_SIZE, &s);
|
||||
if (ret <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(ret != _all_fields && !_allow_partial)
|
||||
if (ret != _all_fields && !_allow_partial)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -61,7 +67,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
// LOG_INF"received a valid json\n");
|
||||
// LOG_DBG"received a valid json\n");
|
||||
// print(s);
|
||||
// LOG_INF"\n");
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user