diff options
| author | erin_yueh <erin_yueh@99fdad57-331a-0410-800a-d7fa5415bdb3> | 2008-01-24 15:20:40 +0000 | 
|---|---|---|
| committer | erin_yueh <erin_yueh@99fdad57-331a-0410-800a-d7fa5415bdb3> | 2008-01-24 15:20:40 +0000 | 
| commit | 288049ff764151736483ba5f07987df67748b9cd (patch) | |
| tree | 31f2f881943d19db1f4b1677b0de05c3b48963d9 /src/util | |
| parent | b97df6c14964a74476e2327f426dd2b7d9f40ee0 (diff) | |
gsmd: query network registration status (Erin Yueh)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3943 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src/util')
| -rw-r--r-- | src/util/shell.c | 27 | 
1 files changed, 27 insertions, 0 deletions
diff --git a/src/util/shell.c b/src/util/shell.c index e9aae1c..0507be5 100644 --- a/src/util/shell.c +++ b/src/util/shell.c @@ -291,6 +291,7 @@ static int net_msghandler(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh)  		((void *) gmh + sizeof(*gmh));  	const struct gsmd_voicemail *vmail = (struct gsmd_voicemail *)  		((void *) gmh + sizeof(*gmh)); +	enum gsmd_netreg_state state = *(enum gsmd_netreg_state *) gmh->data;  	int result = *(int *) gmh->data;  	static const char *oper_stat[] = {  		[GSMD_OPER_UNKNOWN] = "of unknown status", @@ -361,6 +362,28 @@ static int net_msghandler(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh)  			printf ("voicemail number is %s \n",vmail->addr.number);  		pending_responses --;  		break; +	case GSMD_NETWORK_QUERY_REG: +		switch (state) { +			case GSMD_NETREG_UNREG: +				printf("not searching for network \n"); +				break; +			case GSMD_NETREG_REG_HOME: +				printf("registered (home network) \n"); +				break; +			case GSMD_NETREG_UNREG_BUSY: +				printf("searching for network \n"); +				break; +			case GSMD_NETREG_DENIED: +				printf("registration denied \n"); +				break; +			case GSMD_NETREG_REG_ROAMING: +				printf("registered (roaming) \n"); +				break; +			default: +				break; +		} +		pending_responses --; +		break;  	default:  		return -EINVAL;  	} @@ -648,6 +671,10 @@ int shell_main(struct lgsm_handle *lgsmh, int sync)  				printf("Signal strength\n");  				lgsm_signal_quality(lgsmh);  				pending_responses ++; +			} else if (!strcmp(buf, "nr")) { +				printf("Query network registration\n"); +				lgsm_netreg_query(lgsmh); +				pending_responses ++;  			} else if (!strcmp(buf, "q")) {  				exit(0);  			} else if (buf[0] == 'S' ) {  | 
