Skip to main content

TPM multicast client

Project description

tpm_multicast_client

Versions Code style: black Test codecov

Listens to the TPM multicast stream and unpack the data into a status dictionary. This is a Python-only implementation of Jeff Hagen's tpmdgram.c.

Installation

To install with pip do

pip install sdss-tpm-multicast-client

To install from source do

pip install .

or, for development,

poetry install

More information on developing with Poetry can be found here.

Usage

The library provides a single function, listen_to_multicast, that creates a connection to the TPM broadcast, unpacks the datagram, and passes it to a callback function. A basic example

from pprint import pprint

from tpm_multicast_client import __version__, listen_to_multicast


def pprint_datagram(data: dict):
    pprint(data)

async def main():
    _, protocol = await listen_to_multicast(pprint_datagram)
    await protocol.run_forever()


if __name__ == "__main__":
    main()

The callback, pprint_datagram in this case, can be a function or a coroutine. In the former case it will be called with loop.call_soon(). In the latter the coroutine is scheduled as a task.

CLI

The library provides a simple CLI script tpm-multicast-client that prints the output of the datagram to stdout. It's basically equivalent to the example above.

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

sdss_tpm_multicast_client-0.3.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file sdss_tpm_multicast_client-0.3.1.tar.gz.

File metadata

File hashes

Hashes for sdss_tpm_multicast_client-0.3.1.tar.gz
Algorithm Hash digest
SHA256 bb3052dcc838fc43699f4f856f517874156657fda00c2bcf7dce63991ef903dd
MD5 04659a96c6d83d452c5269d04a4e82ac
BLAKE2b-256 8d964ec0aebfbe5c5cf550f905b1dcace5c90895462fbe0a258d0dcf1785e7b2

See more details on using hashes here.

File details

Details for the file sdss_tpm_multicast_client-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sdss_tpm_multicast_client-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e2af843603ad2a39e6cfee6d42107f1824c650ab35dff5be45bc984768f392c2
MD5 64036fb205495d06267d78f8923aa881
BLAKE2b-256 3253232b0872387dabbc81004f23ecc1bbe15f4aff46eb4cd252f38ad9212ebc

See more details on using hashes here.

Supported by

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