sensor-sdk 0.0.2__tar.gz → 0.0.3__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.

Potentially problematic release.


This version of sensor-sdk might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sensor-sdk
3
- Version: 0.0.2
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
@@ -9,7 +9,7 @@ Requires-Python: >=3.8.0
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE.txt
11
11
 
12
- # synchroni_sdk_python
12
+ # sensor-sdk
13
13
 
14
14
  Synchroni sdk for Python
15
15
 
@@ -17,7 +17,6 @@ Synchroni sdk for Python
17
17
 
18
18
  Synchroni SDK is the software development kit for developers to access Synchroni products.
19
19
 
20
-
21
20
  ## Contributing
22
21
 
23
22
  See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
@@ -34,7 +33,7 @@ MIT
34
33
  pip install sensor-sdk
35
34
  ```
36
35
 
37
- ## 1. Permission
36
+ ## 1. Permission
38
37
 
39
38
  Application will obtain bluetooth permission by itself.
40
39
 
@@ -44,9 +43,9 @@ Application will obtain bluetooth permission by itself.
44
43
  from sensor import *
45
44
  ```
46
45
 
47
- # SensorController methods:
46
+ ## SensorController methods
48
47
 
49
- ## 1. Initalize
48
+ ### 1. Initalize
50
49
 
51
50
  ```python
52
51
  SensorControllerInstance = SensorController()
@@ -59,33 +58,41 @@ if not SensorControllerInstance.hasDeviceFoundCallback:
59
58
  SensorControllerInstance.onDeviceFoundCallback = on_device_callback
60
59
  ```
61
60
 
62
- ## 2. Start scan
63
- Use `def start_scan(period_in_ms: int) -> bool` to start scan
61
+ ### 2. Start scan
62
+
63
+ Use `def startScan(period_in_ms: int) -> bool` to start scan
64
+
64
65
  ```python
65
66
  success = SensorControllerInstance.startScan(6000)
66
67
  ```
68
+
67
69
  returns true if start scan success, periodInMS means onDeviceCallback will be called every periodInMS
68
70
 
69
- ## 3. Stop scan
71
+ ### 3. Stop scan
72
+
73
+ Use `def stopScan() -> None` to stop scan
70
74
 
71
- Use `def stop_scan() -> None` to stop scan
72
75
  ```python
73
76
  SensorControllerInstance.stopScan()
74
77
  ```
75
- ## 4. Check scaning
78
+
79
+ ### 4. Check scaning
76
80
 
77
81
  Use `property isScanning: bool` to check scanning status
82
+
78
83
  ```python
79
84
  isScanning = SensorControllerInstance.isScanning
80
85
  ```
81
86
 
82
- ## 5. Check if bluetooth is enabled
87
+ ### 5. Check if bluetooth is enabled
83
88
 
84
89
  Use `property isEnabled: bool` to check if bluetooth is enabled
90
+
85
91
  ```python
86
92
  isEnabled = SensorControllerInstance.isEnabled
87
93
  ```
88
- ## 6. Create SensorProfile
94
+
95
+ ### 6. Create SensorProfile
89
96
 
90
97
  Use `def requireSensor(device: BLEDevice) -> SensorProfile | None` to create SensorProfile.
91
98
 
@@ -95,7 +102,7 @@ If bleDevice is invalid, result is None.
95
102
  sensorProfile = SensorControllerInstance.requireSensor(bleDevice)
96
103
  ```
97
104
 
98
- ## 7. Get SensorProfile
105
+ ### 7. Get SensorProfile
99
106
 
100
107
  Use `def getSensor(device: BLEDevice) -> SensorProfile | None` to get SensorProfile.
101
108
 
@@ -105,24 +112,27 @@ If SensorProfile didn't created, result is None.
105
112
  sensorProfile = SensorControllerInstance.getSensor(bleDevice)
106
113
  ```
107
114
 
