dbrgn / espresso

AT based driver crate for ESP8266 WiFi modules.
Apache License 2.0
9 stars 4 forks source link

Allow receiving responses through URCs #7

Open dbrgn opened 4 years ago

dbrgn commented 4 years ago

Waiting for https://github.com/BlackbirdHQ/atat/pull/35, but it kind of works already:

Received URC: NetworkData(NetworkData { connection_id: None, data: [58, 72, 84, 84, 80, 47, 49, 46, 49, 32, 50, 48, 48, 32, 79, 75, 13, 10, 83, 101, 114, 118, 101, 114, 58, 32, 67, 111, 119, 98, 111, 121, 13, 10, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 58, 32, 107, 101, 101, 112, 45, 97, 108, 105, 118, 101, 13, 10, 67, 111, 110, 116, 101, 110, 116, 45, 84, 121, 112, 101, 58, 32, 116, 101, 120, 116, 47, 112, 108, 97, 105, 110, 13, 10, 86, 97, 114, 121, 58, 32, 79, 114, 105, 103, 105, 110, 13, 10, 68, 97, 116, 101, 58, 32, 83, 117, 110, 44, 32, 50, 50, 32, 77, 97, 114, 32, 50, 48, 50, 48, 32, 50, 49, 58, 48, 54, 58, 48, 52, 32, 71, 77, 84, 13, 10, 67, 111, 110, 116, 101, 110, 116, 45, 76, 101, 110, 103, 116, 104, 58, 32, 49, 51, 13, 10, 86, 105, 97, 58, 32, 49, 46, 49, 32, 118, 101, 103, 117, 114, 13, 10, 13, 10, 56, 48, 46, 50, 49, 56, 46, 50, 48, 52, 46, 56, 54] })

API is still very unergonomic.

fkohlgrueber commented 3 years ago

Did you consider using the "passive receive mode" (see https://docs.espressif.com/projects/esp-at/en/latest/AT_Command_Set/TCP-IP_AT_Commands.html#cmd-ciprecvmode)?

As I understand this, using that mode would make the URC simpler (containing just the length of the data) and a subsequent command would be used to actually receive the data. I'm not sure if that's easier but it's probably worth looking into.

dbrgn commented 3 years ago

Woahhhh, thanks a lot for pointing that out. It would/will make an implementation so much easier.

These +IPD messages that can come in at any time are really a pain to handle.