TPM multicast client
Project description
tpm_multicast_client
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sdss_tpm_multicast_client-0.3.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb3052dcc838fc43699f4f856f517874156657fda00c2bcf7dce63991ef903dd |
|
MD5 | 04659a96c6d83d452c5269d04a4e82ac |
|
BLAKE2b-256 | 8d964ec0aebfbe5c5cf550f905b1dcace5c90895462fbe0a258d0dcf1785e7b2 |
Hashes for sdss_tpm_multicast_client-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2af843603ad2a39e6cfee6d42107f1824c650ab35dff5be45bc984768f392c2 |
|
MD5 | 64036fb205495d06267d78f8923aa881 |
|
BLAKE2b-256 | 3253232b0872387dabbc81004f23ecc1bbe15f4aff46eb4cd252f38ad9212ebc |