This scenario shows how to use SendIOControlAsync to receive asynchronous events from the device driver.
The Begin Receiving Switch Change Events button below sends an get interrupt message IO control to the driver. The driver completes this only when the DIP switches on the Fx2 have changed. On completion the sample code updates the UI and then issues another get interrupt IO control. The Stop Receiving Switch Change Events button cancels the pending IO control. The IO control is also canceled if the scenario is changed. If the device is unplugged or disconnected the pending IO control completes with an error, and the sample code stops retrieving events.
The IO control codes used in this scenario, along with all other driver-defined constants, in the fx2Driver object(fx2Driver.js)