www.pudn.com > arm.rar > keyshell.c, change:2005-09-03,size:1777b


#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <pthread.h>
#include <time.h>
#include "../keyboard/get_key.h"

char shell_s[]="\nkeyshell> ";

/*int argc, char *argv[*/
#define CMD_TPYE			(0)
#define PHONE_NUMBER		(1)
#define MAX_CMD_DEPTH  	(2)

extern char PHONE[];
void * keyshell()
{

	char cmd[256]={0,};
	int i;
	
	kbd_init();		//键盘初始化	
	
	gprs_init();		//GPRS 初始化	
	
	printf("\n<gprs control shell>");
	printf("\n [1]  give a call");		
	printf("\n [2]  respond a call");		
	printf("\n [3]  hold a call");		
	printf("\n [4]  send a msg");
	printf("\n [**] help menu");
//	printf("\n[1]give a call	[2]send a msg	[**]exit shell");		
//	printf("\n[1]give a call	[2]send a msg	[**]exit shell");		
	while(1){

		printf(shell_s);
		fflush(stdout);

		get_line(cmd);
		printf("\r\n");				//显示必要的输出

		if(strncmp("1",cmd,1)==0){
			
			printf("\nyou select to gvie a call, please input number:");	
			fflush(stdout);
			get_number(cmd);
			gprs_call(cmd, strlen(cmd));
			printf("\ncalling......");		
		} else if(strncmp("2",cmd,1)==0){
			
			gprs_ans();
			printf("\nanswering.......");	
		} else if(strncmp("3",cmd,1)==0){

			gprs_hold();
			printf("\nhold a call");
		}else if (strncmp("4",cmd,1)==0){
		
			printf("\nyou select to send a message, please input number:");	
			fflush(stdout);
			get_number(cmd);
			gprs_msg(cmd, strlen(cmd));
			printf("\nsending......");	
		}else if (strncmp("**",cmd,2)==0){
			printf("\n<gprs control shell>");
			printf("\n [1]  give a call");
			printf("\n [2]  respond a call");		
			printf("\n [3]  hold a call");		
			printf("\n [4]  send a msg");
			printf("\n [**] help menu");
		}else if(cmd[0] != 0){
		
			system(cmd);
		}
	}		
}