108
- ## 8. Get Connected SensorProfiles
115
+ ### 8. Get Connected SensorProfiles
109
116
 
110
117
  Use `def getConnectedSensors() -> list[SensorProfile]` to get connected SensorProfiles.
118
+
111
119
  ```python
112
120
  sensorProfiles = SensorControllerInstance.getConnectedSensors()
113
121
  ```
114
122
 
115
- ## 9. Get Connected BLE Devices
123
+ ### 9. Get Connected BLE Devices
116
124
 
117
125
  Use `def getConnectedDevices() -> list[SensorProfile]` to get connected BLE Devices.
126
+
118
127
  ```python
119
128
  bleDevices = SensorControllerInstance.getConnectedDevices()
120
129
  ```
121
130
 
122
- ## 10. Terminate
131
+ ### 10. Terminate
132
+
133
+ Use `def terminate()` to terminate sdk
123
134
 
124
135
  ```python
125
- SensorControllerInstance.terminate()
126
136
 
127
137
  def terminate():
128
138
  SensorControllerInstance.terminate()
@@ -133,13 +143,15 @@ def main():
133
143
  time.sleep(30)
134
144
  SensorControllerInstance.terminate()
135
145
 
136
- Please call terminate when exit main() or press Ctrl+C
146
+ Please MAKE SURE to call terminate when exit main() or press Ctrl+C
137
147
  ```
138
148
 
139
- # SensorProfile methods:
149
+ ## SensorProfile methods
150
+
151
+ ### 11. Initalize
140
152
 
141
- ## 1. Initalize
142
153
  Please register callbacks for SensorProfile
154
+
143
155
  ```python
144
156
  sensorProfile = SensorControllerInstance.requireSensor(bleDevice)
145
157
 
@@ -166,26 +178,30 @@ sensorProfile.onPowerChanged = on_power_changed
166
178
  sensorProfile.onDataCallback = on_data_callback
167
179
  ```
168
180
 
169
- ## 2. Connect device
181
+ ### 12. Connect device
182
+
170
183
  Use `def connect() -> bool` to connect.
184
+
171
185
  ```python
172
186
  success = sensorProfile.connect()
173
187
  ```
174
188
 
175
- ## 3. Disconnect
189
+ ### 13. Disconnect
190
+
176
191
  Use `def disconnect() -> bool` to disconnect.
192
+
177
193
  ```python
178
194
  success = sensorProfile.disconnect()
179
195
  ```
180
196
 
197
+ ### 14. Get device status
181
198
 
182
- ## 4. Get device status
183
- Use `property connectionState: DeviceStateEx` to get device status.
199
+ Use `property deviceState: DeviceStateEx` to get device status.
184
200
 
185
201
  Please send command in 'Ready' state, should be after connect() return True.
186
202
 
187
203
  ```python
188
- deviceStateEx = sensorProfile.connectionState
204
+ deviceStateEx = sensorProfile.deviceState
189
205
 
190
206
  # deviceStateEx has define:
191
207
  # class DeviceStateEx(Enum):
@@ -197,15 +213,16 @@ deviceStateEx = sensorProfile.connectionState
197
213
  # Invalid = 5
198
214
  ```
199
215
 
216
+ ### 15. Get BLE device of SensorProfile
200
217
 
201
-
202
- ## 5. Get BLE device of SensorProfile
203
218
  Use `property BLEDevice: BLEDevice` to get BLE device of SensorProfile.
219
+
204
220
  ```python
205
221
  bleDevice = sensorProfile.BLEDevice
206
222
  ```
207
223
 
208
- ## 6. Get device info of SensorProfile
224
+ ### 16. Get device info of SensorProfile
225
+
209
226
  Use `def getDeviceInfo() -> dict | None` to get device info of SensorProfile.
210
227
 
211
228
  Please call after device in 'Ready' state, return None if it's not connected.
@@ -229,28 +246,34 @@ Please call after device in 'Ready' state, return None if it's not connected.
229
246
  # }
