50 const std::string
id = inputStorage.
readString();
53 if (!libsumo::Edge::handleVariable(
id, variable, &server, &inputStorage)) {
55 "Get Edge Variable: unsupported variable " +
toHex(variable, 2)
56 +
" specified", outputStorage);
81 "Change Edge State: unsupported variable " +
toHex(variable, 2)
82 +
" specified", outputStorage);
91 const std::vector<std::string> classes =
StoHelp::readTypedStringList(inputStorage,
"Allowed vehicle classes must be given as a list of strings.");
92 libsumo::Edge::setAllowed(
id, classes);
97 const std::vector<std::string> classes =
StoHelp::readTypedStringList(inputStorage,
"Not allowed vehicle classes must be given as a list of strings.");
98 libsumo::Edge::setDisallowed(
id, classes);
103 const int parameterCount =
StoHelp::readCompound(inputStorage, -1,
"Setting travel time requires a compound object.");
104 if (parameterCount == 3) {
106 const double begTime =
StoHelp::readTypedDouble(inputStorage,
"The first variable must be the begin time given as double.");
107 const double endTime =
StoHelp::readTypedDouble(inputStorage,
"The second variable must be the end time given as double.");
108 const double value =
StoHelp::readTypedDouble(inputStorage,
"The third variable must be the value given as double.");
109 libsumo::Edge::adaptTraveltime(
id, value, begTime, endTime);
110 }
else if (parameterCount == 1) {
113 libsumo::Edge::adaptTraveltime(
id, value, 0., std::numeric_limits<double>::max());
116 "Setting travel time requires either begin time, end time, and value, or only value as parameter.",
123 const int parameterCount =
StoHelp::readCompound(inputStorage, -1,
"Setting effort requires a compound object.");
124 if (parameterCount == 3) {
126 const double begTime =
StoHelp::readTypedDouble(inputStorage,
"The first variable must be the begin time given as double.");
127 const double endTime =
StoHelp::readTypedDouble(inputStorage,
"The second variable must be the end time given as double.");
128 const double value =
StoHelp::readTypedDouble(inputStorage,
"The third variable must be the value given as double.");
129 libsumo::Edge::setEffort(
id, value, begTime, endTime);
130 }
else if (parameterCount == 1) {
133 libsumo::Edge::setEffort(
id, value, 0., std::numeric_limits<double>::max());
136 "Setting effort requires either begin time, end time, and value, or only value as parameter.",
144 libsumo::Edge::setMaxSpeed(
id, value);
150 libsumo::Edge::setFriction(
id, value);
155 StoHelp::readCompound(inputStorage, 2,
"A compound object of size 2 is needed for setting a parameter.");
156 const std::string name =
StoHelp::readTypedString(inputStorage,
"The name of the parameter must be given as a string.");
157 const std::string value =
StoHelp::readTypedString(inputStorage,
"The value of the parameter must be given as a string.");
158 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 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