Category:ASI
Jump to navigation
Jump to search
ASI features got added With OS 4.2 (apilevel 2.7)
Official documentation: https://education.ti.com/html/webhelp/EG_TINspireLUA/EN/content/libraries/stem-iolib/asilibrary.htm
Available functions:
- error = asi.addStateListener(asiStateCallback [, object]) - Registers an ASI state-change listener callback. The registration of multiple listener callbacks at the same time is supported. Registered listener callbacks can be removed by calling removeStateListener.
- success = asi.removeStateListener(asiStateCallback) - Removes a registered ASI state-change listener callback which was previously registered by calling addStateListener.
- asi.isScanning() - Returns true if a scan for ASI ports is ongoing or false otherwise.
- asi.startScanning(portFoundCallback [, object]) - Scans for ASI ports. A second call to startScanning while already scanning does not reset the process. If a rescan is desired, call stopScanning first and then startScanning to reset the process.
- asi.stopScanning() - Stops scanning for ASI ports. Also resets the list of reported ports. Calling asi.startScanning() again will report all available ports once more.
Related: the Port class
- port:getName() - Returns the name of the port as a string, as given by the platform
- port:getIdentifier() - Returns the identifier associated to the port as a string, as given by the platform
- port:getState() - Returns the current state of the port as a constant from the asi table.
- port:setBaudRate(newBaudRate)
- port:connect(connectionCallback[, object]) - Sends an asynchronous request for connection to the port. When the request is processed, the result is reported to the specified callback.
- port:disconnect() - Sends an asynchronous request for disconnection from the port. The result will be notified at the callback provided at port:connect().
- port:setWriteListener(writeCallback[, object]) - Registers a callback for write-complete notifications. The callback is called after a write request. Returns self.
- port:write(writeData) - Sends an asynchronous request for a write operation. When the request is serviced, the writeCallback is called to confirm completion, if previously specified with setWriteListener. Returns error if an error occurred.
- port:setReadListener(readCallback[, object]) - Registers a callback for read notifications. The callback is called after a read request. Returns self.
- port:setReadTimeout(newTimeout) - Sets the maximum amount of time that the platform should wait for the first byte. This affects the behavior of read(). By default the timeout is 1000 milliseconds (1 second). Returns self.
- port:read([bytesToRead]) - Sends an asynchronous request for a read operation. When the request is serviced, the readCallback is called to confirm completion, if previously specified with setReadListener. Returns error if an error occurred.
- port:getValue() - Retrieves the last data read, as string.
This category currently contains no pages or media.