📄 at_chld.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_CHLD extends ATCommandBase {
private StringBuffer command = new StringBuffer();
private int commandType;
private String supportedNs = "";
/**
* 构造函数 提供"AT+CHLD?"的AT命令
*/
public AT_CHLD() {
this(false);
}
/**
* 构造函数 提供"AT+CHLD=?"的AT命令或"AT+CHLD?"的AT命令
*
* @param tested
* 当为true时提供"AT+CHLD=?"的AT命令,当为false时提供"AT+CHLD?"的AT命令。
*/
public AT_CHLD(boolean tested) {
commandType = tested ? COMMAND_TYPE_TEST : COMMAND_TYPE_READ;
command.append(tested ? "AT+CHLD=?" : "AT+CHLD?");
command.append(ATConstants.CR);
}
/**
* 构造函数 提供"AT+CHLD=int"的AT命令
*
* @param n
* call related services<br>
* 0 release all held calls or set User Determined User Busy
* (UDUB) for a waiting call.<br>
* 1 release all active calls (if any exist) and accepts the
* other (held or waiting) call.<br>
* 1X release a specific call X (active, held or waiting).<br>
* 2 place all active calls (if any exist) on hold and accepts
* the other (held or waiting) call.<br>
* 2X place all active calls on hold except call X with which
* communication is supported.<br>
* 3 add a held call to the conversation.<br>
* 4 connect the two calls and disconnect the subscriber from
* both calls (Explicit Call Transfer).
*/
public AT_CHLD(int n) {
command.append("AT+CHLD=");
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_TEST) {
// format:<CR><LF>+CHLD: (list of supported <n>s)<CR><LF><CR><LF>OK<CR><LF>
supportedNs = StringUtils.substring(str, "+CHLD:", ATConstants.CRLF).trim();
}
}
catch(Exception ex) {
}
}
/**
* 取得设备支持的call related services值
* @return 返回设备支持的call related services值
*/
public String getSupportedNs() {
return supportedNs;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -