AbstractProtocol Class
用于 Communicator 层的通信接口 More...
Public Functions
AbstractProtocol(QObject *parent = 0) | |
virtual void | clearCmdCount() = 0 |
bool | enabled() const |
int | getCmdExecuteTime() const |
int | getCmdTimeout() const |
virtual CommandObject * | getFirstCmd() = 0 |
int | priority() const |
virtual const int | remainCmdCount() = 0 |
void | setCmdExecuteTime(int cmdExecuteTime) |
void | setCmdTimeout(int cmdTimeout) |
void | setEnabled(bool enabled) |
void | setPriority(int priority) |
virtual const int | totalCmdCount() = 0 |
Public Slots
virtual void | lastQueryFailed() = 0 |
virtual bool | processData(DataObject *dataObj) = 0 |
virtual void | stopRemainCmd() = 0 |
Signals
void | cmdAdded() |
void | skipCurrentQuery() |
Static Public Members
QByteArray | xorCODE(const QByteArray &ba) |
Detailed Description
\author
BriFuture
用于 Communicator 层的通信接口
Member Function Documentation
AbstractProtocol::AbstractProtocol(QObject *parent = 0)
Default constructs an instance of AbstractProtocol.
[pure virtual]
void AbstractProtocol::clearCmdCount()
[signal]
void AbstractProtocol::cmdAdded()
新增加了一条指令
bool AbstractProtocol::enabled() const
AbstractProtocol::enabled \return
是否使能当前协议
See also setEnabled().
int AbstractProtocol::getCmdExecuteTime() const
int AbstractProtocol::getCmdTimeout() const
[pure virtual]
CommandObject *AbstractProtocol::getFirstCmd()
[pure virtual slot]
void AbstractProtocol::lastQueryFailed()
计时器超时后调用该方法,表明查询失败
int AbstractProtocol::priority() const
AbstractProtocol::priority 优先级,数值越大,表明优先级越高
See also setPriority().
[pure virtual slot]
bool AbstractProtocol::processData(DataObject *dataObj)
[pure virtual]
const int AbstractProtocol::remainCmdCount()
void AbstractProtocol::setCmdExecuteTime(int cmdExecuteTime)
设置指令执行次数(0 表示当前协议将会一直等待指令回复,该值一般不使用, 若在网络不畅时可以使用,即等待超时时间将会被忽略)
-1 means waitting util the command is replied (so waitTime will be ignored but it still reports FAILED) 0 means that command won't be repeated
void AbstractProtocol::setCmdTimeout(int cmdTimeout)
void AbstractProtocol::setEnabled(bool enabled)
AbstractProtocol::setEnabled \param
enabled 使能当前协议
See also enabled().
void AbstractProtocol::setPriority(int priority)
See also priority().
[signal]
void AbstractProtocol::skipCurrentQuery()
通知通讯器跳过当前查询(查询成功)
[pure virtual slot]
void AbstractProtocol::stopRemainCmd()
停止查询操作,清除等待的命令
[pure virtual]
const int AbstractProtocol::totalCmdCount()
[static]
QByteArray AbstractProtocol::xorCODE(const QByteArray &ba)
求每个字符的异或值 ( #/$ 与*之间的数值的 XOR 值,不包含 #/$) 根据字符计算出异或校验码
This function overloads QByteArray.
@param ba
实际例子: #BUZZER?* 计算 # 和 * 之间的各个字符的校验码
See also XOR_CODE(const Command &).