tap-python-sdk 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tap_python_sdk-0.7.0/History.md +87 -0
- tap_python_sdk-0.7.0/LICENSE +11 -0
- tap_python_sdk-0.7.0/MANIFEST.in +9 -0
- tap_python_sdk-0.7.0/PKG-INFO +403 -0
- tap_python_sdk-0.7.0/Readme.md +283 -0
- tap_python_sdk-0.7.0/setup.cfg +4 -0
- tap_python_sdk-0.7.0/setup.py +74 -0
- tap_python_sdk-0.7.0/tap_python_sdk.egg-info/PKG-INFO +403 -0
- tap_python_sdk-0.7.0/tap_python_sdk.egg-info/SOURCES.txt +21 -0
- tap_python_sdk-0.7.0/tap_python_sdk.egg-info/dependency_links.txt +1 -0
- tap_python_sdk-0.7.0/tap_python_sdk.egg-info/requires.txt +14 -0
- tap_python_sdk-0.7.0/tap_python_sdk.egg-info/top_level.txt +1 -0
- tap_python_sdk-0.7.0/tapsdk/__init__.py +10 -0
- tap_python_sdk-0.7.0/tapsdk/__version__.py +1 -0
- tap_python_sdk-0.7.0/tapsdk/enumerations.py +58 -0
- tap_python_sdk-0.7.0/tapsdk/inputmodes.py +71 -0
- tap_python_sdk-0.7.0/tapsdk/parsers.py +74 -0
- tap_python_sdk-0.7.0/tapsdk/tap.py +469 -0
- tap_python_sdk-0.7.0/tests/__init__.py +0 -0
- tap_python_sdk-0.7.0/tests/conftest.py +28 -0
- tap_python_sdk-0.7.0/tests/test_cross_platform.py +32 -0
- tap_python_sdk-0.7.0/tests/test_inputmodes.py +33 -0
- tap_python_sdk-0.7.0/tests/test_parsers.py +94 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# History
|
|
2
|
+
|
|
3
|
+
## Releasing
|
|
4
|
+
|
|
5
|
+
PyPI releases are published automatically when a version tag is pushed to GitHub.
|
|
6
|
+
|
|
7
|
+
1. Bump `__version__` in `tapsdk/__version__.py` and update this file.
|
|
8
|
+
2. Merge the release changes into `develop`, then into `master` as needed.
|
|
9
|
+
3. Create and push an annotated tag whose name matches the package version (for example `v0.7.0`):
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
git tag -a v0.7.0 -m "Release 0.7.0"
|
|
13
|
+
git push origin v0.7.0
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The `Publish to PyPI` workflow runs the same lint and test matrix as CI, verifies that the tag (without the `v` prefix) matches `tapsdk.__version__`, builds the package with `python -m build`, and uploads it to PyPI using Trusted Publishing.
|
|
17
|
+
|
|
18
|
+
Maintainers must configure PyPI Trusted Publishing for the `tap-python-sdk` project name, the `TapWithUs/tap-python-sdk` repository, and a GitHub `pypi` environment before the first automated release.
|
|
19
|
+
|
|
20
|
+
## 0.7.0 (2026-06-09)
|
|
21
|
+
______________________
|
|
22
|
+
### Main features
|
|
23
|
+
|
|
24
|
+
* Unified cross-platform implementation in `tapsdk/tap.py` (removed separate posix/dotnet backends).
|
|
25
|
+
* Windows rewritten to use Bleak/WinRT instead of TAPWin.dll.
|
|
26
|
+
* `InputMode` API: `TapInputMode("…")` replaced by `InputModeText`, `InputModeController`, `InputModeControllerText`, `InputModeRaw`.
|
|
27
|
+
* Raw mode: typed sensitivity enums and optional scaling to mg/mdps (`scaled=True`).
|
|
28
|
+
* Connection and disconnection events implemented on all platforms.
|
|
29
|
+
* Windows: BLE scan and reconnect polling for paired devices.
|
|
30
|
+
* Python requirement raised to 3.9+.
|
|
31
|
+
* CI: cross-platform pytest and flake8.
|
|
32
|
+
* New `AirGestures` values (thumb and state gestures).
|
|
33
|
+
|
|
34
|
+
### Breaking changes
|
|
35
|
+
|
|
36
|
+
* Removed `TapInputMode`, `loop` constructor argument, `tapsdk.models`, and OS-specific examples.
|
|
37
|
+
* Windows no longer uses bundled TAPWin.dll.
|
|
38
|
+
|
|
39
|
+
## 0.6.0 (2024-07-04)
|
|
40
|
+
______________________
|
|
41
|
+
### Main features
|
|
42
|
+
|
|
43
|
+
* Added Spatial features for TapXR.
|
|
44
|
+
* Mac and Linux backends unified to posix backend.
|
|
45
|
+
|
|
46
|
+
### Known Issues
|
|
47
|
+
* Windows backend -
|
|
48
|
+
* Raw sensor data rate might be lower than expected.
|
|
49
|
+
* Sometimes a Tap strap wouldn't be detected upon connection. In this case try restarting your Tap and/or the Python application. In worst case scenario re-pair your Tap.
|
|
50
|
+
* Spatial features are still not available for Windows backend.
|
|
51
|
+
* MacOS & Linux backends -
|
|
52
|
+
* Doesn't support multiple Tap strap connections.
|
|
53
|
+
* OnConnect and OnDisconnect events are not implemented
|
|
54
|
+
* Raw sensor data is given unscaled (i.e. unitless), therefore in order to scale to physical units need to multiply by the relevant scale factor
|
|
55
|
+
|
|
56
|
+
## 0.5.1 (2024-01-01)
|
|
57
|
+
______________________
|
|
58
|
+
### Main features
|
|
59
|
+
|
|
60
|
+
* Support TapXR Air Gesture pinch
|
|
61
|
+
|
|
62
|
+
## 0.5.0 (2021-08-03)
|
|
63
|
+
______________________
|
|
64
|
+
### Main features
|
|
65
|
+
|
|
66
|
+
* Support Bleak 0.12.1 for mac
|
|
67
|
+
|
|
68
|
+
## 0.3.0 (2020-09-07)
|
|
69
|
+
______________________
|
|
70
|
+
### Main features
|
|
71
|
+
|
|
72
|
+
* Linux support
|
|
73
|
+
* Some bug fixes
|
|
74
|
+
|
|
75
|
+
## 0.2.0 (2020-02-22)
|
|
76
|
+
______________________
|
|
77
|
+
### Main features
|
|
78
|
+
|
|
79
|
+
* Added dll to enable windows backend.
|
|
80
|
+
* fix parsers output types on gesture and tap messages
|
|
81
|
+
|
|
82
|
+
## 0.1.0 (2020-02-20)
|
|
83
|
+
______________________
|
|
84
|
+
### Main features
|
|
85
|
+
|
|
86
|
+
* SDK created.
|
|
87
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2020, Tap Systems Inc.
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
|
|
8
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
11
|
+
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tap-python-sdk
|
|
3
|
+
Version: 0.7.0
|
|
4
|
+
Summary: Tap strap python sdk
|
|
5
|
+
Home-page: https://github.com/TapWithUs/tap-python-sdk
|
|
6
|
+
Author: Tap systems Inc.
|
|
7
|
+
Author-email: support@tapwithus.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: bleak==0.6.4; platform_system == "Linux"
|
|
13
|
+
Requires-Dist: bleak==0.12.1; platform_system == "Darwin"
|
|
14
|
+
Requires-Dist: bleak==0.22.3; platform_system == "Windows"
|
|
15
|
+
Requires-Dist: bleak-winrt==1.2.0; platform_system == "Windows"
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: pytest; extra == "dev"
|
|
18
|
+
Requires-Dist: flake8; extra == "dev"
|
|
19
|
+
Dynamic: author
|
|
20
|
+
Dynamic: author-email
|
|
21
|
+
Dynamic: description
|
|
22
|
+
Dynamic: description-content-type
|
|
23
|
+
Dynamic: home-page
|
|
24
|
+
Dynamic: license
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
Dynamic: provides-extra
|
|
27
|
+
Dynamic: requires-dist
|
|
28
|
+
Dynamic: requires-python
|
|
29
|
+
Dynamic: summary
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## TapStrap Python SDK (beta)
|
|
33
|
+
|
|
34
|
+
### What Is This ?
|
|
35
|
+
|
|
36
|
+
TAP python SDK allows you to build python app that can establish BLE connection with Tap Strap and TapXR, send commands and receive events and data - Thus allowing TAP to act as a controller for your app!
|
|
37
|
+
The library is developed with Python >= 3.9 and is **currently in beta**.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Supported Platforms
|
|
41
|
+
This package supports the following platforms:
|
|
42
|
+
* MacOS (tested on 10.15.2) - using Apple's CoreBluetooth library. The library depends on PyObjC which Apple includes with their Python version on OSX. Note that if you're using a different Python, be sure to install PyObjC for that version of Python.
|
|
43
|
+
* Windows 10 - using [Bleak](https://github.com/hbldh/bleak) with WinRT for BLE connectivity (no external DLL required).
|
|
44
|
+
* Linux (tested on Ubuntu 18.04) - need to install libbluetooth-dev and bluez-tools
|
|
45
|
+
```
|
|
46
|
+
sudo apt-get install bluez-tools libbluetooth-dev
|
|
47
|
+
```
|
|
48
|
+
also the user needs to be in the bluetooth group:
|
|
49
|
+
```
|
|
50
|
+
sudo usermod -G bluetooth -a <username>
|
|
51
|
+
#and can reload groups in this shell by running the following command or by logging out and back in:
|
|
52
|
+
su - $USER
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Installation
|
|
57
|
+
|
|
58
|
+
Install the package from PyPI:
|
|
59
|
+
```console
|
|
60
|
+
pip install tap-python-sdk
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Or clone this repo and install the package locally:
|
|
64
|
+
```console
|
|
65
|
+
git clone https://github.com/TapWithUs/tap-python-sdk
|
|
66
|
+
cd tap-python-sdk
|
|
67
|
+
pip install .
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
The SDK is asyncio-based. Pair your Tap device with the OS first, then connect and register callbacks inside an async entry point:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
import asyncio
|
|
75
|
+
from tapsdk import TapSDK
|
|
76
|
+
|
|
77
|
+
async def main():
|
|
78
|
+
tap_device = TapSDK()
|
|
79
|
+
tap_device.register_tap_events(lambda identifier, tapcode: print(identifier, tapcode))
|
|
80
|
+
await tap_device.run() # connects to a paired Tap, or scans until one is found
|
|
81
|
+
|
|
82
|
+
asyncio.run(main())
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
If no Tap is already connected at the OS level, `run()` will scan and wait for a device. On Windows and MacOS it also polls for already-paired devices that reconnect without advertising.
|
|
86
|
+
|
|
87
|
+
Also make sure that you have updated your Tap device to the latest version.
|
|
88
|
+
|
|
89
|
+
### Features
|
|
90
|
+
|
|
91
|
+
This SDK implements two basic interfaces with a Tap device.
|
|
92
|
+
|
|
93
|
+
First is setting the operation mode:
|
|
94
|
+
|
|
95
|
+
1. *Text mode* - the Tap device will operate normally, with no events being sent to the SDK
|
|
96
|
+
2. *Controller mode* - the Tap device will send events to the SDK
|
|
97
|
+
3. *Controller and Text mode* - the Tap device will operate normally, in parallel with sending events to the SDK
|
|
98
|
+
4. *Raw data mode* - the Tap device will stream raw sensors data to the SDK.
|
|
99
|
+
|
|
100
|
+
Second, subscribing to the following events:
|
|
101
|
+
|
|
102
|
+
1. *Tap event* - whenever a tap event has occurred
|
|
103
|
+
2. *Mouse event* - whenever a mouse movement has occurred
|
|
104
|
+
3. *AirGesture event* - whenever one of the gestures is detected
|
|
105
|
+
4. *Raw data* - whenever new raw data sample is being made.
|
|
106
|
+
|
|
107
|
+
Additional to these functional events, there are also some state events, such as connection and disconnection of Tap devices to the SDK backend.
|
|
108
|
+
|
|
109
|
+
#### Spatial Control - NEW
|
|
110
|
+
Authorized developers can gain access to the experimental Spatial Control features:
|
|
111
|
+
1. Extended AirGesture state - enabling aggregation for pinch, drag and swipe gestures.
|
|
112
|
+
2. Select input type - enabling the selection of input type to be activated - i.e. AirMouse/Tapping.
|
|
113
|
+
|
|
114
|
+
These features are only available on TapXR and only for qualified developers. Request access [here](https://www.tapwithus.com/contact-us/)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### Migration from 0.6.x
|
|
118
|
+
|
|
119
|
+
If you are upgrading from an earlier release, note these breaking changes:
|
|
120
|
+
|
|
121
|
+
* `TapInputMode("controller")` → `InputModeController()` (and similarly for other modes). Import from `tapsdk`.
|
|
122
|
+
* `TapInputMode("raw", sensitivity=[2, 1, 4])` → `InputModeRaw(finger_accl_sens=..., imu_gyro_sens=..., imu_accl_sens=...)`. Use the typed enums in `tapsdk.enumerations`.
|
|
123
|
+
* `from tapsdk.models import AirGestures` → `from tapsdk import AirGestures`
|
|
124
|
+
* The `loop=` constructor argument has been removed.
|
|
125
|
+
* Event registration (`register_*`) is synchronous; call it before `await tap_device.run()`.
|
|
126
|
+
* Commands (`set_input_mode`, `set_input_type`, `send_vibration_sequence`) are async and must be awaited.
|
|
127
|
+
* OS-specific examples (`example_unix.py`, `example_win.py`) have been replaced by a single cross-platform `examples/basic.py`.
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
### High level API
|
|
131
|
+
The SDK uses callbacks to implement user functions on the various events. To register a callback, you just have to instance a TapSDK object and:
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
def on_tap_event(identifier, tapcode):
|
|
135
|
+
print(identifier + " tapped " + str(tapcode))
|
|
136
|
+
|
|
137
|
+
tap_device.register_tap_events(on_tap_event)
|
|
138
|
+
```
|
|
139
|
+
#### Commands list
|
|
140
|
+
1. ```set_input_mode(self, input_mode:InputMode, identifier=None):```
|
|
141
|
+
This function sends a mode selection command. It accepts an object of type ```InputMode``` such as ```InputModeText```, ```InputModeController```, ```InputModeControllerText```, or ```InputModeRaw```.
|
|
142
|
+
For example:
|
|
143
|
+
```python
|
|
144
|
+
from tapsdk import InputModeController
|
|
145
|
+
await tap_device.set_input_mode(InputModeController())
|
|
146
|
+
```
|
|
147
|
+
For raw sensors mode, you can specify sensitivity and scaling:
|
|
148
|
+
```python
|
|
149
|
+
from tapsdk import InputModeRaw
|
|
150
|
+
from tapsdk.enumerations import FingerAcclSensitivity, ImuGyroSensitivity, ImuAcclSensitivity
|
|
151
|
+
await tap_device.set_input_mode(InputModeRaw(
|
|
152
|
+
scaled=True,
|
|
153
|
+
finger_accl_sens=FingerAcclSensitivity.G4,
|
|
154
|
+
imu_gyro_sens=ImuGyroSensitivity.DPS250,
|
|
155
|
+
imu_accl_sens=ImuAcclSensitivity.G4
|
|
156
|
+
))
|
|
157
|
+
```
|
|
158
|
+
2. ```set_input_type(self, input_type:InputType, identifier=None):```
|
|
159
|
+
> **Only for TapXR and with Spatial Control experimental firmware**
|
|
160
|
+
|
|
161
|
+
This function sends a command to force input type. It accepts an enum of type ```InputType``` initialized with any of the types ```InputType.MOUSE```, ```InputType.KEYBOARD```, or ```InputType.AUTO```.
|
|
162
|
+
For example:
|
|
163
|
+
```python
|
|
164
|
+
from tapsdk import InputType
|
|
165
|
+
await tap_device.set_input_type(InputType.AUTO)
|
|
166
|
+
```
|
|
167
|
+
This will set the input to be automatically selected by the Tap device, based on hand posture.
|
|
168
|
+
|
|
169
|
+
3. ```send_vibration_sequence(self, sequence:list, identifier=None):```
|
|
170
|
+
This function sends a series of haptic activations. ```sequence``` is a list of integers indicating the activation and delay periods one after another. The periods are in millisecond units, in the range of [10,2550] and in resolution of 10ms. Each haptic command supports up to 18 period definitions (i.e. 9 haptics + delay pairs).
|
|
171
|
+
For example:
|
|
172
|
+
```python
|
|
173
|
+
await tap_device.send_vibration_sequence(sequence=[1000,300,200])
|
|
174
|
+
```
|
|
175
|
+
will trigger a 1s haptic, followed by 300ms delay, followed by 200ms haptic.
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
#### Events list
|
|
179
|
+
1. ```register_connection_events(self, listener:Callable):```
|
|
180
|
+
Register callback to a Tap strap connection event.
|
|
181
|
+
```python
|
|
182
|
+
def on_connect(tap_sdk_instance):
|
|
183
|
+
print("Connected to Tap device")
|
|
184
|
+
|
|
185
|
+
tap_device.register_connection_events(on_connect)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
2. ```register_disconnection_events(self, listener:Callable):```
|
|
189
|
+
Register callback to a Tap strap disconnection event.
|
|
190
|
+
```python
|
|
191
|
+
def on_disconnect(client):
|
|
192
|
+
print("Tap device disconnected")
|
|
193
|
+
|
|
194
|
+
tap_device.register_disconnection_events(on_disconnect)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
3. ```register_tap_events(self, listener:Callable):```
|
|
198
|
+
Register callback to a tap event.
|
|
199
|
+
```python
|
|
200
|
+
def on_tap_event(identifier, tapcode):
|
|
201
|
+
print(identifier + " - tapped " + str(tapcode))
|
|
202
|
+
|
|
203
|
+
tap_device.register_tap_events(on_tap_event)
|
|
204
|
+
```
|
|
205
|
+
```tapcode``` is an 8-bit unsigned number, between 1 and 31 which is formed by a binary representation of the fingers that are tapped.
|
|
206
|
+
The LSb is thumb finger, the MSb is the pinky finger.
|
|
207
|
+
For example: if combination equals 5 - its binary form is 10100 - means that the thumb and the middle fingers were tapped.
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
4. ```register_mouse_events(self, listener:Callable):```
|
|
211
|
+
Register callback to a mouse or air mouse movement event.
|
|
212
|
+
```python
|
|
213
|
+
def on_mouse_event(identifier, vx, vy, proximity):
|
|
214
|
+
print(identifier + " - moused: %d, %d" %(vx, vy))
|
|
215
|
+
|
|
216
|
+
tap_device.register_mouse_events(on_mouse_event)
|
|
217
|
+
```
|
|
218
|
+
```vx``` and ```vy``` are the horizontal and vertical velocities of the mouse movement respectively.
|
|
219
|
+
```proximity``` is a boolean that indicates proximity with a surface.
|
|
220
|
+
5. ```register_raw_data_events(self, listener:Callable):```
|
|
221
|
+
Register callback to raw sensors data packet received event.
|
|
222
|
+
```python
|
|
223
|
+
def on_raw_sensor_data(identifier, packets):
|
|
224
|
+
for packet in packets:
|
|
225
|
+
print(identifier, packet["type"], packet["ts"], packet["payload"])
|
|
226
|
+
|
|
227
|
+
tap_device.register_raw_data_events(on_raw_sensor_data)
|
|
228
|
+
```
|
|
229
|
+
The callback receives a list of dicts, each with keys `type` (`"imu"` or `"accl"`), `ts` (millisecond timestamp), and `payload` (list of sample values). When `InputModeRaw(scaled=True)` is active, values are in mg and mdps.
|
|
230
|
+
You'll find more information on that mode in the dedicated section below or [here](https://tapwithus.atlassian.net/wiki/spaces/TD/pages/792002574/Tap+Strap+Raw+Sensors+Mode).
|
|
231
|
+
|
|
232
|
+
6. ```register_air_gesture_events(self, listener:Callable):```
|
|
233
|
+
Register callback to air gesture events.
|
|
234
|
+
```python
|
|
235
|
+
from tapsdk import AirGestures
|
|
236
|
+
|
|
237
|
+
def on_airgesture(identifier, gesture):
|
|
238
|
+
print(identifier + " - gesture: " + str(AirGestures(gesture)))
|
|
239
|
+
|
|
240
|
+
tap_device.register_air_gesture_events(on_airgesture)
|
|
241
|
+
```
|
|
242
|
+
```gesture``` is an integer code of the air gesture detected. The air gesture values are enumerated in the ```AirGestures``` class, including directional gestures (`UP_ONE_FINGER`, `PINCH`, etc.), thumb gestures (`THUMB_FINGER`, `THUMB_MIDDLE`), and spatial state gestures (`STATE_OPEN`, `STATE_FIST`, etc.).
|
|
243
|
+
|
|
244
|
+
7. ```register_air_gesture_state_events(self, listener:Callable):```
|
|
245
|
+
Register callback to mouse-mode state changes (e.g. air mouse, optical mouse).
|
|
246
|
+
```python
|
|
247
|
+
from tapsdk.enumerations import MouseModes
|
|
248
|
+
|
|
249
|
+
def on_mouse_mode_change(identifier, mouse_mode):
|
|
250
|
+
print(identifier + " - mode: " + str(mouse_mode))
|
|
251
|
+
|
|
252
|
+
tap_device.register_air_gesture_state_events(on_mouse_mode_change)
|
|
253
|
+
```
|
|
254
|
+
```mouse_mode``` is a ```MouseModes``` enum value: `STDBY`, `AIR_MOUSE`, `OPTICAL1`, or `OPTICAL2`.
|
|
255
|
+
|
|
256
|
+
### Raw sensors mode
|
|
257
|
+
|
|
258
|
+
**Make sure that "Developer mode" is enabled on TapManager app for this mode to work properly**
|
|
259
|
+
|
|
260
|
+
In raw sensors mode, the Tap device continuously sends raw data from the following sensors:
|
|
261
|
+
1. Five 3-axis accelerometers - one per each finger (**available only on TAP Strap and Tap Strap 2**).
|
|
262
|
+
* sampled at 200Hz
|
|
263
|
+
* allows dynamic range configuration (±2G, ±4G, ±8G, ±16G)
|
|
264
|
+
2. IMU (3-axis accelerometer + gyro) located on the thumb (**available on TAP Strap 2 and TapXR**).
|
|
265
|
+
* sampled at 208Hz.
|
|
266
|
+
* allows dynamic range configuration for the accelerometer (±2G, ±4G, ±8G, ±16G) and for the gyro (±125dps, ±250dps, ±500dps, ±1000dps, ±2000dps).
|
|
267
|
+
|
|
268
|
+
The sensors measurements are given with respect to the reference system below.
|
|
269
|
+
|
|
270
|
+

|
|
271
|
+

|
|
272
|
+
|
|
273
|
+
Each sample (of accelerometer or imu) is preambled with a millisecond timestamp, referenced to an internal Tap clock.
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
The dynamic range of the sensors is determined with the ```set_input_mode``` method by passing an ```InputModeRaw``` instance with the desired sensitivity enums, and a boolean flag indicating if the data should be scaled to mg and mdps for the accelerometer and gyro respectively:
|
|
277
|
+
```python
|
|
278
|
+
from tapsdk import InputModeRaw
|
|
279
|
+
from tapsdk.enumerations import FingerAcclSensitivity, ImuGyroSensitivity, ImuAcclSensitivity
|
|
280
|
+
|
|
281
|
+
await tap_device.set_input_mode(InputModeRaw(
|
|
282
|
+
scaled=True,
|
|
283
|
+
finger_accl_sens=FingerAcclSensitivity.G4,
|
|
284
|
+
imu_gyro_sens=ImuGyroSensitivity.DPS250,
|
|
285
|
+
imu_accl_sens=ImuAcclSensitivity.G4
|
|
286
|
+
))
|
|
287
|
+
```
|
|
288
|
+
Refer to `FingerAcclSensitivity`, `ImuGyroSensitivity`, and `ImuAcclSensitivity` in [`tapsdk.enumerations`](tapsdk/enumerations.py) for the available sensitivity values.
|
|
289
|
+
|
|
290
|
+
### Examples
|
|
291
|
+
|
|
292
|
+
You can find some examples in the [examples folder](examples).
|
|
293
|
+
|
|
294
|
+
### Testing
|
|
295
|
+
|
|
296
|
+
To run the tests, first install the development dependencies:
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
pip install .[dev]
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Then run the tests using pytest:
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
pytest
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
### Known Issues
|
|
310
|
+
See [History.md](History.md) for release notes. No known issues at 0.7.0.
|
|
311
|
+
|
|
312
|
+
### Support
|
|
313
|
+
|
|
314
|
+
Please refer to the issues tab! :)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
# History
|
|
318
|
+
|
|
319
|
+
## Releasing
|
|
320
|
+
|
|
321
|
+
PyPI releases are published automatically when a version tag is pushed to GitHub.
|
|
322
|
+
|
|
323
|
+
1. Bump `__version__` in `tapsdk/__version__.py` and update this file.
|
|
324
|
+
2. Merge the release changes into `develop`, then into `master` as needed.
|
|
325
|
+
3. Create and push an annotated tag whose name matches the package version (for example `v0.7.0`):
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
git tag -a v0.7.0 -m "Release 0.7.0"
|
|
329
|
+
git push origin v0.7.0
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
The `Publish to PyPI` workflow runs the same lint and test matrix as CI, verifies that the tag (without the `v` prefix) matches `tapsdk.__version__`, builds the package with `python -m build`, and uploads it to PyPI using Trusted Publishing.
|
|
333
|
+
|
|
334
|
+
Maintainers must configure PyPI Trusted Publishing for the `tap-python-sdk` project name, the `TapWithUs/tap-python-sdk` repository, and a GitHub `pypi` environment before the first automated release.
|
|
335
|
+
|
|
336
|
+
## 0.7.0 (2026-06-09)
|
|
337
|
+
______________________
|
|
338
|
+
### Main features
|
|
339
|
+
|
|
340
|
+
* Unified cross-platform implementation in `tapsdk/tap.py` (removed separate posix/dotnet backends).
|
|
341
|
+
* Windows rewritten to use Bleak/WinRT instead of TAPWin.dll.
|
|
342
|
+
* `InputMode` API: `TapInputMode("…")` replaced by `InputModeText`, `InputModeController`, `InputModeControllerText`, `InputModeRaw`.
|
|
343
|
+
* Raw mode: typed sensitivity enums and optional scaling to mg/mdps (`scaled=True`).
|
|
344
|
+
* Connection and disconnection events implemented on all platforms.
|
|
345
|
+
* Windows: BLE scan and reconnect polling for paired devices.
|
|
346
|
+
* Python requirement raised to 3.9+.
|
|
347
|
+
* CI: cross-platform pytest and flake8.
|
|
348
|
+
* New `AirGestures` values (thumb and state gestures).
|
|
349
|
+
|
|
350
|
+
### Breaking changes
|
|
351
|
+
|
|
352
|
+
* Removed `TapInputMode`, `loop` constructor argument, `tapsdk.models`, and OS-specific examples.
|
|
353
|
+
* Windows no longer uses bundled TAPWin.dll.
|
|
354
|
+
|
|
355
|
+
## 0.6.0 (2024-07-04)
|
|
356
|
+
______________________
|
|
357
|
+
### Main features
|
|
358
|
+
|
|
359
|
+
* Added Spatial features for TapXR.
|
|
360
|
+
* Mac and Linux backends unified to posix backend.
|
|
361
|
+
|
|
362
|
+
### Known Issues
|
|
363
|
+
* Windows backend -
|
|
364
|
+
* Raw sensor data rate might be lower than expected.
|
|
365
|
+
* Sometimes a Tap strap wouldn't be detected upon connection. In this case try restarting your Tap and/or the Python application. In worst case scenario re-pair your Tap.
|
|
366
|
+
* Spatial features are still not available for Windows backend.
|
|
367
|
+
* MacOS & Linux backends -
|
|
368
|
+
* Doesn't support multiple Tap strap connections.
|
|
369
|
+
* OnConnect and OnDisconnect events are not implemented
|
|
370
|
+
* Raw sensor data is given unscaled (i.e. unitless), therefore in order to scale to physical units need to multiply by the relevant scale factor
|
|
371
|
+
|
|
372
|
+
## 0.5.1 (2024-01-01)
|
|
373
|
+
______________________
|
|
374
|
+
### Main features
|
|
375
|
+
|
|
376
|
+
* Support TapXR Air Gesture pinch
|
|
377
|
+
|
|
378
|
+
## 0.5.0 (2021-08-03)
|
|
379
|
+
______________________
|
|
380
|
+
### Main features
|
|
381
|
+
|
|
382
|
+
* Support Bleak 0.12.1 for mac
|
|
383
|
+
|
|
384
|
+
## 0.3.0 (2020-09-07)
|
|
385
|
+
______________________
|
|
386
|
+
### Main features
|
|
387
|
+
|
|
388
|
+
* Linux support
|
|
389
|
+
* Some bug fixes
|
|
390
|
+
|
|
391
|
+
## 0.2.0 (2020-02-22)
|
|
392
|
+
______________________
|
|
393
|
+
### Main features
|
|
394
|
+
|
|
395
|
+
* Added dll to enable windows backend.
|
|
396
|
+
* fix parsers output types on gesture and tap messages
|
|
397
|
+
|
|
398
|
+
## 0.1.0 (2020-02-20)
|
|
399
|
+
______________________
|
|
400
|
+
### Main features
|
|
401
|
+
|
|
402
|
+
* SDK created.
|
|
403
|
+
|