Skip to content

aromajoin/controller-sdk-java

Repository files navigation

English / 日本語

Controller SDK for Java · Download License

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

Prerequisites

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

Installation

Gradle

  1. Firstly, add our repository on the top of your [rootProject]/build.gradle.
repositories {
    // ... other repositories
    maven { url "https://dl.bintray.com/aromajoin/maven/" }
}
  1. Then, add controller-sdk dependency.
dependencies {
    // ... other dependencies
    compile 'com.aromajoin.sdk:jvm:2.x.x'
}

Maven

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

Binary files (.jar)

  1. Directly download the latest *.jar file from Bintray.
  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(3000, true, 2, 5);
  • Diffuse scents method for AS2 (AromaShooter 2) devices only
Port port1 = new Port(1, 100);
Port port2 = new Port(2, 50);

usbController.diffuseAll(3000, 0, 100, [port1, port2]);

Stop

Stop all ports of current connected devices if they are diffusing

usbController.stopAllPorts();

Disconnect

Disconnect all devices.

usbController.disconnectAll();

Issues

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

License

The Apache License (Apache)
Copyright (c) 2017 Aromajoin Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.