Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

eSense iOS Library

CI Status Version License Platform

This library allows us to use eSense (earable computing platform) on iOS easily. This library is inspired by eSense library for Android which is developed by Pervasive Systems team at Nokia Bell Labs Cambridge.


To run the example project, clone the repo, and run pod install from the Example directory first.


iOS 10 or later


ESense is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ESense'

Use eSense Library

  1. Import the library in your iOS project
import ESense
  1. Implement ESenseConnectionListener on your class
extension YOUR_CLASS:ESenseConnectionListener{
    func onDeviceFound(_ manager: ESenseManager) {
        // YOUR CODE HERE

    func onDeviceNotFound(_ manager: ESenseManager) {
        // YOUR CODE HERE

    func onConnected(_ manager: ESenseManager) {
        manager.setDeviceReadyHandler { device in
            // YOUR CODE HERE

    func onDisconnected(_ manager: ESenseManager) {
        // YOUR CODE HERE
  1. Create the ESenseManager instance

Prepare a variable for ESenseManager as a class or static variable.

var manager:ESenseManager? = nil

Initialize an ESenseManager class using a target device name and a class which is implemented the ESenseConnectionListener.

manager = ESenseManager(deviceName: "YOUR_ESENSE_NAME", listener: YOUR_CLASS)
  1. Scan and connect an eSense device

For scanning an eSense device, you can use scan(timeout) method. If ESenseManager finds an eSense device, onDeviceFind(manager) method on ESenseConnectionListener is called.

manager.scan(timeout: SECOND)
  1. Handling sensor update events

After connecting the device, you can listen the sensor change events via ESenseSensrListener. Please implement ESenseSensorListener in your class just like below.

extension YOUR_CLASS:ESenseSensorListener{
    func onSensorChanged(_ evt: ESenseEvent) {
        // YOUR CODE HERE

Finally, you can set the ESenseSensorListener into your ESenseManager with a sampling late (hz).

manager.registerSensorListener(YOUR_CLASS, hz: 10)
  1. Handling eSense device events

In addition, you can handle eSense other events (battery, button, and config related events) using ESenseEventListener. Please implement ESenseEventListener on your class.

extension YOUR_CLASS:ESenseEventListener{
    func onBatteryRead(_ voltage: Double) {
        // YOUR CODE HERE

    func onButtonEventChanged(_ pressed: Bool) {
        // YOUR CODE HERE

    func onAdvertisementAndConnectionIntervalRead(_ minAdvertisementInterval: Int, _ maxAdvertisementInterval: Int, _ minConnectionInterval: Int, _ maxConnectionInterval: Int) {
        // YOUR CODE HERE

    func onDeviceNameRead(_ deviceName: String) {
        // YOUR CODE HERE

    func onSensorConfigRead(_ config: ESenseConfig) {
        // YOUR CODE HERE

    func onAccelerometerOffsetRead(_ offsetX: Int, _ offsetY: Int, _ offsetZ: Int) {
        // YOUR CODE HERE

Also, you can registe the implement listener by registerEventListener(ESenseEventListener) method on ESenseManager class.


Executing read operations will trigger events on ESenseEventListener.



eSense Library for iOS is developed by Yuuki Nishiyama (The University of Tokyo, Japan)


ESense is available under the MIT license. See the LICENSE file for more info.