PCMSSetRoadSpeed
Syntax
int PCMSSetRoadSpeed(Trip trip, long speed, const char *state, long type, bool urban)
Parameters
Trip trip – Handle to a trip.
long speed – A speed value above 0 for the selected road type.
const char *state – The state/province/country abbreviation of the desired jurisdiction. Examples in North America are “NY” for New York or “QC” for Quebec. If PC*Miler Worldwide or DTOD data is installed, country abbreviations for areas outside of North America can be used.
long type – A new set of defined constants that begin with ROADTYPE. Below are the valid road types, identical to the road types in the PC*Miler user interface:
#define | Road Type | Value |
---|---|---|
ROADTYPE_INTERSTATE | Interstate | 1 |
ROADTYPE_MAJORHIGHWAY | Major Highway | 2 |
ROADTYPE_PRIMARY | Primary | 3 |
ROADTYPE_FERRY | Ferry | 4 |
ROADTYPE_SECONDARY | Secondary | 5 |
ROADTYPE_RAMP | Ramp | 6 |
ROADTYPE_LOCAL | Local | 7 |
bool urban – Indicates if the roads are urban or not.
Description
Sets the road speed for the given jurisdiction and road type.
Return Values
Returns non-negative on success.
Returns -1 and an INVALID ARGUMENT error code if any supplied parameters are out of range, or if an invalid state is passed in.
Sample Code
int _CALLCONV PCMSGetRoadSpeed(Trip trip, const char *state, long type, bool urban)
{
LOG_PROLOG4(PCMSSetRoadSpeed, trip, state, type, urban);
if (type < ROADTYPE_INTERSTATE || type > ROADTYPE_LOCAL)
{
SetError(PCMS_INVALIDINPUT);
LOG_RETURN1(-1);
}
GET_RT_ENGINE();
GET_ROUTE(trip);
GET_OPTIONS();
int roadSpeed = pRt->GetRoadSpeed(state, type, urban);
if (roadSpeed < 0)
{
SetError(PCMS_INVALIDINPUT);
LOG_RETURN1(-1);
}
LOG_RETURN1(roadSpeed);
}
Support Since: PC*Miler Connect 29
Category: Trip Management