本文整理汇总了C++中PDU::getCommandId方法的典型用法代码示例。如果您正苦于以下问题:C++ PDU::getCommandId方法的具体用法?C++ PDU::getCommandId怎么用?C++ PDU::getCommandId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PDU
的用法示例。
在下文中一共展示了PDU::getCommandId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readPduResponse
// blocks until response is read
PDU SmppClient::readPduResponse(const uint32_t &sequence, const uint32_t &commandId)
{
uint32_t response = GENERIC_NACK | commandId;
list<PDU>::iterator it = pdu_queue.begin();
while (it != pdu_queue.end()) {
PDU pdu = (*it);
if (pdu.getSequenceNo() == sequence && pdu.getCommandId() == response) {
it = pdu_queue.erase(it);
return pdu;
}
it++;
}
while (true) {
PDU pdu = readPdu(true);
if (!pdu.null) {
if ((pdu.getSequenceNo() == sequence
&& (pdu.getCommandId() == response || pdu.getCommandId() == GENERIC_NACK))
|| (pdu.getSequenceNo() == 0 && pdu.getCommandId() == GENERIC_NACK)) return pdu;
}
}
PDU pdu;
return pdu;
}
示例2: readSms
SMS SmppClient::readSms()
{
// see if we're bound correct.
checkState(BOUND_RX);
// if there are any messages in the queue pop the first usable one off and return it
if (!pdu_queue.empty()) return parseSms();
// fill queue until we get a DELIVER_SM command
try {
bool b = false;
while (!b) {
PDU pdu = readPdu(true);
if (pdu.getCommandId() == ENQUIRE_LINK) {
PDU resp = PDU(ENQUIRE_LINK_RESP, 0, pdu.getSequenceNo());
sendPdu(resp);
continue;
}
if (pdu.null) {
break;
}
if (!pdu.null) pdu_queue.push_back(pdu); // save pdu for reading later
b = pdu.getCommandId() == DELIVER_SM;
}
} catch (std::exception &e) {
throw smpp::TransportException(e.what());
}
return parseSms();
}
示例3: sendCommand
PDU SmppClient::sendCommand(PDU &pdu)
{
sendPdu(pdu);
PDU resp = readPduResponse(pdu.getSequenceNo(), pdu.getCommandId());
switch (resp.getCommandStatus()) {
case smpp::ESME_RINVPASWD:
throw smpp::InvalidPasswordException(smpp::getEsmeStatus(resp.getCommandStatus()));
break;
case smpp::ESME_RINVSYSID:
throw smpp::InvalidSystemIdException(smpp::getEsmeStatus(resp.getCommandStatus()));
break;
case smpp::ESME_RINVSRCADR:
throw smpp::InvalidSourceAddressException(smpp::getEsmeStatus(resp.getCommandStatus()));
break;
case smpp::ESME_RINVDSTADR:
throw smpp::InvalidDestinationAddressException(smpp::getEsmeStatus(resp.getCommandStatus()));
break;
}
if (resp.getCommandStatus() != smpp::ESME_ROK) throw smpp::SmppException(
smpp::getEsmeStatus(resp.getCommandStatus()));
return resp;
}
示例4: PDU
void smpp::SmppClient::enquireLinkRespond()
{
list<PDU>::iterator it = pdu_queue.begin();
while (it != pdu_queue.end()) {
PDU pdu = (*it);
if (pdu.getCommandId() == ENQUIRE_LINK) {
PDU resp = PDU(ENQUIRE_LINK_RESP, 0, pdu.getSequenceNo());
sendCommand(resp);
}
it++;
}
PDU pdu = readPdu(false);
if (!pdu.null && pdu.getCommandId() == ENQUIRE_LINK) {
PDU resp = PDU(ENQUIRE_LINK_RESP, 0, pdu.getSequenceNo());
sendPdu(resp);
}
}