Sun Microsystems 800-1256-04 — Sun Microsystems 800-1256-04 SunCGI Reference Manual PDF

92 SunCGI Reference Manual request_input puts the input device in the RESPOND_EVENT state. If a Q trigger is activated within this period, the activating trigger and the device meas- ure are returned in the trigger and sample arguments respectively. If the trigger is not activated within this period, the current device measure is returned in the sample argument and trigger is set to zero. Before returning, the input device is reset to NO_ EVENTS state. request_input returns a device status in the argument valid. This argument uses the enumerated type Cawresult (A Wait Result) which contains values describing the state of an input device.

typedef enum { VALID_DATA, TIMED_OUT, DISABLED, WRONG_STATE, NOT_SUPPORTED Cawresult; VALID _DATA indicates a trigger is activated within the specified timeout period. TIMED_ OUT indicates that a trigger was not activated with a specified period. WRONG_STATE indicates SunCGI is not in state VSAC. NOT_SUPPORTED indi- cates the requestea device is not a legal device. If the appropriate field of the sample argument is a pointer, it must be set to an application program allocated area. 0 ENOTVSAC [4] Errors EINDNOEX [80] CGI not in proper state: CGI shall be in state VSAC. EINDINIT [81] Input device does not exist EINEVNEN [94] Input device not initialized. Events not enabled. 5.3.

Asynchronous Input This section explains the asynchronous method of input device management where the application process and the input device process operate simultane- ously. The designated input device is sampled with initiate_request and the measure of the input device is read with get_last_requested_input. Alternatively, the current measure of a device may be read with sample_input. The example program in Figure E-2 demonstrates how to use the asynchronous input functions. Initiate Request Cerror initiate_request(devclass, devnum) Cdevoff devclass; /* device type*/ Cint devnum; /* device number*/ initiate request puts the device in the REQUEST EVENT state.

It then o returns to the calling function without waiting for a trigger activation. The value . caused by the nigger activation can be obtained by the initiate_request sets up a device so that the measure resulting from the next trigger activation will be placed in the request register. Venion C of 17 March 1986