230
247
  ```
231
248
 
249
+ ### 17. Init data transfer
232
250
 
233
- ## 7. Init data transfer
234
251
  Use `def init(packageSampleCount: int, powerRefreshInterval: int) -> bool`.
235
252
 
236
253
  Please call after device in 'Ready' state, return True if init succeed.
254
+
237
255
  ```python
238
256
  success = sensorProfile.init(5, 60*1000)
239
257
  ```
258
+
240
259
  packageSampleCount: set sample counts of SensorData.channelSamples in onDataCallback()
241
260
  powerRefreshInterval: callback period for onPowerChanged()
242
261
 
243
- ## 8. Check if init data transfer succeed
262
+ ### 18. Check if init data transfer succeed
263
+
244
264
  Use `property hasInited: bool` to check if init data transfer succeed.
265
+
245
266
  ```python
246
267
  hasInited = sensorProfile.hasInited
247
268
  ```
248
269
 
249
- ## 9. DataNotify
270
+ ### 19. DataNotify
271
+
250
272
  Use `def startDataNotification() -> bool` to start data notification.
251
273
 
252
274
  Please call if hasInited return True
253
- ### 9.1 Start data transfer
275
+
276
+ #### 19.1 Start data transfer
254
277
 
255
278
  ```python
256
279
  success = sensorProfile.startDataNotification()
@@ -290,19 +313,24 @@ def on_data_callback(sensor, data):
290
313
  sensorProfile.onDataCallback = on_data_callback
291
314
  ```
292
315
 
293
- ### 9.2 Stop data transfer
316
+ #### 19.2 Stop data transfer
317
+
294
318
  Use `def stopDataNotification() -> bool` to stop data transfer.
319
+
295
320
  ```python
296
321
  success = sensorProfile.stopDataNotification()
297
322
  ```
298
323
 
299
- ### 9.3 Check if it's data transfering
324
+ #### 19.3 Check if it's data transfering
325
+
300
326
  Use `property isDataTransfering: bool` to check if it's data transfering.
327
+
301
328
  ```python
302
329
  isDataTransfering = sensorProfile.isDataTransfering
303
330
  ```
304
331
 
305
- ## 10. Get battery level
332
+ ### 20. Get battery level
333
+
306
334
  Use `def getBatteryLevel() -> int` to get battery level. Please call after device in 'Ready' state.
307
335
 
308
336
  ```python
@@ -1,4 +1,4 @@
1
- # synchroni_sdk_python
1
+ # sensor-sdk
2
2
 
3
3
  Synchroni sdk for Python
4
4
 
@@ -6,7 +6,6 @@ Synchroni sdk for Python
6
6
 
7
7
  Synchroni SDK is the software development kit for developers to access Synchroni products.
8
8
 
9
-
10
9
  ## Contributing
11
10
 
12
11
  See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
@@ -23,7 +22,7 @@ MIT
23
22
  pip install sensor-sdk
24
23
  ```
25
24
 
26
- ## 1. Permission
25
+ ## 1. Permission
27
26
 
28
27
  Application will obtain bluetooth permission by itself.
29
28
 
@@ -33,9 +32,9 @@ Application will obtain bluetooth permission by itself.
33
32
  from sensor import *
34
33
  ```
35
34
 
36
- # SensorController methods:
35
+ ## SensorController methods
37
36
 
38
- ## 1. Initalize
37
+ ### 1. Initalize
39
38
 
40
39
  ```python
41
40
  SensorControllerInstance = SensorController()
@@ -48,33 +47,41 @@ if not SensorControllerInstance.hasDeviceFoundCallback:
48
47
  SensorControllerInstance.onDeviceFoundCallback = on_device_callback
49
48
  ```
50
49
 
