public class Physicaloid
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
Physicaloid.UploadCallBack
Callbacks of program process
|
Constructor and Description |
---|
Physicaloid(Context context) |
Modifier and Type | Method and Description |
---|---|
boolean |
addReadListener(ReadLisener listener)
Adds read listener
|
void |
clearReadListener()
Clears read listener
|
boolean |
close()
Closes a device.
|
boolean |
open()
Opens a device and communicate USB UART by default settings
|
boolean |
open(UartConfig uart)
Opens a device and communicate USB UART
|
int |
read(byte[] buf,
int size)
Reads from a device
|
void |
upload(Boards board,
java.io.InputStream fileStream)
Uploads a binary file to a device on background process.
|
void |
upload(Boards board,
java.io.InputStream fileStream,
Physicaloid.UploadCallBack callback)
Uploads a binary file to a device on background process.
|
void |
upload(Boards board,
java.lang.String filePath)
Uploads a binary file to a device on background process.
|
void |
upload(Boards board,
java.lang.String filePath,
Physicaloid.UploadCallBack callback)
Uploads a binary file to a device on background process.
|
int |
write(byte[] buf,
int size)
Writes to a device.
|
public boolean open() throws java.lang.RuntimeException
java.lang.RuntimeException
public boolean open(UartConfig uart) throws java.lang.RuntimeException
uart
- UART configurationjava.lang.RuntimeException
public boolean close() throws java.lang.RuntimeException
java.lang.RuntimeException
public int read(byte[] buf, int size) throws java.lang.RuntimeException
buf
- size
- java.lang.RuntimeException
public boolean addReadListener(ReadLisener listener) throws java.lang.RuntimeException
listener
- ReadListenerjava.lang.RuntimeException
public void clearReadListener() throws java.lang.RuntimeException
java.lang.RuntimeException
public int write(byte[] buf, int size) throws java.lang.RuntimeException
buf
- size
- java.lang.RuntimeException
public void upload(Boards board, java.lang.String filePath) throws java.lang.RuntimeException
board
- board profile e.g. Boards.ARDUINO_UNOfilePath
- a binary file path e.g. /sdcard/arduino/Blink.hexjava.lang.RuntimeException
public void upload(Boards board, java.lang.String filePath, Physicaloid.UploadCallBack callback) throws java.lang.RuntimeException
board
- board profile e.g. Boards.ARDUINO_UNOfilePath
- a binary file path e.g. /sdcard/arduino/Blink.uno.hexcallback
- java.lang.RuntimeException
public void upload(Boards board, java.io.InputStream fileStream) throws java.lang.RuntimeException
board
- board profile e.g. Boards.ARDUINO_UNOfileStream
- a binary stream e.g. getResources().getAssets().open("Blink.uno.hex")java.lang.RuntimeException
public void upload(Boards board, java.io.InputStream fileStream, Physicaloid.UploadCallBack callback) throws java.lang.RuntimeException
board
- board profile e.g. Boards.ARDUINO_UNOfileStream
- a binary stream e.g. getResources().getAssets().open("Blink.uno.hex")callback
- java.lang.RuntimeException