Line 3: |
Line 3: |
| | | |
| | | |
− | Available functions: | + | Available functions (after a ''require "asi"''): |
| : 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. | | : 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. | | : success = '''asi.removeStateListener'''(asiStateCallback) - Removes a registered ASI state-change listener callback which was previously registered by calling addStateListener. |
Line 16: |
Line 16: |
| : '''port:getIdentifier'''() - Returns the identifier associated to 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:getState'''() - Returns the current state of the port as a constant from the asi table. |
− | : '''port:setBaudRate'''(newBaudRate) | + | : '''port:setBaudRate'''(newBaudRate) - Sets the baud rate for the connection. By default connections are established at 115200 bauds. If a different value is desired, the new baud rate must be set before establishing a connecting to the port. Returns self. |
| : '''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: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:disconnect'''() - Sends an asynchronous request for disconnection from the port. The result will be notified at the callback provided at port:connect(). |