aromajoin / controller-sdk-java

Enable developers to connect and control Aroma Shooter.
https://aromajoin.com/software/sdk
Apache License 2.0
4 stars 0 forks source link
aroma-shooter-controller aromajoin controller-sdk java scent

English / 日本語.

Controller SDK for Java

Maven Central License Join the community on Spectrum

A Java library version of AromaShooter Controller SDK which is used to communicate with Aroma Shooter devices

Table of Contents

  1. Supported devices
  2. Prerequisites
  3. Installation
  4. Usage
  5. Issues
  6. License

Supported devices

Connection

Prerequisites

Installation

Gradle

Please add controller-sdk dependency.

dependencies {
    // ... other dependencies
    compile 'com.aromajoin.sdk:jvm:2.4.0'
}

Maven

<dependency>
  <groupId>com.aromajoin.sdk</groupId>
  <artifactId>jvm</artifactId>
  <version>2.4.0</version>
  <type>pom</type>
</dependency>

Binary files (.jar)

  1. Directly download the latest controller-sdk-java.jar file.
  2. Add it into your project's build path.

Usage

For details, please check our Sample project (Recommended).

Setup

// Initialize an instance of USBASController
USBASController usbController = new USBASController();

Scan and connect device

usbController.scanAndConnect(new DiscoverCallback() {
    @Override
    public void onDiscovered(List<AromaShooter> aromaShooters) {
        for(AromaShooter aromaShooter : aromaShooters){
            // Detected Aroma Shooter.
        }
    }

    @Override
    public void onFailed(String msg) {
       // Failed on scanning.
    }
});

Connected devices

List<AromaShooter> connectedDevices = usbController.getConnectedDevices();

Diffuse

/**
 * Diffuses aroma at specific ports from all connected devices.
 * @param duration     diffusing duration in milliseconds.
 * @param booster      whether booster is used or not. 
 * @param ports        cartridge numbers to diffuse aroma. Value: 1 ~ 6.
 */
// For example, the following codes will diffuse aroma at cartridge 2 and 5 for 3 seconds.
usbController.diffuseAll(duration, booster, ports);

controller.diffuseAll(duration, boosterIntensity, fanIntensity, ports);


* Other diffuse methods
```java
// Diffuse one Aroma Shooter
controller.diffuse(aromaShooter, duration, booster, ports);
// Diffuse one Aroma Shooter with its serial number input
controller.diffuse(aromaShooterSerial, duration, booster, ports);
// Diffuse one Aroma Shooter with intensity (Aroma Shooter 2 supported only)
controller.diffuse(aromaShooter, durationMilliSec, boosterIntensity, fanIntensity, ports);
// Diffuse one Aroma Shooter with intensity and serial number input (Aroma Shooter 2 supported only)
controller.diffuse(aromaShooterSerial, durationMilliSec, boosterIntensity, fanIntensity, ports);

Stop

Disconnect

Disconnect all devices.

usbController.disconnectAll();

Issues

If you get any issues or require any new features, please create a new issue.

License

Please check the LICENSE file for the details.