51
- ## 2. Start scan
52
- Use `def start_scan(period_in_ms: int) -> bool` to start scan
50
+ ### 2. Start scan
51
+
52
+ Use `def startScan(period_in_ms: int) -> bool` to start scan
53
+
53
54
  ```python
54
55
  success = SensorControllerInstance.startScan(6000)
55
56
  ```
57
+
56
58
  returns true if start scan success, periodInMS means onDeviceCallback will be called every periodInMS
57
59
 
58
- ## 3. Stop scan
60
+ ### 3. Stop scan
61
+
62
+ Use `def stopScan() -> None` to stop scan
59
63
 
60
- Use `def stop_scan() -> None` to stop scan
61
64
  ```python
62
65
  SensorControllerInstance.stopScan()
63
66
  ```
64
- ## 4. Check scaning
67
+
68
+ ### 4. Check scaning
65
69
 
66
70
  Use `property isScanning: bool` to check scanning status
71
+
67
72
  ```python
68
73
  isScanning = SensorControllerInstance.isScanning
69
74
  ```
70
75
 
71
- ## 5. Check if bluetooth is enabled
76
+ ### 5. Check if bluetooth is enabled
72
77
 
73
78
  Use `property isEnabled: bool` to check if bluetooth is enabled
79
+
74
80
  ```python
75
81
  isEnabled = SensorControllerInstance.isEnabled
76
82
  ```
77
- ## 6. Create SensorProfile
83
+
84
+ ### 6. Create SensorProfile
78
85
 
79
86
  Use `def requireSensor(device: BLEDevice) -> SensorProfile | None` to create SensorProfile.
80
87
 
@@ -84,7 +91,7 @@ If bleDevice is invalid, result is None.
84
91
  sensorProfile = SensorControllerInstance.requireSensor(bleDevice)
85
92
  ```
86
93
 
87
- ## 7. Get SensorProfile
94
+ ### 7. Get SensorProfile
88
95
 
89
96
  Use `def getSensor(device: BLEDevice) -> SensorProfile | None` to get SensorProfile.
90
97
 
@@ -94,24 +101,27 @@ If SensorProfile didn't created, result is None.
94
101
  sensorProfile = SensorControllerInstance.getSensor(bleDevice)
95
102
  ```
96
103
 
97
- ## 8. Get Connected SensorProfiles
104
+ ### 8. Get Connected SensorProfiles
98
105
 
99
106
  Use `def getConnectedSensors() -> list[SensorProfile]` to get connected SensorProfiles.
107
+
100
108
  ```python
101
109
  sensorProfiles = SensorControllerInstance.getConnectedSensors()
102
110
  ```
103
111
 
104
- ## 9. Get Connected BLE Devices
112
+ ### 9. Get Connected BLE Devices
105
113
 
106
114
  Use `def getConnectedDevices() -> list[SensorProfile]` to get connected BLE Devices.
115
+
107
116
  ```python
108
117
  bleDevices = SensorControllerInstance.getConnectedDevices()
109
118
  ```
110
119
 
111
- ## 10. Terminate
120
+ ### 10. Terminate
121
+
122
+ Use `def terminate()` to terminate sdk
112
123
 
113
124
  ```python
114
- SensorControllerInstance.terminate()
115
125
 
116
126
  def terminate():
117
127
  SensorControllerInstance.terminate()
@@ -122,13 +132,15 @@ def main():
122
132
  time.sleep(30)
123
133
  SensorControllerInstance.terminate()
124
134
 
125
- Please call terminate when exit main() or press Ctrl+C
135
+ Please MAKE SURE to call terminate when exit main() or press Ctrl+C
126
136
  ```
127
137
 
128
- # SensorProfile methods:
138
+ ## SensorProfile methods
139
+
140
+ ### 11. Initalize
129
141
 
130
- ## 1. Initalize
131
142
  Please register callbacks for SensorProfile
