gshock-api 2.0.6__tar.gz → 2.0.7__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.
Files changed (47) hide show
  1. {gshock_api-2.0.6/src/gshock_api.egg-info → gshock_api-2.0.7}/PKG-INFO +1 -1
  2. {gshock_api-2.0.6 → gshock_api-2.0.7}/pyproject.toml +1 -1
  3. {gshock_api-2.0.6 → gshock_api-2.0.7}/setup.py +1 -1
  4. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/cancelable_result.py +2 -2
  5. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/connection.py +5 -4
  6. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/gshock_api.py +0 -2
  7. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/time_io.py +9 -4
  8. {gshock_api-2.0.6 → gshock_api-2.0.7/src/gshock_api.egg-info}/PKG-INFO +1 -1
  9. {gshock_api-2.0.6 → gshock_api-2.0.7}/LICENSE.txt +0 -0
  10. {gshock_api-2.0.6 → gshock_api-2.0.7}/README.rst +0 -0
  11. {gshock_api-2.0.6 → gshock_api-2.0.7}/setup.cfg +0 -0
  12. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/__init__.py +0 -0
  13. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/alarms.py +0 -0
  14. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/app_notification.py +0 -0
  15. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/casio_constants.py +0 -0
  16. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/configurator.py +0 -0
  17. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/event.py +0 -0
  18. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/exceptions.py +0 -0
  19. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/__init__.py +0 -0
  20. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/alarms_io.py +0 -0
  21. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/app_info_io.py +0 -0
  22. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/app_notification_io.py +0 -0
  23. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/button_pressed_io.py +0 -0
  24. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/dst_for_world_cities_io.py +0 -0
  25. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/dst_watch_state_io.py +0 -0
  26. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/error_io.py +0 -0
  27. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/events_io.py +0 -0
  28. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/settings_io.py +0 -0
  29. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/time_adjustement_io.py +0 -0
  30. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/timer_io.py +0 -0
  31. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/unknown_io.py +0 -0
  32. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/watch_condition_io.py +0 -0
  33. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/watch_name_io.py +0 -0
  34. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/iolib/world_cities_io.py +0 -0
  35. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/logger.py +0 -0
  36. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/mailsener.py +0 -0
  37. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/message_dispatcher.py +0 -0
  38. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/scanner.py +0 -0
  39. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/settings.py +0 -0
  40. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/utils.py +0 -0
  41. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api/watch_info.py +0 -0
  42. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api.egg-info/SOURCES.txt +0 -0
  43. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api.egg-info/dependency_links.txt +0 -0
  44. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api.egg-info/not-zip-safe +0 -0
  45. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api.egg-info/requires.txt +0 -0
  46. {gshock_api-2.0.6 → gshock_api-2.0.7}/src/gshock_api.egg-info/top_level.txt +0 -0
  47. {gshock_api-2.0.6 → gshock_api-2.0.7}/tests/test_code.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gshock_api
3
- Version: 2.0.6
3
+ Version: 2.0.7
4
4
  Summary: Pythgon API for GShock Watches using BLE
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: Ivo Zivkov
@@ -5,7 +5,7 @@ requires = ["setuptools>=61.0"]
5
5
 
6
6
  [project]
7
7
  name = "gshock_api" # Change to your project name
8
- version = "2.0.6"
8
+ version = "2.0.7"
9
9
  description = "Pythgon API for GShock Watches using BLE"
10
10
  readme = "README.rst"
11
11
  authors = [{ name = "Ivo Zivkov", email = "izivkov@gmail.com" }]
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='gshock_api',
5
- version='2.0.6',
5
+ version='2.0.7',
6
6
  package_dir={'': 'src'},
7
7
  packages=find_packages(where='src'),
