Beispiel #1
0
	def addCabRequest(self, request):
		#take the cab request in the json
		newCabRequest = request["cabRequest"]
		#intance the new cab request
		cabRequest = CabRequest(newCabRequest, self.mapManagerTaxi)
		self.cabRequestList.append(cabRequest)
		print 'New cab request created!'
		# Olivier: Auto broadcast on new cab request
		cabQueueJson = self.toDictFormatCabRequest()
		NetworkWebSocket.server_WEBSOCKET.broadcastAll(cabQueueJson)
Beispiel #2
0
 def __init__(self, taxiInfo, mapManagerTaxi):
     self.odometer = taxiInfo["odometer"]
     #determine if the taxi have alreay accept a request
     if taxiInfo["destination"] != None:
         self.destination = CabRequest(taxiInfo["destination"],
                                       mapManagerTaxi)
     else:
         self.destination = None
     #initialise locations
     self.loc_now = Location(taxiInfo["loc_now"], mapManagerTaxi)
     self.loc_prior = Location(taxiInfo["loc_prior"], mapManagerTaxi)