143
+
132
144
  ```python
133
145
  sensorProfile = SensorControllerInstance.requireSensor(bleDevice)
134
146
 
@@ -155,26 +167,30 @@ sensorProfile.onPowerChanged = on_power_changed
155
167
  sensorProfile.onDataCallback = on_data_callback
156
168
  ```
157
169
 
158
- ## 2. Connect device
170
+ ### 12. Connect device
171
+
159
172
  Use `def connect() -> bool` to connect.
173
+
160
174
  ```python
161
175
  success = sensorProfile.connect()
162
176
  ```
163
177
 
164
- ## 3. Disconnect
178
+ ### 13. Disconnect
179
+
165
180
  Use `def disconnect() -> bool` to disconnect.
181
+
166
182
  ```python
167
183
  success = sensorProfile.disconnect()
168
184
  ```
169
185
 
186
+ ### 14. Get device status
170
187
 
171
- ## 4. Get device status
172
- Use `property connectionState: DeviceStateEx` to get device status.
188
+ Use `property deviceState: DeviceStateEx` to get device status.
173
189
 
174
190
  Please send command in 'Ready' state, should be after connect() return True.
175
191
 
176
192
  ```python
177
- deviceStateEx = sensorProfile.connectionState
193
+ deviceStateEx = sensorProfile.deviceState
178
194
 
179
195
  # deviceStateEx has define:
180
196
  # class DeviceStateEx(Enum):
@@ -186,15 +202,16 @@ deviceStateEx = sensorProfile.connectionState
186
202
  # Invalid = 5
187
203
  ```
188
204
 
205
+ ### 15. Get BLE device of SensorProfile
189
206
 
190
-
191
- ## 5. Get BLE device of SensorProfile
192
207
  Use `property BLEDevice: BLEDevice` to get BLE device of SensorProfile.
208
+
193
209
  ```python
194
210
  bleDevice = sensorProfile.BLEDevice
195
211
  ```
196
212
 
197
- ## 6. Get device info of SensorProfile
213
+ ### 16. Get device info of SensorProfile
214
+
198
215
  Use `def getDeviceInfo() -> dict | None` to get device info of SensorProfile.
199
216
 
200
217
  Please call after device in 'Ready' state, return None if it's not connected.
@@ -218,28 +235,34 @@ Please call after device in 'Ready' state, return None if it's not connected.
218
235
  # }
219
236
  ```
220
237
 
238
+ ### 17. Init data transfer
221
239
 
222
- ## 7. Init data transfer
223
240
  Use `def init(packageSampleCount: int, powerRefreshInterval: int) -> bool`.
224
241
 
225
242
  Please call after device in 'Ready' state, return True if init succeed.
243
+
226
244
  ```python
227
245
  success = sensorProfile.init(5, 60*1000)
228
246
  ```
247
+
229
248
  packageSampleCount: set sample counts of SensorData.channelSamples in onDataCallback()
230
249
  powerRefreshInterval: callback period for onPowerChanged()
231
250
 
232
- ## 8. Check if init data transfer succeed
251
+ ### 18. Check if init data transfer succeed
252
+
233
253
  Use `property hasInited: bool` to check if init data transfer succeed.
254
+
234
255
  ```python
235
256
  hasInited = sensorProfile.hasInited
236
257
  ```
237
258
 
238
- ## 9. DataNotify
259
+ ### 19. DataNotify
260
+
239
261
  Use `def startDataNotification() -> bool` to start data notification.
240
262
 
241
263
  Please call if hasInited return True
242
- ### 9.1 Start data transfer
264
+
265
+ #### 19.1 Start data transfer
243
266
 
244
267
  ```python
245
268
  success = sensorProfile.startDataNotification()
@@ -279,19 +302,24 @@ def on_data_callback(sensor, data):
279
302
  sensorProfile.onDataCallback = on_data_callback
280
303
  ```
281
304
 
282
- ### 9.2 Stop data transfer
305
+ #### 19.2 Stop data transfer
306
+
283
307
  Use `def stopDataNotification() -> bool` to stop data transfer.
308
+
284
309
  ```python
