During a first pass of handling a multi-field response I was having a bunch of trouble parsing with more than one string field. E.g. for a response "+EXAMPLE: 42,-1,\"Test\",00F0" before I nailed down all the exact types I wanted to first just grab each field as strings:
#[derive(AtatResp, Debug, Clone, PartialEq)]
pub struct ExampleResponse {
pub fieldA: String<8>,
pub fieldB: String<8>,
pub fieldC: String<80>,
pub fieldD: String<4>,
}
But that would fail to parse. The only such attempt that worked would be gathering up all fields into one combined one:
#[derive(AtatResp, Debug, Clone, PartialEq)]
pub struct ExampleResponse {
pub allFields: String<256>,
}
Looking for examples of how to make it work I ended up finding the https://github.com/FactbirdHQ/ublox-cellular-rs/blob/3a1a6c39a30fb83805598ba90e19c18e5035522d/ublox-cellular/src/command/device_data_security/responses.rs#L28-L55 code. I don't have that modem but as far as I've found it's a good example of what I'm after as sources e.g. show that the AT+USECMNG=3 command responds with something like:
CA,"ca_cert","An MQTT broker","2032/10/18 08:23:32"
CC,"client_cert","A client certificate","2032/06/22 12:34:48"
PK,"client_key"
Where the first field is similarly not quoted. And the ublox-cellular-rs seems to expect it to still fill in a String<2> similar to my own response parsing.
The trouble is that that code does not seem to work? I made a test for such parsing which fails:
I have since found the serde_at::HexStr work of #135 that I might be able to use instead in my own case and just go straight to all the specific/numeric types instead of trying to log individual streams, but for other situations like this ListSecurityData command there on the ublox-cellular-rs driver I can't tell was ever working? And unless I'm mistaken would need support for unquoted strings to work in practice.
During a first pass of handling a multi-field response I was having a bunch of trouble parsing with more than one string field. E.g. for a response
"+EXAMPLE: 42,-1,\"Test\",00F0"before I nailed down all the exact types I wanted to first just grab each field as strings:But that would fail to parse. The only such attempt that worked would be gathering up all fields into one combined one:
Looking for examples of how to make it work I ended up finding the https://github.com/FactbirdHQ/ublox-cellular-rs/blob/3a1a6c39a30fb83805598ba90e19c18e5035522d/ublox-cellular/src/command/device_data_security/responses.rs#L28-L55 code. I don't have that modem but as far as I've found it's a good example of what I'm after as sources e.g. show that the
AT+USECMNG=3command responds with something like:Where the first field is similarly not quoted. And the
ublox-cellular-rsseems to expect it to still fill in aString<2>similar to my own response parsing.The trouble is that that code does not seem to work? I made a test for such parsing which fails:
I have since found the
serde_at::HexStrwork of #135 that I might be able to use instead in my own case and just go straight to all the specific/numeric types instead of trying to log individual streams, but for other situations like thisListSecurityDatacommand there on the ublox-cellular-rs driver I can't tell was ever working? And unless I'm mistaken would need support for unquoted strings to work in practice.