~phablet-team/ofono/midori-support

« back to all changes in this revision

Viewing changes to drivers/atmodem/network-registration.c

  • Committer: Alfonso Sanchez-Beato
  • Date: 2015-09-28 08:10:59 UTC
  • mfrom: (6830.1.168)
  • mto: This revision was merged to the branch mainline in revision 6904.
  • Revision ID: alfonso.sanchez-beato@canonical.com-20150928081059-1o08e2a9pkit6ar6
* Update to upstream release 1.17
* Do not assert when the radio is unavailable (LP: #1490991)
* Fix crash when importing phonebook (LP: #1486004)
* Check only destination port when receiving push (LP: #1490673)
* Fix crash when retrying to close context (LP: #1492483)

Show diffs side-by-side

added added

removed removed

Lines of Context:
838
838
        ofono_netreg_strength_notify(netreg, strength);
839
839
}
840
840
 
 
841
static void cinterion_ciev_notify(GAtResult *result, gpointer user_data)
 
842
{
 
843
        struct ofono_netreg *netreg = user_data;
 
844
        struct netreg_data *nd = ofono_netreg_get_data(netreg);
 
845
        const char *signal_identifier = "rssi";
 
846
        const char *ind_str;
 
847
        int strength;
 
848
        GAtResultIter iter;
 
849
 
 
850
        g_at_result_iter_init(&iter, result);
 
851
 
 
852
        if (!g_at_result_iter_next(&iter, "+CIEV:"))
 
853
                return;
 
854
 
 
855
        if (!g_at_result_iter_next_unquoted_string(&iter, &ind_str))
 
856
                return;
 
857
 
 
858
        if (!g_str_equal(signal_identifier, ind_str))
 
859
                return;
 
860
 
 
861
        if (!g_at_result_iter_next_number(&iter, &strength))
 
862
                return;
 
863
 
 
864
        DBG("rssi %d", strength);
 
865
 
 
866
        if (strength == nd->signal_invalid)
 
867
                strength = -1;
 
868
        else
 
869
                strength = (strength * 100) / (nd->signal_max - nd->signal_min);
 
870
 
 
871
        ofono_netreg_strength_notify(netreg, strength);
 
872
}
 
873
 
841
874
static void ctzv_notify(GAtResult *result, gpointer user_data)
842
875
{
843
876
        struct ofono_netreg *netreg = user_data;
1915
1948
                g_at_chat_send(nd->chat, "AT*TLTS=1", none_prefix,
1916
1949
                                                NULL, NULL, NULL);
1917
1950
                break;
 
1951
        case OFONO_VENDOR_CINTERION:
 
1952
                /*
 
1953
                 * We can't set rssi bounds from Cinterion responses
 
1954
                 * so set them up to specified values here
 
1955
                 *
 
1956
                 * Cinterion rssi signal strength specified as:
 
1957
                 * 0      <= -112dBm
 
1958
                 * 1 - 4  signal strengh in 15 dB steps
 
1959
                 * 5      >= -51 dBm
 
1960
                 * 99     not known or undetectable
 
1961
                 */
 
1962
                nd->signal_min = 0;
 
1963
                nd->signal_max = 5;
 
1964
                nd->signal_invalid = 99;
 
1965
 
 
1966
                /* Register for specific signal strength reports */
 
1967
                g_at_chat_send(nd->chat, "AT^SIND=\"rssi\",1", none_prefix,
 
1968
                                NULL, NULL, NULL);
 
1969
                g_at_chat_register(nd->chat, "+CIEV:",
 
1970
                                cinterion_ciev_notify, FALSE, netreg, NULL);
 
1971
                break;
1918
1972
        case OFONO_VENDOR_NOKIA:
1919
1973
        case OFONO_VENDOR_SAMSUNG:
1920
1974
                /* Signal strength reporting via CIND is not supported */