50 const std::string
id = inputStorage.
readString();
53 if (!libsumo::Edge::handleVariable(
id, variable, &server, &inputStorage)) {
67 "Get Edge Variable: unsupported variable " +
toHex(variable, 2)
68 +
" specified", outputStorage);
89 "Change Edge State: unsupported variable " +
toHex(variable, 2)
90 +
" specified", outputStorage);
99 const std::vector<std::string> classes =
StoHelp::readTypedStringList(inputStorage,
"Allowed vehicle classes must be given as a list of strings.");
100 libsumo::Edge::setAllowedVehicleClasses(
id, classes);
105 const std::vector<std::string> classes =
StoHelp::readTypedStringList(inputStorage,
"Not allowed vehicle classes must be given as a list of strings.");
106 libsumo::Edge::setDisallowedVehicleClasses(
id, classes);
111 const int parameterCount =
StoHelp::readCompound(inputStorage, -1,
"Setting travel time requires a compound object.");
112 if (parameterCount == 3) {
114 const double begTime =
StoHelp::readTypedDouble(inputStorage,
"The first variable must be the begin time given as double.");
115 const double endTime =
StoHelp::readTypedDouble(inputStorage,
"The second variable must be the end time given as double.");
116 const double value =
StoHelp::readTypedDouble(inputStorage,
"The third variable must be the value given as double.");
117 libsumo::Edge::adaptTraveltime(
id, value, begTime, endTime);
118 }
else if (parameterCount == 1) {
121 libsumo::Edge::adaptTraveltime(
id, value, 0., std::numeric_limits<double>::max());
124 "Setting travel time requires either begin time, end time, and value, or only value as parameter.",
131 const int parameterCount =
StoHelp::readCompound(inputStorage, -1,
"Setting effort requires a compound object.");
132 if (parameterCount == 3) {
134 const double begTime =
StoHelp::readTypedDouble(inputStorage,
"The first variable must be the begin time given as double.");
135 const double endTime =
StoHelp::readTypedDouble(inputStorage,
"The second variable must be the end time given as double.");
136 const double value =
StoHelp::readTypedDouble(inputStorage,
"The third variable must be the value given as double.");
137 libsumo::Edge::setEffort(
id, value, begTime, endTime);
138 }
else if (parameterCount == 1) {
141 libsumo::Edge::setEffort(
id, value, 0., std::numeric_limits<double>::max());
144 "Setting effort requires either begin time, end time, and value, or only value as parameter.",
152 libsumo::Edge::setMaxSpeed(
id, value);
157 StoHelp::readCompound(inputStorage, 2,
"A compound object of size 2 is needed for setting a parameter.");
158 const std::string name =
StoHelp::readTypedString(inputStorage,
"The name of the parameter must be given as a string.");
159 const std::string value =
StoHelp::readTypedString(inputStorage,
"The value of the parameter must be given as a string.");
160 libsumo::Edge::setParameter(
id, name, value);
std::string toHex(const T i, std::streamsize numDigits=0)
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xca: Change Edge State)
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xaa: Get Edge Variable)
TraCI server used to control sumo by a remote TraCI client.
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
tcpip::Storage & getWrapperStorage()
void initWrapper(const int domainID, const int variable, const std::string &objID)
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
static void writeTypedDouble(tcpip::Storage &content, double value)
static int readCompound(tcpip::Storage &ret, int expectedSize=-1, const std::string &error="")
static std::string readTypedString(tcpip::Storage &ret, const std::string &error="")
static std::vector< std::string > readTypedStringList(tcpip::Storage &ret, const std::string &error="")
static double readTypedDouble(tcpip::Storage &ret, const std::string &error="")
An error which allows to continue.
virtual std::string readString()
virtual int readUnsignedByte()
TRACI_CONST int CMD_SET_EDGE_VARIABLE
TRACI_CONST int VAR_EDGE_TRAVELTIME
TRACI_CONST int CMD_GET_EDGE_VARIABLE
TRACI_CONST int RESPONSE_GET_EDGE_VARIABLE
TRACI_CONST int VAR_EDGE_EFFORT
TRACI_CONST int VAR_MAXSPEED
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int LANE_DISALLOWED
TRACI_CONST int LANE_ALLOWED