Need help with ADL Serializer for my driver. #4330
-
Hey, I've recently tried to use the Serialization/Deserialization processes to convert a struct from the ESP-IDF Wifi driver so that I can store the parameters as a .json file, load it from the SPIFFS and use the arbitrary type conversion to convert the json object into my struct. I don't know what I'm doing wrong so I hope y'all be able to shed some light onto my problem. I haven't tried to use the macro provided for two reasons: first, I don't need to initialize every member of the struct, so I wanted to be able to only include the ones that are needed in the .json file. Then, some members of the struct are struct themselves, so i figured I didn't needed to serialize those if I called their members directly. I also have some members that are part of a bitset, so those can't be converted normally I think. Here's my header file containing my structs and my serializers. Update: Fixed some typos and reformated the functions.
And here's the struct:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
Since you are able to add things to the namespace, you shouldn't need to use AdlSerializer. Just plug your body in here, and it should work:
|
Beta Was this translation helpful? Give feedback.
Update:
I managed to fix all of my crashes! I had multiple things that prevented my JSON file to be properly parsed.
First, the enum I tried to serialized weren't serialized properly because I tried to do it while inside my namespace. But the enums are from the ESP IDF WiFi driver and are not part of my namespace, so to fix it I needed to move them out of the namespace for it to be serialized properly.
Then, another of the fields wasn't being parsed correctly as it tried to parse a uint8_t array, but that's an oversight I made because I fixed this issue earlier with the SSID and password fields using memcpy.
@gregmarr Thanks for your help!