285
310
  success = sensorProfile.stopDataNotification()
286
311
  ```
287
312
 
288
- ### 9.3 Check if it's data transfering
313
+ #### 19.3 Check if it's data transfering
314
+
289
315
  Use `property isDataTransfering: bool` to check if it's data transfering.
316
+
290
317
  ```python
291
318
  isDataTransfering = sensorProfile.isDataTransfering
292
319
  ```
293
320
 
294
- ## 10. Get battery level
321
+ ### 20. Get battery level
322
+
295
323
  Use `def getBatteryLevel() -> int` to get battery level. Please call after device in 'Ready' state.
296
324
 
297
325
  ```python
@@ -300,4 +328,4 @@ batteryPower = sensorProfile.getBatteryLevel()
300
328
  # batteryPower is battery level returned, value ranges from 0 to 100, 0 means out of battery, while 100 means full.
301
329
  ```
302
330
 
303
- Please check console.py in examples directory
331
+ Please check console.py in examples directory
@@ -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
- impedance = _impedanceData[impedanceChannelIndex]
379
- saturation = _saturationData[impedanceChannelIndex]
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.2
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
@@ -9,7 +9,7 @@ Requires-Python: >=3.8.0
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE.txt
11
11
 
12
- # synchroni_sdk_python
12
+ # sensor-sdk
13
13
 
14
14
  Synchroni sdk for Python
15
15
 
@@ -17,7 +17,6 @@ Synchroni sdk for Python
17
17
 
18
18
  Synchroni SDK is the software development kit for developers to access Synchroni products.
19
19
 
20
-
21
20
  ## Contributing
22
21
 
23
22
  See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
@@ -34,7 +33,7 @@ MIT
34
33
  pip install sensor-sdk
35
34
  ```
36
35
 
37
- ## 1. Permission
36
+ ## 1. Permission
38
37
 
39
38
  Application will obtain bluetooth permission by itself.
40
39
 
@@ -44,9 +43,9 @@ Application will obtain bluetooth permission by itself.
44
43
  from sensor import *
45
44
  ```
46
45
 
47
- # SensorController methods:
46
+ ## SensorController methods
48
47
 
49
- ## 1. Initalize
48
+ ### 1. Initalize
50
49
 
51
50
  ```python
52
51
  SensorControllerInstance = SensorController()
@@ -59,33 +58,41 @@ if not SensorControllerInstance.hasDeviceFoundCallback:
59
58
  SensorControllerInstance.onDeviceFoundCallback = on_device_callback
60
59
  ```
61
60
 
62
- ## 2. Start scan
63
- Use `def start_scan(period_in_ms: int) -> bool` to start scan
61
+ ### 2. Start scan
62
+
63
+ Use `def startScan(period_in_ms: int) -> bool` to start scan
64
+
64
65
  ```python
65
66
  success = SensorControllerInstance.startScan(6000)
66
67
  ```
68
+
67
69
  returns true if start scan success, periodInMS means onDeviceCallback will be called every periodInMS
68
70
 
69
- ## 3. Stop scan
71
+ ### 3. Stop scan
72
+
73
+ Use `def stopScan() -> None` to stop scan
70
74
 
71
- Use `def stop_scan() -> None` to stop scan
72
75
  ```python
73
76
  SensorControllerInstance.stopScan()
74
77
  ```
75
- ## 4. Check scaning
78
+
79
+ ### 4. Check scaning
76
80
 
77
81
  Use `property isScanning: bool` to check scanning status
82
+
78
83
  ```python
79
84
  isScanning = SensorControllerInstance.isScanning
80
85
  ```
81
86
 
82
- ## 5. Check if bluetooth is enabled
87
+ ### 5. Check if bluetooth is enabled
83
88
 
84
89
  Use `property isEnabled: bool` to check if bluetooth is enabled
90
+
85
91
  ```python
