void dial_num(uint8 *p, uint8 num) { uint8 i; init_dial(); enable_cs(); for(i = 0; i < num; i++) put_9200a(p[i]); put_9200a(0xFF); //stop code disable_cs(); }
/* $Function : call_the_phone == ============================================================================================== == Description : 拨打6组电话号码 == ============================================================================================== == Argument : == ============================================================================================== == Return : == : == =============================================================================================== == History : Modify by || ID || Date || Contents == : xul || || 2009/11/5 || Create this function == =============================================================================================== */ int call_the_phone(STWORK* pInfo) { int8 i,j; init_dial(); for (i = 0; i < MAX_TEL_NUM; i++) { j = 0; while (pInfo->phone_num[i][j] != '\0') { j++; } dial_num(pInfo->phone_num[i], j); //这里怎么检测对方电话是否接通???? } return 1;//需要修改 }
int16 main(void) { GRECT n = {0,0,0,0}; GRECT r1; EVNTDATA ev; int16 bclicks, bmask, bstate; boolean leave; quit = FALSE; debug_init("MControl", null, NULL); init_app("mcontrol.rsc"); init_rsrc(); init_conf(); init_dial(); init_comm(); init_beta(); /* Callback f�r modale Fensterdialoge, Fenster-Alerts usw. */ set_mdial_wincb(handle_msg); graf_mkstate( &ev ); wdial_hover( ev.x, ev.y, &r1, &leave ); while (!quit) { mbutton = 0; if( !((ev.bstate) & 3) ) bclicks = 258; else bclicks = 0; bmask = 3; bstate = 0; event = evnt_multi( MU_BUTTON|MU_M1|MU_MESAG|MU_KEYBD, bclicks, bmask, bstate, leave, &r1, 0, &n, msg, 0l, &ev, &kreturn, &mclick ); msx = ev.x; msy = ev.y; mbutton = ev.bstate; kstate = ev.kstate; if (event & MU_MESAG) { if( msg[0] == WM_MOVED ) wdial_hover( msx, msy, &r1, &leave ); handle_msg(msg); } if (event & MU_BUTTON) { if( mbutton == 2 ) menu_context( msx, msy ); else if (!click_wdial(mclick, msx, msy, kstate, mbutton)) ; } if (event & MU_M1) wdial_hover( msx, msy, &r1, &leave ); if (event & MU_KEYBD) { int16 title, item; if (is_menu_key(kreturn, kstate, &title, &item)) handle_menu(title, item); else { key_wdial(kreturn, kstate); key_sdial(kreturn, kstate); } } } exit_comm(); exit_dial(); exit_rsrc(); debug_exit(); exit_app(0); return 0; }
void main() { UBYTE key1, key2, i, j, pos_x, pos_y, ch_pos; UBYTE non_flick = OFF; UWORD on_time, off_time; char str[MAX_DTMF]; char str_ms[10]; /* default dialling time setting */ on_time = DTMF_ON; off_time = DTMF_OFF; disable_interrupts(); SPRITES_8x8; /* sprites are 8x8 */ init_dial(); init_bkg(); init_key(); init_cursor(); disp(TITLE); SHOW_BKG; SHOW_SPRITES; DISPLAY_ON; enable_interrupts(); i = j = 0; ch_pos = 0; while(1) { wait_vbl_done(); key1 = joypad(); if(key1 != key2){ pos_x = i * KEY_STEP + START_CURSOR_X; pos_y = j * KEY_STEP + START_CURSOR_Y; move_cursor(pos_x, pos_y); } if(key2 & J_A){ if(key1 & J_A){ /* value set for each sound reg only numeric key pad*/ if(i <= 3 && j <= 3){ /* frequncy register set up for DTMF */ NR13_REG = row[i]; NR23_REG = col[j]; NR24_REG = 0x87U; /* sound output on */ NR51_REG = 0x33U; } /* '?' button */ /* appear the title during press A button */ if(i == 5 && j == 0 && !non_flick){ disp(TITLE); non_flick = ON; } /* incremental button */ /* decremental button */ /* appear the delay during press A button */ if(i == 5 && (j == 1 || j == 2) && !non_flick){ sprintf(str_ms, "%lu MS", on_time); disp(str_ms); non_flick = ON; } } else{ /* sound output off */ NR51_REG = 0x00U; break_button(i, j); /* '?' button */ /* incremental button */ /* decremental button */ /* return to normal display at release the A button */ if(i == 5 && (j == 0 || j == 1 || j == 2)){ non_flick = OFF; if(ch_pos == 0) clr_disp(); else disp(str); } } } else{ if(key1 & J_A){ /* button display handle */ press_button(i, j); /* numeric key pad handling */ if(i <= 3 && j <= 3){ /* string length check */ if(ch_pos < MAX_DTMF-1){ str[ch_pos] = pad[j][i]; ch_pos++; str[ch_pos] = 0x00; disp(str); } } /* ',' button */ if(i == 4 && j == 2){ /* string length check */ if(ch_pos < MAX_DTMF-1){ str[ch_pos] = pad[j][i]; ch_pos++; str[ch_pos] = 0x00; disp(str); } } /* all clear button */ if(i == 4 && j == 0){ ch_pos = 0x00; strcpy(str,""); clr_disp(); } /* delete button */ if(i == 4 && j == 1){ if(ch_pos > 0){ ch_pos--; str[ch_pos] = 0x00; if(ch_pos == 0) clr_disp(); else disp(str); } } /* incremental button */ if(i == 5 && j == 1){ if(on_time >= DTMF_ON / 2){ on_time = on_time - 10; off_time = off_time - 10; } } /* decremental button */ if(i == 5 && j == 2){ if(on_time <= DTMF_ON * 2){ on_time = on_time + 10; off_time = off_time + 10; } } /* dialing button */ if((i==4 || i==5) && j==3){ dialtone(on_time, off_time, str); } } } if(!(key1 & J_A)){ if((key1 & J_UP) && !(key2 & J_UP) && j > 0) j--; else if((key1 & J_DOWN) && !(key2 & J_DOWN) && j < 3) j++; if((key1 & J_LEFT) && !(key2 & J_LEFT) && i > 0) i--; else if((key1 & J_RIGHT) && !(key2 & J_RIGHT) && i < 5) i++; } key2 = key1; } }