FactbirdHQ / atat

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

URC parser does not allow colon #150

Closed mschnell1 closed 1 year ago

mschnell1 commented 1 year ago

The Modem I use (Quectel EC25) after connecting or trying to connect to the Network sends something like +QMTOPEN: 0,3 I know that / how I can implement my own parser for responses to client.send(), but this response is delayed after the command to the Modem, and hence I seem to need to add the #[at_urc("+QMTOPEN")] to the Urc enum. Unfortunately I get ERROR atat::ingress > Parsing URC FAILED: "+QMTOPEN: 0,3" and hence no return from subscriber.next_message().await;
We already did test, that the standard parser does not like colons. Is this intentionnally ? Is there a way to handle such Modem responses ? (This modem sends colons in a lot of Urcs. ) -Michael

MathiasKoch commented 1 year ago

I am not quite sure what is wrong in your case, but all the URC's i am using this for are using colon, and it works fine?

https://github.com/BlackbirdHQ/ublox-cellular-rs/blob/master/ublox-cellular/src/command/mod.rs

It's a bit hard without seeing your enum

mschnell1 commented 1 year ago

I have:

pub enum Urc {
    #[at_urc("+QMTRECV")]
    QmtrecvReceived(mqtt::on_receive::OnReceived),
    #[at_urc("+QMTOPEN")]
    QmtopenReceived(mqtt::on_receive::OnReceived),
    #[at_urc("+QISTAT")]
    QistateReceived(mqtt::on_receive::OnReceived),
}

I can reproduce the problem with just one.

MathiasKoch commented 1 year ago

And how does your OnReceived struct look?

mschnell1 commented 1 year ago

(Not in the office right now) AH, the OnReceived struct is used to configure the Parser. That does make sense. As I did not find information on that, I just put some random elements in that struct . So I need to construct a decent OnReceive struct for responses such as +QMTOPEN: 0,3 I'll try to find more information on that ... ( Thanks

mschnell1 commented 1 year ago

Yep ! with constructing an appropriate OnReceived struct such as


#[derive(Clone, AtatResp)]
pub struct OnReceivedQmtOpen {
    pub p1: u32,
    pub p2: u32,
}

it works. Thanks for your help !