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.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99cd0bd1bb632c5a7d64c1a4724192fd946914d1b57290c5c9bc3321a6f72529 |
|
MD5 | f4fd3471bdf6a71fd561ac2e683b9b9a |
|
BLAKE2b-256 | d33f642aec3744cf6cd1d1a1cb45e67711149f34d26934ca2b1effecf5163bfa |
Hashes for sdss_tpm_multicast_client-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a10169bc3229789ceec267edb4f78d1195a68dff643925bc0cf12ddfe629b3c0 |
|
MD5 | 31a2b7cb67c4e586b88cc482cb942843 |
|
BLAKE2b-256 | 89381e37f4baf26cffed2023fb561c66a790b256cd1cfce3d516d644d8e044ac |