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.
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