📄 at_clip.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_CLIP extends ATCommandBase {
private int commandType;
private StringBuffer command = new StringBuffer();
private int m = -1;
private int n = -1;
private String supportedNs = "";
public AT_CLIP() {
this(false);
}
public AT_CLIP(boolean tested) {
commandType = tested ? COMMAND_TYPE_TEST : COMMAND_TYPE_READ;
command.append(tested? "AT+CLIP=?" : "AT+CLIP?");
command.append(ATConstants.CR);
}
public AT_CLIP(int n) {
commandType = COMMAND_TYPE_ACTION;
command.append("AT+CLIP=");
command.append(n);
command.append(ATConstants.CR);
}
public String buildCommand() {
return command.toString();
}
protected void decodeOkResponse(CharBuffer response) {
String str = response.toString();
try {
if (commandType == COMMAND_TYPE_READ) {
// format:<CR><LF>+CLIP: <n>,<m><CR><LF><CR><LF>OK<CR><LF>
str = StringUtils.substring(str, "+CLIP:", ATConstants.CRLF).trim();
String[] arry = str.split(",");
n = Integer.parseInt(arry[0].trim());
m = Integer.parseInt(arry[1].trim());
}
else if (commandType == COMMAND_TYPE_TEST) {
supportedNs = StringUtils.substring(str, "+CLIP:", ATConstants.CRLF).trim();
}
}
catch(Exception ex) {
}
}
public int getN() {
return n;
}
public int getM() {
return m;
}
public String getSupportedNs() {
return supportedNs;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -