vsTASKER 7 Tutorial
×
Menu
Index

IG to Host

 
The lower section of the CIGI Packet definition is reserved for receiving messages from IG to the host (vsTASKER simulation engine).
Because of the asynchronous communication between Host and IG, each response is tagged with the same id as the request.
 
The principle retained to treat asynchronous response to request, without blocking the single thread of the simulation engine, is to give to a logic the task to talk to the IG.
 
 
Sending the Line of Sight request message will be done on the same principle as here. Instead of the CigiViewDefV3, we will use the CigiLosVectReqV3_2 class.
In the LoSvectorReq Packet, the code will be the following:
 
void Pkt::request(WCoord from, float az, float el, int id)
{
   from.convertToLLA();
   if (az > 180) az -= 360; // [0..359] -> [-179..180]
 
   req.SetLosID(id);
   req.SetSrcCoordSys(CigiBaseLosVectReq::CoordSysGrp::Geodetic);
   req.SetVectAz(az);
   req.SetVectEl(el);
   req.SetSrcLat(from.lat);
   req.SetSrcLon(from.lon);
   req.SetSrcAlt(from.alt);
   tic();
}
 
In the Logic object, the code is:
 
cigi.LosVectReq->request(E:pos, E:dyn->getHeading(), E:dyn->getElevation(), 2);
 
In the Wait object, the code is:
 
if (!cigi.LosResp->getResponse(2, false)) // continue asking
 
In the Process object, the code is:
 
CigiLosRespV3_2* response = cigi.LosResp->getResponse(2, true)) // true = remove it from the list
// process response
...
delete response;