当前位置: 首页>>代码示例>>C++>>正文


C++ PDU::getSequenceNo方法代码示例

本文整理汇总了C++中PDU::getSequenceNo方法的典型用法代码示例。如果您正苦于以下问题:C++ PDU::getSequenceNo方法的具体用法?C++ PDU::getSequenceNo怎么用?C++ PDU::getSequenceNo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PDU的用法示例。


在下文中一共展示了PDU::getSequenceNo方法的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;
}
开发者ID:h3net,项目名称:cpp-smpp,代码行数:28,代码来源:smppclient.cpp

示例2: 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;
}
开发者ID:h3net,项目名称:cpp-smpp,代码行数:26,代码来源:smppclient.cpp

示例3: 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();
}
开发者ID:h3net,项目名称:cpp-smpp,代码行数:34,代码来源:smppclient.cpp

示例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);
	}
}
开发者ID:h3net,项目名称:cpp-smpp,代码行数:20,代码来源:smppclient.cpp


注:本文中的PDU::getSequenceNo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。