FactbirdHQ / ublox-cellular-rs

A driver crate for the entire u-blox cellular family in Rust
21 stars 10 forks source link

Parsing Error #62

Open gfabiano opened 2 years ago

gfabiano commented 2 years ago

I receive this kind of parse error with lara-r2. I'm using the last version on github.

DEBUG Sending command: "b"AT+CGATT?\r\n""
DEBUG Received response: "b"+CGATT: 1""
DEBUG Sending command: "b"AT+CGACT?\r\n""
ERROR Timeout: [b"AT+CGACT?"]
DEBUG Received response: "b"+CGACT: 1,1\r\n\r\n+CGACT: 8,0\r\n\r\n+CGACT: 31,1""
DEBUG Sending command: "b"AT+CGATT?\r\n""
ERROR Parse: [b"AT+CGATT?"]
DEBUG Received response: "b"+CGATT: 1""
DEBUG Sending command: "b"AT+CGATT?\r\n""
DEBUG Received response: "b"+CGATT: 1""
DEBUG Sending command: "b"AT+CGACT?\r\n""
ERROR Parse: [b"AT+CGACT?"]
DEBUG Received response: "b"+CGACT: 1,1\r\n\r\n+CGACT: 8,0\r\n\r\nGACT: 31,1""
DEBUG Sending command: "b"AT+CGATT?\r\n""
ERROR Parse: [b"AT+CGATT?"]
DEBUG Received response: "b"+CGATT: 1""
DEBUG Sending command: "b"AT+CGATT?\r\n""
DEBUG Received response: "b"+CGATT: 1""
DEBUG Sending command: "b"AT+CGACT?\r\n""
ERROR Parse: [b"AT+CGACT?"]
DEBUG Received response: "b"+CGACT: 1,1\r\n\r\n+CGACT: 8,0\r\n\r\n+CGACT: 31,1""
DEBUG Sending command: "b"AT+CGATT?\r\n""
ERROR Parse: [b"AT+CGATT?"]
DEBUG Received response: "b"+CGATT: 1""
DEBUG Sending command: "b"AT+CGATT?\r\n""
DEBUG Received response: "b"+CGATT: 1""
DEBUG Sending command: "b"AT+CGACT?\r\n""
ERROR Parse: [b"AT+CGACT?"]
DEBUG Received response: "b"+CGACT: 1,1\r\n\r\n+CGACT: 8,0\r\n\r\n+CGACT: 31,1""
DEBUG Sending command: "b"AT+CGATT?\r\n""
ERROR Parse: [b"AT+CGATT?"]
DEBUG Received response: "b"+CGATT: 1""
DEBUG Sending command: "b"AT+CGATT?\r\n""
DEBUG Received response: "b"+CGATT: 1""
DEBUG Sending command: "b"AT+CGACT?\r\n""
ERROR Parse: [b"AT+CGACT?"]
DEBUG Received response: "b"+CGACT: 1,1\r\n\r\n+CGACT: 8,0\r\n\r\n+CGACT: 31,1""
DEBUG Sending command: "b"AT+CGATT?\r\n""
ERROR Parse: [b"AT+CGATT?"]
DEBUG Received response: "b"+CGATT: 1""
DEBUG Sending command: "b"AT+CGATT?\r\n""
DEBUG Received response: "b"+CGATT: 1""
DEBUG Sending command: "b"AT+CGACT?\r\n""
ERROR Parse: [b"AT+CGACT?"]
DEBUG Received response: "b"+CGACT: 1,1\r\n\r\n+CGACT: 8,0\r\n\r\n+CGACT: 31,1""
DEBUG Sending command: "b"AT+CGATT?\r\n""
ERROR Parse: [b"AT+CGATT?"]
DEBUG Received response: "b"+CGATT: 1""
DEBUG Sending command: "b"AT+CGATT?\r\n""
DEBUG Received response: "b"+CGATT: 1""
DEBUG Sending command: "b"AT+CGACT?\r\n""
ERROR Parse: [b"AT+CGACT?"]
MathiasKoch commented 2 years ago

Hi!

It looks like the current implementation of CGACT doesn't handle the list structure correctly image

I think it is only parsing the first one, and then ending.

I will try to set up a unit test on Vec responses like this one, and see if i can fix it when i get the time.

A PR is also more than welcomed! The issue is in https://github.com/BlackbirdHQ/atat/

gfabiano commented 2 years ago

Hi!

Ok!, I'll try to figure it out. I studied a little the parser and I don't understand how it can loose the second struct. I mean, if the parser respect the index of character it must get the second command. In this evening when I'm at home I'll try to parse some test strings.

MathiasKoch commented 2 years ago

Cool! It should be fairly easy to add unit tests to atat and track it through first digest & second parsing in client.rs

gfabiano commented 2 years ago

Hi! I checked and there was a test on vec PDP Context in atat/src/traits.rs called multi_response and it does not give any problem.

Viewing the return in verbose mode the problem seems on AT+CGACT? . What you think?