Skip to content

Commit

Permalink
Update sample to sdk version 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
quangctkm9207 committed Sep 9, 2019
1 parent 7737b12 commit 2c09e46
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/controller-sdk-java.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ repositories {
}

dependencies {
compile 'com.aromajoin.sdk:jvm:2.0.10'
compile 'com.aromajoin.sdk:jvm:2.2.0'
}
46 changes: 33 additions & 13 deletions Sample/src/main/java/AromaShooterUSBSample.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,10 @@

public class AromaShooterUSBSample {
public static void main(String args[]) {
System.out.println("======= A sample of Controller SDK for Aroma Shooter USB=========");
//testWithSpecificPort();
testWithAutomaticScan();
System.out.println("======= DONE =========");
}

/**
* You can define AromaShooter USB connected port.
*/
private static void testWithSpecificPort() {
USBASController usbController = new USBASController("/dev/tty.usbserial-AH03I8XI");
usbController.diffuseAll(3000, true, 2, 3);
usbController.disconnectAll();
System.out.println("Aroma Shooter's SDK sample!");
//testWithAutomaticScan();
testWithAutomaticScanSync();
System.out.println("Completed.");
}

/**
Expand All @@ -31,11 +22,40 @@ private static void testWithAutomaticScan() {
System.out.println("AromaShooter: " + aromaShooter.getSerial());
}
usbController.diffuseAll(3000, true, 2, 3);
usbController.disconnectAll();
}

@Override public void onFailed(String msg) {

}
});
}

/**
* Scans and diffuses scents synchronously
*/
private static void testWithAutomaticScanSync() {
USBASController usbController = new USBASController();
usbController.scanAndConnect();
if (!usbController.getConnectedDevices().isEmpty()) {
for (AromaShooter aromaShooter : usbController.getConnectedDevices()) {
System.out.println("AromaShooter: " + aromaShooter.getSerial());
}
usbController.diffuseAll(3000, true, 2, 3, 5);
try {
Thread.sleep(500);
usbController.stopAllPorts();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
//try {
// Thread.sleep(10000);
//} catch (InterruptedException e) {
// e.printStackTrace();
//}
//usbController.diffuse(usbController.getConnectedDevices().get(0), 3000, true, 2, 3);
//usbController.diffuse("ASN1UA0150", 3000, true, 4, 6);
usbController.disconnectAll();
}
}

0 comments on commit 2c09e46

Please sign in to comment.