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);
94 "Change Edge State: unsupported variable " +
toHex(variable, 2)
95 +
" specified", outputStorage);
104 const std::vector<std::string> classes =
StoHelp::readTypedStringList(inputStorage,
"Allowed vehicle classes must be given as a list of strings.");
105 libsumo::Edge::setAllowed(
id, classes);
110 const std::vector<std::string> classes =
StoHelp::readTypedStringList(inputStorage,
"Not allowed vehicle classes must be given as a list of strings.");
111 libsumo::Edge::setDisallowed(
id, classes);
116 const int parameterCount =
StoHelp::readCompound(inputStorage, -1,
"Setting travel time requires a compound object.");
117 if (parameterCount == 3) {
119 const double begTime =
StoHelp::readTypedDouble(inputStorage,
"The first variable must be the begin time given as double.");
120 const double endTime =
StoHelp::readTypedDouble(inputStorage,
"The second variable must be the end time given as double.");
121 const double value =
StoHelp::readTypedDouble(inputStorage,
"The third variable must be the value given as double.");
122 libsumo::Edge::adaptTraveltime(
id, value, begTime, endTime);
123 }
else if (parameterCount == 1) {
126 libsumo::Edge::adaptTraveltime(
id, value, 0., std::numeric_limits<double>::max());
129 "Setting travel time requires either begin time, end time, and value, or only value as parameter.",
136 const int parameterCount =
StoHelp::readCompound(inputStorage, -1,
"Setting effort requires a compound object.");
137 if (parameterCount == 3) {
139 const double begTime =
StoHelp::readTypedDouble(inputStorage,
"The first variable must be the begin time given as double.");
140 const double endTime =
StoHelp::readTypedDouble(inputStorage,
"The second variable must be the end time given as double.");
141 const double value =
StoHelp::readTypedDouble(inputStorage,
"The third variable must be the value given as double.");
142 libsumo::Edge::setEffort(
id, value, begTime, endTime);
143 }
else if (parameterCount == 1) {
146 libsumo::Edge::setEffort(
id, value, 0., std::numeric_limits<double>::max());
149 "Setting effort requires either begin time, end time, and value, or only value as parameter.",
157 libsumo::Edge::setMaxSpeed(
id, value);
163 libsumo::Edge::setFriction(
id, value);
168 StoHelp::readCompound(inputStorage, 2,
"A compound object of size 2 is needed for setting a parameter.");
169 const std::string name =
StoHelp::readTypedString(inputStorage,
"The name of the parameter must be given as a string.");
170 const std::string value =
StoHelp::readTypedString(inputStorage,
"The value of the parameter must be given as a string.");
171 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::vector< std::string > readTypedStringList(tcpip::Storage &ret, const std::string &error="")
static std::string readTypedString(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 VAR_FRICTION
TRACI_CONST int LANE_ALLOWED