FactbirdHQ / atat

no_std crate for parsing AT commands
Apache License 2.0
115 stars 31 forks source link

fix parsing trailing message content from CMGR command #182

Closed dragonnn closed 11 months ago

dragonnn commented 11 months ago

I think I have here something for issue https://github.com/BlackbirdHQ/atat/issues/180 that doesn't fell like a huge hack. Still probably a hack but a hope a small one. It misuses fields attribute from deserialize_struct(), saves it count in the Deserializer. Then SeqAccess does count how many fields it already parsed, if it hits the branch that no , are present anymore and the count of parsed fields is exactly one less then the expected count of fields to parse it sets a flag in the Deserializer is_trailing_parsing to indicate that parse_str or parse_bytes should now just take everything left and try to parse it. This does seam to work fine for my use case, but I bet it still has some edge cases where it might not work. Doesn't seam to break any other tests and I add a test for my use case.

rmja commented 11 months ago

I will run it through my sim900 driver test suite and get back.

rmja commented 11 months ago

This change is fine with me, all tests pass fine.