bool OpenIGTLinkProtocol::isValid(const igtl::MessageBase::Pointer &msg) const { if(this->isSupportedBodyType(msg->GetDeviceType())) return true; else return false; }
::fwData::Object::sptr DataConverter::fromIgtlMessage(const ::igtl::MessageBase::Pointer src) const { ::fwData::Object::sptr obj; const std::string deviceType = src->GetDeviceType(); if (deviceType == "ATOMS") { obj = m_defaultConverter->fromIgtlMessage(src); return obj; } for(const converter::IConverter::sptr& converter : m_converters) { if (converter->getIgtlType() == deviceType) { obj = converter->fromIgtlMessage(src); return obj; } } SLM_WARN("Message type not supported : " + std::string(src->GetDeviceType())); return obj; }
bool OpenIGTLinkProtocol::unpackBody(const igtl::MessageBase::Pointer &body) { int c = body->Unpack(this->doCRC()); if (c & igtl::MessageHeader::UNPACK_BODY) { this->translate(mHeader, body); } else { CX_LOG_CHANNEL_ERROR(CX_OPENIGTLINK_CHANNEL_NAME) << "Could not unpack the body of type: " << body->GetDeviceType(); return false; } return true; }