本文整理汇总了C++中NetworkNode::getSession方法的典型用法代码示例。如果您正苦于以下问题:C++ NetworkNode::getSession方法的具体用法?C++ NetworkNode::getSession怎么用?C++ NetworkNode::getSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetworkNode
的用法示例。
在下文中一共展示了NetworkNode::getSession方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendMessage
/**
* Send message on the correct interface
*/
void NodeNetworkSystem::sendMessage(Message* msg) {
if (!msg) {
if (_DEBUG)
cerr << "NodeNetworkSystem::sendMessage: Empty message" << endl;
return;
}
NetworkNode* dst = msg->getDst();
if (!dst) {
if (_DEBUG)
cerr << "NodeNetworkSystem::sendMessage: Empty destination" << endl;
delete msg;
return;
}
if (msg->getType() == MESSAGETYPE_DATA_ATC
|| msg->getType() == MESSAGETYPE_DATA_CTA) {
boost::mutex::scoped_lock lock(_countMutex);
_queuedMessages++;
_gpios[5]->setValue(BlackLib::high); //Set transmission pin
lock.unlock();
}
switch (msg->getLinkType()) {
case LINKTYPE_TCP: {
Session* ses = dst->getSession();
if (!ses) {
if (_DEBUG)
cerr << "NodeNetworkSystem::sendMessage: Empty session" << endl;
delete msg;
return;
}
ses->writeMessage(msg);
break;
}
case LINKTYPE_TELOS: {
_telosbRadioSystem->writeMessage(msg);
break;
}
default: {
if (_DEBUG)
cout << "NodeNetworkSystem::sendMessage: Not yet implemented"
<< endl;
delete msg;
break;
}
}
}