Skip to main content

Touch SDK py

PyPI PyPI - Downloads PyPI - License Discord

Connects to Doublepoint Touch SDK compatible Bluetooth devices – like this Wear OS app.

There is also a web SDK and a Unity SDK.

See doublepoint.com/product for more info.

Installation

pip install touch-sdk

Example usage

from touch_sdk import Watch

class MyWatch(Watch):
    def on_tap(self):
        print('Tap')

watch = MyWatch()
watch.start()

Usage

All callback functions should be methods in the class that inherits Watch, like in the example above.

An optional name string in the constructor will search only for devices with that name (case insensitive).

watch = MyWatch('fvaf')

Tap gesture

def on_tap(self):
    print('tap')

Sensors

def on_sensors(self, sensors):
    print(sensors.acceleration) # (x, y, z)
    print(sensors.gravity) # (x, y, z)
    print(sensors.angular_velocity) # (x, y, z)
    print(sensors.orientation) # (x, y, z, w)
    print(sensors.magnetic_field) # (x, y, z), or None if unavailable
    print(sensors.magnetic_field_calibration) # (x, y, z), or None if unavailable

Touch screen

def on_touch_down(self, x, y):
    print('touch down', x, y)

def on_touch_up(self, x, y):
    print('touch up', x, y)

def on_touch_move(self, x, y):
    print('touch move', x, y)

def on_touch_cancel(self, x, y):
    print('touch cancel', x, y)

Rotary dial

def on_rotary(self, direction):
    print('rotary', direction)

Outputs +1 for clockwise and -1 for counter-clockwise.

Back button

def on_back_button(self):
    print('back button')

Called when the back button is pressed and released. Wear OS does not support separate button down and button up events for the back button.

Probability output

def on_gesture_probability(self, probabilities):
    print(f'probabilities: {probabilities}')

Triggered when a gesture detection model produces an output. See examples/pinch_probability.py for a complete example.

Haptics

The trigger_haptics(intensity, length) method can be used to initiate one-shot haptic effects on the watch. For example, to drive the haptics motor for 300 ms at 100% intensity on watch, call watch.trigger_haptics(1.0, 300).

Miscellaneous

watch.hand # Hand.NONE, Hand.LEFT or Hand.RIGHT
watch.battery_percentage # 0-100
watch.touch_screen_resolution # (width, height) or None
watch.haptics_available # True if device supports haptic feedback

Acting as backend for Unity Play Mode

This package provides the stream_watch module, which makes it possible to use touch-sdk-py as the backend for touch-sdk-unity (>=0.12.0) applications in Play Mode. To use this feature, create a virtual environment in which touch-sdk-py is installed, and then set the python path of the BluetoothWatchProvider script in your Unity project to the virtual environment's python executable.

Unexplainable bugs

Sometimes turning your device's Bluetooth off and on again fixes problems – this has been observed on Linux, Mac and Windows. This is unideal, but those error states are hard to reproduce and thus hard to fix.

Pylint

python3 -m pylint src --rcfile=.pylintrc

Adding pylint to pre-commit

echo 'python3 -m pylint src --rcfile=.pylintrc -sn' > .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

Release files for touch-sdk 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for touch-sdk 0.8.0
File Size Uploaded
touch_sdk-0.8.0.tar.gz 17.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for touch-sdk 0.8.0
File Interpreter ABI Platform
touch_sdk-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 37.8 kB

Release files / touch_sdk-0.8.0.tar.gz

Download URL touch_sdk-0.8.0.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a2e9534f2e167e710aa9c73b72fa57ad734ac466ddb658e10c466d9cd9ad0b02
BLAKE2b-256 checksum
How to use checksums
c03a09e4f1c30d671e258f8e2430daf02154997bb4e14d1b9a134cb6353f0c38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.14

Release files / touch_sdk-0.8.0-py3-none-any.whl

Download URL touch_sdk-0.8.0-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb87c54ba883347994dd2152c988cb63eb58607bdb3923868785573e1e6a5377
BLAKE2b-256 checksum
How to use checksums
fdd58ab6a5610d5af5c69a43d7e55bfa8207733b7648a376cb591e34a4a06ecb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.14

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.0

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page