Jump to content

addReceivePacketCallback


photo

Recommended Posts

image.thumb.png.2ae8840a5ccd1a7b48cd2b8b672c934f.png

I used addRecievePacketCallback instead because the setRecievePacketCallback disappeared after switching from version 13 to 14.

However, parameter errors appeared. 
Is it possible to use only the CigiHostPacket* argument to the marked part of the picture?

Link to comment
4 hours ago, dongju.jeong said:

Is it possible to use only the CigiHostPacket* argument to the marked part of the picture?

Yes, sure, this is the right way.
We specified type of callbacks for consistency and to avoid mistakes with incorrect casts. All callbacks now receive a pointer to the base class.

typedef Unigine::CallbackBase1<Unigine::Plugins::IG::CIGI::CigiHostPacket *> CigiRecvCallback;


callback should have void(CigiHostPacket *) interface
and inside method you need to cast CigiHostPacket to derived packet

void terrestrial_process(CigiHostPacket * packet)
{
    CigiTerrestrialControl * terrestial_packet = dynamic_cast<CigiTerrestrialControl *>(packet);
    //... do smth
}


 

  • Thanks 1
Link to comment
×
×
  • Create New...