Qualcomm AT command 添加方法 (AP側 Android )

參考出處: https://blog.csdn.net/a5103330/article/details/78467211

 

新版路徑:

./commonsys/telephony-apps/ATFwd/src/com/qualcomm/atfwd

./telephony-apps/ATFWD-daemon/atfwd_daemon.c

 

在Vendor下添加AT Command的注册。在*/vendor/qcom/proprietary/telephony-apps/ATFWD-daemon/atfwd_daemon.c下的qmi_atcop_at_cmd_fwd_req_type atCmdFwdReqType[]数组中添加定义:

 

{ //AT command fwd type

1, // Number of commands

{

{ QMI_ATCOP_AT_CMD_NOT_ABORTABLE,”+TEST”},

}

},

 

4.在\vendor\qcom\proprietary\commonsys/telephony-apps/ATFwd/src/com/qualcomm/atfwd下新增

AtTestCmdHandler.java文件,可以复制其他已有的Java文件,修改内容,如:

 

packagecom.qualcomm.atfwd;

importandroid.content.Context;

//importcom.qualcomm.qcrilhook.QcRilHook;

importandroid.util.Log;

publicclass AtTestCmdHandler extends AtCmdBaseHandler {

private static final String LOG_TAG =”AtTestCmdHandler”;

//QcRilHook qrh = null;

public AtTestCmdHandler(Context c)throws AtCmdHandlerInstantiationException{

super(c);

}

@Override

public String getCommandName(){

return “+TEST”;

}

@Override

public AtCmdResponse handleCommand(AtCmdcmd) {

String result = null;//需要最后显示的结果

String atTest= null;

boolean isAtCmdRespOK =false;

switch (cmd.getOpcode()) {

case AtCmd.ATCMD_OPCODE_NA_QU:

Log.i(LOG_TAG,”ATCOMMAND_TEST”);

result  = “+TEST:” + “at_command”;

isAtCmdRespOK =true;

break;

default:

Log.d(LOG_TAG,”atTest OpCode Error”);

result =cmd.getAtCmdErrStr(AtCmd.AT_ERR_OP_NOT_SUPP);

break;

}

return  isAtCmdRespOK ? newAtCmdResponse(AtCmdResponse.RESULT_OK, result) :

new AtCmdResponse(AtCmdResponse.RESULT_ERROR,result);

}

}

 

5.在\vendor\qcom\proprietary\telephony-apps\ATFwd\src\com\qualcomm\atfwd

\AtCmdFwdService.java中把新增的AtTestCmdHandler.java文件加到HashMap集合中:

 

publicAtCmdFwdService(Context c)

{

mContext = c;

mCmdHandlers = new HashMap<String,AtCmdHandler>();

 

AtCmdHandler cmd;

……

try {

cmd = newAtTestCmdHandler(c);

mCmdHandlers.put(cmd.getCommandName().toUpperCase(), cmd);

} catch (AtCmdHandlerInstantiationExceptione) {

Log.e(LOG_TAG, “Unable toinstantiate command”, e);

}

……

}
————————————————
版权声明:本文为CSDN博主「嘿v小米」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/a5103330/article/details/78467211

未經允許不得轉載:GoMCU » Qualcomm AT command 添加方法 (AP側 Android )

評論 搶沙發

  • 暱稱 (必填)
  • 郵箱 (必填)
  • 網址