SWDataNetwork WiiMote support

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

- Example -

WiiMote.start;    // start the eventloop
WiiMote.discover; // discover a new device (wait for post about connected)

w = WiiMote.all[0];

w.enableMotionSensor( 1 );
w.enableExpansion( 1 );
w.enableButtons( 1 );


x = SWDataNetwork.new;

// add just wiimote
x.addExpected( 1 );
w.addToNetwork( x, 1 );

x.makeGui;

// add both wiimote and extension:
x.addExpected( 1 );
x.addExpected( 2 );
w.addToNetwork( x, 1, 2 );

x.makeGui;



w.setLEDState( 0,1 ); // LEDs are reflected as data as well
w.setLEDState( 0,0 ); // LEDs are reflected as data as well


w.close;

- Method extension to WiiMote -

addToNetwork( network, id1, id2 )
network is the instance of SWDataNetwork to which this device will be added. id1 is the data node ID that the device's data from the wiimote will be put into. id2 is the data node ID that the device's data from the attached extension will be put into.



Marije Baalman 2009-03-16