public class ATConnection extends Object
Constructor and Description |
---|
ATConnection() |
Modifier and Type | Method and Description |
---|---|
static ATConnection |
getInstance() |
int |
read(byte[] data,
int offset,
int length)
Reads up to len bytes of data from the connection into an array of bytes.
|
void |
sendCommand(byte[] data,
int offset,
int length)
Send AT command from the connection.
|
void |
sendCommand(String command)
Send AT command from the connection.
|
public static ATConnection getInstance()
public void sendCommand(String command) throws IOException
command
- The AT command as a String to send.IOException
- If an I/O error occurred.public void sendCommand(byte[] data, int offset, int length) throws IOException
data
- The byte array containing the AT command.offset
- The offset of the AT command in the byte array.length
- The length of the byte array.IOException
- If an I/O error occurred or connection closed.public int read(byte[] data, int offset, int length) throws IOException
data
- The destination buffer.offset
- The offset of the destination buffer.length
- The maximum length of data to read.IOException
- If I/O error occurred or connection closed.NullPointerException
- If data byte array is null.IndexOutOfBoundsException
- If offset is negative, or length is negative, or offset+length is greater than the length of the
array data.