public class SerialComm extends EMDKBase
{@code public class MainActivity extends Activity implements EMDKListener { SerialComm serialComm; EMDKManager emdkManager;
Modifier and Type | Method and Description |
---|---|
void |
disable()
This method disables USB/serial channel to communicate with the remote device.
|
void |
enable()
This method enables the channel for the application to communicate with the remote device via USB/Serial.
|
boolean |
isEnabled()
Gets whether the communication port is enabled or not.
|
byte[] |
read(int readTimeOut)
This method reads the available data and returns immediately.
|
int |
write(byte[] data,
int bytesToWrite)
Writes a specified number of bytes from buffer to the opened communication channel.
|
public boolean isEnabled()
public void enable() throws SerialCommException
SerialCommException
public void disable() throws SerialCommException
SerialCommException
public int write(byte[] data, int bytesToWrite) throws SerialCommException
data
- The byte array that contains the data to write.bytesToWrite
- The number of bytes to write.SerialCommException
public byte[] read(int readTimeOut) throws SerialCommException
readTimeOut
- Wait for data until timeout. The timeout unit is milli seconds.
A timeout of zero means the calling read will wait forever unless interrupted by disable or release.SerialCommException