sensor-sdk 0.0.2__py3-none-any.whl → 0.0.3__py3-none-any.whl
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.
Potentially problematic release.
This version of sensor-sdk might be problematic. Click here for more details.
- sensor/sensor_data_context.py +2 -2
- {sensor_sdk-0.0.2.dist-info → sensor_sdk-0.0.3.dist-info}/METADATA +64 -36
- {sensor_sdk-0.0.2.dist-info → sensor_sdk-0.0.3.dist-info}/RECORD +7 -7
- {sensor_sdk-0.0.2.dist-info → sensor_sdk-0.0.3.dist-info}/LICENSE.txt +0 -0
- {sensor_sdk-0.0.2.dist-info → sensor_sdk-0.0.3.dist-info}/WHEEL +0 -0
- {sensor_sdk-0.0.2.dist-info → sensor_sdk-0.0.3.dist-info}/top_level.txt +0 -0
- {sensor_sdk-0.0.2.dist-info → sensor_sdk-0.0.3.dist-info}/zip-safe +0 -0
sensor/sensor_data_context.py
CHANGED
|
@@ -375,8 +375,8 @@ class SensorProfileDataCtx:
|
|
|
375
375
|
saturation = 0.0
|
|
376
376
|
if sensorData.dataType == DataType.NTF_ECG:
|
|
377
377
|
impedanceChannelIndex = self.sensorDatas[SensorDataType.DATA_TYPE_EEG].channelCount
|
|
378
|
-
|
|
379
|
-
|
|
378
|
+
impedance = _impedanceData[impedanceChannelIndex]
|
|
379
|
+
saturation = _saturationData[impedanceChannelIndex]
|
|
380
380
|
impedanceChannelIndex += 1
|
|
381
381
|
|
|
382
382
|
dataItem = Sample()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sensor-sdk
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: Python sdk for Synchroni
|
|
5
5
|
Home-page: https://github.com/oymotion/SynchroniSDKPython
|
|
6
6
|
Author: Martin Ye
|
|
@@ -12,7 +12,7 @@ Requires-Dist: numpy
|
|
|
12
12
|
Requires-Dist: setuptools
|
|
13
13
|
Requires-Dist: bleak
|
|
14
14
|
|
|
15
|
-
#
|
|
15
|
+
# sensor-sdk
|
|
16
16
|
|
|
17
17
|
Synchroni sdk for Python
|
|
18
18
|
|
|
@@ -20,7 +20,6 @@ Synchroni sdk for Python
|
|
|
20
20
|
|
|
21
21
|
Synchroni SDK is the software development kit for developers to access Synchroni products.
|
|
22
22
|
|
|
23
|
-
|
|
24
23
|
## Contributing
|
|
25
24
|
|
|
26
25
|
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
@@ -37,7 +36,7 @@ MIT
|
|
|
37
36
|
pip install sensor-sdk
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
## 1. Permission
|
|
39
|
+
## 1. Permission
|
|
41
40
|
|
|
42
41
|
Application will obtain bluetooth permission by itself.
|
|
43
42
|
|
|
@@ -47,9 +46,9 @@ Application will obtain bluetooth permission by itself.
|
|
|
47
46
|
from sensor import *
|
|
48
47
|
```
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
## SensorController methods
|
|
51
50
|
|
|
52
|
-
|
|
51
|
+
### 1. Initalize
|
|
53
52
|
|
|
54
53
|
```python
|
|
55
54
|
SensorControllerInstance = SensorController()
|
|
@@ -62,33 +61,41 @@ if not SensorControllerInstance.hasDeviceFoundCallback:
|
|
|
62
61
|
SensorControllerInstance.onDeviceFoundCallback = on_device_callback
|
|
63
62
|
```
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
### 2. Start scan
|
|
65
|
+
|
|
66
|
+
Use `def startScan(period_in_ms: int) -> bool` to start scan
|
|
67
|
+
|
|
67
68
|
```python
|
|
68
69
|
success = SensorControllerInstance.startScan(6000)
|
|
69
70
|
```
|
|
71
|
+
|
|
70
72
|
returns true if start scan success, periodInMS means onDeviceCallback will be called every periodInMS
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
### 3. Stop scan
|
|
75
|
+
|
|
76
|
+
Use `def stopScan() -> None` to stop scan
|
|
73
77
|
|
|
74
|
-
Use `def stop_scan() -> None` to stop scan
|
|
75
78
|
```python
|
|
76
79
|
SensorControllerInstance.stopScan()
|
|
77
80
|
```
|
|
78
|
-
|
|
81
|
+
|
|
82
|
+
### 4. Check scaning
|
|
79
83
|
|
|
80
84
|
Use `property isScanning: bool` to check scanning status
|
|
85
|
+
|
|
81
86
|
```python
|
|
82
87
|
isScanning = SensorControllerInstance.isScanning
|
|
83
88
|
```
|
|
84
89
|
|
|
85
|
-
|
|
90
|
+
### 5. Check if bluetooth is enabled
|
|
86
91
|
|
|
87
92
|
Use `property isEnabled: bool` to check if bluetooth is enabled
|
|
93
|
+
|
|
88
94
|
```python
|
|
89
95
|
isEnabled = SensorControllerInstance.isEnabled
|
|
90
96
|
```
|
|
91
|
-
|
|
97
|
+
|
|
98
|
+
### 6. Create SensorProfile
|
|
92
99
|
|
|
93
100
|
Use `def requireSensor(device: BLEDevice) -> SensorProfile | None` to create SensorProfile.
|
|
94
101
|
|
|
@@ -98,7 +105,7 @@ If bleDevice is invalid, result is None.
|
|
|
98
105
|
sensorProfile = SensorControllerInstance.requireSensor(bleDevice)
|
|
99
106
|
```
|
|
100
107
|
|
|
101
|
-
|
|
108
|
+
### 7. Get SensorProfile
|
|
102
109
|
|
|
103
110
|
Use `def getSensor(device: BLEDevice) -> SensorProfile | None` to get SensorProfile.
|
|
104
111
|
|
|
@@ -108,24 +115,27 @@ If SensorProfile didn't created, result is None.
|
|
|
108
115
|
sensorProfile = SensorControllerInstance.getSensor(bleDevice)
|
|
109
116
|
```
|
|
110
117
|
|
|
111
|
-
|
|
118
|
+
### 8. Get Connected SensorProfiles
|
|
112
119
|
|
|
113
120
|
Use `def getConnectedSensors() -> list[SensorProfile]` to get connected SensorProfiles.
|
|
121
|
+
|
|
114
122
|
```python
|
|
115
123
|
sensorProfiles = SensorControllerInstance.getConnectedSensors()
|
|
116
124
|
```
|
|
117
125
|
|
|
118
|
-
|
|
126
|
+
### 9. Get Connected BLE Devices
|
|
119
127
|
|
|
120
128
|
Use `def getConnectedDevices() -> list[SensorProfile]` to get connected BLE Devices.
|
|
129
|
+
|
|
121
130
|
```python
|
|
122
131
|
bleDevices = SensorControllerInstance.getConnectedDevices()
|
|
123
132
|
```
|
|
124
133
|
|
|
125
|
-
|
|
134
|
+
### 10. Terminate
|
|
135
|
+
|
|
136
|
+
Use `def terminate()` to terminate sdk
|
|
126
137
|
|
|
127
138
|
```python
|
|
128
|
-
SensorControllerInstance.terminate()
|
|
129
139
|
|
|
130
140
|
def terminate():
|
|
131
141
|
SensorControllerInstance.terminate()
|
|
@@ -136,13 +146,15 @@ def main():
|
|
|
136
146
|
time.sleep(30)
|
|
137
147
|
SensorControllerInstance.terminate()
|
|
138
148
|
|
|
139
|
-
Please call terminate when exit main() or press Ctrl+C
|
|
149
|
+
Please MAKE SURE to call terminate when exit main() or press Ctrl+C
|
|
140
150
|
```
|
|
141
151
|
|
|
142
|
-
|
|
152
|
+
## SensorProfile methods
|
|
153
|
+
|
|
154
|
+
### 11. Initalize
|
|
143
155
|
|
|
144
|
-
## 1. Initalize
|
|
145
156
|
Please register callbacks for SensorProfile
|
|
157
|
+
|
|
146
158
|
```python
|
|
147
159
|
sensorProfile = SensorControllerInstance.requireSensor(bleDevice)
|
|
148
160
|
|
|
@@ -169,26 +181,30 @@ sensorProfile.onPowerChanged = on_power_changed
|
|
|
169
181
|
sensorProfile.onDataCallback = on_data_callback
|
|
170
182
|
```
|
|
171
183
|
|
|
172
|
-
|
|
184
|
+
### 12. Connect device
|
|
185
|
+
|
|
173
186
|
Use `def connect() -> bool` to connect.
|
|
187
|
+
|
|
174
188
|
```python
|
|
175
189
|
success = sensorProfile.connect()
|
|
176
190
|
```
|
|
177
191
|
|
|
178
|
-
|
|
192
|
+
### 13. Disconnect
|
|
193
|
+
|
|
179
194
|
Use `def disconnect() -> bool` to disconnect.
|
|
195
|
+
|
|
180
196
|
```python
|
|
181
197
|
success = sensorProfile.disconnect()
|
|
182
198
|
```
|
|
183
199
|
|
|
200
|
+
### 14. Get device status
|
|
184
201
|
|
|
185
|
-
|
|
186
|
-
Use `property connectionState: DeviceStateEx` to get device status.
|
|
202
|
+
Use `property deviceState: DeviceStateEx` to get device status.
|
|
187
203
|
|
|
188
204
|
Please send command in 'Ready' state, should be after connect() return True.
|
|
189
205
|
|
|
190
206
|
```python
|
|
191
|
-
deviceStateEx = sensorProfile.
|
|
207
|
+
deviceStateEx = sensorProfile.deviceState
|
|
192
208
|
|
|
193
209
|
# deviceStateEx has define:
|
|
194
210
|
# class DeviceStateEx(Enum):
|
|
@@ -200,15 +216,16 @@ deviceStateEx = sensorProfile.connectionState
|
|
|
200
216
|
# Invalid = 5
|
|
201
217
|
```
|
|
202
218
|
|
|
219
|
+
### 15. Get BLE device of SensorProfile
|
|
203
220
|
|
|
204
|
-
|
|
205
|
-
## 5. Get BLE device of SensorProfile
|
|
206
221
|
Use `property BLEDevice: BLEDevice` to get BLE device of SensorProfile.
|
|
222
|
+
|
|
207
223
|
```python
|
|
208
224
|
bleDevice = sensorProfile.BLEDevice
|
|
209
225
|
```
|
|
210
226
|
|
|
211
|
-
|
|
227
|
+
### 16. Get device info of SensorProfile
|
|
228
|
+
|
|
212
229
|
Use `def getDeviceInfo() -> dict | None` to get device info of SensorProfile.
|
|
213
230
|
|
|
214
231
|
Please call after device in 'Ready' state, return None if it's not connected.
|
|
@@ -232,28 +249,34 @@ Please call after device in 'Ready' state, return None if it's not connected.
|
|
|
232
249
|
# }
|
|
233
250
|
```
|
|
234
251
|
|
|
252
|
+
### 17. Init data transfer
|
|
235
253
|
|
|
236
|
-
## 7. Init data transfer
|
|
237
254
|
Use `def init(packageSampleCount: int, powerRefreshInterval: int) -> bool`.
|
|
238
255
|
|
|
239
256
|
Please call after device in 'Ready' state, return True if init succeed.
|
|
257
|
+
|
|
240
258
|
```python
|
|
241
259
|
success = sensorProfile.init(5, 60*1000)
|
|
242
260
|
```
|
|
261
|
+
|
|
243
262
|
packageSampleCount: set sample counts of SensorData.channelSamples in onDataCallback()
|
|
244
263
|
powerRefreshInterval: callback period for onPowerChanged()
|
|
245
264
|
|
|
246
|
-
|
|
265
|
+
### 18. Check if init data transfer succeed
|
|
266
|
+
|
|
247
267
|
Use `property hasInited: bool` to check if init data transfer succeed.
|
|
268
|
+
|
|
248
269
|
```python
|
|
249
270
|
hasInited = sensorProfile.hasInited
|
|
250
271
|
```
|
|
251
272
|
|
|
252
|
-
|
|
273
|
+
### 19. DataNotify
|
|
274
|
+
|
|
253
275
|
Use `def startDataNotification() -> bool` to start data notification.
|
|
254
276
|
|
|
255
277
|
Please call if hasInited return True
|
|
256
|
-
|
|
278
|
+
|
|
279
|
+
#### 19.1 Start data transfer
|
|
257
280
|
|
|
258
281
|
```python
|
|
259
282
|
success = sensorProfile.startDataNotification()
|
|
@@ -293,19 +316,24 @@ def on_data_callback(sensor, data):
|
|
|
293
316
|
sensorProfile.onDataCallback = on_data_callback
|
|
294
317
|
```
|
|
295
318
|
|
|
296
|
-
|
|
319
|
+
#### 19.2 Stop data transfer
|
|
320
|
+
|
|
297
321
|
Use `def stopDataNotification() -> bool` to stop data transfer.
|
|
322
|
+
|
|
298
323
|
```python
|
|
299
324
|
success = sensorProfile.stopDataNotification()
|
|
300
325
|
```
|
|
301
326
|
|
|
302
|
-
|
|
327
|
+
#### 19.3 Check if it's data transfering
|
|
328
|
+
|
|
303
329
|
Use `property isDataTransfering: bool` to check if it's data transfering.
|
|
330
|
+
|
|
304
331
|
```python
|
|
305
332
|
isDataTransfering = sensorProfile.isDataTransfering
|
|
306
333
|
```
|
|
307
334
|
|
|
308
|
-
|
|
335
|
+
### 20. Get battery level
|
|
336
|
+
|
|
309
337
|
Use `def getBatteryLevel() -> int` to get battery level. Please call after device in 'Ready' state.
|
|
310
338
|
|
|
311
339
|
```python
|
|
@@ -2,13 +2,13 @@ sensor/__init__.py,sha256=L1VyAP0EDEnJIMeMTzp4iXHSRUUHyHScF_GIl3iYKRI,123
|
|
|
2
2
|
sensor/gforce.py,sha256=ZVOHV6_NiwGMPAf4BXqlxEHsDrynUBr0rcgqmbJT5oc,24586
|
|
3
3
|
sensor/sensor_controller.py,sha256=SD4kcU9Z0IjAoCDCtpM475TpuNwymGxmuFATP4NjY9M,8078
|
|
4
4
|
sensor/sensor_data.py,sha256=pHHHitKPs24MWYorW0DrIe4DKOMZU9c5Oh2mGktDUGg,4449
|
|
5
|
-
sensor/sensor_data_context.py,sha256=
|
|
5
|
+
sensor/sensor_data_context.py,sha256=yFeCydxg2gpAu9Znp_OQup2XPO1iwmJMDTxVvyNEcVY,24140
|
|
6
6
|
sensor/sensor_device.py,sha256=XLpYe7jlc60PmIstdcqWJ_Vr1CxR2GPVAx5ll_ofnPM,3052
|
|
7
7
|
sensor/sensor_profile.py,sha256=44dCvb6EDv1fT6LJfjWmKlH_BMMVfdt46PlNO_LZaJs,17096
|
|
8
8
|
sensor/utils.py,sha256=rrgMKIPJ3u1iVSbQqcfUhlQ5h_IatHNPtqojdUHIc9Y,741
|
|
9
|
-
sensor_sdk-0.0.
|
|
10
|
-
sensor_sdk-0.0.
|
|
11
|
-
sensor_sdk-0.0.
|
|
12
|
-
sensor_sdk-0.0.
|
|
13
|
-
sensor_sdk-0.0.
|
|
14
|
-
sensor_sdk-0.0.
|
|
9
|
+
sensor_sdk-0.0.3.dist-info/LICENSE.txt,sha256=8CSivOpub3IuXODTyqBRI91AxouJZk02YrcKuOAkWu8,1111
|
|
10
|
+
sensor_sdk-0.0.3.dist-info/METADATA,sha256=qgnH7Pvzl3BstfDE1zHtBL1qH48t0AaDo9fmR5O44Bs,8055
|
|
11
|
+
sensor_sdk-0.0.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
12
|
+
sensor_sdk-0.0.3.dist-info/top_level.txt,sha256=Ftq49B6bH0Ffdc7c8LkcyakHo6lsg_snlBbpEUoILSk,7
|
|
13
|
+
sensor_sdk-0.0.3.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
14
|
+
sensor_sdk-0.0.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|