-
Notifications
You must be signed in to change notification settings - Fork 0
/
mrpd.py
33 lines (19 loc) · 764 Bytes
/
mrpd.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
from MrPickles import WireProtocol
from MrPickles.CommandHandlers.Movement.Steering import Steering
from MrPickles.CommandHandlers.Movement.Acceleration import Acceleration
from MrPickles.CommandHandlers.Management.KeepAlive import KeepAlive
class PacketHandlerUDP(DatagramProtocol):
def datagramReceived(self, datagram, address):
WireProtocol.runHandler(datagram)
def main():
WireProtocol.registerHandler(KeepAlive)
WireProtocol.registerHandler(Steering)
WireProtocol.registerHandler(Acceleration)
print WireProtocol.handlers
reactor.listenUDP(6969, PacketHandlerUDP())
reactor.run()
if __name__ == '__main__':
main()