86
92
  isEnabled = SensorControllerInstance.isEnabled
87
93
  ```
88
- ## 6. Create SensorProfile
94
+
95
+ ### 6. Create SensorProfile
89
96
 
90
97
  Use `def requireSensor(device: BLEDevice) -> SensorProfile | None` to create SensorProfile.
91
98
 
@@ -95,7 +102,7 @@ If bleDevice is invalid, result is None.
95
102
  sensorProfile = SensorControllerInstance.requireSensor(bleDevice)
96
103
  ```
97
104
 
98
- ## 7. Get SensorProfile
105
+ ### 7. Get SensorProfile
99
106
 
100
107
  Use `def getSensor(device: BLEDevice) -> SensorProfile | None` to get SensorProfile.
101
108
 
@@ -105,24 +112,27 @@ If SensorProfile didn't created, result is None.
105
112
  sensorProfile = SensorControllerInstance.getSensor(bleDevice)
106
113
  ```
107
114
 
108
- ## 8. Get Connected SensorProfiles
115
+ ### 8. Get Connected SensorProfiles
109
116
 
110
117
  Use `def getConnectedSensors() -> list[SensorProfile]` to get connected SensorProfiles.
118
+
111
119
  ```python
112
120
  sensorProfiles = SensorControllerInstance.getConnectedSensors()
113
121
  ```
114
122
 
115
- ## 9. Get Connected BLE Devices
123
+ ### 9. Get Connected BLE Devices
116
124
 
117
125
  Use `def getConnectedDevices() -> list[SensorProfile]` to get connected BLE Devices.
126
+
118
127
  ```python
119
128
  bleDevices = SensorControllerInstance.getConnectedDevices()
120
129
  ```
121
130
 
122
- ## 10. Terminate
131
+ ### 10. Terminate
132
+
133
+ Use `def terminate()` to terminate sdk
123
134
 
124
135
  ```python
125
- SensorControllerInstance.terminate()
126
136
 
127
137
  def terminate():
128
138
  SensorControllerInstance.terminate()
@@ -133,13 +143,15 @@ def main():
133
143
  time.sleep(30)
134
144
  SensorControllerInstance.terminate()
135
145
 
136
- Please call terminate when exit main() or press Ctrl+C
146
+ Please MAKE SURE to call terminate when exit main() or press Ctrl+C
137
147
  ```
138
148
 
139
- # SensorProfile methods:
149
+ ## SensorProfile methods
150
+
151
+ ### 11. Initalize
140
152
 
141
- ## 1. Initalize
142
153
  Please register callbacks for SensorProfile
154
+
143
155
  ```python
144
156
  sensorProfile = SensorControllerInstance.requireSensor(bleDevice)
145
157
 
@@ -166,26 +178,30 @@ sensorProfile.onPowerChanged = on_power_changed
166
178
  sensorProfile.onDataCallback = on_data_callback
167
179
  ```
168
180
 
169
- ## 2. Connect device
181
+ ### 12. Connect device
182
+
170
183
  Use `def connect() -> bool` to connect.
184
+
171
185
  ```python
172
186
  success = sensorProfile.connect()
173
187
  ```
174
188
 
175
- ## 3. Disconnect
189
+ ### 13. Disconnect
190
+
176
191
  Use `def disconnect() -> bool` to disconnect.
192
+
177
193
  ```python
178
194
  success = sensorProfile.disconnect()
179
195
  ```
180
196
 
197
+ ### 14. Get device status
181
198
 
182
- ## 4. Get device status
183
- Use `property connectionState: DeviceStateEx` to get device status.
199
+ Use `property deviceState: DeviceStateEx` to get device status.
184
200
 
185
201
  Please send command in 'Ready' state, should be after connect() return True.
186
202
 
187
203
  ```python
188
- deviceStateEx = sensorProfile.connectionState
204
+ deviceStateEx = sensorProfile.deviceState
189
205
 
