gshock-api 2.0.34__tar.gz → 2.0.35__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.
- {gshock_api-2.0.34 → gshock_api-2.0.35}/PKG-INFO +10 -10
- {gshock_api-2.0.34 → gshock_api-2.0.35}/README.rst +7 -7
- {gshock_api-2.0.34 → gshock_api-2.0.35}/pyproject.toml +2 -2
- {gshock_api-2.0.34 → gshock_api-2.0.35}/setup.cfg +5 -4
- {gshock_api-2.0.34 → gshock_api-2.0.35}/setup.py +1 -1
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/examples/api_tests.py +2 -4
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/connection.py +5 -5
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/gshock_api.py +16 -16
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/alarms_io.py +3 -2
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/events_io.py +2 -2
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/time_io.py +1 -1
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/world_cities_io.py +2 -2
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/scanner.py +3 -4
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/watch_info.py +3 -3
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api.egg-info/PKG-INFO +10 -10
- {gshock_api-2.0.34 → gshock_api-2.0.35}/LICENSE.txt +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/examples/app_notifications_tests.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/examples/args.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/examples/gshock_server.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/examples/health_test.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/__init__.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/alarms.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/always_connected_watch_filter.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/app_notification.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/cancelable_result.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/casio_constants.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/event.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/exceptions.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/__init__.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/app_info_io.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/app_notification_io.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/button_pressed_io.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/connection_protocol.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/dst_for_world_cities_io.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/dst_watch_state_io.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/error_io.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/settings_io.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/time_adjustement_io.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/timer_io.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/unknown_io.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/watch_condition_io.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/iolib/watch_name_io.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/logger.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/message_dispatcher.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/settings.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api/utils.py +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api.egg-info/SOURCES.txt +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api.egg-info/dependency_links.txt +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api.egg-info/entry_points.txt +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api.egg-info/not-zip-safe +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api.egg-info/requires.txt +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/src/gshock_api.egg-info/top_level.txt +0 -0
- {gshock_api-2.0.34 → gshock_api-2.0.35}/tests/test_code.py +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gshock_api
|
|
3
|
-
Version: 2.0.
|
|
4
|
-
Summary:
|
|
5
|
-
Home-page: https://github.com/
|
|
3
|
+
Version: 2.0.35
|
|
4
|
+
Summary: Python API for GShock Watches using BLE
|
|
5
|
+
Home-page: https://github.com/izivkov/gshock_api/
|
|
6
6
|
Author: Ivo Zivkov
|
|
7
7
|
Author-email: Ivo Zivkov <izivkov@gmail.com>
|
|
8
8
|
License-Expression: MIT
|
|
@@ -110,14 +110,14 @@ It is recommended that you create a virtual environment to run the tests:
|
|
|
110
110
|
|
|
111
111
|
.. code-block:: sh
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
uv run src/examples/api_tests.py
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
the library will try to connect to the last connected watch only. If you have multiple watches, you should use this parameter.
|
|
117
|
-
|
|
118
|
-
The optional **`--multi-watch`** parameter forces the library to scan for watches every time it tries to connect to a watch. If not provided,
|
|
119
|
-
the library will try to connect to the last connected watch only. If you have multiple watches, you should use this parameter.
|
|
115
|
+
or activate `venv`` first and then run using python:
|
|
120
116
|
|
|
117
|
+
.. code-block:: sh
|
|
118
|
+
|
|
119
|
+
source .venv/bin/activate
|
|
120
|
+
python src/examples/api_tests.py
|
|
121
121
|
|
|
122
122
|
Installing the library for your project:
|
|
123
123
|
========================================
|
|
@@ -128,7 +128,7 @@ Installing the library for your project:
|
|
|
128
128
|
|
|
129
129
|
See `this project <https://github.com/izivkov/GShockTimeServer>`_ using this library to run a time server for G-Shock watches.
|
|
130
130
|
|
|
131
|
-
See also `this blog <https://digitalsober.wordpress.com/
|
|
131
|
+
See also `this blog <https://digitalsober.wordpress.com/2024/05/05/g-shock-watch-integration-with-sxmo/>`_ for using the library in the `SXMO <https://sxmo.org/>`_ mobile environment.
|
|
132
132
|
|
|
133
133
|
Troubleshooting:
|
|
134
134
|
================
|
|
@@ -81,14 +81,14 @@ It is recommended that you create a virtual environment to run the tests:
|
|
|
81
81
|
|
|
82
82
|
.. code-block:: sh
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
uv run src/examples/api_tests.py
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
the library will try to connect to the last connected watch only. If you have multiple watches, you should use this parameter.
|
|
88
|
-
|
|
89
|
-
The optional **`--multi-watch`** parameter forces the library to scan for watches every time it tries to connect to a watch. If not provided,
|
|
90
|
-
the library will try to connect to the last connected watch only. If you have multiple watches, you should use this parameter.
|
|
86
|
+
or activate `venv`` first and then run using python:
|
|
91
87
|
|
|
88
|
+
.. code-block:: sh
|
|
89
|
+
|
|
90
|
+
source .venv/bin/activate
|
|
91
|
+
python src/examples/api_tests.py
|
|
92
92
|
|
|
93
93
|
Installing the library for your project:
|
|
94
94
|
========================================
|
|
@@ -99,7 +99,7 @@ Installing the library for your project:
|
|
|
99
99
|
|
|
100
100
|
See `this project <https://github.com/izivkov/GShockTimeServer>`_ using this library to run a time server for G-Shock watches.
|
|
101
101
|
|
|
102
|
-
See also `this blog <https://digitalsober.wordpress.com/
|
|
102
|
+
See also `this blog <https://digitalsober.wordpress.com/2024/05/05/g-shock-watch-integration-with-sxmo/>`_ for using the library in the `SXMO <https://sxmo.org/>`_ mobile environment.
|
|
103
103
|
|
|
104
104
|
Troubleshooting:
|
|
105
105
|
================
|
|
@@ -11,8 +11,8 @@ build-backend = "setuptools.build_meta"
|
|
|
11
11
|
|
|
12
12
|
[project]
|
|
13
13
|
name = "gshock_api" # Change to your project name
|
|
14
|
-
version = "2.0.
|
|
15
|
-
description = "
|
|
14
|
+
version = "2.0.35"
|
|
15
|
+
description = "Python API for GShock Watches using BLE"
|
|
16
16
|
authors = [{ name = "Ivo Zivkov", email = "izivkov@gmail.com" }]
|
|
17
17
|
|
|
18
18
|
license = "MIT"
|
|
@@ -6,10 +6,11 @@ author_email = izivkov@gmail.com
|
|
|
6
6
|
license = MIT
|
|
7
7
|
license_files = LICENSE.txt
|
|
8
8
|
long_description = file: README.rst
|
|
9
|
-
long_description_content_type = text/x-rst
|
|
10
|
-
url = https://github.com/
|
|
9
|
+
long_description_content_type = text/x-rst
|
|
10
|
+
url = https://github.com/izivkov/gshock_api/
|
|
11
11
|
project_urls =
|
|
12
|
-
Documentation = https://
|
|
12
|
+
Documentation = https://github.com/izivkov/gshock_api/
|
|
13
|
+
Source = https://github.com/izivkov/gshock_api/
|
|
13
14
|
platforms = any
|
|
14
15
|
classifiers =
|
|
15
16
|
Development Status :: 4 - Beta
|
|
@@ -63,7 +64,7 @@ exclude =
|
|
|
63
64
|
|
|
64
65
|
[pyscaffold]
|
|
65
66
|
version = 4.4
|
|
66
|
-
package =
|
|
67
|
+
package = gshock_api
|
|
67
68
|
|
|
68
69
|
[egg_info]
|
|
69
70
|
tag_build =
|
|
@@ -5,7 +5,6 @@ import json
|
|
|
5
5
|
from pprint import pformat
|
|
6
6
|
import sys
|
|
7
7
|
import time
|
|
8
|
-
from typing import Optional
|
|
9
8
|
|
|
10
9
|
import pytz
|
|
11
10
|
|
|
@@ -205,11 +204,10 @@ async def app_notifications(api: GshockAPI) -> None:
|
|
|
205
204
|
await api.send_app_notification(email_notification2)
|
|
206
205
|
|
|
207
206
|
|
|
208
|
-
def convert_time_string_to_epoch(time_string: str) ->
|
|
207
|
+
def convert_time_string_to_epoch(time_string: str) -> float | None:
|
|
209
208
|
try:
|
|
210
209
|
time_object = datetime.strptime(time_string, "%H:%M:%S")
|
|
211
|
-
|
|
212
|
-
return timestamp
|
|
210
|
+
return time_object.timestamp()
|
|
213
211
|
except ValueError:
|
|
214
212
|
logger.info("Invalid time format. Please use the format HH:MM:SS.")
|
|
215
213
|
return None
|
|
@@ -100,8 +100,7 @@ class Connection:
|
|
|
100
100
|
def is_service_supported(self, handle: int) -> bool:
|
|
101
101
|
"""Checks if a characteristic UUID mapped to a handle is present in the discovered characteristics."""
|
|
102
102
|
uuid: str | None = self.handles_map.get(handle)
|
|
103
|
-
|
|
104
|
-
return uuid not in self.characteristics_map
|
|
103
|
+
return uuid is not None and uuid in self.characteristics_map
|
|
105
104
|
|
|
106
105
|
async def write(self, handle: int, data: bytes) -> None:
|
|
107
106
|
"""Writes data to a characteristic identified by its handle."""
|
|
@@ -118,13 +117,14 @@ class Connection:
|
|
|
118
117
|
)
|
|
119
118
|
return
|
|
120
119
|
|
|
121
|
-
|
|
120
|
+
# 0x0E is CASIO_ALL_FEATURES_CHARACTERISTIC_UUID (requires response)
|
|
121
|
+
response_type: bool = handle == 0x0E
|
|
122
122
|
|
|
123
123
|
cmd_data: bytes = to_casio_cmd(data)
|
|
124
124
|
|
|
125
125
|
if self.client:
|
|
126
126
|
await self.client.write_gatt_char(
|
|
127
|
-
uuid, cmd_data, response=
|
|
127
|
+
uuid, cmd_data, response=response_type
|
|
128
128
|
)
|
|
129
129
|
|
|
130
130
|
except Exception as e:
|
|
@@ -155,6 +155,6 @@ class Connection:
|
|
|
155
155
|
return handles_map
|
|
156
156
|
|
|
157
157
|
# Replaced Any with TypeVar T
|
|
158
|
-
async def
|
|
158
|
+
async def send_message(self, message: T) -> None:
|
|
159
159
|
"""Sends a message to the watch using the message dispatcher."""
|
|
160
160
|
await message_dispatcher.MessageDispatcher.send_to_watch(message)
|
|
@@ -54,23 +54,23 @@ class GshockAPI:
|
|
|
54
54
|
result: WatchButton = await message_dispatcher.ButtonPressedIO.request(self.connection)
|
|
55
55
|
return result
|
|
56
56
|
|
|
57
|
-
async def get_world_cities(self,
|
|
57
|
+
async def get_world_cities(self, city_number: int) -> str:
|
|
58
58
|
"""Get the name for a particular World City set on the watch."""
|
|
59
|
-
return await self._get_world_cities(
|
|
59
|
+
return await self._get_world_cities(city_number)
|
|
60
60
|
|
|
61
|
-
async def _get_world_cities(self,
|
|
61
|
+
async def _get_world_cities(self, city_number: int) -> str:
|
|
62
62
|
# Assuming WorldCitiesIO.request returns a string
|
|
63
|
-
result: str = await message_dispatcher.WorldCitiesIO.request(self.connection,
|
|
63
|
+
result: str = await message_dispatcher.WorldCitiesIO.request(self.connection, city_number)
|
|
64
64
|
return result
|
|
65
65
|
|
|
66
|
-
async def get_dst_for_world_cities(self,
|
|
66
|
+
async def get_dst_for_world_cities(self, city_number: int) -> str:
|
|
67
67
|
"""Get the **Daylight Saving Time** for a particular World City set on the watch."""
|
|
68
|
-
return await self._get_dst_for_world_cities(
|
|
68
|
+
return await self._get_dst_for_world_cities(city_number)
|
|
69
69
|
|
|
70
|
-
async def _get_dst_for_world_cities(self,
|
|
70
|
+
async def _get_dst_for_world_cities(self, city_number: int) -> str:
|
|
71
71
|
# Assuming DstForWorldCitiesIO.request returns a string
|
|
72
72
|
result: str = await message_dispatcher.DstForWorldCitiesIO.request(
|
|
73
|
-
self.connection,
|
|
73
|
+
self.connection, city_number
|
|
74
74
|
)
|
|
75
75
|
return result
|
|
76
76
|
|
|
@@ -169,8 +169,8 @@ class GshockAPI:
|
|
|
169
169
|
# Assuming T objects are JSON serializable
|
|
170
170
|
alarms_str: str = json.dumps(alarms)
|
|
171
171
|
set_action_cmd: str = f'{{"action":"SET_ALARMS", "value":{alarms_str} }}'
|
|
172
|
-
# connection.
|
|
173
|
-
await self.connection.
|
|
172
|
+
# connection.send_message expects T, which must be convertible to a watch message
|
|
173
|
+
await self.connection.send_message(set_action_cmd)
|
|
174
174
|
|
|
175
175
|
async def get_timer(self) -> int:
|
|
176
176
|
"""Get Timer value in seconds."""
|
|
@@ -181,10 +181,10 @@ class GshockAPI:
|
|
|
181
181
|
result: int = await message_dispatcher.TimerIO.request(self.connection)
|
|
182
182
|
return result
|
|
183
183
|
|
|
184
|
-
async def set_timer(self,
|
|
184
|
+
async def set_timer(self, timer_value: int) -> None:
|
|
185
185
|
"""Set Timer value in seconds."""
|
|
186
|
-
message: str = f'{{"action": "SET_TIMER", "value": {
|
|
187
|
-
await self.connection.
|
|
186
|
+
message: str = f'{{"action": "SET_TIMER", "value": {timer_value} }}'
|
|
187
|
+
await self.connection.send_message(message)
|
|
188
188
|
|
|
189
189
|
# Watch condition request returns an unknown object (object)
|
|
190
190
|
async def get_watch_condition(self) -> object:
|
|
@@ -202,7 +202,7 @@ class GshockAPI:
|
|
|
202
202
|
) -> None:
|
|
203
203
|
"""Sets auto-tame adjustment for the watch"""
|
|
204
204
|
message: str = f"""{{"action": "SET_TIME_ADJUSTMENT", "timeAdjustment": "{time_adjustement}", "minutesAfterHour": "{minutes_after_hour}" }}"""
|
|
205
|
-
await self.connection.
|
|
205
|
+
await self.connection.send_message(message)
|
|
206
206
|
|
|
207
207
|
# SettingsIO returns a list of unknown Setting objects (list[T])
|
|
208
208
|
async def get_basic_settings(self) -> list[T]:
|
|
@@ -215,7 +215,7 @@ class GshockAPI:
|
|
|
215
215
|
"""Set settings to the watch."""
|
|
216
216
|
setting_json: str = json.dumps(settings)
|
|
217
217
|
message: str = f'{{"action": "SET_SETTINGS", "value": {setting_json} }}'
|
|
218
|
-
await self.connection.
|
|
218
|
+
await self.connection.send_message(message)
|
|
219
219
|
|
|
220
220
|
# get_reminders returns a list of unknown Event objects (list[T])
|
|
221
221
|
async def get_reminders(self) -> list[T]:
|
|
@@ -253,7 +253,7 @@ class GshockAPI:
|
|
|
253
253
|
events_as_json: list[Mapping[str, object]] = to_json(events)
|
|
254
254
|
enabled: list[Mapping[str, object]] = get_enabled_events(events_as_json)
|
|
255
255
|
|
|
256
|
-
await self.connection.
|
|
256
|
+
await self.connection.send_message(
|
|
257
257
|
f"""{{"action": "SET_REMINDERS", "value": {json.dumps(enabled)}}}"""
|
|
258
258
|
)
|
|
259
259
|
|
|
@@ -45,12 +45,13 @@ class AlarmsIO:
|
|
|
45
45
|
AlarmsIO.connection = connection
|
|
46
46
|
alarms_inst_typed.clear()
|
|
47
47
|
await AlarmsIO._get_alarms(connection)
|
|
48
|
-
|
|
48
|
+
if AlarmsIO.result is None:
|
|
49
|
+
raise RuntimeError("AlarmsIO.result must not be None after _get_alarms")
|
|
49
50
|
return AlarmsIO.result
|
|
50
51
|
|
|
51
52
|
@staticmethod
|
|
52
53
|
async def _get_alarms(connection: ConnectionProtocol) -> CancelableResult[list[dict[str, object]]]:
|
|
53
|
-
await connection.
|
|
54
|
+
await connection.send_message('{ "action": "GET_ALARMS"}')
|
|
54
55
|
AlarmsIO.result = CancelableResult[list[dict[str, object]]]()
|
|
55
56
|
return await AlarmsIO.result.get_result()
|
|
56
57
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import TypedDict
|
|
3
3
|
|
|
4
4
|
from gshock_api.cancelable_result import CancelableResult
|
|
5
5
|
from gshock_api.casio_constants import CasioConstants
|
|
@@ -45,7 +45,7 @@ class ReminderTimeDict(TypedDict):
|
|
|
45
45
|
repeat_period: str
|
|
46
46
|
start_date: DateDict
|
|
47
47
|
end_date: DateDict
|
|
48
|
-
days_of_week:
|
|
48
|
+
days_of_week: list[str]
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
class EventsIO:
|
|
@@ -10,9 +10,9 @@ class WorldCitiesIO:
|
|
|
10
10
|
connection: ConnectionProtocol | None = None
|
|
11
11
|
|
|
12
12
|
@staticmethod
|
|
13
|
-
async def request(connection: ConnectionProtocol,
|
|
13
|
+
async def request(connection: ConnectionProtocol, city_number: int) -> CancelableResult[bytes]:
|
|
14
14
|
WorldCitiesIO.connection = connection
|
|
15
|
-
key = f"1f0{
|
|
15
|
+
key = f"1f0{city_number}"
|
|
16
16
|
await connection.request(key)
|
|
17
17
|
|
|
18
18
|
WorldCitiesIO.result = CancelableResult[bytes]()
|
|
@@ -24,10 +24,10 @@ MAX_SCAN_RETRIES: Final[int] = 60
|
|
|
24
24
|
# --- Type Aliases ---
|
|
25
25
|
|
|
26
26
|
# WatchFilter is a function that takes a BLEDevice name (str) and returns a boolean.
|
|
27
|
-
WatchFilter
|
|
27
|
+
type WatchFilter = Callable[[str], bool] | None
|
|
28
28
|
|
|
29
29
|
# Type for the filter used in find_device_by_filter (takes device and ad data, returns bool)
|
|
30
|
-
BleakDeviceFilter
|
|
30
|
+
type BleakDeviceFilter = Callable[[BLEDevice, AdvertisementData], bool]
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
class Scanner:
|
|
@@ -38,8 +38,7 @@ class Scanner:
|
|
|
38
38
|
async def scan(
|
|
39
39
|
self,
|
|
40
40
|
device_address: str | None = None,
|
|
41
|
-
|
|
42
|
-
watch_filter: WatchFilter | None = None, # type: ignore
|
|
41
|
+
watch_filter: WatchFilter = None,
|
|
43
42
|
max_retries: int = MAX_SCAN_RETRIES
|
|
44
43
|
) -> BLEDevice | None:
|
|
45
44
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from collections import ChainMap
|
|
2
2
|
from dataclasses import dataclass, field
|
|
3
3
|
from enum import IntEnum
|
|
4
|
-
from typing import Any, Final
|
|
4
|
+
from typing import Any, Final
|
|
5
5
|
|
|
6
|
-
ModelCapability
|
|
7
|
-
ModelMap
|
|
6
|
+
type ModelCapability = dict[str, Any]
|
|
7
|
+
type ModelMap = dict[Any, ChainMap]
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class WatchModel(IntEnum):
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gshock_api
|
|
3
|
-
Version: 2.0.
|
|
4
|
-
Summary:
|
|
5
|
-
Home-page: https://github.com/
|
|
3
|
+
Version: 2.0.35
|
|
4
|
+
Summary: Python API for GShock Watches using BLE
|
|
5
|
+
Home-page: https://github.com/izivkov/gshock_api/
|
|
6
6
|
Author: Ivo Zivkov
|
|
7
7
|
Author-email: Ivo Zivkov <izivkov@gmail.com>
|
|
8
8
|
License-Expression: MIT
|
|
@@ -110,14 +110,14 @@ It is recommended that you create a virtual environment to run the tests:
|
|
|
110
110
|
|
|
111
111
|
.. code-block:: sh
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
uv run src/examples/api_tests.py
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
the library will try to connect to the last connected watch only. If you have multiple watches, you should use this parameter.
|
|
117
|
-
|
|
118
|
-
The optional **`--multi-watch`** parameter forces the library to scan for watches every time it tries to connect to a watch. If not provided,
|
|
119
|
-
the library will try to connect to the last connected watch only. If you have multiple watches, you should use this parameter.
|
|
115
|
+
or activate `venv`` first and then run using python:
|
|
120
116
|
|
|
117
|
+
.. code-block:: sh
|
|
118
|
+
|
|
119
|
+
source .venv/bin/activate
|
|
120
|
+
python src/examples/api_tests.py
|
|
121
121
|
|
|
122
122
|
Installing the library for your project:
|
|
123
123
|
========================================
|
|
@@ -128,7 +128,7 @@ Installing the library for your project:
|
|
|
128
128
|
|
|
129
129
|
See `this project <https://github.com/izivkov/GShockTimeServer>`_ using this library to run a time server for G-Shock watches.
|
|
130
130
|
|
|
131
|
-
See also `this blog <https://digitalsober.wordpress.com/
|
|
131
|
+
See also `this blog <https://digitalsober.wordpress.com/2024/05/05/g-shock-watch-integration-with-sxmo/>`_ for using the library in the `SXMO <https://sxmo.org/>`_ mobile environment.
|
|
132
132
|
|
|
133
133
|
Troubleshooting:
|
|
134
134
|
================
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|