Skip to main content

A simple CPDLC client

Project description

python-cpdlc

A simple CPDLC client for flight simulation written by python

Quick Start

  1. install package with pip or any tools you like
pip install python-cpdlc
  1. use example code under
    By the way, dont forgot to logon your ATC CPDLC first :)
import asyncio

from python_cpdlc import CPDLC


async def main():
    # Create CPDLC client instance
    cpdlc = CPDLC()

    # Set your hoppie code
    cpdlc.set_logon_code("11111111111")

    # Set your email for network change (If you dont need to change network, you can skip it)
    cpdlc.set_email("halfnothingno@gmail.com")

    # of course, you can use your own hoppie server
    # cpdlc.set_acars_url("http://127.0.0.1:80")

    # you can add callback function which will be called when cpdlc connected and disconnected
    # there can only be one callback function per event
    # cpdlc.set_cpdlc_connect_callback(lambda: None)
    # cpdlc.set_cpdlc_disconnect_callback(lambda: None)
    # cpdlc.set_cpdlc_atc_info_update_callback(lambda: None)

    # you also can add message callback
    # cpdlc.add_message_sender_callback()
    # cpdlc.add_message_receiver_callback()

    # Decorators are recommended unless your callback function is a class method
    # @cpdlc.listen_message_receiver()
    # def message_receiver(msg: AcarsMessage):
    #     pass
    # @cpdlc.listen_message_sender()
    # def message_sender(to: str, msg: str):
    #     pass

    # you should set your callsign before you use CPDLC, and you can change this anytime you like
    # but if you change this callsign, you may miss some message send to you
    cpdlc.set_callsign("CES2352")

    # after set complete, you need to initialize service
    cpdlc.initialize_service()

    # you can reset service or reinitialize service anytime you like
    # cpdlc.reset_service()
    # cpdlc.reinitialize_service()

    # you can get your current network by cpdlc.network
    # you can change your network if necessary
    # cpdlc.change_network(Network.VATSIM)

    # some function...
    # cpdlc.query_info()
    # cpdlc.send_telex_message()
    # cpdlc.departure_clearance_delivery()

    # send login request
    cpdlc.cpdlc_login("ZSHA")

    # wait 60 seconds
    await asyncio.sleep(60)

    # request logout
    cpdlc.cpdlc_logout()


if __name__ == "__main__":
    asyncio.run(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_cpdlc-1.3.5.tar.gz (29.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_cpdlc-1.3.5-py3-none-any.whl (35.2 kB view details)

Uploaded Python 3

File details

Details for the file python_cpdlc-1.3.5.tar.gz.

File metadata

  • Download URL: python_cpdlc-1.3.5.tar.gz
  • Upload date:
  • Size: 29.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.4 CPython/3.10.7 Windows/10

File hashes

Hashes for python_cpdlc-1.3.5.tar.gz
Algorithm Hash digest
SHA256 9d0317c6d258c45cfc2fc5e3f2e28a39cb32219275720301b1fb0ab126a29dc5
MD5 e6ece41a7508f88078b06266e5ee8b7f
BLAKE2b-256 6fcc6a387f2feab01c79d6021f5791375f470d0b9706444c5cce96a0567b8f0a

See more details on using hashes here.

File details

Details for the file python_cpdlc-1.3.5-py3-none-any.whl.

File metadata

  • Download URL: python_cpdlc-1.3.5-py3-none-any.whl
  • Upload date:
  • Size: 35.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.4 CPython/3.10.7 Windows/10

File hashes

Hashes for python_cpdlc-1.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 97ccd5983d9051a2a6d7236fc45c47ae0db0d12dcaa7ad4e539dfee46d0ff8fe
MD5 55535f8521b7ee0b94a0ef5b984b1a15
BLAKE2b-256 4735ec016397eff452377ab0347fbc834fa4e1cd0fd4339af8617bb29b0f67c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page