Reading and storing the IMEI

Hi,

   I've seen a few posts about reading the IMEI number using AT commands, eg AT+CGSN.

How do I do this within my application? Upon investigation it seems that I need to use the modem library API as mentioned here..AT interface — nrfxlib 2.3.99 documentation (nordicsemi.com)

But it seems on the surface to be quite involved!
Is this the easiest way for me to get the IMEI so I can store it somewhere to use later?

Cheers

Duncan

Parents
  • It's ok I found the answer!

    Simple case of including the nrf_modem_at.h header file and then following the examples like this...

    void foo(void)
    {
            int err;
            char response[64];
    
            err = nrf_modem_at_cmd(response, sizeof(response), "AT+CFUN=%d", 1);
            if (err) {
                    /* error */
            }
    
            /* buffer contains the whole response */
            printf("Modem response:\n%s", response);
    }
Reply
  • It's ok I found the answer!

    Simple case of including the nrf_modem_at.h header file and then following the examples like this...

    void foo(void)
    {
            int err;
            char response[64];
    
            err = nrf_modem_at_cmd(response, sizeof(response), "AT+CFUN=%d", 1);
            if (err) {
                    /* error */
            }
    
            /* buffer contains the whole response */
            printf("Modem response:\n%s", response);
    }
Children
No Data
Related