Name | touch-sdk JSON |
Version |
0.7.0
JSON |
| download |
home_page | None |
Summary | Doublepoint Touch SDK |
upload_time | 2024-04-15 12:45:16 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | None |
keywords |
bluetooth
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Touch SDK py
![PyPI](https://img.shields.io/pypi/v/touch-sdk)
![PyPI - Downloads](https://img.shields.io/pypi/dm/touch-sdk)
![PyPI - License](https://img.shields.io/pypi/l/touch-sdk)
![Discord](https://img.shields.io/discord/869474617729875998)
Connects to Doublepoint Touch SDK compatible Bluetooth devices – like [this Wear OS app](https://play.google.com/store/apps/details?id=io.port6.watchbridge).
There is also a [web SDK](https://www.npmjs.com/package/touch-sdk) and a [Unity SDK](https://openupm.com/packages/io.port6.sdk/).
See [doublepoint.com/product](https://doublepoint.com/product) for more info.
## Installation
```sh
pip install touch-sdk
```
## Example usage
```python
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).
```python
watch = MyWatch('fvaf')
```
### Tap gesture
```python
def on_tap(self):
print('tap')
```
### Sensors
```python
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
```python
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
```python
def on_rotary(self, direction):
print('rotary', direction)
```
Outputs +1 for clockwise and -1 for counter-clockwise.
### Back button
```python
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
```python
def on_gesture_probability(self, prob):
print(f'probability: {prob}')
```
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
```python
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
```sh
python3 -m pylint src --rcfile=.pylintrc
```
### Adding pylint to pre-commit
```sh
echo 'python3 -m pylint src --rcfile=.pylintrc -sn' > .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
```
Raw data
{
"_id": null,
"home_page": null,
"name": "touch-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "bluetooth",
"author": null,
"author_email": "Doublepoint <developer@doublepoint.com>",
"download_url": "https://files.pythonhosted.org/packages/db/e0/6ef7666af48feae4e4203403d8a3cb3afcec5a02bf702cd45789261fff53/touch_sdk-0.7.0.tar.gz",
"platform": null,
"description": "# Touch SDK py\n\n![PyPI](https://img.shields.io/pypi/v/touch-sdk)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/touch-sdk)\n![PyPI - License](https://img.shields.io/pypi/l/touch-sdk)\n![Discord](https://img.shields.io/discord/869474617729875998)\n\nConnects to Doublepoint Touch SDK compatible Bluetooth devices \u2013 like [this Wear OS app](https://play.google.com/store/apps/details?id=io.port6.watchbridge).\n\nThere is also a [web SDK](https://www.npmjs.com/package/touch-sdk) and a [Unity SDK](https://openupm.com/packages/io.port6.sdk/).\n\nSee [doublepoint.com/product](https://doublepoint.com/product) for more info.\n\n## Installation\n\n```sh\npip install touch-sdk\n```\n\n## Example usage\n```python\nfrom touch_sdk import Watch\n\nclass MyWatch(Watch):\n def on_tap(self):\n print('Tap')\n\nwatch = MyWatch()\nwatch.start()\n```\n\n## Usage\n\nAll callback functions should be methods in the class that inherits `Watch`, like in the example above.\n\nAn optional name string in the constructor will search only for devices with that name (case insensitive).\n\n```python\nwatch = MyWatch('fvaf')\n```\n\n### Tap gesture\n```python\ndef on_tap(self):\n print('tap')\n```\n\n### Sensors\n```python\ndef on_sensors(self, sensors):\n print(sensors.acceleration) # (x, y, z)\n print(sensors.gravity) # (x, y, z)\n print(sensors.angular_velocity) # (x, y, z)\n print(sensors.orientation) # (x, y, z, w)\n print(sensors.magnetic_field) # (x, y, z), or None if unavailable\n print(sensors.magnetic_field_calibration) # (x, y, z), or None if unavailable\n```\n\n### Touch screen\n```python\ndef on_touch_down(self, x, y):\n print('touch down', x, y)\n\ndef on_touch_up(self, x, y):\n print('touch up', x, y)\n\ndef on_touch_move(self, x, y):\n print('touch move', x, y)\n\ndef on_touch_cancel(self, x, y):\n print('touch cancel', x, y)\n```\n\n### Rotary dial\n```python\ndef on_rotary(self, direction):\n print('rotary', direction)\n```\nOutputs +1 for clockwise and -1 for counter-clockwise.\n\n### Back button\n```python\ndef on_back_button(self):\n print('back button')\n```\n\nCalled when the back button is pressed and released. Wear OS does not support separate button down and button up events for the back button.\n\n### Probability output\n```python\ndef on_gesture_probability(self, prob):\n print(f'probability: {prob}')\n```\nTriggered when a gesture detection model produces an output. See `examples/pinch_probability.py` for a complete example.\n\n### Haptics\nThe `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)`.\n\n### Miscellaneous\n```python\nwatch.hand # Hand.NONE, Hand.LEFT or Hand.RIGHT\nwatch.battery_percentage # 0-100\nwatch.touch_screen_resolution # (width, height) or None\nwatch.haptics_available # True if device supports haptic feedback\n```\n\n## Acting as backend for Unity Play Mode\n\nThis 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.\n\n## Unexplainable bugs\nSometimes turning your device's Bluetooth off and on again fixes problems \u2013 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.\n\n## Pylint\n```sh\npython3 -m pylint src --rcfile=.pylintrc\n```\n\n### Adding pylint to pre-commit\n```sh\necho 'python3 -m pylint src --rcfile=.pylintrc -sn' > .git/hooks/pre-commit\nchmod +x .git/hooks/pre-commit\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Doublepoint Touch SDK",
"version": "0.7.0",
"project_urls": {
"Bug Tracker": "https://github.com/doublepointlab/touch-sdk-py/issues",
"Homepage": "https://github.com/doublepointlab/touch-sdk-py#readme"
},
"split_keywords": [
"bluetooth"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b89d239911bb6d8e952bb02c559fb8fcad9e1cf99e9f902fe5659ccef3c6e350",
"md5": "f54d171ef7ba40f67de1b9b5f32a831c",
"sha256": "10d4dc28d59113eeb8c7cbf4b229135c493ed00f5af63f3681e7aabab544f540"
},
"downloads": -1,
"filename": "touch_sdk-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f54d171ef7ba40f67de1b9b5f32a831c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 18401,
"upload_time": "2024-04-15T12:45:14",
"upload_time_iso_8601": "2024-04-15T12:45:14.572798Z",
"url": "https://files.pythonhosted.org/packages/b8/9d/239911bb6d8e952bb02c559fb8fcad9e1cf99e9f902fe5659ccef3c6e350/touch_sdk-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "dbe06ef7666af48feae4e4203403d8a3cb3afcec5a02bf702cd45789261fff53",
"md5": "9bf4f1773215a53e7dbb0a298839b971",
"sha256": "1ddfb0dea012634448b62a683b16ef157120e70c2111f9d7bfff4361de071ff0"
},
"downloads": -1,
"filename": "touch_sdk-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "9bf4f1773215a53e7dbb0a298839b971",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 15858,
"upload_time": "2024-04-15T12:45:16",
"upload_time_iso_8601": "2024-04-15T12:45:16.208802Z",
"url": "https://files.pythonhosted.org/packages/db/e0/6ef7666af48feae4e4203403d8a3cb3afcec5a02bf702cd45789261fff53/touch_sdk-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-15 12:45:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "doublepointlab",
"github_project": "touch-sdk-py",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "touch-sdk"
}