gshock-api 2.0.3__tar.gz → 2.0.4__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.3/src/gshock_api.egg-info → gshock_api-2.0.4}/PKG-INFO +1 -1
- {gshock_api-2.0.3 → gshock_api-2.0.4}/pyproject.toml +1 -1
- {gshock_api-2.0.3 → gshock_api-2.0.4}/setup.py +1 -1
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/connection.py +8 -2
- gshock_api-2.0.4/src/gshock_api/device.py +6 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/message_dispatcher.py +0 -1
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/scanner.py +7 -8
- {gshock_api-2.0.3 → gshock_api-2.0.4/src/gshock_api.egg-info}/PKG-INFO +1 -1
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api.egg-info/SOURCES.txt +1 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/LICENSE.txt +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/README.rst +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/setup.cfg +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/__init__.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/alarms.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/app_notification.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/cancelable_result.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/casio_constants.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/configurator.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/event.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/gshock_api.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/__init__.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/alarms_io.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/app_info_io.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/app_notification_io.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/button_pressed_io.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/dst_for_world_cities_io.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/dst_watch_state_io.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/error_io.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/events_io.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/settings_io.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/time_adjustement_io.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/time_io.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/timer_io.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/unknown_io.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/watch_condition_io.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/watch_name_io.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/iolib/world_cities_io.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/logger.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/mailsener.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/settings.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/utils.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api/watch_info.py +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api.egg-info/dependency_links.txt +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api.egg-info/not-zip-safe +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api.egg-info/requires.txt +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/src/gshock_api.egg-info/top_level.txt +0 -0
- {gshock_api-2.0.3 → gshock_api-2.0.4}/tests/test_code.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "gshock_api" # Change to your project name
|
|
7
|
-
version = "2.0.
|
|
7
|
+
version = "2.0.4"
|
|
8
8
|
description = "Pythgon API for GShock Watches using BLE"
|
|
9
9
|
readme = "README.rst"
|
|
10
10
|
authors = [{ name = "Ivo Zivkov", email = "izivkov@gmail.com" }]
|
|
@@ -5,14 +5,17 @@ from gshock_api.casio_constants import CasioConstants
|
|
|
5
5
|
from gshock_api import message_dispatcher
|
|
6
6
|
from gshock_api.utils import to_casio_cmd
|
|
7
7
|
from gshock_api.logger import logger
|
|
8
|
+
from gshock_api.watch_info import watch_info
|
|
9
|
+
from gshock_api.device import Device
|
|
8
10
|
|
|
9
11
|
class Connection:
|
|
10
|
-
def __init__(self, device):
|
|
12
|
+
def __init__(self, device: Device):
|
|
11
13
|
self.handles_map = self.init_handles_map()
|
|
12
14
|
self.device = device
|
|
13
|
-
self.client = BleakClient(device)
|
|
15
|
+
self.client = BleakClient(device.address)
|
|
14
16
|
self.characteristics_map = {}
|
|
15
17
|
|
|
18
|
+
|
|
16
19
|
def notification_handler(
|
|
17
20
|
self, characteristic: BleakGATTCharacteristic, data: bytearray
|
|
18
21
|
):
|
|
@@ -35,7 +38,10 @@ class Connection:
|
|
|
35
38
|
CasioConstants.CASIO_ALL_FEATURES_CHARACTERISTIC_UUID,
|
|
36
39
|
self.notification_handler,
|
|
37
40
|
)
|
|
41
|
+
|
|
42
|
+
watch_info.set_name_and_model(self.device.name)
|
|
38
43
|
return True
|
|
44
|
+
|
|
39
45
|
except Exception as e:
|
|
40
46
|
logger.debug(f"Cannot connect: {e}")
|
|
41
47
|
return False
|
|
@@ -4,12 +4,12 @@ from bleak import BleakScanner
|
|
|
4
4
|
from gshock_api.configurator import conf
|
|
5
5
|
from gshock_api.watch_info import watch_info
|
|
6
6
|
from gshock_api.logger import logger
|
|
7
|
-
|
|
7
|
+
from gshock_api.device import Device
|
|
8
8
|
|
|
9
9
|
class Scanner:
|
|
10
10
|
CASIO_SERVICE_UUID = "00001804-0000-1000-8000-00805f9b34fb"
|
|
11
11
|
|
|
12
|
-
async def scan(self, device_address=None):
|
|
12
|
+
async def scan(self, device_address=None) -> Device:
|
|
13
13
|
scanner = BleakScanner()
|
|
14
14
|
logger.info("Scanning for devices...")
|
|
15
15
|
|
|
@@ -22,10 +22,9 @@ class Scanner:
|
|
|
22
22
|
logger.info(f"device: {device}")
|
|
23
23
|
if device is None:
|
|
24
24
|
continue
|
|
25
|
-
|
|
26
|
-
#
|
|
27
|
-
# watch_info.
|
|
28
|
-
watch_info.set_name_and_model(device.name)
|
|
25
|
+
|
|
26
|
+
# This is now set after connection in Connection class
|
|
27
|
+
# watch_info.set_name_and_model(device.name)
|
|
29
28
|
|
|
30
29
|
conf.put("device.address", device.address)
|
|
31
30
|
conf.put("device.name", device.name)
|
|
@@ -35,8 +34,8 @@ class Scanner:
|
|
|
35
34
|
device = await scanner.find_device_by_address(
|
|
36
35
|
device_address, sys.float_info.max
|
|
37
36
|
)
|
|
37
|
+
watch_info.set_name_and_model(device.name)
|
|
38
38
|
|
|
39
|
-
return device
|
|
40
|
-
|
|
39
|
+
return Device(device.name, device.address)
|
|
41
40
|
|
|
42
41
|
scanner = Scanner()
|
|
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
|