Lines Matching defs:modem
37 # define D_ACTIVE VERBOSE_CHECK(modem)
84 static const char* _amodem_switch_technology(AModem modem, AModemTech newtech, int32_t newpreferred);
85 static int _amodem_set_cdma_subscription_source( AModem modem, ACdmaSubscriptionSource ss);
86 static int _amodem_set_cdma_prl_version( AModem modem, int prlVersion);
199 AModem modem;
280 * Hold non-volatile ram configuration for modem
305 amodem_unsol( AModem modem, const char* format, ... )
307 if (modem->unsol_func) {
310 vsnprintf( modem->out_buff, sizeof(modem->out_buff), format, args );
313 modem->unsol_func( modem->unsol_opaque, modem->out_buff );
318 amodem_receive_sms( AModem modem, SmsPDU sms )
322 if (modem->unsol_func) {
326 strcpy( modem->out_buff, SMS_UNSOL_HEADER );
327 p = modem->out_buff + (sizeof(SMS_UNSOL_HEADER)-1);
328 max = sizeof(modem->out_buff) - 3 - (sizeof(SMS_UNSOL_HEADER)-1);
338 modem->unsol_func( modem->unsol_opaque, modem->out_buff );
343 amodem_printf( AModem modem, const char* format, ... )
347 vsnprintf( modem->out_buff, sizeof(modem->out_buff), format, args );
350 return modem->out_buff;
354 amodem_begin_line( AModem modem )
356 modem->out_size = 0;
360 amodem_add_line( AModem modem, const char* format, ... )
364 modem->out_size += vsnprintf( modem->out_buff + modem->out_size,
365 sizeof(modem->out_buff) - modem->out_size,
371 amodem_end_line( AModem modem )
373 modem->out_buff[ modem->out_size ] = 0;
374 return modem->out_buff;
393 amodem_load_nvram( AModem modem )
396 D("Using config file: %s\n", modem->nvram_config_filename);
397 if (aconfig_load_file(root, modem->nvram_config_filename)) {
400 aconfig_save_file(root, modem->nvram_config_filename);
406 amodem_nvram_get_int( AModem modem, const char *nvname, int defval)
412 value = aconfig_int(modem->nvram_config, nvname, defval);
419 aconfig_set(modem->nvram_config, nvname, newvalue);
425 amodem_nvram_get_str( AModem modem, const char *nvname, const char *defval)
429 value = aconfig_str(modem->nvram_config, nvname, defval);
437 aconfig_set(modem->nvram_config, nvname, value);
442 static ACdmaSubscriptionSource _amodem_get_cdma_subscription_source( AModem modem )
445 iss = amodem_nvram_get_int( modem, NV_CDMA_SUBSCRIPTION_SOURCE, A_SUBSCRIPTION_RUIM );
453 static ACdmaRoamingPref _amodem_get_cdma_roaming_preference( AModem modem )
456 rp = amodem_nvram_get_int( modem, NV_CDMA_ROAMING_PREF, A_ROAMING_PREF_ANY );
465 amodem_reset( AModem modem )
469 modem->nvram_config = amodem_load_nvram(modem);
470 modem->radio_state = A_RADIO_STATE_OFF;
471 modem->wait_sms = 0;
473 modem->rssi= 7; // Two signal strength bars
474 modem->ber = 99; // Means 'unknown'
476 modem->oper_name_index = amodem_nvram_get_int(modem, NV_OPER_NAME_INDEX, 2);
477 modem->oper_selection_mode = amodem_nvram_get_int(modem, NV_SELECTION_MODE, A_SELECTION_AUTOMATIC);
478 modem->oper_index = amodem_nvram_get_int(modem, NV_OPER_INDEX, 0);
479 modem->oper_count = amodem_nvram_get_int(modem, NV_OPER_COUNT, 2);
480 modem->in_emergency_mode = amodem_nvram_get_int(modem, NV_IN_ECBM, 0);
481 modem->prl_version = amodem_nvram_get_int(modem, NV_PRL_VERSION, 0);
483 modem->emergency_numbers[0] = "911";
487 modem->emergency_numbers[i] = amodem_nvram_get_str(modem,key_name, NULL);
490 modem->area_code = -1;
491 modem->cell_id = -1;
493 strcpy( modem->operators[0].name[0], OPERATOR_HOME_NAME );
494 strcpy( modem->operators[0].name[1], OPERATOR_HOME_NAME );
495 strcpy( modem->operators[0].name[2], OPERATOR_HOME_MCCMNC );
497 modem->operators[0].status = A_STATUS_AVAILABLE;
499 strcpy( modem->operators[1].name[0], OPERATOR_ROAMING_NAME );
500 strcpy( modem->operators[1].name[1], OPERATOR_ROAMING_NAME );
501 strcpy( modem->operators[1].name[2], OPERATOR_ROAMING_MCCMNC );
503 modem->operators[1].status = A_STATUS_AVAILABLE;
505 modem->voice_mode = A_REGISTRATION_UNSOL_ENABLED_FULL;
506 modem->voice_state = A_REGISTRATION_HOME;
507 modem->data_mode = A_REGISTRATION_UNSOL_ENABLED_FULL;
508 modem->data_state = A_REGISTRATION_HOME;
509 modem->data_network = A_DATA_NETWORK_UMTS;
511 tmp = amodem_nvram_get_str( modem, NV_MODEM_TECHNOLOGY, "gsm" );
512 modem->technology = android_parse_modem_tech( tmp );
513 if (modem->technology == A_TECH_UNKNOWN) {
514 modem->technology = aconfig_int( modem->nvram_config, NV_MODEM_TECHNOLOGY, A_TECH_GSM );
517 modem->preferred_mask = amodem_nvram_get_int( modem, NV_PREFERRED_MODE, 0x0f );
519 modem->subscription_source = _amodem_get_cdma_subscription_source( modem );
520 modem->roaming_pref = _amodem_get_cdma_roaming_preference( modem );
523 static AVoiceCall amodem_alloc_call( AModem modem );
524 static void amodem_free_call( AModem modem, AVoiceCall call );
530 AModem modem = opaque;
534 qemu_put_byte(f, modem->call_count);
537 for (nn = modem->call_count - 1; nn >= 0; nn--) {
538 AVoiceCall vcall = modem->calls + nn;
554 AModem modem = opaque;
558 for (nn = modem->call_count - 1; nn >= 0; nn--) {
559 amodem_free_call( modem, modem->calls + nn);
564 modem );
581 AModem modem = _android_modem;
586 modem->base_port = base_port;
587 start = bufprint_config_file( start, end, "modem-nv-ram-" );
588 start = bufprint( start, end, "%d", modem->base_port );
589 modem->nvram_config_filename = strdup( nvfname );
591 amodem_reset( modem );
592 modem->supportsNetworkDataType = 1;
593 modem->unsol_func = unsol_func;
594 modem->unsol_opaque = unsol_opaque;
596 modem->sim = asimcard_create(base_port);
605 modem);
607 aconfig_save_file( modem->nvram_config, modem->nvram_config_filename );
608 return modem;
612 amodem_set_legacy( AModem modem )
614 modem->supportsNetworkDataType = 0;
618 amodem_destroy( AModem modem )
620 asimcard_destroy( modem->sim );
621 modem->sim = NULL;
626 amodem_has_network( AModem modem )
628 return !(modem->radio_state == A_RADIO_STATE_OFF ||
629 modem->oper_index < 0 ||
630 modem->oper_index >= modem->oper_count ||
631 modem->oper_selection_mode == A_SELECTION_DEREGISTRATION );
636 amodem_get_radio_state( AModem modem )
638 return modem->radio_state;
642 amodem_set_radio_state( AModem modem, ARadioState state )
644 modem->radio_state = state;
648 amodem_get_sim( AModem modem )
650 return modem->sim;
654 amodem_get_voice_registration( AModem modem )
656 return modem->voice_state;
660 amodem_set_voice_registration( AModem modem, ARegistrationState state )
662 modem->voice_state = state;
665 modem->oper_index = OPERATOR_HOME_INDEX;
667 modem->oper_index = OPERATOR_ROAMING_INDEX;
669 switch (modem->voice_mode) {
671 amodem_unsol( modem, "+CREG: %d,%d\r",
672 modem->voice_mode, modem->voice_state );
676 amodem_unsol( modem, "+CREG: %d,%d, \"%04x\", \"%04x\"\r",
677 modem->voice_mode, modem->voice_state,
678 modem->area_code & 0xffff, modem->cell_id & 0xffff);
686 amodem_get_data_registration( AModem modem )
688 return modem->data_state;
692 amodem_set_data_registration( AModem modem, ARegistrationState state )
694 modem->data_state = state;
696 switch (modem->data_mode) {
698 amodem_unsol( modem, "+CGREG: %d,%d\r",
699 modem->data_mode, modem->data_state );
703 if (modem->supportsNetworkDataType)
704 amodem_unsol( modem, "+CGREG: %d,%d,\"%04x\",\"%04x\",\"%04x\"\r",
705 modem->data_mode, modem->data_state,
706 modem->area_code & 0xffff, modem->cell_id & 0xffff,
707 modem->data_network );
709 amodem_unsol( modem, "+CGREG: %d,%d,\"%04x\",\"%04x\"\r",
710 modem->data_mode, modem->data_state,
711 modem->area_code & 0xffff, modem->cell_id & 0xffff );
720 amodem_nvram_set( AModem modem, const char *name, const char *value )
722 aconfig_set(modem->nvram_config, name, value);
746 amodem_set_data_network_type( AModem modem, ADataNetworkType type )
749 modem->data_network = type;
750 amodem_set_data_registration( modem, modem->data_state );
752 if (modem->unsol_func && modemTech != A_TECH_UNKNOWN) {
753 if (_amodem_switch_technology( modem, modemTech, modem->preferred_mask )) {
754 modem->unsol_func( modem->unsol_opaque, modem->out_buff );
760 amodem_get_operator_name ( AModem modem, ANameIndex index, char* buffer, int buffer_size )
765 if ( (unsigned)modem->oper_index >= (unsigned)modem->oper_count ||
769 oper = modem->operators + modem->oper_index;
784 amodem_set_operator_name( AModem modem, ANameIndex index, const char* buffer, int buffer_size )
789 if ( (unsigned)modem->oper_index >= (unsigned)modem->oper_count ||
793 oper = modem->operators + modem->oper_index;
807 amodem_get_call_count( AModem modem )
809 return modem->call_count;
813 amodem_get_call( AModem modem, int index )
815 if ((unsigned)index >= (unsigned)modem->call_count)
818 return &modem->calls[index].call;
822 amodem_alloc_call( AModem modem )
825 int count = modem->call_count;
831 for (id = 0; id < modem->call_count; id++) {
835 if ( modem->calls[nn].call.id == (id+1) ) {
843 call = modem->calls + count;
845 call->modem = modem;
847 modem->call_count += 1;
854 amodem_free_call( AModem modem, AVoiceCall call )
864 remote_call_cancel( call->call.number, modem->base_port );
868 for (nn = 0; nn < modem->call_count; nn++) {
869 if ( modem->calls + nn == call )
872 assert( nn < modem->call_count );
874 memmove( modem->calls + nn,
875 modem->calls + nn + 1,
876 (modem->call_count - 1 - nn)*sizeof(*call) );
878 modem->call_count -= 1;
883 amodem_find_call( AModem modem, int id )
887 for (nn = 0; nn < modem->call_count; nn++) {
888 AVoiceCall call = modem->calls + nn;
896 amodem_send_calls_update( AModem modem )
900 amodem_unsol( modem, "RING\r" );
905 amodem_add_inbound_call( AModem modem, const char* number )
907 AVoiceCall vcall = amodem_alloc_call( modem );
928 amodem_send_calls_update( modem );
933 amodem_find_call_by_number( AModem modem, const char* number )
935 AVoiceCall vcall = modem->calls;
936 AVoiceCall vend = vcall + modem->call_count;
949 amodem_set_signal_strength( AModem modem, int rssi, int ber )
951 modem->rssi = rssi;
952 modem->ber = ber;
963 int port = call->modem->base_port;
983 amodem_update_call( AModem modem, const char* fromNumber, ACallState state )
985 AVoiceCall vcall = (AVoiceCall) amodem_find_call_by_number(modem, fromNumber);
991 amodem_send_calls_update(modem);
997 amodem_disconnect_call( AModem modem, const char* number )
999 AVoiceCall vcall = (AVoiceCall) amodem_find_call_by_number(modem, number);
1004 amodem_free_call( modem, vcall );
1005 amodem_send_calls_update(modem);
1013 unknownCommand( const char* cmd, AModem modem )
1015 modem=modem;
1042 chooseTechFromMask( AModem modem, int32_t preferred )
1063 _amodem_switch_technology( AModem modem, AModemTech newtech, int32_t newpreferred )
1066 modem->technology, newtech, modem->preferred_mask,newpreferred);
1068 assert( modem );
1073 if (modem->preferred_mask != newpreferred) {
1075 modem->preferred_mask = newpreferred;
1077 amodem_nvram_set(modem, NV_PREFERRED_MODE, value);
1078 if (!matchPreferredMask(modem->preferred_mask, newtech)) {
1079 newtech = chooseTechFromMask(modem, newpreferred);
1083 if (modem->technology != newtech) {
1084 modem->technology = newtech;
1085 ret = amodem_printf(modem, "+CTEC: %d", modem->technology);
1109 amodem_set_cdma_prl_version( AModem modem, int prlVersion)
1112 if (!_amodem_set_cdma_prl_version( modem, prlVersion)) {
1113 amodem_unsol(modem, "+WPRL: %d", prlVersion);
1118 _amodem_set_cdma_prl_version( AModem modem, int prlVersion)
1121 if (modem->prl_version != prlVersion) {
1122 modem->prl_version = prlVersion;
1129 amodem_set_cdma_subscription_source( AModem modem, ACdmaSubscriptionSource ss)
1132 if (!_amodem_set_cdma_subscription_source( modem, ss)) {
1133 amodem_unsol(modem, "+CCSS: %d", (int)ss);
1139 _amodem_set_cdma_subscription_source( AModem modem, ACdmaSubscriptionSource ss)
1144 if (ss != modem->subscription_source) {
1146 amodem_nvram_set( modem, NV_CDMA_SUBSCRIPTION_SOURCE, value );
1147 modem->subscription_source = ss;
1154 handleSubscriptionSource( const char* cmd, AModem modem )
1163 return amodem_printf( modem, "+CCSS: %d", modem->subscription_source );
1169 _amodem_set_cdma_subscription_source( modem, newsource );
1170 return amodem_printf( modem, "+CCSS: %d", modem->subscription_source );
1174 return amodem_printf( modem, "ERROR: Invalid subscription source");
1178 handleRoamPref( const char * cmd, AModem modem )
1186 return amodem_printf( modem, "+WRMP: %d", modem->roaming_pref );
1190 return amodem_printf( modem, "+WRMP: 0,1,2" );
1197 modem->roaming_pref = roaming_pref;
1198 aconfig_set( modem->nvram_config, NV_CDMA_ROAMING_PREF, cmd );
1199 aconfig_save_file( modem->nvram_config, modem->nvram_config_filename );
1203 return amodem_printf( modem, "ERROR");
1206 handleTech( const char* cmd, AModem modem )
1208 AModemTech newtech = modem->technology;
1209 int pt = modem->preferred_mask;
1215 return amodem_printf( modem, "+CTEC: %d,%x",modem->technology, modem->preferred_mask );
1217 amodem_begin_line( modem );
1219 return amodem_printf( modem, "+CTEC: 0,1,2,3" );
1237 return amodem_printf( modem, "ERROR: invalid preferred mode" );
1238 return _amodem_switch_technology( modem, newtech, pt );
1240 return amodem_printf( modem, "ERROR: %s: Unknown Technology", cmd + 1 );
1244 handleEmergencyMode( const char* cmd, AModem modem )
1251 return amodem_printf( modem, "+WSOS: %d", modem->in_emergency_mode);
1256 return amodem_printf(modem, "+WSOS: (0)");
1259 return amodem_printf(modem, "ERROR");
1264 return amodem_printf(modem, "ERROR");
1269 if ((!arg) != (!modem->in_emergency_mode)) {
1270 modem->in_emergency_mode = arg;
1271 return amodem_printf(modem, "+WSOS: %d", arg);
1274 return amodem_printf(modem, "ERROR");
1278 handlePrlVersion( const char* cmd, AModem modem )
1283 return amodem_printf( modem, "+WPRL: %d", modem->prl_version);
1286 return amodem_printf(modem, "ERROR");
1290 handleRadioPower( const char* cmd, AModem modem )
1295 modem->radio_state = A_RADIO_STATE_OFF;
1300 modem->radio_state = A_RADIO_STATE_ON;
1306 handleRadioPowerReq( const char* cmd, AModem modem )
1308 if (modem->radio_state != A_RADIO_STATE_OFF)
1315 handleSIMStatusReq( const char* cmd, AModem modem )
1319 switch (asimcard_get_status(modem->sim)) {
1334 handleSRegister( const char * cmd, AModem modem )
1345 handleNetworkRegistration( const char* cmd, AModem modem )
1350 if (modem->voice_mode == A_REGISTRATION_UNSOL_ENABLED_FULL)
1351 return amodem_printf( modem, "+CREG: %d,%d, \"%04x\", \"%04x\"",
1352 modem->voice_mode, modem->voice_state,
1353 modem->area_code, modem->cell_id );
1355 return amodem_printf( modem, "+CREG: %d,%d",
1356 modem->voice_mode, modem->voice_state );
1360 modem->voice_mode = A_REGISTRATION_UNSOL_DISABLED;
1364 modem->voice_mode = A_REGISTRATION_UNSOL_ENABLED;
1368 modem->voice_mode = A_REGISTRATION_UNSOL_ENABLED_FULL;
1383 if (modem->supportsNetworkDataType)
1384 return amodem_printf( modem, "+CGREG: %d,%d,\"%04x\",\"%04x\",\"%04x\"",
1385 modem->data_mode, modem->data_state,
1386 modem->area_code, modem->cell_id,
1387 modem->data_network );
1389 return amodem_printf( modem, "+CGREG: %d,%d,\"%04x\",\"%04x\"",
1390 modem->data_mode, modem->data_state,
1391 modem->area_code, modem->cell_id );
1395 modem->data_mode = A_REGISTRATION_UNSOL_DISABLED;
1399 modem->data_mode = A_REGISTRATION_UNSOL_ENABLED;
1403 modem->data_mode = A_REGISTRATION_UNSOL_ENABLED_FULL;
1420 handleSetDialTone( const char* cmd, AModem modem )
1427 handleDeleteSMSonSIM( const char* cmd, AModem modem )
1434 handleSIM_IO( const char* cmd, AModem modem )
1436 return asimcard_io( modem->sim, cmd );
1441 handleOperatorSelection( const char* cmd, AModem modem )
1446 AOperator oper = &modem->operators[ modem->oper_index ];
1448 if ( !amodem_has_network( modem ) )
1451 return amodem_printf( modem, "+CME ERROR: 30" );
1454 oper = &modem->operators[ modem->oper_index ];
1456 if ( modem->oper_name_index == 2 )
1457 return amodem_printf( modem, "+COPS: %d,2,%s",
1458 modem->oper_selection_mode,
1461 return amodem_printf( modem, "+COPS: %d,%d,\"%s\"",
1462 modem->oper_selection_mode,
1463 modem->oper_name_index,
1464 oper->name[ modem->oper_name_index ] );
1469 amodem_begin_line( modem );
1470 for (nn = 0; nn < modem->oper_count; nn++) {
1471 AOperator oper = &modem->operators[nn];
1472 amodem_add_line( modem, "%s(%d,\"%s\",\"%s\",\"%s\")", comma,
1476 return amodem_end_line( modem );
1481 modem->oper_selection_mode = A_SELECTION_AUTOMATIC;
1504 for (nn = 0; nn < modem->oper_count; nn++) {
1505 AOperator oper = modem->operators + nn;
1517 } else if (modem->operators[found].status == A_STATUS_DENIED) {
1521 modem->oper_index = found;
1527 modem->voice_state = A_REGISTRATION_HOME;
1528 modem->data_state = A_REGISTRATION_HOME;
1530 modem->voice_state = A_REGISTRATION_ROAMING;
1531 modem->data_state = A_REGISTRATION_ROAMING;
1537 modem->oper_selection_mode = A_SELECTION_DEREGISTRATION;
1551 modem->oper_name_index = format;
1559 return unknownCommand(cmd,modem);
1563 handleRequestOperator( const char* cmd, AModem modem )
1568 if ( !amodem_has_network(modem) )
1571 oper = modem->operators + modem->oper_index;
1572 modem->oper_name_index = 2;
1573 return amodem_printf( modem, "+COPS: 0,0,\"%s\"\r"
1580 handleSendSMStoSIM( const char* cmd, AModem modem )
1587 handleSendSMS( const char* cmd, AModem modem )
1589 modem->wait_sms = 1;
1653 handleSendSMSText( const char* cmd, AModem modem )
1707 if (modem->sms_receiver == NULL) {
1708 modem->sms_receiver = sms_receiver_create();
1709 if (modem->sms_receiver == NULL) {
1715 index = sms_receiver_add_submit_pdu( modem->sms_receiver, pdu );
1729 modem->base_port );
1732 deliver = sms_receiver_create_deliver( modem->sms_receiver, index, from );
1740 if ( remote_call_sms( number, modem->base_port, deliver[nn] ) < 0 ) {
1785 if ( remote_call_sms( number, modem->base_port, pdu ) < 0 )
1805 handleChangeOrEnterPIN( const char* cmd, AModem modem )
1810 switch (asimcard_get_status(modem->sim)) {
1824 if ( !asimcard_check_pin( modem->sim, pin ) )
1828 asimcard_set_pin( modem->sim, pin );
1835 if ( asimcard_check_pin( modem->sim, cmd ) )
1845 if ( asimcard_check_puk( modem->sim, puk, cmd+5 ) )
1861 handleListCurrentCalls( const char* cmd, AModem modem )
1864 amodem_begin_line( modem );
1865 for (nn = 0; nn < modem->call_count; nn++) {
1866 AVoiceCall vcall = modem->calls + nn;
1869 amodem_add_line( modem, "+CLCC: %d,%d,%d,%d,%d,\"%s\",%d\r\n",
1873 return amodem_end_line( modem );
1889 amodem_addTimeUpdate( AModem modem )
1939 amodem_add_line( modem, "%%CTZV: %02d/%02d/%02d:%02d:%02d:%02d%c%d:%d:%s\r\n",
1948 handleEndOfInit( const char* cmd, AModem modem )
1950 amodem_begin_line( modem );
1951 amodem_addTimeUpdate( modem );
1952 return amodem_end_line( modem );
1957 handleListPDPContexts( const char* cmd, AModem modem )
1961 amodem_begin_line( modem );
1963 ADataContext data = modem->data_contexts + nn;
1966 amodem_add_line( modem, "+CGACT: %d,%d\r\n", data->id, data->active );
1968 return amodem_end_line( modem );
1972 handleDefinePDPContext( const char* cmd, AModem modem )
2013 data = modem->data_contexts + id;
2026 handleQueryPDPContext( const char* cmd, AModem modem )
2029 amodem_begin_line(modem);
2031 ADataContext data = modem->data_contexts + nn;
2034 amodem_add_line( modem, "+CGDCONT: %d,\"%s\",\"%s\",\"%s\",0,0\r\n",
2043 return amodem_end_line(modem);
2047 handleStartPDPContext( const char* cmd, AModem modem )
2058 AModem modem = vcall->modem;
2065 amodem_free_call(modem, vcall);
2066 amodem_send_calls_update(modem);
2083 vcall->modem->base_port,
2090 amodem_free_call( vcall->modem, vcall );
2107 amodem_send_calls_update(vcall->modem);
2110 static int amodem_is_emergency( AModem modem, const char *number )
2116 if ( modem->emergency_numbers[i] && !strcmp( number, modem->emergency_numbers[i] )) break;
2125 handleDial( const char* cmd, AModem modem )
2127 AVoiceCall vcall = amodem_alloc_call( modem );
2165 amodem_begin_line( modem );
2166 if (amodem_is_emergency(modem, call->number)) {
2167 modem->in_emergency_mode = 1;
2168 amodem_add_line( modem, "+WSOS: 1" );
2176 return amodem_end_line( modem );
2181 handleAnswer( const char* cmd, AModem modem )
2184 for (nn = 0; nn < modem->call_count; nn++) {
2185 AVoiceCall vcall = modem->calls + nn;
2198 amodem_free_call( modem, vcall );
2210 handleSignalStrength( const char* cmd, AModem modem )
2212 amodem_begin_line( modem );
2219 amodem_addTimeUpdate( modem );
2225 // TODO: return 99 if modem->radio_state==A_RADIO_STATE_OFF, once radio_state is in snapshot.
2226 int rssi = modem->rssi;
2227 int ber = modem->ber;
2230 amodem_add_line( modem, "+CSQ: %i,%i,85,130,90,6,4,25,9,50,68,12\r\n", rssi, ber );
2231 return amodem_end_line( modem );
2235 handleHangup( const char* cmd, AModem modem )
2242 for (nn = 0; nn < modem->call_count; nn++) {
2243 AVoiceCall vcall = modem->calls + nn;
2250 amodem_free_call(modem, vcall);
2258 for (nn = 0; nn < modem->call_count; nn++) {
2259 AVoiceCall vcall = modem->calls + nn;
2264 amodem_free_call(modem, vcall);
2274 AVoiceCall vcall = amodem_find_call( modem, id );
2276 amodem_free_call( modem, vcall );
2282 for (nn = 0; nn < modem->call_count; nn++) {
2283 AVoiceCall vcall = modem->calls + nn;
2297 for (nn = 0; nn < modem->call_count; nn++) {
2298 AVoiceCall vcall = modem->calls + nn;
2310 for (nn = 0; nn < modem->call_count; nn++) {
2311 AVoiceCall vcall = modem->calls + nn;
2323 for (nn = 0; nn < modem->call_count; nn++) {
2324 AVoiceCall vcall = modem->calls + nn;
2344 typedef const char* (*ResponseHandler)(const char* cmd, AModem modem);
2480 const char* amodem_send( AModem modem, const char* cmd )
2484 if ( modem->wait_sms != 0 ) {
2485 modem->wait_sms = 0;
2487 answer = handleSendSMSText( cmd, modem );
2536 REPLY( amodem_printf( modem, "%s\rOK", answer ) );
2543 answer = handler( cmd, modem );
2554 if (answer != modem->out_buff)
2555 REPLY( amodem_printf( modem, "%s\rOK", answer ) );
2557 strcat( modem->out_buff, "\rOK" );