Skip to content

Small Objective-C library for controlling Lovense sex toys (Lush, Hush, Nora, Max) over Bluetooth LE from an iOS device

License

Notifications You must be signed in to change notification settings

mattbierner/lovense-ios-controller

Repository files navigation

Lovense iOS Controller

Small Objective-C library for controlling Lovense sex toys (Lush, Hush, Nora, Max) over Bluetooth LE from an iOS device.

Usage

To get started, simply include LovenseController.h and LovenseController.m in your project.

The library use Core Bluetooth for communicating with the toys. To connect a Hush or Lush for example, start by scanning for devices:

#import "LovenseController.h"

...

CBCentralManager* blueToothManager = ...;

[blueToothManager scanForPeripheralsWithServices:@[LovenseVibratorController.serviceUUID] options:nil];

After connecting to the discovered vibrator using Core Bluetooth, create a LovenseVibratorController from the CBPeripheral to start using it:

- (void) centralManager:(CBCentralManager *)central
    didConnectPeripheral:(CBPeripheral *)peripheral
{
    // Create a controller for a lush or hush device
    [LovenseVibratorController createWithPeripheral:peripheral onReady:^(LovenseVibratorController* toy, NSError* err) {
        if (err) {
            NSLog(@"Error: %@", err);
            return;
        }

        // Get the battery level
        [toy getBattery:^(NSNumber* result, NSError* err) {
            NSLog(@"Battery: %@", result);
        }];
    
        // Start vibrations
        [toy setVibration:5 onComplete:^(BOOL ok, NSError* error) {
            NSLog(@"Started vibration");
        }];
    }];
}

Example App

A very basic example iOS application is included in example/. This app shows how to use basic Core Bluetooth to connect to a Lush or Hush or Max toy and control vibration.

Limitations

This library is a prototype and not production ready.

  • Untested on the Nora. I guessed that it works like the Max, but cannot verify this. If you a Nora can help test, please let me know or submit a PR with any fixes.
  • No interfaces for reading accelerometer data.
  • Unsupported/invalid commands are not handled well.
  • Needs more testing around error cases.
  • Needs more testing for threading and potential communication interleaving issues.
  • The example app is super basic and buggy.

PRs are welcome.

Credits


Disclaimer: I'm not affiliated with Lovense in any way. This project is for noncommercial, personal use. For commercial applications, try contacting Lovense.

About

Small Objective-C library for controlling Lovense sex toys (Lush, Hush, Nora, Max) over Bluetooth LE from an iOS device

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published