The Android version of AromaShooterController library which is used to communicate with Aroma Shooter devices.
- Aroma Shooter Bluetooth BLE version
- Aroma Shooter USB version
- Android 4.4 and later
- For USB connection: USB OTG is required
The Gradle dependency is available via Maven Central.
Please add the controller-sdk
dependence in your module's build.gradle
file:
dependencies {
implementation "com.aromajoin.sdk:core:2.5.2"
implementation "com.aromajoin.sdk:android:2.4.6"
}
There are small differences between BLE connection and USB connetion.
In case you are working with Aroma Shooter via Bluetooth BLE connection. There are 3 options to have connection screen in your application.
- Extend ASBaseActivity which has a bar button to go to the default connection Screen
- Use Intent to go to the default connection screen normally
Intent intent = new Intent(YourCurrentActivity.this, ASConnectionActivity.class);
startActivity(intent);
- Write your own connection part using APIs
-
Get the reference of AndroidBLEController
AndroidBLEController controller = AndroidBLEController.getInstance();
-
Discover
controller.startScan(context, discoverCallback);
Don't forget to stop scanning when pause or stop activity/fragment:
protected void onPause() { super.onPause(); controller.stopScan(context); }
-
Connect
controller.connect(aromaShooter, connectCallback);
-
Disconnect
controller.disconnect(aromaShooter, disconnectCallback);
-
Note: currently, it can control only 1 Aroma Shooter.
- Initialize an AndroidUSBController object
AndroidUSBController controller = new AndroidUSBController(usbManager);
- Discover
controller.scan(discoverCallback);
- Connect
controller.connect(aromaShooter. connectCallback);
- Disconnect
controller.disconnect(aromaShooter, disconnectCallback);
List<AromaShooter> aromaShooters = controller.getConnectedDevices();
/**
* Diffuses aroma at device's ports.
*
* @param duration diffusing duration in milliseconds.
* @param booster whether booster is used or not.
* @param ports port numbers to diffuse aroma.
*/
controller.diffuseAll(duration, booster, ports);
- Diffuse scents method for AS2 (AromaShooter 2) devices only
/**
* Diffuses aroma at specific ports from all connected devices.
* @param duration diffusing duration in milliseconds.
* @param boosterIntensity booster port. Value: 0~100.
* @param fanIntensity fan port. Value: 0~100.
* @param ports array of ports. Value: Port(portNumber, portIntensity)
*/
controller.diffuseAll(duration, boosterIntensity, fanIntensity, ports);
/**
* Stops all ports of current connected devices if they are diffusing.
*/
controller.stopAllPorts();
/**
* Stops all ports if they are diffusing aroma.
*
* @param aromaShooter device to communicate.
*/
controller.stopAllPorts(AromaShooter aromaShooter);
For more information, please checkout this repository and refer to the sample project.
If you get any issues or require any new features, please create a new issue.
Please check the LICENSE file for the details.