Package-level declarations

Types

Link copied to clipboard
interface Com

The {@link Com} interface provide methods that enables the use of the serial communication port.
Implementation of the {@link Com} interface is provided in the class {@link SerialCommunication}.
To start using the serial communication an instance of the class {@link SerialCommunication} needs to be created.
Below examples show how to connect to the serial communication port,
setup callback to get notification when data is available for reading and method to write data.

Create instance of the SerialCommunication class and do connect.

         ...         {@code           SerialCommunication = _serialCommunication = new SerialCommunication();           if (_serialCommunication.connect(_baudRate)) {             setDataAvailableCallback();             Toast.makeText(SerialComActivity.this, "Successful connect!", Toast.LENGTH_SHORT).show();           } else {             Toast.makeText(SerialComActivity.this, "Unsuccessful connect!", Toast.LENGTH_SHORT).show();           }         }         ...     
Setup data available callback and read data when it is available.
         {@code           private void setDataAvailableCallback() {             _serialCommunication.setDataAvailableCallback(new DataAvailable()  {               Override               public void onDataAvailable(SerialCommunication.EventTypes event) {                 if (event == SerialCommunication.EventTypes.DATA_AVAILABLE) {                   byte [] buffer = new byteMAX_BUFFER_SIZE;                   _serialCommunication.read(buffer, buffer.length);                 }               }             });           }         }     
Write to the serial port.
         ...         {@code           byte[] buffer = text.getBytes();           _serialCommunication.write(buffer, buffer.length);         }         ...     

Link copied to clipboard
interface DataAvailable

Application layer callback interface.

Link copied to clipboard

Wrapper layer for the native serial port communication functions.
For information on how to use {@link SerialCommunication} see {@link Com}.