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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84f93eb42db71457c05014e140c1526badcb93db6df89069c0a014bd1be99277 |
|
MD5 | 573c3f103a255886f2da166bce653849 |
|
BLAKE2b-256 | 2984aad72f910256d347055497aa1904cbb06c07900ba0d4a12ab4804f6b2f3a |
Hashes for sdss_tpm_multicast_client-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b60f56112842a2b6e2add71301b66ce279325db384fb739c7034001b6de32d77 |
|
MD5 | 0e282e27c9d7fe0c0d16b861a7bd9a6e |
|
BLAKE2b-256 | 19ff1afbf14a6831ca5533b826e5fef76061747f429b2756ab0fee4ee2ee2c18 |