gshock-api 2.0.7__tar.gz → 2.0.9__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 (48) hide show
  1. {gshock_api-2.0.7/src/gshock_api.egg-info → gshock_api-2.0.9}/PKG-INFO +1 -1
  2. {gshock_api-2.0.7 → gshock_api-2.0.9}/pyproject.toml +1 -1
  3. {gshock_api-2.0.7 → gshock_api-2.0.9}/setup.py +1 -1
  4. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/connection.py +7 -3
  5. gshock_api-2.0.9/src/gshock_api/exceptions.py +13 -0
  6. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/time_io.py +3 -4
  7. {gshock_api-2.0.7 → gshock_api-2.0.9/src/gshock_api.egg-info}/PKG-INFO +1 -1
  8. gshock_api-2.0.7/src/gshock_api/exceptions.py +0 -9
  9. {gshock_api-2.0.7 → gshock_api-2.0.9}/LICENSE.txt +0 -0
  10. {gshock_api-2.0.7 → gshock_api-2.0.9}/README.rst +0 -0
  11. {gshock_api-2.0.7 → gshock_api-2.0.9}/setup.cfg +0 -0
  12. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/__init__.py +0 -0
  13. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/alarms.py +0 -0
  14. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/app_notification.py +0 -0
  15. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/cancelable_result.py +0 -0
  16. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/casio_constants.py +0 -0
  17. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/configurator.py +0 -0
  18. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/event.py +0 -0
  19. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/gshock_api.py +0 -0
  20. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/__init__.py +0 -0
  21. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/alarms_io.py +0 -0
  22. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/app_info_io.py +0 -0
  23. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/app_notification_io.py +0 -0
  24. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/button_pressed_io.py +0 -0
  25. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/dst_for_world_cities_io.py +0 -0
  26. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/dst_watch_state_io.py +0 -0
  27. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/error_io.py +0 -0
  28. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/events_io.py +0 -0
  29. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/settings_io.py +0 -0
  30. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/time_adjustement_io.py +0 -0
  31. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/timer_io.py +0 -0
  32. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/unknown_io.py +0 -0
  33. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/watch_condition_io.py +0 -0
  34. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/watch_name_io.py +0 -0
  35. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/iolib/world_cities_io.py +0 -0
  36. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/logger.py +0 -0
  37. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/mailsener.py +0 -0
  38. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/message_dispatcher.py +0 -0
  39. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/scanner.py +0 -0
  40. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/settings.py +0 -0
  41. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/utils.py +0 -0
  42. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api/watch_info.py +0 -0
  43. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api.egg-info/SOURCES.txt +0 -0
  44. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api.egg-info/dependency_links.txt +0 -0
  45. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api.egg-info/not-zip-safe +0 -0
  46. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api.egg-info/requires.txt +0 -0
  47. {gshock_api-2.0.7 → gshock_api-2.0.9}/src/gshock_api.egg-info/top_level.txt +0 -0
  48. {gshock_api-2.0.7 → gshock_api-2.0.9}/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.7
3
+ Version: 2.0.9
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.7"
8
+ version = "2.0.9"
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.7',
5
+ version='2.0.9',
6
6
  package_dir={'': 'src'},
7
7
  packages=find_packages(where='src'),
8
8
  install_requires=[
@@ -1,6 +1,7 @@
1
1
  import asyncio, time
2
2
  from tracemalloc import start
3
3
  from bleak import BleakClient
4
+ from bleak.exc import BleakDBusError
4
5
  from bleak.backends.characteristic import BleakGATTCharacteristic
5
6
  from gshock_api.casio_constants import CasioConstants
6
7
  from gshock_api import message_dispatcher
@@ -9,7 +10,7 @@ from gshock_api.logger import logger
9
10
  from gshock_api.watch_info import watch_info
10
11
  from bleak.backends.device import BLEDevice
11
12
  from gshock_api.scanner import scanner
12
- from gshock_api.exceptions import GShockConnectionError
13
+ from gshock_api.exceptions import GShockIgnorableException, GShockConnectionError
13
14
 
14
15
  class Connection:
15
16
  def __init__(self, address = None):
@@ -81,8 +82,11 @@ class Connection:
81
82
  )
82
83
 
83
84
  except Exception as e:
84
- print("Exception type:", type(e))
85
- raise GShockConnectionError(f"Unable to write to G-Shock device: {e}") from e
85
+ e.args = (type(e).__name__,)
86
+ if isinstance(e, (BleakDBusError, EOFError)):
87
+ raise GShockIgnorableException(e)
88
+ else:
89
+ raise GShockConnectionError(f"Unable to send time to watch: {e}")
86
90
 
87
91
  async def request(self, request):
88
92
  await self.write(0xC, request)
@@ -0,0 +1,13 @@
1
+ # gshock_api/exceptions.py
2
+
3
+ class GShockError(Exception):
4
+ """Base exception for all G-Shock errors."""
5
+ pass
6
+
7
+ class GShockConnectionError(GShockError):
8
+ """Raised when BLE connection to G-Shock device fails."""
9
+ pass
10
+
11
+ class GShockIgnorableException(GShockConnectionError):
12
+ """Raised when BLE connection to G-Shock device fails."""
13
+ pass
@@ -7,7 +7,7 @@ from gshock_api.logger import logger
7
7
 
8
8
  from gshock_api.utils import to_compact_string, to_hex_string
9
9
  from gshock_api.casio_constants import CasioConstants
10
- import bleak
10
+ from gshock_api.exceptions import GShockIgnorableException
11
11
 
12
12
  CHARACTERISTICS = CasioConstants.CHARACTERISTICS
13
13
 
@@ -38,12 +38,11 @@ class TimeIO:
38
38
  )
39
39
  try:
40
40
  await TimeIO.connection.write(0xE, to_compact_string(time_command))
41
- except (Exception) as e:
41
+ except (GShockIgnorableException) as e:
42
42
  # Ignore this exception if the LOWER-RIGHT button is pressed.
43
43
  # In this case, the connection will be closed before the call completes with a response, and we get an EOFError.
44
44
  # The call actually works, though.
45
-
46
- logger.info(f"Error {e} ignored due to timeout limitation")
45
+ logger.info(f"Ignoring {e}")
47
46
 
48
47
  class TimeEncoder:
49
48
  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.7
3
+ Version: 2.0.9
4
4
  Summary: Pythgon API for GShock Watches using BLE
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: Ivo Zivkov
@@ -1,9 +0,0 @@
1
- # gshock_api/exceptions.py
2
-
3
- class GShockError(Exception):
4
- """Base exception for all G-Shock errors."""
5
- pass
6
-
7
- class GShockConnectionError(GShockError):
8
- """Raised when BLE connection to G-Shock device fails."""
9
- pass
File without changes
File without changes
File without changes