-
-
Notifications
You must be signed in to change notification settings - Fork 9
SimpleCommand
gcreate edited this page Jan 29, 2015
·
1 revision
package testcase;
import serialportutil.AbstractSerialCommand;
import serialportutil.CommandBatch;
import serialportutil.SerialPortConf;
/**
* Direct send command to serial<BR>
* Using System.out as output
*
*/
public class SimpleCommand extends AbstractSerialCommand {
@Override
protected void setup() {
// Setup serial
setSerialPortConf(new SerialPortConf("COM15", 115200, 8, 1, 0));
addOutputStream(System.out);
}
@Override
protected void processCommand() throws Exception {
// Send command "ps" to serial port,
sendCommand("ps |grep sh\n", 100, 1);
}
public static void main(String[] args) {
CommandBatch.addClazz(SimpleCommand.class);
CommandBatch.go();
}
}
Output
Start>>class testcase.SimpleCommand
Connecting to COM15 [speed:115200] [databit:8] [stopbit:1] [paritybit:0]
Connected!
ps |grep sh
root 715 2 0 0 bf3ecc88 00000000 D FlashIO
shell 759 1 968 508 c002c9c0 b6f8e378 S /system/bin/sh
root 763 1 940 444 c002c9c0 b6ea1378 S /system/bin/sh
shell 2956 1 3616 236 ffffffff 000225b8 S /sbin/adbd
root 14156 759 956 484 c002c9c0 b6f46378 S sh
shell@root:/data # Disconnected from COM15
End<<<<class testcase.SimpleCommand
Email:flylb1@gmail.com