AT指令的处理函数(相应NV项)

dsat_result_enum_type dsatvend_exec_mycmd_cmd ( dsat_mode_enum_type mode, /* AT command mode */ const dsati_cmd_type *cmd_table, /* Ptr to cmd in command table */ const tokens_struct_type *tok_ptr, /* Command tokens from parser */ dsm_item_type *res_buff_ptr /* Place to put response */ ) { dsat_result_enum_type result; nv_stat_enum_type nv_status; nv_item_type nv_item; char *rb_ptr = (char*)res_buff_ptr->data_ptr; /*-------------------------------------- Perform command parameter processing : ----------------------------------------*/ result = dsatparm_exec_param_cmd( mode, cmd_table, tok_ptr, res_buff_ptr ); nv_status = dsatutil_get_nv_item( NV_YYYY_I, &nv_item); if( nv_status != NV_DONE_S ) { MSG_MED("First read priority from nv",0,0,0); nv_status = dsatutil_put_nv_item(NV_YYYY_I,&nv_item); if (nv_status != NV_DONE_S) { MSG_MED("Success to write priority to nv first time!",0,0,0); } } /*--------------------------------------- Perform special processing : ----------------------------------------*/ if (DSAT_OK == result) { if(tok_ptr->op == (NA|EQ|AR)) { if(*tok_ptr->arg[0]=='3') { nv_item.YYYY.pkoid = 3; } else if(*tok_ptr->arg[0]=='7') { nv_item.YYYY.pkoid = 7; } else { nv_item.YYYY.pkoid = 9; } nv_status = dsatutil_put_nv_item(NV_YYYY_I,&nv_item); if (nv_status != NV_DONE_S) { MSG_MED("Success to write priority to nv first time!",0,0,0); } MSG_MED("Success to read priority from nv",0,0,0); } } sprintf(rb_ptr,"%s/n+mycmd's nv is:%d",rb_ptr,nv_item.YYYY.pkoid); // res_buff_ptr->data_ptr[res_buff_ptr->used++] = nv_item.YYYY.pkoid; res_buff_ptr->used=(word)strlen(rb_ptr); return result; } /* dsatvend_exec_mycmd_cmd */

你可能感兴趣的:(AT指令的处理函数(相应NV项))