sim7020 0.1.2

driver for sim7020E NB IoT modem
Documentation

SIM7020 Driver

Based on the rp2040-project-template.

This driver currently supports only a basic subset of AT commands. It's enough to get an NTP time stamp and send data via mqtt:


    modem
        .send_and_wait_reply(at_command::ntp::StartNTPConnection {}).or_else(|e| {
        warn!("failed starting ntp connection. Connection already established?" );
        return Err(e)
    });

    modem
        .send_and_wait_reply(at_command::ntp::NTPTime {})
        .unwrap();

    modem
        .send_and_wait_reply(at_command::mqtt::MQTTRawData {})
        .unwrap();

    modem
        .send_and_wait_reply(at_command::mqtt::MQTTRawData {
            data_format: at_command::mqtt::MQTTDataFormat::Bytes,
        })
        .unwrap();

    match modem.send_and_wait_reply(at_command::mqtt::NewMQTTConnection {
        server: "88.198.111.21",
        port: 1883,
        timeout_ms: 5000,
        buffer_size: 600,
        context_id: None,
    }) {
        Ok(_) => info!("connected mqtt"),
        Err(e) => warn!("failed connecting mqtt"),
    };

    modem
        .send_and_wait_reply(at_command::mqtt::MQTTConnect {
            mqtt_id: 0,
            version: at_command::mqtt::MQTTVersion::MQTT311,
            client_id: "0",
            keepalive_interval: 120,
            clean_session: false,
            will_flag: false,
            username: "someuser",
            password: "somepassword"
        })
        .unwrap();

Feel free to open an issue if you need support for specific other functionality.