?? dp_dial-jamie.c
字號:
intdp_dial (void){ char digit; static int i = -1; if (i != dp_dial_state) PRINTF ("dp_dial_state %d\n", (i = dp_dial_state)); switch (dp_dial_state) { case DIAL_INIT: // 0, 2b341 dp_busy_cycles = 0; dp_answer_state = 0; dp_max_pause = 0; START_TIMER (dp_continuous_busy_timer); if (dp_stored_number (dp_dial_string) == 0) { x_dial_residual = 0; return 3; } dp_dial_ptr = dp_dial_string; if (H_dial_modifier_validation == 1) { if (dp_test_dialstring (dp_dial_string) == 0) dp_dial_string [0] = 0; dp_dial_ptr = dp_dial_string; while ((*dp_dial_ptr == 'T' || *dp_dial_ptr == 'P' || *dp_dial_ptr == ',') && *(dp_dial_ptr+1) == ',') { *(dp_dial_ptr+1) = *dp_dial_ptr; dp_dial_ptr++; } if (*dp_dial_ptr == ',') dp_dial_ptr++; } if (*dp_dial_ptr == 'T') S (0x2f) = 1; if (*dp_dial_ptr == 'P' && H_not_pulse_dial_flag == 0) S (0x2f) = 0; if (dp_dialing_status == 0 && (x_modem_mode == 0 || x_modem_mode == 1)) { if (S (0x7a) == 0 && H_blacklist_or_delay_flag && dp_check_list (dp_dial_string)) return 3; if (country_code != COUNTRY_NORTH_AMERICA && !dp_first_call && (ELAPSED_TIME (dp_timer1) < (country_code == COUNTRY_FRANCE) ? 6000 : 5000)) return 0; } START_TIMER (dp_dial_timer); if (cell_originate () == 1) dp_dial_state = DIAL_DIGIT; else if (dp_dialing_status == 0) { if (dp_offhook_cmd () == 0) { x_dial_residual = 2; return 3; } dp_dialing_status = 2; START_TIMER (dp_ocp_timer); dp_dial_state = DIAL_1; } else if (dp_dialing_status == 1) { dp_offhook_cmd (); dp_dialing_status = 2; dp_dial_state = DIAL_DIGIT; } else { if (S (0x6a) == 2) dp_offhook_cmd (); if (x_modem_mode != 2) { if (S_speaker_enable != 0) x_output (8); x_output (14); x_output (19); } dp_dial_state = DIAL_DIGIT; } START_TIMER (dp_dial_timer); if (S_speaker_enable == 3) x_output (7); break; case DIAL_1: // 2b51f if (ELAPSED_TIME (dp_dial_timer) >= 55) { if (*dp_dial_ptr != 0 && *dp_dial_ptr != ';') { dp_detect_tones_cmd (); dp_dial_state = DIAL_WAITING_FOR_DIALTONE; START_TIMER (dp_dial_timer); PRINTF ("Entering DIAL_WAITING_FOR_DIALTONE\n"); } else { if (*dp_dial_ptr == ';') dp_dialing_status = 0; dp_dial_state = DIAL_DIGIT; } } dp_detect_over_current (0); break; case DIAL_WAITING_FOR_DIALTONE: // 2b577 if (S (0x2d) == 0 && H_blind_dial_flag != 0) { if (ELAPSED_TIME (dp_dial_timer) > 1000 * S_wait_before_dialing) { if (H_blind_dial_flag == 2 && (x_modem_mode == 0 || x_modem_mode == 1)) x_output (8); START_TIMER (dp_timer); dp_dial_state = DIAL_DIGIT; } } else if (ELAPSED_TIME (dp_dial_timer) > 10 * H_dial_tone_detection_delay && dp_dial_tone_detected () == 1) dp_dial_state = DIAL_DIGIT; else if (S (0x2e) != 0 && H_detect_busy_tone_during_dial_tone != 0 && dp_busy_tone_detected () == 1) { x_dial_residual = 3; if (H_blacklist_or_delay_flag != 0 && x_modem_mode != 3) dp_update_blacklist (dp_dial_string, 1); return 3; } else if (ELAPSED_TIME (dp_dial_timer) >= (country_code == COUNTRY_AUSTRIA ? 6000 : 10000)) { x_dial_residual = 2; if (H_blacklist_or_delay_flag != 0 && x_modem_mode != 3) dp_update_blacklist (dp_dial_string, 1); return 3; } dp_detect_over_current (0); break; case DIAL_WAITING_FOR_W_DIALTONE: // 2b6aa if (H_no_dialtone_timeout_with_W_modifier >= S_connect_completion_timeout && dp_busy_tone_detected () == 1) { x_dial_residual = 3; return 3; } else if (dp_dial_tone_detected () == 1) { if (S (0x2f) == 0) x_output (15); dp_dial_state = DIAL_DIGIT; } else if (ELAPSED_TIME (dp_dial_timer) >= 1000 * H_no_dialtone_timeout_with_W_modifier) { x_dial_residual = 2; return 3; } break; case DIAL_HOOK_FLASH: // 2b713 if (ELAPSED_TIME (dp_dial_timer) > 10 * H_hook_flash_time) { x_output (2); dp_dial_state = DIAL_HOOK_FLASH_RECOVERY; x_output (15); START_TIMER (dp_dial_timer); } break; case DIAL_HOOK_FLASH_RECOVERY: // 2b757 if (ELAPSED_TIME (dp_dial_timer) > 20 && ELAPSED_TIME (dp_dial_timer) < 50) x_output (16); if (ELAPSED_TIME (dp_dial_timer) > 10 * H_hook_flash_time) dp_dial_state = DIAL_DIGIT; break; case DIAL_CHECKING_QUIET_ANSWER: // 2b7aa if (dp_busy_tone_detected () == 1) { x_dial_residual = 3; return 3; } if (dp_dial_tone_detected () != 1 && dp_answer_tone_detected () != 1) { if (dp_quiet_answer_detected () == 1) { dp_dial_state = DIAL_DIGIT; break; } if (ELAPSED_TIME (dp_long_timer) < 10 * S_connect_completion_timeout) break; } x_dial_residual = 5; return 3; case DIAL_WAITING_FOR_BONG: // 2b800 if (dp_busy_tone_detected () == 1) { x_dial_residual = 3; return 3; } else if (dp_bong_tone_detected () == 1) { dp_dial_pause = 1000; dp_dial_state = DIAL_PAUSE; } else if (ELAPSED_TIME (dp_dial_timer) >= 50000) { x_dial_residual = 2; return 3; } break; case DIAL_DIGIT: // 2b857 if (dp_redial == 1) { dp_redial = 0;#if 0 FAE = 0; // BYTE FAC = S_command_termination_char; FAD = S_response_format_char; x_strcat (&FAC, "Dialing..."); x_strcat (&FAC, dp_dial_ptr); x_send_mail (0x21, 3, &FAC, x_strlen (&FAC));#endif PRINTF ("%cDialing...%s%c", S_response_format_char, dp_dial_ptr, S_command_termination_char); } START_TIMER (dp_dial_timer); switch (*dp_dial_ptr) { case 0: // 2b8dc if (cell_active == 1) cell_send (); if (x_dsp_mars && ((S (0x7e) & 7) == 1 || (S (0x7e) & 7) == 2) && S_speaker_enable != 0) x_output (S_speaker_volume == 3 ? 11 : S_speaker_volume == 2 ? 10 : 9); return 2; case '!': // 2b930 if (H_hook_flash_time != 0 && (S (0x2f) != 0 || country_code == COUNTRY_NORTH_AMERICA)) { x_output (3); dp_dial_state = DIAL_HOOK_FLASH; } break; case '$': // 2b983 dp_bong_tone1_on_time = 0; dp_detect_tones_cmd (); dp_dial_state = DIAL_WAITING_FOR_BONG; break; case ',': // 2b9b5 if (H_comma_pause_duration_limit == 255) dp_dial_pause = 1000 * S_comma_dial_time; else if (dp_max_pause < 1000 * H_comma_pause_duration_limit) { dp_max_pause += 1000 * S_comma_dial_time; dp_dial_pause = 1000 * S_comma_dial_time; } else dp_dial_pause = 0; dp_dial_state = DIAL_PAUSE; break; case ';': // 2ba27 if (S (0x2f) == 0) x_output (16); if (dp_dialing_status != 3 && x_modem_mode != 3) { x_modem_state = 4; x_send_mail (0x16, 2, 0, 0); return 1; } break; case '@': // 2ba69 dp_detect_tones_cmd (); dp_dial_state = DIAL_CHECKING_QUIET_ANSWER; START_TIMER (dp_long_timer); break; case 'A': case 'B': case 'C': case 'D': // 2baa8 if (H_disallow_ABCD_dialing) { dp_dial_ptr++; return 0; } /* Fall through */ case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '*': case '0': case '#': // 2bac7 if (S (0x40) != 0 && cell_state_online () == 0) { START_TIMER (dp_dial_timer); while (*dp_dial_ptr != 0) { if (dp_dial_modify_check (*dp_dial_ptr)) { if (*dp_dial_ptr++ != ';' || dp_dialing_status == 3 || x_modem_mode == 3) return 0; return 1; } // I assumed cell_dial does not use dp_dial_ptr. // Otherwise logic in next 3 lines is wrong. if (*dp_dial_ptr != '-') cell_dial (*dp_dial_ptr); dp_dial_ptr++; } return dp_dial (); } if (S (0x2f) == 0) { int pulses = *dp_dial_ptr; if (pulses < '0' || pulses > '9') break; pulses = pulses - '0'; if (H_pulse_dial_digit_pattern == 2) pulses++; else if (H_pulse_dial_digit_pattern == 3) pulses = 10 - pulses; else pulses = pulses ? pulses : 10; START_TIMER (dp_dial_timer); dp_pulse_dial_cmd (pulses); } else { int tone = *dp_dial_ptr; if (x_dsp_mars && (S (0x7e) == 1 || S (0x7e) == 2)) dp_write_dsp_ram (0x0d, 0x0090); if (tone >= '0' && tone <= '9') tone = tone - '0'; else if (tone == '*') tone = 10; else if (tone == '#') tone = 11; else /* tone >= 'A' && tone < 'F' */ tone = tone - 'A' + 12; dp_DTMF_dial_cmd (tone); } dp_dial_state = DIAL_DIGIT_RECOVERY; break; case 'P': // 2bc0e if (!H_not_pulse_dial_flag && (dp_dial_string [0] == 'P' || !H_disallow_mixed_tone_and_pulse_dial)) { S (0x2f) = 0; if (dp_dial_ptr [1] != 0) { x_output (15); if (country_code == COUNTRY_NETHERLANDS || country_code == COUNTRY_AUSTRIA) { dp_dial_pause = 250; dp_dial_state = DIAL_PAUSE; } } } break; case 'T': // 2bce9 if (dp_dial_string [0] == 'T' || ! H_disallow_mixed_tone_and_pulse_dial) S (0x2f) = 1; break; case 'V': // 2bcc9 if (x_dsp_mars && ((S (0x7e) & 7) == 1 || (S (0x7e) & 7) == 2)) break; dp_dialing_status = 3; break; case 'W': // 2bca4 if (x_modem_mode != 3) { dp_detect_tones_cmd (); if (S (0x2f) == 0) x_output (16); } dp_dial_state = DIAL_WAITING_FOR_DIALTONE; break; case '^': // 2bc8e if (H_calling_tone_flag == 1) dp_calling_tone_disable = 1; break; case 'S': // 2bd04 if (dp_dial_ptr [1] == '=') load_number (dp_dial_ptr [2] - '0', dp_dial_ptr + 1); dp_redial = 1; break; } if (*dp_dial_ptr != 0) dp_dial_ptr++; break; case DIAL_PAUSE: // 2bd3c if (ELAPSED_TIME (dp_dial_timer) >= dp_dial_pause || ELAPSED_TIME (dp_timer) > 0xfff5) // Unsigned. Peculiar value. { dp_dial_state = DIAL_DIGIT; if (S (0x2f) == 0 && (*dp_dial_ptr == 0 || *dp_dial_ptr == 'T')) x_output (16); } break; case DIAL_DIGIT_RECOVERY: // 2bd9d if (!(dp_read_dsp_ram (0x3a) & 0x10)) { dp_dial_state = DIAL_DIGIT; if (S (0x2f) == 0 && (*dp_dial_ptr == 0 || *dp_dial_ptr == 'T')) { dp_dial_pause = (country_code == COUNTRY_FRANCE ? 900 : country_code == COUNTRY_AUSTRIA ? 300 : 750); START_TIMER (dp_dial_timer); dp_dial_state = DIAL_PAUSE; } } break; } return 0;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -