1. Arjan Scherpenisse
  2. txosc

Wiki

Clone wiki

txosc / InitialSoftwareDesign

The original of this page is at http://etherpad.com/VqI9ecW6cK

Files organization

  • twisted/protocols/osc.py
  • twisted/test/test_osc.py
  • doc/core/examples/oscserver.py
  • doc/core/examples/oscclient.py

Inspiration

Repository

We made a fork of Twised trunk at SVN revision 27896 to add OSC support. hg clone http://bitbucket.org/arjan/twisted-osc/

functions and classes signatures

  • Message. attributes: address, type_tags, arguments
  • Bundle. Attributes: messages, time tag
  • Argument
    • BlobArgument
    • StringArgument
    • IntArgument
    • LongArgument
    • FloatArgument
    • TimetagArgument
    • DoubleArgument
    • SymbolArgument : what is that?
  • OscServerProtocol - Handles incoming messages. Automatically has an AddressSpace instance.
    • messageReceived(Message)
    • getAddressSpace()
    • setAddressSpace()
  • AddressSpace - Adding/removing callback functions
    • addCallback(pattern, callable, typeTags=None)
    • removeCallback(address, callable) -> None
    • removeAllCallbacks(pattern) -> None
    • getCallbacks(pattern) -> set of callables Retrieve all callbacks which match to given pattern.
    • matchCallbacks(Message) -> set of callables Retrieve all callbacks which match the given message.
    • dispatch(Message, clientAddress) -> None executes every callback matching the message address with Message as arg. (and not only its arguments) The order in which the callbacks are called in undefined.
  • OscClientProtocol - handling sending messages
    • send(Message)
  • OscSender - send OSC messages
  • HandlersManager class:
    • handleMessage(Message)

I looked at the OSC docs, they call it an "OSC address space" the tree of possible paths/messages

Features Requests

  • Support wildcards (*, [1-4]) in the receiving and sending end.
  • Be able to register one callback for many messages.
  • Be able to register many messages for one callback.
  • Support a catch-all callback, that catches all leftovers.

-------

class Receiver

  • getProtocol() - return OscServerProtocol instance
  • dispatch - message or bundle received; dispatch it to the callbacks.
  • addCallback
  • removeCallback
  • removeAllCallbacks
  • getCallbacks
  • matchCallbacks
recv = Receiver()
recv.addCallback("/*", someFunction)
reactor.listenUDP(14444, recv.getProtocol())

Updated