To use RouteSync with PC*MILER|Connect, it must be licensed and installed along with PC*MILER|Streets. Street-level routing must also be turned on. The following APIs can then be used with RouteSync:
- PCMSGetManagedRouteMsgBytes creates a RouteSync message (blob) to send a route from PC*MILER|Connect to a CoPilot client.
- PCMSCreateManagedRouteMsgBytes creates a RouteSync message (blob) to send a route from PC*MILER|Connect to a CoPilot client with one caveat: The trip handle given by the user is only needed to retrieve the desired routing options that will be applied on the CoPilot side.
- PCMSGetAFMsgBytes creates a RouteSync message (blob) to send avoid/favor data from a PC*MILER client to a CoPilot Truck client.
- PCMSGetRouteSyncMsg creates a data packet (blob) used to send a route from PC*MILER|Connect to a CoPilot client.
The recommended API to use for RouteSync functionality is PCMSGetManagedRouteMsgBytes. By default, PC*MILER|Connect is configured to run in highway-only mode for rating purposes, but RouteSync requires that you turn on street-level routing with PCMSSetRouteLevel.
The following sample code shows what you need for an integration:
PCMServerID server = PCMSOpenServer(NULL, NULL); // NOTE: OpenServer and CloseServer should be executed sparingly due to excess overhead. Trip = PCMSNewTrip(server); PCMSSetRouteLevel(trip, TRUE); // turn streets on PCMSAddStop(trip,"Philadelphia, PA"); PCMSAddStop(trip,"Hamilton, NJ"); PCMSAddStop(trip,"Manhattan,NY"); PCMSSetCalcType(trip, CALC_AVOIDTOLL); PCMSSetCalcType(trip, CALC_NATIONAL); PCMSCalculate(trip); long bufRetLength = 0; char * pBuffer = NULL;long OORCompliance = 0; double OORDist = .5; bool IsFirstLegManaged = true; bufRetLength= PCMSGetManagedRouteMsgBytes(trip,NULL,0,OORCompliance,OORDist, IsFirstLegManaged); pBuffer = new char[bufRetLength]; bufRetLength = PCMSGetManagedRouteMsgBytes(trip, pBuffer, bufRetLength, OORCompliance, OORDist, IsFirstLegManaged); // Send the pBuffer data blob via your communication method to the CoPilot device. delete  pBuffer; PCMSDeleteTrip(trip); PCMSCloseServer(server);