C# SDK

◆ AddTMCEvent()

static int AddTMCEvent ( out SError  Error,
ref STmcEvent  TmcEvent,
Int32  MaxTime 
)
inlinestatic

Adds a custom TMC event. This event is independent on the events received online.

Parameters
ErrorAdditional error information returned from Drive.
TmcEventTMC event defined in the STmcEvent class.
MaxTimeMaximum time (in milliseconds) function can take. If MaxTime=0 function execution is not time limited.
Returns
1 if successful, other value otherwise.

Possible error codes returned from Drive are:

  • 0 - Function not succeeded.
  • 1 - Function succeeded.
  • 2 - Drive not succeeded.
  • 3 - Function reached timeout.



SStopOffPoint[] aSPs = new SStopOffPoint[2];
aSPs[0] = new SStopOffPoint();
aSPs[1] = new SStopOffPoint();
//Bratislava center
aSPs[0].Location = new LONGPOSITION(1710731, 4814837);
//Bratislava Karlova ves
aSPs[1].Location = new LONGPOSITION(1705836, 4815003);
//Start point
aSPs[0].nPointType = 3;
aSPs[0].SetCaption("one");
aSPs[1].SetCaption("two");
string anItineraryName = "trafficTest";
STmcEvent ev = new STmcEvent();
LONGPOSITION lp = new LONGPOSITION(1709121, 4814170);
ev.lX = lp.lX;
ev.lY = lp.lY;
ev.nEventCode = (int)STmcEvent.EventCode.TMCClosure;
CApplicationAPI.AddTMCEvent(out myGlobalSerror, ref ev, 0);
CApplicationAPI.AddItinerary(out myGlobalSerror, aSPs, anItineraryName, 0);
DriveHandler.Instance.SetRoute(anItineraryName, 0, false);

References SError.SizeOf(), and STmcEvent.SizeOf().