Have a look at opaque handling in the mqueue transport, that should show you how to do it.
Sylvain On Tue, Sep 1, 2015 at 9:16 AM, Janosch Machowinski < [email protected]> wrote: > Hey, > we are using the typelib marshaler to implement a > second network transport. For Mashaling we use this code : > while (static_cast<RTT::base::InputPortInterface > *>(handle.port)->read(handle.sample, false) == RTT::NewData) > gotNewData = true; > > if (gotNewData) { > Communication::DataContainer data; > > handle.transport->refreshTypelibSample(handle.transportHandle); > handle.transport->marshal(data.buffer, > handle.transportHandle); > which works fine. > > In case that the port contains a RoPtr<base::samples::Frame> we get an > std::bad_alloc on > unmashaling using this code : > > handle.transport->unmarshal(data.buffer, handle.transportHandle); > > The Handle here looks like this : > class PortHandle > { > public: > std::string name; > orogen_transports::TypelibMarshallerBase *transport; > RTT::base::DataSourceBase::shared_ptr sample; > orogen_transports::TypelibMarshallerBase::Handle *transportHandle; > RTT::base::PortInterface *port; > }; > And is set up using this code : > RTT::types::TypeInfo const *type = port->getTypeInfo(); > curHandle.transport = > dynamic_cast<orogen_transports::TypelibMarshallerBase > *>(type->getProtocol(orogen_transports::TYPELIB_MARSHALLER_ID)); > if (! curHandle.transport) { > return false; > } > > curHandle.transportHandle = curHandle.transport->createSample(); > curHandle.sample = > curHandle.transport->getDataSource(curHandle.transportHandle); > > Any ideas what is wrong ? I suspect, that I need to initialize the > orocos sample somehow on the > receiving end, before unmarhsaling the data... > Greetings > Janosch > > -- > Dipl. Inf. Janosch Machowinski > SAR- & Sicherheitsrobotik > > Universität Bremen > FB 3 - Mathematik und Informatik > AG Robotik > Robert-Hooke-Straße 1 > 28359 Bremen, Germany > > Zentrale: +49 421 178 45-6611 > > Besuchsadresse der Nebengeschäftstelle: > Robert-Hooke-Straße 5 > 28359 Bremen, Germany > > Tel.: +49 421 178 45-6614 > Empfang: +49 421 178 45-6600 > Fax: +49 421 178 45-4150 > E-Mail: [email protected] > > Weitere Informationen: http://www.informatik.uni-bremen.de/robotik > > _______________________________________________ > Rock-dev mailing list > [email protected] > http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev >
_______________________________________________ Rock-dev mailing list [email protected] http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev
