def main(): init() oscid = listen(port=10001) bind(oscid, update_mouse, '/update') while True: readQueue(oscid)
def __init__(self, mbHost="localhost", oscOutHost="localhost", oscOutPort=9000, oscInPort=9001, mbPattern=None): MessageBoard.SimpleMessageHandler.__init__(self) oscAPI.init() self.oscInPort = oscInPort self.oscOutPort = oscOutPort self.oscOutHost = oscOutHost self.mbPortal = MessageBoard.MessageClient(mbHost) self.oscInSocket = createListener("localhost", oscInPort) if mbPattern: self.mbPortal.registerMessageHandler(self, mbPattern) else: self.mbPortal.registerMessageHandler(self)
import oscAPI def sendMessageToOSC(msg, host="localhost", port=9000): args = [] for key in msg.keys(): args.append(key) args.append(msg[key]) print "args:", args oscAPI.sendMsg("/messageBoardGateway", args, host, port) if __name__ == "__main__": oscAPI.init() msg = {"msgType": "test.type1", "num": 3} sendMessageToOSC(msg, "localhost", 9001)