python-igps-ble 0.1.0__tar.gz → 0.3.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.
Files changed (29) hide show
  1. python_igps_ble-0.3.4/LICENSE +21 -0
  2. python_igps_ble-0.3.4/PKG-INFO +151 -0
  3. python_igps_ble-0.3.4/README.md +133 -0
  4. {python_igps_ble-0.1.0 → python_igps_ble-0.3.4}/pyproject.toml +2 -2
  5. python_igps_ble-0.3.4/src/igps_ble/__init__.py +18 -0
  6. {python_igps_ble-0.1.0 → python_igps_ble-0.3.4}/src/igps_ble/__main__.py +3 -6
  7. python_igps_ble-0.3.4/src/igps_ble/client.py +528 -0
  8. python_igps_ble-0.3.4/src/igps_ble/models.py +59 -0
  9. python_igps_ble-0.3.4/src/igps_ble/protocol.py +210 -0
  10. {python_igps_ble-0.1.0 → python_igps_ble-0.3.4}/src/igps_ble/scanner.py +1 -3
  11. python_igps_ble-0.3.4/src/python_igps_ble.egg-info/PKG-INFO +151 -0
  12. {python_igps_ble-0.1.0 → python_igps_ble-0.3.4}/src/python_igps_ble.egg-info/SOURCES.txt +3 -0
  13. python_igps_ble-0.3.4/tests/test_protocol.py +162 -0
  14. python_igps_ble-0.1.0/PKG-INFO +0 -78
  15. python_igps_ble-0.1.0/README.md +0 -62
  16. python_igps_ble-0.1.0/src/igps_ble/__init__.py +0 -7
  17. python_igps_ble-0.1.0/src/igps_ble/client.py +0 -69
  18. python_igps_ble-0.1.0/src/igps_ble/models.py +0 -23
  19. python_igps_ble-0.1.0/src/python_igps_ble.egg-info/PKG-INFO +0 -78
  20. {python_igps_ble-0.1.0 → python_igps_ble-0.3.4}/setup.cfg +0 -0
  21. {python_igps_ble-0.1.0 → python_igps_ble-0.3.4}/src/igps_ble/const.py +0 -0
  22. {python_igps_ble-0.1.0 → python_igps_ble-0.3.4}/src/igps_ble/parser.py +0 -0
  23. {python_igps_ble-0.1.0 → python_igps_ble-0.3.4}/src/python_igps_ble.egg-info/dependency_links.txt +0 -0
  24. {python_igps_ble-0.1.0 → python_igps_ble-0.3.4}/src/python_igps_ble.egg-info/entry_points.txt +0 -0
  25. {python_igps_ble-0.1.0 → python_igps_ble-0.3.4}/src/python_igps_ble.egg-info/requires.txt +0 -0
  26. {python_igps_ble-0.1.0 → python_igps_ble-0.3.4}/src/python_igps_ble.egg-info/top_level.txt +0 -0
  27. {python_igps_ble-0.1.0 → python_igps_ble-0.3.4}/tests/test_client.py +0 -0
  28. {python_igps_ble-0.1.0 → python_igps_ble-0.3.4}/tests/test_parser.py +0 -0
  29. {python_igps_ble-0.1.0 → python_igps_ble-0.3.4}/tests/test_scanner.py +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hudson Brendon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,151 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-igps-ble
