Changeset 3512
- Timestamp:
- 11/26/07 16:21:39 (6 years ago)
- Location:
- trunk/src/target/OM-2007.2/applications/openmoko-dialer2
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
src/phone-kit/moko-dialer-mcc-dc.h (modified) (13 diffs)
-
src/phone-kit/moko-dialer.c (modified) (14 diffs)
-
src/phone-kit/moko-dialer.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
r3495 r3512 1 2007-11-26 Chris Lord <chris@openedhand.com> 2 3 * src/phone-kit/moko-dialer-mcc-dc.h: 4 Replace "+1-" with "+1" 5 6 * src/phone-kit/moko-dialer.c: (on_network_registered), 7 (start_handling_sms), (net_msghandler), (pb_msghandler), 8 (sms_store_opened_cb), (dialer_init_gsmd), 9 (moko_dialer_check_gsmd), (moko_dialer_send_sms): 10 Try to resolve local numbers (numbers beginning in '0'), make gsmd 11 requests in more reliable places, be a bit better with failures (all to 12 do with SMS code) 13 14 * src/phone-kit/moko-dialer.h: 15 Remove error code PK_DIALER_ERROR_NO_TOOLONG, add error code 16 PK_DIALER_ERROR_INVALID_NUMBER 17 1 18 2007-11-23 Chris Lord <chris@openedhand.com> 2 19 -
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-dialer-mcc-dc.h
r3495 r3512 14 14 { "276", "+355", "Albania" }, 15 15 { "603", "+213", "Algeria" }, 16 { "544", "+1 -684", "American Samoa (US)" },16 { "544", "+1684", "American Samoa (US)" }, 17 17 { "213", "+376", "Andorra" }, 18 18 { "631", "+244", "Angola" }, 19 { "365", "+1 -264", "Anguilla" },20 { "344", "+1 -268", "Antigua and Barbuda" },19 { "365", "+1264", "Anguilla" }, 20 { "344", "+1268", "Antigua and Barbuda" }, 21 21 { "722", "+54", "Argentine Republic" }, 22 22 { "283", "+374", "Armenia" }, … … 25 25 { "232", "+43", "Austria" }, 26 26 { "400", "+994", "Azerbaijani Republic" }, 27 { "364", "+1 -242", "Bahamas" },27 { "364", "+1242", "Bahamas" }, 28 28 { "426", "+973", "Bahrain" }, 29 29 { "470", "+880", "Bangladesh" }, 30 { "342", "+1 -246", "Barbados" },30 { "342", "+1246", "Barbados" }, 31 31 { "257", "+375", "Belarus" }, 32 32 { "206", "+32", "Belgium" }, 33 33 { "702", "+501", "Belize" }, 34 34 { "616", "+229", "Benin" }, 35 { "350", "+1 -441", "Bermuda (UK)" },35 { "350", "+1441", "Bermuda (UK)" }, 36 36 { "402", "+975", "Bhutan" }, 37 37 { "736", "+591", "Bolivia" }, … … 39 39 { "652", "+267", "Botswana" }, 40 40 { "724", "+55", "Brazil" }, 41 { "348", "+1 -284", "British Virgin Islands (UK)" },41 { "348", "+1284", "British Virgin Islands (UK)" }, 42 42 { "528", "+673", "Brunei Darussalam" }, 43 43 { "284", "+359", "Bulgaria" }, … … 48 48 { "302", "+1", "Canada" }, 49 49 { "625", "+238", "Cape Verde" }, 50 { "346", "+1 -345", "Cayman Islands (UK)" },50 { "346", "+1345", "Cayman Islands (UK)" }, 51 51 { "623", "+236", "Central African Republic" }, 52 52 { "622", "+235", "Chad" }, … … 66 66 { "238", "+45", "Denmark" }, 67 67 { "638", "+253", "Djibouti" }, 68 { "366", "+1 -767", "Dominica" },69 { "370", "+1 -809", "Dominican Republic" },68 { "366", "+1767", "Dominica" }, 69 { "370", "+1809", "Dominican Republic" }, 70 70 { "514", "+670", "East Timor" }, 71 71 { "740", "+593", "Ecuador" }, … … 90 90 { "202", "+30", "Greece" }, 91 91 { "290", "+299", "Greenland (Denmark)" }, 92 { "352", "+1 -473", "Grenada" },92 { "352", "+1473", "Grenada" }, 93 93 { "340", "+590", "Guadeloupe (France)" }, 94 { "535", "+1 -671", "Guam (US)" },94 { "535", "+1671", "Guam (US)" }, 95 95 { "704", "+502", "Guatemala" }, 96 96 { "611", "+224", "Guinea" }, … … 110 110 { "425", "+972", "Israel" }, 111 111 { "222", "+39", "Italy" }, 112 { "338", "+1 -876", "Jamaica" },112 { "338", "+1876", "Jamaica" }, 113 113 { "441", "+81", "Japan" }, 114 114 { "440", "+81", "Japan" }, … … 147 147 { "212", "+377", "Monaco" }, 148 148 { "428", "+976", "Mongolia" }, 149 { "354", "+1 -664", "Montserrat (UK)" },149 { "354", "+1664", "Montserrat (UK)" }, 150 150 { "604", "+212", "Morocco" }, 151 151 { "643", "+258", "Mozambique" }, … … 161 161 { "614", "+227", "Niger" }, 162 162 { "621", "+234", "Nigeria" }, 163 { "534", "+1 -670", "Northern Mariana Islands (US)" },163 { "534", "+1670", "Northern Mariana Islands (US)" }, 164 164 { "242", "+47", "Norway" }, 165 165 { "422", "+968", "Oman" }, … … 173 173 { "260", "+48", "Poland" }, 174 174 { "351", "+351", "Portugal" }, 175 { "330", "+1 -787", "Puerto Rico (US)" },175 { "330", "+1787", "Puerto Rico (US)" }, 176 176 { "427", "+974", "Qatar" }, 177 177 { "647", "+262", "Réunion (France)" }, … … 179 179 { "250", "+7", "Russian Federation" }, 180 180 { "635", "+250", "Rwandese Republic" }, 181 { "356", "+1 -869", "Saint Kitts and Nevis" },182 { "358", "+1 -758", "Saint Lucia" },181 { "356", "+1869", "Saint Kitts and Nevis" }, 182 { "358", "+1758", "Saint Lucia" }, 183 183 { "308", "+508", "Saint Pierre and Miquelon (France)" }, 184 { "360", "+1 -784", "Saint Vincent and the Grenadines" },184 { "360", "+1784", "Saint Vincent and the Grenadines" }, 185 185 { "549", "+685", "Samoa" }, 186 186 { "292", "+378", "San Marino" }, … … 211 211 { "615", "+228", "Togolese Republic" }, 212 212 { "539", "+676", "Tonga" }, 213 { "374", "+1 -868", "Trinidad and Tobago" },213 { "374", "+1868", "Trinidad and Tobago" }, 214 214 { "605", "+216", "Tunisia" }, 215 215 { "286", "+90", "Turkey" }, 216 216 { "438", "+993", "Turkmenistan" }, 217 { "376", "+1 -649", "Turks and Caicos Islands (UK)" },217 { "376", "+1649", "Turks and Caicos Islands (UK)" }, 218 218 { "641", "+256", "Uganda" }, 219 219 { "255", "+380", "Ukraine" }, … … 230 230 { "315", "+1", "United States of America" }, 231 231 { "316", "+1", "United States of America" }, 232 { "332", "+1 -340", "United States Virgin Islands (US)" },232 { "332", "+1340", "United States Virgin Islands (US)" }, 233 233 { "748", "+598", "Uruguay" }, 234 234 { "434", "+998", "Uzbekistan" }, -
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-dialer.c
r3495 r3512 76 76 struct lgsm_handle *handle; 77 77 MokoDialerSource *source; 78 gboolean handling_sms; 78 79 79 80 /* Storage objects */ 80 81 JanaStore *sms_store; 81 82 gboolean sms_store_open; 82 JanaNote *last_msg;83 JanaNote *last_msg; 83 84 MokoJournal *journal; 84 85 MokoContacts *contacts; … … 110 111 111 112 static void dialer_init_gsmd (MokoDialer *dialer); 113 114 static const gchar *moko_dialer_cc_from_mcc (gchar *mcc); 112 115 113 116 /* DBus functions */ … … 427 430 case GSMD_NETREG_REG_ROAMING: 428 431 g_debug ("Network registered: LocationAreaCode: %x. CellID: %x.", lac, cell); 429 priv->gsm_location.lac = lac;430 priv->gsm_location.cid = cell;431 432 432 if ((priv->registered != GSMD_NETREG_REG_HOME) &&433 (priv->registered != GSMD_NETREG_REG_ROAMING)) {433 /* Retrieve details when we switch location/type */ 434 if ((priv->registered != type) || (priv->gsm_location.lac != lac)) { 434 435 /* Retrieve operator name */ 435 436 lgsm_oper_get (priv->handle); … … 441 442 lgsm_get_imsi (priv->handle); 442 443 } 444 445 priv->gsm_location.lac = lac; 446 priv->gsm_location.cid = cell; 443 447 444 448 break; … … 956 960 } 957 961 962 static void 963 start_handling_sms (MokoDialer *dialer) 964 { 965 MokoDialerPrivate *priv = dialer->priv; 966 967 /* Register SMS handling callback */ 968 lgsm_register_handler (priv->handle, GSMD_MSG_SMS, &sms_msghandler); 969 970 /* List all messages to move to journal */ 971 lgsm_sms_list (priv->handle, GSMD_SMS_ALL); 972 973 priv->handling_sms = TRUE; 974 } 975 958 976 static int 959 977 net_msghandler (struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh) … … 971 989 case GSMD_NETWORK_GET_NUMBER : 972 990 g_free (priv->own_number); 973 priv->own_number = g_strdup (num->addr.number); 991 992 if ((num->addr.number) && (num->addr.number[0] == '0') && (priv->imsi)) 993 priv->own_number = g_strconcat (moko_dialer_cc_from_mcc (priv->imsi), 994 num->addr.number + 1, NULL); 995 else 996 priv->own_number = g_strdup (num->addr.number); 997 998 if ((priv->sms_store_open) && (!priv->handling_sms)) { 999 start_handling_sms (dialer); 1000 } 1001 974 1002 break; 975 1003 case GSMD_NETWORK_OPER_GET : … … 1004 1032 case GSMD_PHONEBOOK_GET_IMSI : 1005 1033 priv->imsi = g_strdup ((char *)gmh + sizeof (*gmh)); 1034 1035 /* Get phone number */ 1036 lgsm_get_subscriber_num (priv->handle); 1006 1037 break; 1007 1038 default : … … 1055 1086 g_debug ("SMS store opened"); 1056 1087 1057 if (!priv->handle) return; 1058 1059 /* Register SMS handling callback */ 1060 lgsm_register_handler (priv->handle, GSMD_MSG_SMS, &sms_msghandler); 1061 1062 /* List all messages to move to journal */ 1063 lgsm_sms_list (priv->handle, GSMD_SMS_ALL); 1088 if (priv->handle && priv->own_number) { 1089 start_handling_sms (self); 1090 } 1064 1091 } 1065 1092 … … 1104 1131 priv->registered = GSMD_NETREG_UNREG; 1105 1132 lgsm_netreg_register (priv->handle, ""); 1106 1133 1107 1134 /* Get phone number */ 1108 1135 lgsm_get_subscriber_num (priv->handle); 1109 1136 1110 1137 /* Start polling for events */ 1111 1138 priv->source = (MokoDialerSource *) … … 1195 1222 MokoDialerPrivate *priv = self->priv; 1196 1223 1224 if (!priv->handle) dialer_init_gsmd (self); 1225 1197 1226 if (!priv->handle) { 1198 1227 *error = g_error_new (PHONE_KIT_DIALER_ERROR, PK_DIALER_ERROR_GSMD, … … 1241 1270 gboolean ascii; 1242 1271 JanaNote *note; 1272 const gchar *dialcode; 1243 1273 1244 1274 g_assert (self && number && message); … … 1259 1289 /* Set destination number */ 1260 1290 if (strlen (number) > GSMD_ADDR_MAXLEN + 1) { 1261 *error = g_error_new (PHONE_KIT_DIALER_ERROR, PK_DIALER_ERROR_NO_TOOLONG, 1262 "Number too long"); 1291 *error = g_error_new (PHONE_KIT_DIALER_ERROR, 1292 PK_DIALER_ERROR_INVALID_NUMBER, 1293 "Invalid number"); 1263 1294 return FALSE; 1264 1295 } else { … … 1287 1318 } else { 1288 1319 sms.alpha = ALPHABET_8BIT; 1289 sms.length = strlen (message);1290 1320 strcpy ((gchar *)sms.data, message); 1291 1321 } 1322 sms.length = msg_length; 1292 1323 1293 1324 /* Send message */ … … 1296 1327 /* Store sent message in journal */ 1297 1328 note = jana_ecal_note_new (); 1298 jana_note_set_recipient (note, number); 1329 if ((number[0] == '0') && (priv->network_number) && 1330 (dialcode = moko_dialer_cc_from_mcc (priv->network_number))) { 1331 gchar *full_number = g_strconcat (dialcode, number + 1, NULL); 1332 jana_note_set_recipient (note, full_number); 1333 g_free (full_number); 1334 } else 1335 jana_note_set_recipient (note, number); 1299 1336 jana_note_set_author (note, priv->own_number); 1300 1337 -
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-dialer.h
r3495 r3512 52 52 PK_DIALER_ERROR_SMS_STORE, 53 53 PK_DIALER_ERROR_SMS_TOOLONG, 54 PK_DIALER_ERROR_NO_TOOLONG,55 54 PK_DIALER_ERROR_NO_PROVIDER, 56 55 PK_DIALER_ERROR_NO_PROVIDER_NUM, 57 56 PK_DIALER_ERROR_NO_IMSI, 58 57 PK_DIALER_ERROR_NO_NUMBER, 58 PK_DIALER_ERROR_INVALID_NUMBER, 59 59 } PhoneKitDialerError; 60 60
Note: See TracChangeset
for help on using the changeset viewer.
