Skip to content

aromajoin/controller-sdk-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • Aroma Shooter 1 USB version
  • Aroma Shooter 2

Connection

  • USB

Prerequisites

  • JRE version: >= 1.8+
  • Donwload and install drivers based on your OS.

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);
  • 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);
  • Other diffuse methods
// 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

  • Stop all ports of current connected devices if they are diffusing
usbController.stopAllPorts();
  • Stop all ports of one device if it is diffusing scents
usbController.stopAllPorts(aromaShooter);

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.