3
+ Version: 0.3.4
4
+ Summary: Pure-Python BLE library for the iGPSPORT iGS10S cycling computer (battery, sensors, ride status, activities, profile)
5
+ Author-email: Hudson Brendon <contato.hudsonbrendon@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/hudsonbrendon/python-igps-ble
8
+ Project-URL: Issues, https://github.com/hudsonbrendon/python-igps-ble/issues
9
+ Requires-Python: >=3.11
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: bleak>=0.22
13
+ Provides-Extra: dev
14
+ Requires-Dist: pytest>=8; extra == "dev"
15
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
16
+ Requires-Dist: ruff>=0.5; extra == "dev"
17
+ Dynamic: license-file
18
+
19
+ <p align="center">
20
+ <img src="assets/igpsport-logo.png" alt="iGPSPORT" width="420">
21
+ </p>
22
+
23
+ # python-igps-ble
24
+
25
+ [![CI](https://github.com/hudsonbrendon/python-igps-ble/actions/workflows/ci.yml/badge.svg)](https://github.com/hudsonbrendon/python-igps-ble/actions/workflows/ci.yml)
26
+ [![PyPI](https://img.shields.io/pypi/v/python-igps-ble)](https://pypi.org/project/python-igps-ble/)
27
+ [![Python](https://img.shields.io/pypi/pyversions/python-igps-ble)](https://pypi.org/project/python-igps-ble/)
28
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
29
+
30
+ Talk to an **iGPSPORT iGS10S** cycling computer over Bluetooth LE from Python —
31
+ battery, internal sensors, ride status, stored activities, last GPS position and
32
+ the rider/bike profile, through iGPSPORT's proprietary protobuf-over-Nordic-UART
33
+ protocol (reverse engineered from the official app, no pairing or login needed).
34
+
35
+ This library powers the
36
+ [**iGPSPORT iGS10S Home Assistant integration**](https://github.com/hudsonbrendon/ha-igps-ble),
37
+ but works standalone in any async Python project (or straight from the command line).
38
+
39
+ > Protocol notes:
40
+ > [`ha-igps-ble/docs/PROTOCOL.md`](https://github.com/hudsonbrendon/ha-igps-ble/blob/main/docs/PROTOCOL.md).
41
+
42
+ ## Features
43
+
44
+ - 🔌 **Async BLE control** built on [`bleak`](https://github.com/hbldh/bleak) —
45
+ works on Linux, macOS, and Windows.
46
+ - 🔍 **Discovery helper** — `discover_devices()` finds nearby iGPSPORT devices
47
+ (presence + RSSI).
48
+ - 🏷️ **Device info** — manufacturer, hardware revision, firmware, serial and
49
+ protocol version.
50
+ - 🔋 **Battery** — level (%) and voltage.
51
+ - 🌡️ **Sensors** — internal temperature, free memory, device clock.
52
+ - 🚴 **Ride status** — idle / recording / paused, live ride fields while recording,
53
+ last GPS position.
54
+ - 🗂️ **Activities** — list of rides stored on the device (start time, size).
55
+ - 💾 **`.fit` download** — `download_activity(session, id, size)` with per-chunk CRC and
56
+ size checks.
57
+ - 🧹 **Maintenance** — delete one/all activities, `factory_control()` (format,
58
+ factory reset, settings reset, lock, logs, test mode), unbind, DFU mode.
59
+ - 🛰️ **GPS** — `gps_control()`, `set_gnss()`, `set_gps_dynamic()`, `set_gps_position()`.
60
+ - 🧪 **Raw** — `command(session, service, op, fields)` for anything else.
61
+ - ⚙️ **Profile** — write rider weight/height/age/sex, wheel circumference, bike
62
+ weight and time zone (`set_profile`).
63
+ - 🖥️ **CLI** — `igps-ble scan / info` for quick testing.
64
+
65
+ ## Requirements
66
+
67
+ - Python **3.11** or newer.
68
+ - A Bluetooth LE adapter (built-in or USB).
69
+ - An iGPSPORT iGS10S (other iGPSPORT models exposing the same standard services
70
+ may also work).
71
+
72
+ ## Installation
73
+
74
+ ```bash
75
+ pip install python-igps-ble
76
+ ```
77
+
78
+ ## CLI usage
79
+
80
+ ```bash
81
+ igps-ble scan # find nearby iGPSPORT devices
82
+ igps-ble info AA:BB:CC:DD:EE:FF # connect and read everything
83
+ ```
84
+
85
+ ## Library usage
86
+
87
+ ```python
88
+ import asyncio
89
+ from igps_ble import IGPSDeviceState
90
+ from igps_ble.scanner import discover_devices
91
+ from igps_ble.client import IGPSClient
92
+
93
+
94
+ async def main():
95
+ for dev in await discover_devices(timeout=10):
96
+ state: IGPSDeviceState = await IGPSClient(
97
+ dev.address, dev.name
98
+ ).async_read_state()
99
+ print(state.manufacturer, state.model, state.firmware, state.battery_level)
100
+
101
+
102
+ asyncio.run(main())
103
+ ```
104
+
105
+ `IGPSClient` accepts a `bleak` `BLEDevice` (preferred — e.g. from Home Assistant's
106
+ shared scanner or a Bluetooth proxy) or a string MAC/UUID address.
107
+
108
+ ### API
109
+
110
+ | Symbol | Description |
111
+ |---|---|
112
+ | `discover_devices(timeout=10.0)` | List nearby iGPSPORT devices as `IGPSDeviceState` (presence + RSSI; does not connect). |
113
+ | `is_igps_device(local_name)` | `True` if an advertisement name matches a known iGPSPORT prefix. |
114
+ | `IGPSClient(address, name="iGS10S", rssi=None)` | Async client; `await client.async_read_state()` connects and returns an `IGPSDeviceState`. |
115
+ | `read_state(client, address, name, rssi, session=None)` | Read everything over an already-connected `BleakClient`. |
116
+ | `IGPSSession(client)` | Request/response over the NUS channels; `await session.start()` once per connection. |
117
+ | `set_profile(session, UserProfile(...))` | Write the whole rider/bike profile (the device does not report it back). |
118
+ | `IGPSDeviceState` | Frozen dataclass with everything read (battery, sensors, ride status, GPS, activities…). |
119
+ | `igps_ble.protocol` | Framing (20-byte header, CRC-8/MAXIM) and a tiny protobuf codec. |
120
+ | `parse_battery_level(data)` / `decode_device_string(data)` | Pure parsers for the standard Bluetooth SIG characteristics. |
121
+
122
+ ## Scope
123
+
124
+ | Data | Supported | Source |
125
+ |------|-----------|--------|
126
+ | Presence | ✅ | BLE advertisement |
127
+ | Manufacturer / hardware / firmware | ✅ | Device Information Service `0x180A` |
128
+ | Battery % / voltage | ✅ | FACTORY service (protobuf) |
129
+ | Serial, memory, temperature, clock | ✅ | FACTORY service |
130
+ | Ride status, last GPS fix, live ride fields | ✅ | DEV_STATUS service (live field units unconfirmed) |
131
+ | Stored activity list | ✅ | CYCLING_DATA service |
132
+ | Rider/bike profile, time zone | ✅ write-only | USER_CONFIG service |
133
+ | `.fit` download | ✅ | CYCLING_DATA FILE_GET |
134
+ | Delete activities, format, factory reset, GPS/factory settings, unbind, DFU | ✅ not live-tested | FACTORY / CYCLING_DATA / BLE / FIRMWARE |
135
+ | Display/page settings, time sync | ❌ | unsupported by the iGS10S firmware |
136
+
137
+ ## Development
138
+
139
+ ```bash
140
+ python -m venv .venv && .venv/bin/pip install -e ".[dev]"
141
+ .venv/bin/pytest
142
+ ```
143
+
144
+ ## Credits
145
+
146
+ Built to back the [`ha-igps-ble`](https://github.com/hudsonbrendon/ha-igps-ble)
147
+ Home Assistant integration. Author [@hudsonbrendon](https://github.com/hudsonbrendon).
148
+
149
+ ## License
150
+
151
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,133 @@
1
+ <p align="center">
2
+ <img src="assets/igpsport-logo.png" alt="iGPSPORT" width="420">
3
+ </p>
4
+
5
+ # python-igps-ble
6
+
7
+ [![CI](https://github.com/hudsonbrendon/python-igps-ble/actions/workflows/ci.yml/badge.svg)](https://github.com/hudsonbrendon/python-igps-ble/actions/workflows/ci.yml)
8
+ [![PyPI](https://img.shields.io/pypi/v/python-igps-ble)](https://pypi.org/project/python-igps-ble/)
9
+ [![Python](https://img.shields.io/pypi/pyversions/python-igps-ble)](https://pypi.org/project/python-igps-ble/)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
11
+
12
+ Talk to an **iGPSPORT iGS10S** cycling computer over Bluetooth LE from Python —
13
+ battery, internal sensors, ride status, stored activities, last GPS position and
14
+ the rider/bike profile, through iGPSPORT's proprietary protobuf-over-Nordic-UART
15
+ protocol (reverse engineered from the official app, no pairing or login needed).
16
+
17
+ This library powers the
18
+ [**iGPSPORT iGS10S Home Assistant integration**](https://github.com/hudsonbrendon/ha-igps-ble),
19
+ but works standalone in any async Python project (or straight from the command line).
20
+
21
+ > Protocol notes:
22
+ > [`ha-igps-ble/docs/PROTOCOL.md`](https://github.com/hudsonbrendon/ha-igps-ble/blob/main/docs/PROTOCOL.md).
23
+
24
+ ## Features
25
+
26
+ - 🔌 **Async BLE control** built on [`bleak`](https://github.com/hbldh/bleak) —
27
+ works on Linux, macOS, and Windows.
28
+ - 🔍 **Discovery helper** — `discover_devices()` finds nearby iGPSPORT devices
29
+ (presence + RSSI).
30
+ - 🏷️ **Device info** — manufacturer, hardware revision, firmware, serial and
31
+ protocol version.
32
+ - 🔋 **Battery** — level (%) and voltage.
33
+ - 🌡️ **Sensors** — internal temperature, free memory, device clock.
34
+ - 🚴 **Ride status** — idle / recording / paused, live ride fields while recording,
35
+ last GPS position.
36
+ - 🗂️ **Activities** — list of rides stored on the device (start time, size).
37
+ - 💾 **`.fit` download** — `download_activity(session, id, size)` with per-chunk CRC and
38
+ size checks.
39
+ - 🧹 **Maintenance** — delete one/all activities, `factory_control()` (format,
40
+ factory reset, settings reset, lock, logs, test mode), unbind, DFU mode.
41
+ - 🛰️ **GPS** — `gps_control()`, `set_gnss()`, `set_gps_dynamic()`, `set_gps_position()`.
42
+ - 🧪 **Raw** — `command(session, service, op, fields)` for anything else.
43
+ - ⚙️ **Profile** — write rider weight/height/age/sex, wheel circumference, bike
44
+ weight and time zone (`set_profile`).
45
+ - 🖥️ **CLI** — `igps-ble scan / info` for quick testing.
46
+
47
+ ## Requirements
48
+
49
+ - Python **3.11** or newer.
50
+ - A Bluetooth LE adapter (built-in or USB).
51
+ - An iGPSPORT iGS10S (other iGPSPORT models exposing the same standard services
52
+ may also work).
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ pip install python-igps-ble
58
+ ```
59
+
60
+ ## CLI usage
61
+
62
+ ```bash
63
+ igps-ble scan # find nearby iGPSPORT devices
64
+ igps-ble info AA:BB:CC:DD:EE:FF # connect and read everything
65
+ ```
66
+
67
+ ## Library usage
68
+
69
+ ```python
70
+ import asyncio
71
+ from igps_ble import IGPSDeviceState
72
+ from igps_ble.scanner import discover_devices
73
+ from igps_ble.client import IGPSClient
74
+
75
+
76
+ async def main():
77
+ for dev in await discover_devices(timeout=10):
78
+ state: IGPSDeviceState = await IGPSClient(
79
+ dev.address, dev.name
80
+ ).async_read_state()
81
+ print(state.manufacturer, state.model, state.firmware, state.battery_level)
82
+
83
+
84
+ asyncio.run(main())
85
+ ```
86
+
87
+ `IGPSClient` accepts a `bleak` `BLEDevice` (preferred — e.g. from Home Assistant's
88
+ shared scanner or a Bluetooth proxy) or a string MAC/UUID address.
89
+
90
+ ### API
91
+
92
+ | Symbol | Description |
93
+ |---|---|
94
+ | `discover_devices(timeout=10.0)` | List nearby iGPSPORT devices as `IGPSDeviceState` (presence + RSSI; does not connect). |
95
+ | `is_igps_device(local_name)` | `True` if an advertisement name matches a known iGPSPORT prefix. |
96
+ | `IGPSClient(address, name="iGS10S", rssi=None)` | Async client; `await client.async_read_state()` connects and returns an `IGPSDeviceState`. |
97
+ | `read_state(client, address, name, rssi, session=None)` | Read everything over an already-connected `BleakClient`. |
98
+ | `IGPSSession(client)` | Request/response over the NUS channels; `await session.start()` once per connection. |
99
+ | `set_profile(session, UserProfile(...))` | Write the whole rider/bike profile (the device does not report it back). |
100
+ | `IGPSDeviceState` | Frozen dataclass with everything read (battery, sensors, ride status, GPS, activities…). |
101
+ | `igps_ble.protocol` | Framing (20-byte header, CRC-8/MAXIM) and a tiny protobuf codec. |
102
+ | `parse_battery_level(data)` / `decode_device_string(data)` | Pure parsers for the standard Bluetooth SIG characteristics. |
103
+
104
+ ## Scope
105
+
106
+ | Data | Supported | Source |
107
+ |------|-----------|--------|
108
+ | Presence | ✅ | BLE advertisement |
109
+ | Manufacturer / hardware / firmware | ✅ | Device Information Service `0x180A` |
110
+ | Battery % / voltage | ✅ | FACTORY service (protobuf) |
111
+ | Serial, memory, temperature, clock | ✅ | FACTORY service |
112
+ | Ride status, last GPS fix, live ride fields | ✅ | DEV_STATUS service (live field units unconfirmed) |
113
+ | Stored activity list | ✅ | CYCLING_DATA service |
114
+ | Rider/bike profile, time zone | ✅ write-only | USER_CONFIG service |
115
+ | `.fit` download | ✅ | CYCLING_DATA FILE_GET |
116
+ | Delete activities, format, factory reset, GPS/factory settings, unbind, DFU | ✅ not live-tested | FACTORY / CYCLING_DATA / BLE / FIRMWARE |
117
+ | Display/page settings, time sync | ❌ | unsupported by the iGS10S firmware |
118
+
119
+ ## Development
120
+
121
+ ```bash
122
+ python -m venv .venv && .venv/bin/pip install -e ".[dev]"
123
+ .venv/bin/pytest
124
+ ```
125
+
126
+ ## Credits
127
+
128
+ Built to back the [`ha-igps-ble`](https://github.com/hudsonbrendon/ha-igps-ble)
129
+ Home Assistant integration. Author [@hudsonbrendon](https://github.com/hudsonbrendon).
130
+
131
+ ## License
132
+
133
+ MIT — see [LICENSE](LICENSE).
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python-igps-ble"
7
- version = "0.1.0"
8
- description = "Pure-Python BLE library for the iGPSPORT iGS10S cycling computer (presence, battery, device info)"
7
+ version = "0.3.4"
8
+ description = "Pure-Python BLE library for the iGPSPORT iGS10S cycling computer (battery, sensors, ride status, activities, profile)"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
11
11
  requires-python = ">=3.11"
@@ -0,0 +1,18 @@
1
+ """Pure-Python BLE library for the iGPSPORT iGS10S cycling computer."""
2
+
3
+ from .client import IGPSClient, IGPSCommandError, IGPSSession, read_state, set_profile
4
+ from .models import Activity, IGPSDeviceState, UserProfile
5
+
6
+ __version__ = "0.3.4"
7
+
8
+ __all__ = [
9
+ "Activity",
10
+ "IGPSClient",
11
+ "IGPSCommandError",
12
+ "IGPSDeviceState",
13
+ "IGPSSession",
14
+ "UserProfile",
15
+ "__version__",
16
+ "read_state",
17
+ "set_profile",
18
+ ]
@@ -20,11 +20,8 @@ async def _scan(timeout: float) -> None:
20
20
 
21
21
  async def _info(address: str) -> None:
22
22
  state = await IGPSClient(address).async_read_state()
23
- print(f"Endereço: {state.address}")
24
- print(f"Modelo: {state.model}")
25
- print(f"Firmware: {state.firmware}")
26
- print(f"Fabricante: {state.manufacturer}")
27
- print(f"Bateria: {state.battery_level}%")
23
+ for name in state.__slots__:
24
+ print(f"{name:17} {getattr(state, name)}")
28
25
 
29
26
 
30
27
  def main() -> None:
@@ -32,7 +29,7 @@ def main() -> None:
32
29
  sub = parser.add_subparsers(dest="cmd", required=True)
33
30
  p_scan = sub.add_parser("scan", help="Procura aparelhos iGPSPORT por perto")
34
31
  p_scan.add_argument("--timeout", type=float, default=10.0)
35
- p_info = sub.add_parser("info", help="Conecta e lê bateria/device-info")
32
+ p_info = sub.add_parser("info", help="Conecta e lê tudo que o aparelho expõe")
36
33
  p_info.add_argument("address")
37
34
 
38
35
  args = parser.parse_args()