190
206
  # deviceStateEx has define:
191
207
  # class DeviceStateEx(Enum):
@@ -197,15 +213,16 @@ deviceStateEx = sensorProfile.connectionState
197
213
  # Invalid = 5
198
214
  ```
199
215
 
216
+ ### 15. Get BLE device of SensorProfile
200
217
 
201
-
202
- ## 5. Get BLE device of SensorProfile
203
218
  Use `property BLEDevice: BLEDevice` to get BLE device of SensorProfile.
219
+
204
220
  ```python
205
221
  bleDevice = sensorProfile.BLEDevice
206
222
  ```
207
223
 
208
- ## 6. Get device info of SensorProfile
224
+ ### 16. Get device info of SensorProfile
225
+
209
226
  Use `def getDeviceInfo() -> dict | None` to get device info of SensorProfile.
210
227
 
211
228
  Please call after device in 'Ready' state, return None if it's not connected.
@@ -229,28 +246,34 @@ Please call after device in 'Ready' state, return None if it's not connected.
229
246
  # }
230
247
  ```
231
248
 
249
+ ### 17. Init data transfer
232
250
 
233
- ## 7. Init data transfer
234
251
  Use `def init(packageSampleCount: int, powerRefreshInterval: int) -> bool`.
235
252
 
236
253
  Please call after device in 'Ready' state, return True if init succeed.
254
+
237
255
  ```python
238
256
  success = sensorProfile.init(5, 60*1000)
239
257
  ```
258
+
240
259
  packageSampleCount: set sample counts of SensorData.channelSamples in onDataCallback()
241
260
  powerRefreshInterval: callback period for onPowerChanged()
242
261
 
243
- ## 8. Check if init data transfer succeed
262
+ ### 18. Check if init data transfer succeed
263
+
244
264
  Use `property hasInited: bool` to check if init data transfer succeed.
265
+
245
266
  ```python
246
267
  hasInited = sensorProfile.hasInited
247
268
  ```
248
269
 
249
- ## 9. DataNotify
270
+ ### 19. DataNotify
271
+
250
272
  Use `def startDataNotification() -> bool` to start data notification.
251
273
 
252
274
  Please call if hasInited return True
253
- ### 9.1 Start data transfer
275
+
276
+ #### 19.1 Start data transfer
254
277
 
255
278
  ```python
256
279
  success = sensorProfile.startDataNotification()
@@ -290,19 +313,24 @@ def on_data_callback(sensor, data):
290
313
  sensorProfile.onDataCallback = on_data_callback
291
314
  ```
292
315
 
293
- ### 9.2 Stop data transfer
316
+ #### 19.2 Stop data transfer
317
+
294
318
  Use `def stopDataNotification() -> bool` to stop data transfer.
319
+
295
320
  ```python
296
321
  success = sensorProfile.stopDataNotification()
297
322
  ```
298
323
 
299
- ### 9.3 Check if it's data transfering
324
+ #### 19.3 Check if it's data transfering
325
+
300
326
  Use `property isDataTransfering: bool` to check if it's data transfering.
327
+
301
328
  ```python
302
329
  isDataTransfering = sensorProfile.isDataTransfering
303
330
  ```
304
331
 
305
- ## 10. Get battery level
332
+ ### 20. Get battery level
333
+
306
334
  Use `def getBatteryLevel() -> int` to get battery level. Please call after device in 'Ready' state.
307
335
 
308
336
  ```python
@@ -8,7 +8,7 @@ with open(os.path.join(this_directory, 'README.md'), "r", encoding="utf-8") as f
8
8
 
9
9
  setup(
10
10
  name='sensor-sdk',
11
- version='0.0.2',
11
+ version='0.0.3',
12
12
  description='Python sdk for Synchroni',
13
13
  long_description=long_description,
14
14
  long_description_content_type='text/markdown',
File without changes
File without changes
File without changes
File without changes