SWDataNetwork General HID support

To simplify getting the data from a GeneralHID device into an SWDataNetwork, a method has been created which automatically sets actions for the HID device to set the data into a DataNode in the network. It also copies any labels that have been set for the device over to the data slots.

- Example -

x = SWDataNetwork.new;

// build the device list and start the event loop: 
GeneralHID.buildDeviceList; 
GeneralHID.startEventLoop; 
 
// find an Impact game device and open it: 
a = GeneralHID.open( GeneralHID.findBy( 1973 ) ); 

// set the spec for the device (as defined in a previous session; see GeneralHID documentation).
a.setSpec( a.findSpec.first ); 

// Add an expected node to the network and give it the label of the device name:
x.addExpected( 1, \impact );

// Add the device to the network:
a.addToNetwork( x, 1 );

// Access the node:
x.at(\impact)
// Access the left axis slot:
x.at(\lx)
// Access the data of the left axis:
x.at(\lx).value

- Method extension to GeneralHIDDevice -

addToNetwork( network, id, prefix )
network is the instance of SWDataNetwork to which this device will be added. id is the data node ID that the device's data will be put into. prefix is the prefix that will be used for the labels.



Marije Baalman 2009-03-16