📄 at_ccfc.java
字号:
package com.jzl.sirius.at.command;
import java.nio.CharBuffer;
import com.jzl.sirius.at.ATConstants;
import com.jzl.sirius.at.util.StringUtils;
/**
* @author xujian
* @version 2.0
* @see com.jzl.sirius.at.ATCommand
* @see com.jzl.sirius.at.command.ATCommandBase
*/
public class AT_CCFC extends ATCommandBase {
private StringBuffer command = new StringBuffer();
private int commandType;
private int mode = -1;
private String supportedReason;
/**
* 构造函数 提供"AT+CCFC=?"的AT命令
*/
public AT_CCFC() {
commandType = COMMAND_TYPE_TEST;
command.append("AT+CCFC=?");
command.append(ATConstants.CR);
}
/**
* 构造函数 提供"AT+CCFC=int,int"的AT命令
*
* @param intReason
* call forwarding reason
* @param intMode
* requested operation
*/
public AT_CCFC(int reason, int mode) {
this.mode = mode;
commandType = COMMAND_TYPE_ACTION;
command.append("AT+CCFC=");
command.append(reason);
command.append(",");
command.append(mode);
command.append(ATConstants.CR);
}
/**
* 构造函数 提供"AT+CCFC=int,int,str"的AT命令
*
* @param intReason
* call forwarding reason
* @param intMode
* requested operation
* @param strNumber
* phone number
*/
public AT_CCFC(int reason, int mode, String number) {
commandType = COMMAND_TYPE_ACTION;
command.append("AT+CCFC=");
command.append(reason);
command.append(",");
command.append(mode);
command.append(",\"");
command.append(number);
command.append("\"");
command.append(ATConstants.CR);
}
public String buildCommand() {
return command.toString();
}
protected void decodeOkResponse(CharBuffer response) {
if (commandType == COMMAND_TYPE_TEST) {
// format:<CR><LF>+CCFC: (list of supported <reason>s)<CR><LF><CR><LF>OK<CR><LF>
supportedReason = StringUtils.substring(response.toString(), "+CCFC:", ATConstants.CRLF).trim();
}
else if (mode == 2) {
}
}
/**
* 取得设备的supported reasons
*
* @return 返回设备的supported reasons
*/
public String getSupportedReason() {
return supportedReason;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -