def rsu2cars(myip): print 'sending msg i2v: other cars' send( { 'type': 3, 'rsuID': myip, 'cars': cars.list(), 'time': int(time.time()) }, "all")
def sendAction(MYIP, table, gate, control): communication.send({ 'id': randomString(), 'type': 3, 'to': gate, 'from': [MYIP], 'content': control, 'timestamp': time.time(), }, table)
def sendBeacons(MYIP, table): communication.send({ 'id': randomString(), 'type': 1, 'to': 'all', 'from': [MYIP], 'content': table, 'timestamp': time.time(), }, table)
def car2car(myip): print 'sending msg v2v: driver state' send( { 'type': 1, 'carID': myip, 'location': location.get(), 'state': driver.state(), 'time': int(time.time()) }, "all")
def rsu2car(feedback, ip, myip): print 'sending msg i2v: feedback' send( { 'carID': ip, 'type': 6, 'rsuID': myip, 'feedback': feedback, 'time': int(time.time()) }, 'all')
def sendCleanTables(MYIP, table): led.on('YELLOW_PIN') communication.send({ 'id': randomString(), 'type': 4, 'to': 'all', 'from': [MYIP], 'content': 'clear tables', 'timestamp': time.time(), }, table)
def rsu2its(car, state, sensors, myip): print 'sending msg i2c: sensors data' send( { 'type': 4, 'rsuID': myip, 'carID': car, 'state': state, 'sensors': sensors, 'time': int(time.time()) }, "all")
def sendDecoded(MYIP, table, string): led.on('GREEN_PIN') led.on('RED_PIN') communication.send({ 'id': randomString(), 'type': 2, 'to': 'fc01::4', 'from': [MYIP], 'content': string, 'timestamp': time.time(), }, table)
def car2rsu(myip): print 'sending msg v2i: sensors data' sensors = json.dumps(driver.sensors()) sensors = cipher(sensors) send( { 'type': 2, 'carID': myip, 'location': location.get(), 'state': driver.state(), 'sensors': sensors, 'time': int(time.time()) }, "all")
def sendRelay(MYIP, table, msg): msg['from'].append(MYIP) communication.send(msg, table)