Skip to content

aromajoin/controller-sdk-ios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English / 日本語

Controller SDK for iOS

License Join the community on Spectrum

The iOS version of AromaShooterController SDK which is used to communicate with Aroma Shooter devices.

Table of Contents

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

Supported devices

  • Aroma Shooter Bluetooth version

Prerequisites

  • iOS version: >= 8.0
  • Swift version: >= 3.0

Installation

  • Download the framework file at the release page.
  • Drag and drop it into your project. (Make sure that it is added in Embedded Binaries section in your project's target page).

Watch a video walkthrough of this process to simplify your life.

Usage

Add Bluetooth usage description to Info.plist file

From iOS 13 and later, it is required to add the Bluetooth usage description, if not the app will be crashed. So, please add the key and its value to the app's Info.plist file.

<key>NSBluetoothAlwaysUsageDescription</key>
<string>The app uses Bluetooth to connect to Aroma Shooter</string>

Besides, if you get the "Target Integrity" in XCode 12.3, please check out the solution here.

Get Controller references

  • Import Controller module
import AromaShooterControllerSwift
  • Get the Controller class reference
var controller = AromaShooterController.sharedInstance

Connect/disconnect devices

We have done the connection UI part for you. You can easily open the connection view controller by one of two ways. if you are using NavigationController, please use these codes.

let connectionVC = controller.getConnectionViewController()
if let connectionVC = connectionVC {
  self.navigationController?.pushViewController(connectionVC, animated: true)
}

In other cases, you can use the below codes.

let connectionVC = controller.getConnectionViewController()
if let connectionVC = connectionVC {
  self.present(connectionVC, animated: true, completion: nil)
}

Get connected devices

let connectedDevices = controller.connectedDevices

Diffuse scents

  • Diffuse scents of all connected devices
controller.diffuseAll(duration: 3000, booster: true, ports: [1, 2, 3])
  • Diffuse scents of specific devices
controller.diffuse(aromaShooters: devices, duration: 3000, booster: true, port: [1, 2, 3])
  • Diffuse scents method for AS2 (AromaShooter 2) devices only
controller.diffuseAll(durationInMilli: 1000, boosterIntensity: 0, fanIntensity: 50, ports: [CartridgePort(number: 3, intensityPercent: 100)])

controller.diffuse(aromaShooters: controller.connectedDevices, durationInMilli: 1000, boosterIntensity: 50, fanIntensity: 40, ports: [CartridgePort(number: 3, intensityPercent: 100)])

Stop diffusing

Stop all ports of current connected devices if they have been diffusing

controller.stopAll();

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.

License

Please check the LICENSE file for the details.