8
8
  install_requires=[
@@ -3,7 +3,7 @@ from typing import Any
3
3
  from gshock_api.exceptions import GShockConnectionError
4
4
 
5
5
  class CancelableResult:
6
- def __init__(self, timeout: float = 3.0):
6
+ def __init__(self, timeout: float = 10.0):
7
7
  self._timeout = timeout
8
8
  self._future: asyncio.Future[Any] = asyncio.Future()
9
9
 
@@ -14,7 +14,7 @@ class CancelableResult:
14
14
  except asyncio.TimeoutError as e:
15
15
  if not self._future.done():
16
16
  self._future.set_result('') # or raise an exception instead
17
- raise GShockConnectionError(f"Timeout occured wait for response from the watch: {e}") from e
17
+ raise GShockConnectionError(f"Timeout occured waiting for response from the watch: {e}") from e
18
18
 
19
19
  def set_result(self, result: Any) -> None:
20
20
  if not self._future.done():
@@ -1,4 +1,5 @@
1
- import asyncio
1
+ import asyncio, time
2
+ from tracemalloc import start
2
3
  from bleak import BleakClient
3
4
  from bleak.backends.characteristic import BleakGATTCharacteristic
4
5
  from gshock_api.casio_constants import CasioConstants
@@ -71,7 +72,7 @@ class Connection:
71
72
  )
72
73
  if (handle == 13):
73
74
  logger.info(
74
- "Your watch does not suppot notifications..."
75
+ "Your watch does not support notifications..."
75
76
  )
76
77
  return
77
78
 
@@ -80,8 +81,8 @@ class Connection:
80
81
  )
81
82
 
82
83
  except Exception as e:
83
- logger.info("write failed with exception: {}".format(e))
84
- raise GShockConnectionError(f"Unable to connect to G-Shock device: {e}") from e
84
+ print("Exception type:", type(e))
85
+ raise GShockConnectionError(f"Unable to write to G-Shock device: {e}") from e
85
86
 
86
87
  async def request(self, request):
87
88
  await self.write(0xC, request)
@@ -205,8 +205,6 @@ class GshockAPI:
205
205
  if current_time == None:
206
206
  current_time = time.time()
207
207
 
208
- self.logger.info(f"=======> passed: ${current_time}, ${time.time()}")
209
-
210
208
  await self.initialize_for_setting_time()
211
209
  await self._set_time(current_time)
212
210
  current_time = None
@@ -3,17 +3,16 @@ import datetime
3
3
  import json
4
4
  import time
5
5
  from typing import Any
6
- from gshock_api.cancelable_result import CancelableResult
7
6
  from gshock_api.logger import logger
8
7
 
9
8
  from gshock_api.utils import to_compact_string, to_hex_string
10
9
  from gshock_api.casio_constants import CasioConstants
10
+ import bleak
11
11
 
12
12
  CHARACTERISTICS = CasioConstants.CHARACTERISTICS
13
13
 
14
14
 
15
15
  class TimeIO:
16
- result: CancelableResult = None
17
16
  connection = None
18
17
 
19
18
  @staticmethod
@@ -37,8 +36,14 @@ class TimeIO:
37
36
  time_command = to_hex_string(
38
37
  bytearray([CHARACTERISTICS["CASIO_CURRENT_TIME"]]) + time_data
39
38
  )
40
- await TimeIO.connection.write(0xE, to_compact_string(time_command))
41
-
39
+ try:
40
+ await TimeIO.connection.write(0xE, to_compact_string(time_command))
41
+ except (Exception) as e:
42
+ # Ignore this exception if the LOWER-RIGHT button is pressed.
43
+ # In this case, the connection will be closed before the call completes with a response, and we get an EOFError.
44
+ # The call actually works, though.
45
+
46
+ logger.info(f"Error {e} ignored due to timeout limitation")
42
47
 
43
48
  class TimeEncoder:
44
49
  def prepare_current_time(date: datetime.datetime):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gshock_api
3
- Version: 2.0.6
3
+ Version: 2.0.7
4
4
  Summary: Pythgon API for GShock Watches using BLE
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: Ivo Zivkov
File without changes
File without changes
File without changes