fsd9lib 0.1.0__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.
fsd9lib-0.1.0/LICENSE ADDED
@@ -0,0 +1,17 @@
1
+ GNU AFFERO GENERAL PUBLIC LICENSE
2
+ Version 3, 19 November 2007
3
+
4
+ Copyright (C) 2025 fsd9lib contributors
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU Affero General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU Affero General Public License for more details.
15
+
16
+ You should have received a copy of the GNU Affero General Public License
17
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
@@ -0,0 +1,3 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include src *.py
fsd9lib-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,160 @@
1
+ Metadata-Version: 2.4
2
+ Name: fsd9lib
3
+ Version: 0.1.0
4
+ Summary: A Python FSD (Flight Simulator Data) protocol v9 library for VATSIM-compatible pilot client connections
5
+ Author: fsd9lib contributors
6
+ License-Expression: AGPL-3.0
7
+ Project-URL: Homepage, https://github.com/example/fsd9
8
+ Project-URL: Repository, https://github.com/example/fsd9
9
+ Keywords: fsd,flight-simulator,vatsim,fsd9,fsd9lib,aviation,atc,pilot,flight-simulation,networking,protocol
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Games/Entertainment :: Simulation
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=7.0; extra == "dev"
26
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
27
+ Requires-Dist: black>=23.0; extra == "dev"
28
+ Requires-Dist: mypy>=1.0; extra == "dev"
29
+ Dynamic: license-file
30
+
31
+ # fsd9lib
32
+
33
+ A Python library for the FSD (Flight Simulator Data) protocol version 9 — the classic VATSIM-compatible protocol for flight simulation networking.
34
+
35
+ **Zero dependencies** — uses only Python's standard library (`asyncio`).
36
+
37
+ ## Features
38
+
39
+ - Full FSD protocol v9 packet construction and parsing
40
+ - PBH (Pitch/Bank/Heading) encoding/decoding
41
+ - Radio frequency encoding/decoding
42
+ - Async TCP connection with auto-reconnect
43
+ - High-level `PilotClient` for crew (pilot) connections
44
+ - Callback-based message/position/error handling
45
+ - Complete enum types: ratings, facility types, simulator types, error codes, etc.
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ pip install fsd9lib
51
+ ```
52
+
53
+ ## Quick Start
54
+
55
+ ```python
56
+ import asyncio
57
+ from fsd9 import PilotClient, NetworkRating, SimulatorType
58
+
59
+ async def main():
60
+ # Create a pilot client
61
+ client = PilotClient(
62
+ callsign="N7938C",
63
+ cid="123456",
64
+ password="your_vatsim_password",
65
+ server="eu.velocity.vatsim.net",
66
+ real_name="John Doe",
67
+ sim_type=SimulatorType.MSFS2020,
68
+ )
69
+
70
+ # Register callbacks
71
+ async def on_message(client, sender, text):
72
+ print(f"[{sender}] {text}")
73
+
74
+ async def on_position(client, callsign, data):
75
+ print(f" {callsign} @ {data['lat']:.4f}, {data['lon']:.4f} "
76
+ f"FL{data['altitude_true'] // 100} "
77
+ f"GS={data['ground_speed']}kt "
78
+ f"HDG={data['heading']:.0f}°")
79
+
80
+ client.on_message = on_message
81
+ client.on_position = on_position
82
+
83
+ # Connect and login
84
+ await client.connect()
85
+ print(f"Connected as {client.callsign}")
86
+
87
+ # File a flight plan
88
+ await client.file_flight_plan(
89
+ flight_rules="I",
90
+ equipment="H/B738/L",
91
+ tas=450,
92
+ dep_airport="KLAX",
93
+ dest_airport="KSFO",
94
+ cruise_alt=35000,
95
+ hrs_enroute=1,
96
+ min_enroute=30,
97
+ route="VTU5 RZS STOKD SERFR SERFR3",
98
+ )
99
+
100
+ # Send position updates
101
+ await client.send_position(40.65906, -73.79891, 35000, 450, 2.0, 0.0, 90.0)
102
+
103
+ # Send a text message on frequency
104
+ await client.send_radio_message(122.800, "Traffic in sight")
105
+
106
+ # Keep running
107
+ await asyncio.sleep(60)
108
+ await client.disconnect()
109
+
110
+ asyncio.run(main())
111
+ ```
112
+
113
+ ## Auto-Position Mode
114
+
115
+ ```python
116
+ client = PilotClient(
117
+ callsign="N7938C",
118
+ cid="123456",
119
+ password="secret",
120
+ auto_position=True, # Automatically send position every 5s
121
+ position_interval=5.0, # Customize interval
122
+ )
123
+
124
+ await client.connect()
125
+
126
+ # Set the position once — it will repeat automatically
127
+ await client.send_position(40.659, -73.798, 35000, 450)
128
+ ```
129
+
130
+ ## Low-Level Packet API
131
+
132
+ Build and parse individual packets without a connection:
133
+
134
+ ```python
135
+ from fsd9 import packet, frequency, pbh
136
+
137
+ # Pack PBH
138
+ pbh_val = pbh.pack(pitch=2.0, bank=0.0, heading=90.0)
139
+ pitch, bank, heading, on_ground = pbh.unpack(pbh_val)
140
+
141
+ # Encode frequency
142
+ wire = frequency.encode(122.800) # → 22800
143
+ mhz = frequency.decode(22800) # → 122.800
144
+
145
+ # Build packets
146
+ login = packet.build_add_pilot("N7938C", "123456", "pass")
147
+ pos = packet.build_pilot_position("N7938C", "N", 0o2000,
148
+ NetworkRating.OBS, 40.659, -73.798, 35000, 450, 2.0, 0.0, 90.0)
149
+ ```
150
+
151
+ ## Protocol Version
152
+
153
+ This library implements **FSD protocol revision 9** (classic/legacy), which uses plaintext password authentication. It does NOT support:
154
+ - VATSIM Auth (revision 100) — challenge-response MD5
155
+ - VATSIM JWT (revision 101) — JWT tokens
156
+ - VATSIM Velocity fast positions (revision 101+)
157
+
158
+ ## License
159
+
160
+ AGPL-3.0
@@ -0,0 +1,130 @@
1
+ # fsd9lib
2
+
3
+ A Python library for the FSD (Flight Simulator Data) protocol version 9 — the classic VATSIM-compatible protocol for flight simulation networking.
4
+
5
+ **Zero dependencies** — uses only Python's standard library (`asyncio`).
6
+
7
+ ## Features
8
+
9
+ - Full FSD protocol v9 packet construction and parsing
10
+ - PBH (Pitch/Bank/Heading) encoding/decoding
11
+ - Radio frequency encoding/decoding
12
+ - Async TCP connection with auto-reconnect
13
+ - High-level `PilotClient` for crew (pilot) connections
14
+ - Callback-based message/position/error handling
15
+ - Complete enum types: ratings, facility types, simulator types, error codes, etc.
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ pip install fsd9lib
21
+ ```
22
+
23
+ ## Quick Start
24
+
25
+ ```python
26
+ import asyncio
27
+ from fsd9 import PilotClient, NetworkRating, SimulatorType
28
+
29
+ async def main():
30
+ # Create a pilot client
31
+ client = PilotClient(
32
+ callsign="N7938C",
33
+ cid="123456",
34
+ password="your_vatsim_password",
35
+ server="eu.velocity.vatsim.net",
36
+ real_name="John Doe",
37
+ sim_type=SimulatorType.MSFS2020,
38
+ )
39
+
40
+ # Register callbacks
41
+ async def on_message(client, sender, text):
42
+ print(f"[{sender}] {text}")
43
+
44
+ async def on_position(client, callsign, data):
45
+ print(f" {callsign} @ {data['lat']:.4f}, {data['lon']:.4f} "
46
+ f"FL{data['altitude_true'] // 100} "
47
+ f"GS={data['ground_speed']}kt "
48
+ f"HDG={data['heading']:.0f}°")
49
+
50
+ client.on_message = on_message
51
+ client.on_position = on_position
52
+
53
+ # Connect and login
54
+ await client.connect()
55
+ print(f"Connected as {client.callsign}")
56
+
57
+ # File a flight plan
58
+ await client.file_flight_plan(
59
+ flight_rules="I",
60
+ equipment="H/B738/L",
61
+ tas=450,
62
+ dep_airport="KLAX",
63
+ dest_airport="KSFO",
64
+ cruise_alt=35000,
65
+ hrs_enroute=1,
66
+ min_enroute=30,
67
+ route="VTU5 RZS STOKD SERFR SERFR3",
68
+ )
69
+
70
+ # Send position updates
71
+ await client.send_position(40.65906, -73.79891, 35000, 450, 2.0, 0.0, 90.0)
72
+
73
+ # Send a text message on frequency
74
+ await client.send_radio_message(122.800, "Traffic in sight")
75
+
76
+ # Keep running
77
+ await asyncio.sleep(60)
78
+ await client.disconnect()
79
+
80
+ asyncio.run(main())
81
+ ```
82
+
83
+ ## Auto-Position Mode
84
+
85
+ ```python
86
+ client = PilotClient(
87
+ callsign="N7938C",
88
+ cid="123456",
89
+ password="secret",
90
+ auto_position=True, # Automatically send position every 5s
91
+ position_interval=5.0, # Customize interval
92
+ )
93
+
94
+ await client.connect()
95
+
96
+ # Set the position once — it will repeat automatically
97
+ await client.send_position(40.659, -73.798, 35000, 450)
98
+ ```
99
+
100
+ ## Low-Level Packet API
101
+
102
+ Build and parse individual packets without a connection:
103
+
104
+ ```python
105
+ from fsd9 import packet, frequency, pbh
106
+
107
+ # Pack PBH
108
+ pbh_val = pbh.pack(pitch=2.0, bank=0.0, heading=90.0)
109
+ pitch, bank, heading, on_ground = pbh.unpack(pbh_val)
110
+
111
+ # Encode frequency
112
+ wire = frequency.encode(122.800) # → 22800
113
+ mhz = frequency.decode(22800) # → 122.800
114
+
115
+ # Build packets
116
+ login = packet.build_add_pilot("N7938C", "123456", "pass")
117
+ pos = packet.build_pilot_position("N7938C", "N", 0o2000,
118
+ NetworkRating.OBS, 40.659, -73.798, 35000, 450, 2.0, 0.0, 90.0)
119
+ ```
120
+
121
+ ## Protocol Version
122
+
123
+ This library implements **FSD protocol revision 9** (classic/legacy), which uses plaintext password authentication. It does NOT support:
124
+ - VATSIM Auth (revision 100) — challenge-response MD5
125
+ - VATSIM JWT (revision 101) — JWT tokens
126
+ - VATSIM Velocity fast positions (revision 101+)
127
+
128
+ ## License
129
+
130
+ AGPL-3.0
@@ -0,0 +1,55 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "fsd9lib"
7
+ version = "0.1.0"
8
+ description = "A Python FSD (Flight Simulator Data) protocol v9 library for VATSIM-compatible pilot client connections"
9
+ readme = "README.md"
10
+ license = "AGPL-3.0"
11
+ authors = [
12
+ {name = "fsd9lib contributors"}
13
+ ]
14
+ keywords = [
15
+ "fsd", "flight-simulator", "vatsim", "fsd9", "fsd9lib", "aviation",
16
+ "atc", "pilot", "flight-simulation", "networking", "protocol"
17
+ ]
18
+ classifiers = [
19
+ "Development Status :: 3 - Alpha",
20
+ "Intended Audience :: Developers",
21
+ "Operating System :: OS Independent",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.9",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ "Topic :: Games/Entertainment :: Simulation",
29
+ "Topic :: Software Development :: Libraries :: Python Modules",
30
+ ]
31
+ requires-python = ">=3.9"
32
+ dependencies = []
33
+
34
+ [project.optional-dependencies]
35
+ dev = [
36
+ "pytest>=7.0",
37
+ "pytest-asyncio>=0.21",
38
+ "black>=23.0",
39
+ "mypy>=1.0",
40
+ ]
41
+
42
+ [project.urls]
43
+ Homepage = "https://github.com/example/fsd9"
44
+ Repository = "https://github.com/example/fsd9"
45
+
46
+ [tool.setuptools.packages.find]
47
+ where = ["src"]
48
+
49
+ [tool.black]
50
+ line-length = 100
51
+ target-version = ["py39"]
52
+
53
+ [tool.mypy]
54
+ python_version = "3.9"
55
+ strict = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,102 @@
1
+ """
2
+ FSD9 — A Python library for FSD (Flight Simulator Data) protocol v9.
3
+
4
+ Provides a complete implementation of the classic FSD protocol for
5
+ VATSIM-compatible pilot client connections. Supports protocol revision 9
6
+ (legacy plaintext authentication).
7
+
8
+ Quick start::
9
+
10
+ import asyncio
11
+ from fsd9 import PilotClient
12
+
13
+ async def main():
14
+ client = PilotClient(
15
+ callsign="N7938C",
16
+ cid="123456",
17
+ password="secret",
18
+ server="eu.velocity.vatsim.net",
19
+ )
20
+
21
+ async def on_msg(client, sender, text):
22
+ print(f"[{sender}] {text}")
23
+
24
+ client.on_message = on_msg
25
+
26
+ await client.connect()
27
+ await client.send_position(40.659, -73.798, 35000, 450, 2.0, 0.0, 90.0)
28
+ # ... do stuff ...
29
+ await client.disconnect()
30
+
31
+ asyncio.run(main())
32
+ """
33
+
34
+ from .client import PilotClient
35
+ from .connection import FSDConnection
36
+ from .constants import (
37
+ Capability,
38
+ FacilityType,
39
+ FlightRules,
40
+ NetworkRating,
41
+ PilotRating,
42
+ Recipient,
43
+ ServerError,
44
+ SimulatorType,
45
+ TransponderMode,
46
+ FSD_DEFAULT_PORT,
47
+ PROTOCOL_REVISION_CLASSIC,
48
+ CALLSIGN_MIN_LENGTH,
49
+ CALLSIGN_MAX_LENGTH,
50
+ KNOWN_CLIENT_IDS,
51
+ ATC_VISUAL_RANGES,
52
+ )
53
+ from .errors import (
54
+ FSDError,
55
+ FSDConnectionError,
56
+ FSDLoginError,
57
+ FSDProtocolError,
58
+ FSDServerError,
59
+ FSDCallsignError,
60
+ FSDSquawkError,
61
+ FSDFrequencyError,
62
+ )
63
+ from . import frequency
64
+ from . import pbh
65
+ from . import packet
66
+
67
+ __version__ = "0.1.0"
68
+ __all__ = [
69
+ # Client
70
+ "PilotClient",
71
+ "FSDConnection",
72
+ # Enums
73
+ "NetworkRating",
74
+ "PilotRating",
75
+ "SimulatorType",
76
+ "FacilityType",
77
+ "TransponderMode",
78
+ "FlightRules",
79
+ "ServerError",
80
+ "Capability",
81
+ "Recipient",
82
+ # Constants
83
+ "FSD_DEFAULT_PORT",
84
+ "PROTOCOL_REVISION_CLASSIC",
85
+ "CALLSIGN_MIN_LENGTH",
86
+ "CALLSIGN_MAX_LENGTH",
87
+ "KNOWN_CLIENT_IDS",
88
+ "ATC_VISUAL_RANGES",
89
+ # Errors
90
+ "FSDError",
91
+ "FSDConnectionError",
92
+ "FSDLoginError",
93
+ "FSDProtocolError",
94
+ "FSDServerError",
95
+ "FSDCallsignError",
96
+ "FSDSquawkError",
97
+ "FSDFrequencyError",
98
+ # Modules
99
+ "frequency",
100
+ "pbh",
101
+ "packet",
102
+ ]