Skip to main content

imp.net.getcellinfo(callback)

Retrieve cellular connection state information

Availability

Device (from impOS™ 40)

Parameters

Name Type Description
callback Function A function to be called when the cellular connection data has been gathered

Returns

Nothing

Description

This method requests current connection state information from the cellular modem integrated into imps that feature cellular interfaces. It takes as its argument a function which will be called when this information has been retrieved. Gathering this data can take a significant period of time, so imp.net.getcellinfo() operates asynchronously to prevent your application from being blocked while the information is collated. The information is only available once the imp’s cellular modem is powered on.

The cellular connection information is provided in a string — for example, "4G,6300,20,10,10,FDD,262,02,BF75,0345103,350,90,-94,-7,CONN" — and so the callback function should include a single parameter, cellinfo, which will receive the string. For more information on the data contained in the string, which varies according to the connected network type (2G, 3G, 4G, etc), please see ‘The Cinterion ELS61-E AT Command Set’, section 8.11.2.

Example

// Request cellular connection info
imp.net.getcellinfo(function(cellinfo) {
    // Parse string 'cellinfo' - comma-separated values
    local cellData = split(cellinfo, ",");

    // Log the network type
    local ACT = cellData[0];
    server.log("Connected to a " + ACT + " network");

    if (ACT == "4G") {
        // Log the cell ID
        server.log("Global Cell ID: " + cellData[9]);
    }
});