SWDataNetworkOSC

These classes implement the OSC interface of the host. Most of the methods of this class are only used by the class itself in response to incoming OSC messages, or are called from the network to send OSC messages out. Only a few of the methods should be used directly. Care is taken that no other client can set data to a node, once it has been defined by a certain client as ``his'' node.

- Example -


// Define the network
x = SWDataNetwork.new;

// Add an OSC interface to it
x.addOSCInterface;

// Access to the OSC interface:
x.osc

// Create a GUI for the OSC interface:
x.osc.makeGui;

- Methods -

*httppath ( )
*httppath_ ( )
Set the base path where the host machine stores its http accessible files. Default is "/var/www/". On OSX it should be set to: "/Library/WebServer/Documents/"
*new( netw )
Create a new instance of SWDataNetworkOSC, working together with the SWDataNetwork netw
stop( )
This effectively stops the network, it removes the OSC responders, sends all clients the message that they're unregistered, and that the datanetwork has quit. This method is called automatically upon shutdown of sclang (or recompiling the library).
makeGui ( )
Create a GUI for the OSC interface. This shows the connected clients, and a transcript of their interactions with the host.
verbose ( )
verbose_ ( level )
The higher the verbosity level, the more messages will be posted about what is going on. This is useful for debugging the network connections. 0 - no posts, 1 - errors/warning messages, 2 - all incoming osc messages, except /pong and /set/data, 3 - data sent out and coming in (/set/data), 4 - /pong messages.

- Autoconnection and recovery support -

announce ( ports )
Announce the network on the given ports. If none are given, the defaults (6000..6009) ++ (57120..57129); are used. It sends the message out as a broadcast message over the local area network, and as a separate message to all stored client IPs (backup solution, in case broadcasting is not allowed on the network). This method also writes the publicly accessible file with the port on which the interface is listening. This method is called automatically, as the OSC interface is instantiated.
maxMissedPongs ( )
maxMissedPongs_ ( )
When a client does not respond to this many pings, it will be removed from the registered clients. Ping messages are sent every second, so this is the amount of seconds after which a client automatically gets removed. Default value is 60.
backupClients ( name )
Backup the currently connected clients and their properties to a file with name. The file is placed in the userAppSupportDir.
restoreClients ( name )
Restore clients from a file with name, that is in the userAppSupportDir.
backupClientsIPs ( name )
Backup the currently connected client IPs. Is called from backupClients.
restoreClientsIPs ( name )
Restore client IPs from a file with name, that is in the userAppSupportDir.

- Kind of private methods and variables (useful for inspection) -

clients ( )
Array with the current clients.
setters ( )
IdentityDictionary that keeps track of which clients are setters for which nodes.
network ( )
The SWDataNetwork to which this OSC interface belongs.
watcher ( )
The SkipJack which regularly sends the pings to all clients.
sendPings ( )
Send pings to all clients.
createResponders ( )
Creates all OSC responders.
removeResponders ( )
Removes all OSC responders.

- Methods called by the network (SWDataNetwork) -

newExpected ( node )
newNode ( node )
newSlot ( slot )
sendData ( id, data )
-- old version --
sendDataNode ( node )
nodeRemoved ( id )

- Methods called from OSC messages - client management

findClient ( addr )
addClient ( addr )
removeClient ( addr )

- Methods called from OSC messages - queries

expectedQuery ( addr )
nodeQuery ( addr )
slotQuery ( addr )
clientQuery ( addr )
subscriptionQuery ( addr )
setterQuery ( addr )

- Methods called from OSC messages - subscriptions and data retrieval

allNodeSubscribe ( addr )
nodeSubscribe ( addr, msg )
slotSubscribe ( addr, msg )
allNodeUnsubscribe ( addr )
nodeUnsubscribe ( addr, msg )
slotUnsubscribe ( addr, msg )
getNode ( addr, msg )
getSlot ( addr, msg )

- Methods called from OSC messages - node control by clients

setData ( addr, msg )
removeAll ( addr )
removeNode ( addr, msg )
labelNode ( addr, msg )
labelSlot ( addr, msg )
addExpected ( addr, msg )

- Error handling -

getErrorString ( addr, id, msg )
errorMsg ( addr, request, id, msg )
warnMsg ( addr, request, id, msg )

- Recording and logging -

logMsg ( string )
Sends a log message to the gui (if present), or to the file (if logging). Called from various methods.
initLog ( fn )
Create a logfile with filename fn.
writeLogLine ( line )
Write one line into the log. (format: localtime stamp - line)
closeLog ( )
Close the logfile and stop logging.




Marije Baalman 2009-03-16