Eclipse SUMO - Simulation of Urban MObility
TraCIServerAPI_TrafficLight.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2009-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // APIs for getting/setting traffic light values via TraCI
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <microsim/MSLane.h>
28 #include <microsim/MSEdge.h>
31 #include <libsumo/TraCIConstants.h>
32 #include <libsumo/TrafficLight.h>
34 
35 
36 // ===========================================================================
37 // method definitions
38 // ===========================================================================
39 bool
41  tcpip::Storage& outputStorage) {
42  const int variable = inputStorage.readUnsignedByte();
43  const std::string id = inputStorage.readString();
44  server.initWrapper(libsumo::RESPONSE_GET_TL_VARIABLE, variable, id);
45  try {
46  if (!libsumo::TrafficLight::handleVariable(id, variable, &server)) {
47  switch (variable) {
49  std::vector<libsumo::TraCILogic> logics = libsumo::TrafficLight::getCompleteRedYellowGreenDefinition(id);
50  tcpip::Storage& storage = server.getWrapperStorage();
52  storage.writeInt((int)logics.size());
53  for (const libsumo::TraCILogic& logic : logics) {
55  storage.writeInt(5);
57  storage.writeString(logic.programID);
58  // type
60  storage.writeInt(logic.type);
61  // (current) phase index
63  storage.writeInt(logic.currentPhaseIndex);
64  // phase number
66  storage.writeInt((int)logic.phases.size());
67  for (const libsumo::TraCIPhase& phase : logic.phases) {
69  storage.writeInt(6);
71  storage.writeDouble(phase.duration);
73  storage.writeString(phase.state);
75  storage.writeDouble(phase.minDur);
77  storage.writeDouble(phase.maxDur);
79  storage.writeInt((int)phase.next.size());
80  for (int n : phase.next) {
82  storage.writeInt(n);
83  }
85  storage.writeString(phase.name);
86  }
87  // subparameter
89  storage.writeInt((int)logic.subParameter.size());
90  for (const auto& item : logic.subParameter) {
92  storage.writeInt(2);
93  storage.writeString(item.first);
94  storage.writeString(item.second);
95  }
96  }
97  break;
98  }
100  const std::vector<std::vector<libsumo::TraCILink> > links = libsumo::TrafficLight::getControlledLinks(id);
102  tcpip::Storage tempContent;
103  int cnt = 0;
105  tempContent.writeInt((int)links.size());
106  for (const std::vector<libsumo::TraCILink>& sublinks : links) {
108  tempContent.writeInt((int)sublinks.size());
109  ++cnt;
110  for (const libsumo::TraCILink& link : sublinks) {
112  tempContent.writeStringList(std::vector<std::string>({ link.fromLane, link.toLane, link.viaLane }));
113  ++cnt;
114  }
115  }
116  server.getWrapperStorage().writeInt(cnt);
117  server.getWrapperStorage().writeStorage(tempContent);
118  break;
119  }
120  case libsumo::VAR_PARAMETER: {
121  std::string paramName = "";
122  if (!server.readTypeCheckingString(inputStorage, paramName)) {
123  return server.writeErrorStatusCmd(libsumo::CMD_GET_TL_VARIABLE, "Retrieval of a parameter requires its name.", outputStorage);
124  }
127  break;
128  }
130  if (!MSNet::getInstance()->getTLSControl().knows(id)) {
131  throw libsumo::TraCIException("Traffic light '" + id + "' is not known");
132  }
134  const std::string& state = tls->getCurrentPhaseDef().getState();
135  const std::map<std::string, std::string>& params = tls->getParametersMap();
136  int num = 0;
137  for (std::map<std::string, std::string>::const_iterator i = params.begin(); i != params.end(); ++i) {
138  if ("connection:" == (*i).first.substr(0, 11)) {
139  ++num;
140  }
141  }
142 
145  server.getWrapperStorage().writeInt(num * 2);
146  for (std::map<std::string, std::string>::const_iterator i = params.begin(); i != params.end(); ++i) {
147  if ("connection:" != (*i).first.substr(0, 11)) {
148  continue;
149  }
151  server.getWrapperStorage().writeString((*i).second); // foreign id
152  std::string connection = (*i).first.substr(11);
153  std::string from, to;
154  const std::string::size_type b = connection.find("->");
155  if (b == std::string::npos) {
156  from = connection;
157  } else {
158  from = connection.substr(0, b);
159  to = connection.substr(b + 2);
160  }
161  bool denotesEdge = from.find("_") == std::string::npos;
162  MSLane* fromLane = nullptr;
164  MSTrafficLightLogic::LaneVectorVector::const_iterator j = lanes.begin();
165  for (; j != lanes.end() && fromLane == nullptr;) {
166  for (MSTrafficLightLogic::LaneVector::const_iterator k = (*j).begin(); k != (*j).end() && fromLane == nullptr;) {
167  if (denotesEdge && (*k)->getEdge().getID() == from) {
168  fromLane = *k;
169  } else if (!denotesEdge && (*k)->getID() == from) {
170  fromLane = *k;
171  }
172  if (fromLane == nullptr) {
173  ++k;
174  }
175  }
176  if (fromLane == nullptr) {
177  ++j;
178  }
179  }
180  if (fromLane == nullptr) {
181  return server.writeErrorStatusCmd(libsumo::CMD_GET_TL_VARIABLE, "Could not find edge or lane '" + from + "' in traffic light '" + id + "'.", outputStorage);
182  }
183  int pos = (int)std::distance(lanes.begin(), j);
185  server.getWrapperStorage().writeUnsignedByte(state[pos]); // state
186  }
187  break;
188  }
189  default:
190  return server.writeErrorStatusCmd(libsumo::CMD_GET_TL_VARIABLE, "Get TLS Variable: unsupported variable " + toHex(variable, 2) + " specified", outputStorage);
191  }
192  }
193  } catch (libsumo::TraCIException& e) {
194  return server.writeErrorStatusCmd(libsumo::CMD_GET_TL_VARIABLE, e.what(), outputStorage);
195  }
197  server.writeResponseWithLength(outputStorage, server.getWrapperStorage());
198  return true;
199 }
200 
201 
202 bool
204  tcpip::Storage& outputStorage) {
205  std::string warning = ""; // additional description for response
206  // variable
207  const int variable = inputStorage.readUnsignedByte();
208  if (variable != libsumo::TL_PHASE_INDEX && variable != libsumo::TL_PROGRAM && variable != libsumo::TL_PHASE_DURATION
210  && variable != libsumo::VAR_NAME
211  && variable != libsumo::VAR_PARAMETER) {
212  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "Change TLS State: unsupported variable " + toHex(variable, 2) + " specified", outputStorage);
213  }
214  const std::string id = inputStorage.readString();
215  try {
216  switch (variable) {
218  int index = 0;
219  if (!server.readTypeCheckingInt(inputStorage, index)) {
220  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The phase index must be given as an integer.", outputStorage);
221  }
223  }
224  break;
225  case libsumo::VAR_NAME: {
226  std::string name;
227  if (!server.readTypeCheckingString(inputStorage, name)) {
228  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The phase name must be given as a string.", outputStorage);
229  }
231  }
232  break;
233  case libsumo::TL_PROGRAM: {
234  std::string subID;
235  if (!server.readTypeCheckingString(inputStorage, subID)) {
236  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The program must be given as a string.", outputStorage);
237  }
239  }
240  break;
242  double duration = 0.;
243  if (!server.readTypeCheckingDouble(inputStorage, duration)) {
244  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The phase duration must be given as a double.", outputStorage);
245  }
247  }
248  break;
250  std::string state;
251  if (!server.readTypeCheckingString(inputStorage, state)) {
252  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The phase must be given as a string.", outputStorage);
253  }
255  }
256  break;
258  if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
259  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "A compound object is needed for setting a new program.", outputStorage);
260  }
261  //read itemNo
262  inputStorage.readInt();
263  libsumo::TraCILogic logic;
264  if (!server.readTypeCheckingString(inputStorage, logic.programID)) {
265  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 1. parameter (programID) must be a string.", outputStorage);
266  }
267  if (!server.readTypeCheckingInt(inputStorage, logic.type)) {
268  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 2. parameter (type) must be an int.", outputStorage);
269  }
270  if (!server.readTypeCheckingInt(inputStorage, logic.currentPhaseIndex)) {
271  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 3. parameter (index) must be an int.", outputStorage);
272  }
273  if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
274  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "A compound object is needed for the phases.", outputStorage);
275  }
276  const int numPhases = inputStorage.readInt();
277  for (int j = 0; j < numPhases; ++j) {
278  if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
279  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "A compound object is needed for every phase.", outputStorage);
280  }
281  int items = inputStorage.readInt();
282  if (items != 6 && items != 5) {
283  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "A phase compound object requires 5 or 6 items.", outputStorage);
284  }
285  double duration = 0., minDuration = 0., maxDuration = 0.;
286  std::vector<int> next;
287  std::string name;
288  if (!server.readTypeCheckingDouble(inputStorage, duration)) {
289  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 4.1. parameter (duration) must be a double.", outputStorage);
290  }
291  std::string state;
292  if (!server.readTypeCheckingString(inputStorage, state)) {
293  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 4.2. parameter (phase) must be a string.", outputStorage);
294  }
295  if (!server.readTypeCheckingDouble(inputStorage, minDuration)) {
296  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 4.3. parameter (min duration) must be a double.", outputStorage);
297  }
298  if (!server.readTypeCheckingDouble(inputStorage, maxDuration)) {
299  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 4.4. parameter (max duration) must be a double.", outputStorage);
300  }
301  auto tmp = inputStorage.readUnsignedByte();
302  if (tmp != libsumo::TYPE_COMPOUND) {
303  std::cout << " byte:" << tmp << "\n";
304  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program 4.5 parameter (next) must be a compound (list of ints).", outputStorage);
305  }
306  const int numNext = inputStorage.readInt();
307  for (int k = 0; k < numNext; k++) {
308  int tmp;
309  if (!server.readTypeCheckingInt(inputStorage, tmp)) {
310  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 4.5. parameter (next) must be a list of int.", outputStorage);
311  }
312  next.push_back(tmp);
313  }
314  if (items == 6) {
315  if (!server.readTypeCheckingString(inputStorage, name)) {
316  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 4.6. parameter (name) must be a string.", outputStorage);
317  }
318  }
319  logic.phases.emplace_back(libsumo::TraCIPhase(duration, state, minDuration, maxDuration, next, name));
320  }
321  if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
322  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "set program: 5. parameter (subparams) must be a compound object.", outputStorage);
323  }
324  const int numParams = inputStorage.readInt();
325  for (int j = 0; j < numParams; j++) {
326  std::vector<std::string> par;
327  server.readTypeCheckingStringList(inputStorage, par);
328  logic.subParameter[par[0]] = par[1];
329  }
331  }
332  break;
333  case libsumo::VAR_PARAMETER: {
334  if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
335  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "A compound object is needed for setting a parameter.", outputStorage);
336  }
337  //read itemNo
338  inputStorage.readInt();
339  std::string name;
340  if (!server.readTypeCheckingString(inputStorage, name)) {
341  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The name of the parameter must be given as a string.", outputStorage);
342  }
343  std::string value;
344  if (!server.readTypeCheckingString(inputStorage, value)) {
345  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, "The value of the parameter must be given as a string.", outputStorage);
346  }
347  libsumo::TrafficLight::setParameter(id, name, value);
348  }
349  break;
350  default:
351  break;
352  }
353  } catch (libsumo::TraCIException& e) {
354  return server.writeErrorStatusCmd(libsumo::CMD_SET_TL_VARIABLE, e.what(), outputStorage);
355  }
356  server.writeStatusCmd(libsumo::CMD_SET_TL_VARIABLE, libsumo::RTYPE_OK, warning, outputStorage);
357  return true;
358 }
359 
360 
361 /****************************************************************************/
libsumo::CMD_GET_TL_VARIABLE
TRACI_CONST int CMD_GET_TL_VARIABLE
Definition: TraCIConstants.h:120
libsumo::RTYPE_OK
TRACI_CONST int RTYPE_OK
Definition: TraCIConstants.h:353
libsumo::TL_PHASE_INDEX
TRACI_CONST int TL_PHASE_INDEX
Definition: TraCIConstants.h:550
TraCIServerAPI_TrafficLight.h
libsumo::TrafficLight::getControlledLinks
static std::vector< std::vector< TraCILink > > getControlledLinks(const std::string &tlsID)
Definition: TrafficLight.cpp:109
libsumo::TrafficLight::setParameter
static void setParameter(const std::string &tlsID, const std::string &paramName, const std::string &value)
Definition: TrafficLight.cpp:232
libsumo::TrafficLight::setProgram
static void setProgram(const std::string &tlsID, const std::string &programID)
Definition: TrafficLight.cpp:193
MSTLLogicControl.h
libsumo::TL_CONTROLLED_LINKS
TRACI_CONST int TL_CONTROLLED_LINKS
Definition: TraCIConstants.h:562
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
libsumo::VAR_NAME
TRACI_CONST int VAR_NAME
Definition: TraCIConstants.h:544
libsumo::TL_PROGRAM
TRACI_CONST int TL_PROGRAM
Definition: TraCIConstants.h:553
libsumo::TraCILogic::type
int type
Definition: TraCIDefs.h:247
tcpip::Storage::writeUnsignedByte
virtual void writeUnsignedByte(int)
libsumo::TL_COMPLETE_PROGRAM_RYG
TRACI_CONST int TL_COMPLETE_PROGRAM_RYG
Definition: TraCIConstants.h:577
libsumo::TraCIPhase::maxDur
double maxDur
Definition: TraCIDefs.h:220
libsumo::TL_PHASE_DURATION
TRACI_CONST int TL_PHASE_DURATION
Definition: TraCIConstants.h:556
TraCIServer::readTypeCheckingString
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
Definition: TraCIServer.cpp:1416
TraCIServer::writeResponseWithLength
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
Definition: TraCIServer.cpp:1368
libsumo::TraCILogic::currentPhaseIndex
int currentPhaseIndex
Definition: TraCIDefs.h:248
libsumo::VAR_PARAMETER
TRACI_CONST int VAR_PARAMETER
Definition: TraCIConstants.h:928
MSEdge.h
libsumo::TL_EXTERNAL_STATE
TRACI_CONST int TL_EXTERNAL_STATE
Definition: TraCIConstants.h:583
libsumo::TrafficLight::setPhase
static void setPhase(const std::string &tlsID, const int index)
Definition: TrafficLight.cpp:174
TraCIServer::getWrapperStorage
tcpip::Storage & getWrapperStorage()
Definition: TraCIServer.cpp:175
MSTLLogicControl::TLSLogicVariants::getActive
MSTrafficLightLogic * getActive() const
Definition: MSTLLogicControl.cpp:197
MSSimpleTrafficLightLogic.h
libsumo::TrafficLight::setCompleteRedYellowGreenDefinition
static void setCompleteRedYellowGreenDefinition(const std::string &tlsID, const TraCILogic &logic)
Definition: TrafficLight.cpp:212
TraCIServer::readTypeCheckingDouble
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
Definition: TraCIServer.cpp:1406
TraCIServer::writeStatusCmd
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
Definition: TraCIServer.cpp:967
libsumo::TrafficLight::setRedYellowGreenState
static void setRedYellowGreenState(const std::string &tlsID, const std::string &state)
Definition: TrafficLight.cpp:168
TraCIServer::initWrapper
void initWrapper(const int domainID, const int variable, const std::string &objID)
Definition: TraCIServer.cpp:103
libsumo::TraCILogic
Definition: TraCIDefs.h:233
Parameterised::getParametersMap
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
Definition: Parameterised.cpp:105
tcpip::Storage::readUnsignedByte
virtual int readUnsignedByte()
tcpip::Storage::writeInt
virtual void writeInt(int)
libsumo::TYPE_DOUBLE
TRACI_CONST int TYPE_DOUBLE
Definition: TraCIConstants.h:336
MSTLLogicControl::get
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
Definition: MSTLLogicControl.cpp:584
tcpip::Storage::readString
virtual std::string readString()
TraCIConstants.h
tcpip::Storage::readInt
virtual int readInt()
libsumo::TYPE_INTEGER
TRACI_CONST int TYPE_INTEGER
Definition: TraCIConstants.h:334
MSPhaseDefinition::getState
const std::string & getState() const
Returns the state within this phase.
Definition: MSPhaseDefinition.h:200
tcpip::Storage::writeStorage
virtual void writeStorage(tcpip::Storage &store)
libsumo::TraCILogic::programID
std::string programID
Definition: TraCIDefs.h:246
tcpip::Storage::writeStringList
virtual void writeStringList(const std::vector< std::string > &s)
libsumo::TraCIPhase::state
std::string state
Definition: TraCIDefs.h:219
toHex
std::string toHex(const T i, std::streamsize numDigits=0)
Definition: ToString.h:58
libsumo::CMD_SET_TL_VARIABLE
TRACI_CONST int CMD_SET_TL_VARIABLE
Definition: TraCIConstants.h:124
libsumo::TrafficLight::setPhaseDuration
static void setPhaseDuration(const std::string &tlsID, const double phaseDuration)
Definition: TrafficLight.cpp:203
MSTrafficLightLogic
The parent class for traffic light logics.
Definition: MSTrafficLightLogic.h:56
libsumo::TraCIPhase::minDur
double minDur
Definition: TraCIDefs.h:220
TrafficLight.h
libsumo::TraCIPhase::duration
double duration
Definition: TraCIDefs.h:218
libsumo::TrafficLight::setPhaseName
static void setPhaseName(const std::string &tlsID, const std::string &name)
Definition: TrafficLight.cpp:186
TraCIServer::readTypeCheckingStringList
bool readTypeCheckingStringList(tcpip::Storage &inputStorage, std::vector< std::string > &into)
Reads the value type and a string list, verifying the type.
Definition: TraCIServer.cpp:1426
libsumo::TraCIPhase::next
std::vector< int > next
Definition: TraCIDefs.h:221
libsumo::TraCIException
Definition: TraCIDefs.h:90
libsumo::TrafficLight::getParameter
static std::string getParameter(const std::string &tlsID, const std::string &paramName)
Definition: TrafficLight.cpp:162
libsumo::TYPE_STRINGLIST
TRACI_CONST int TYPE_STRINGLIST
Definition: TraCIConstants.h:340
MSTrafficLightLogic::getLaneVectors
const LaneVectorVector & getLaneVectors() const
Returns the list of lists of all lanes controlled by this tls.
Definition: MSTrafficLightLogic.h:180
tcpip::Storage::writeString
virtual void writeString(const std::string &s)
MSNet::getTLSControl
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition: MSNet.h:410
libsumo::TraCILogic::phases
std::vector< TraCIPhase > phases
Definition: TraCIDefs.h:249
libsumo::TraCIPhase
Definition: TraCIDefs.h:208
TraCIServer::readTypeCheckingInt
bool readTypeCheckingInt(tcpip::Storage &inputStorage, int &into)
Reads the value type and an int, verifying the type.
Definition: TraCIServer.cpp:1396
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:168
libsumo::TrafficLight::handleVariable
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
Definition: TrafficLight.cpp:256
TraCIServerAPI_TrafficLight::processGet
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa2: Get Traffic Lights Variable)
Definition: TraCIServerAPI_TrafficLight.cpp:40
libsumo::TYPE_STRING
TRACI_CONST int TYPE_STRING
Definition: TraCIConstants.h:338
libsumo::TL_RED_YELLOW_GREEN_STATE
TRACI_CONST int TL_RED_YELLOW_GREEN_STATE
Definition: TraCIConstants.h:547
libsumo::TYPE_UBYTE
TRACI_CONST int TYPE_UBYTE
Definition: TraCIConstants.h:330
MSTrafficLightLogic::LaneVectorVector
std::vector< LaneVector > LaneVectorVector
Definition of a list that holds lists of lanes that do have the same attribute.
Definition: MSTrafficLightLogic.h:74
libsumo::RESPONSE_GET_TL_VARIABLE
TRACI_CONST int RESPONSE_GET_TL_VARIABLE
Definition: TraCIConstants.h:122
libsumo::TraCILogic::subParameter
std::map< std::string, std::string > subParameter
Definition: TraCIDefs.h:250
config.h
tcpip::Storage::writeDouble
virtual void writeDouble(double)
TraCIServerAPI_TrafficLight::processSet
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc2: Change Traffic Lights State)
Definition: TraCIServerAPI_TrafficLight.cpp:203
TraCIServer
TraCI server used to control sumo by a remote TraCI client.
Definition: TraCIServer.h:62
libsumo::TraCIPhase::name
std::string name
Definition: TraCIDefs.h:222
MSLane.h
libsumo::TL_COMPLETE_DEFINITION_RYG
TRACI_CONST int TL_COMPLETE_DEFINITION_RYG
Definition: TraCIConstants.h:574
tcpip::Storage
Definition: storage.h:36
libsumo::TrafficLight::getCompleteRedYellowGreenDefinition
static std::vector< TraCILogic > getCompleteRedYellowGreenDefinition(const std::string &tlsID)
Definition: TrafficLight.cpp:65
MSTrafficLightLogic::getCurrentPhaseDef
virtual const MSPhaseDefinition & getCurrentPhaseDef() const =0
Returns the definition of the current phase.
libsumo::TYPE_COMPOUND
TRACI_CONST int TYPE_COMPOUND
Definition: TraCIConstants.h:342
TraCIServer::writeErrorStatusCmd
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
Definition: TraCIServer.cpp:981