mirror of
https://github.com/OMGeeky/flucto-heisskleber.git
synced 2026-01-19 01:45:56 +01:00
* Add start, stop and __repr__ to sink and source types. * Merge conflicts on mqtt async pub and resampler. * Add start() and stop() functions to udp and zmq. Change tests accordingly. * Rename broker, ip, interface to common config name "host". * Updated "host" entry in config files. * Add lazyload to mqtt-source.
28 lines
757 B
Python
28 lines
757 B
Python
import asyncio
|
|
|
|
from heisskleber.mqtt import AsyncMqttSubscriber, MqttConf
|
|
from heisskleber.stream import Joint, Resampler, ResamplerConf
|
|
|
|
|
|
async def main():
|
|
topics = ["topic0", "topic1", "topic2", "topic3"]
|
|
|
|
config = MqttConf(host="localhost", port=1883, user="", password="") # not a real password
|
|
subs = [AsyncMqttSubscriber(config, topic=topic) for topic in topics]
|
|
|
|
resampler_config = ResamplerConf(resample_rate=1000)
|
|
|
|
joint = Joint(resampler_config, [Resampler(resampler_config, sub) for sub in subs])
|
|
|
|
while True:
|
|
data = await joint.receive()
|
|
print(data)
|
|
|
|
|
|
# Run the event loop
|
|
if __name__ == "__main__":
|
|
try:
|
|
asyncio.run(main())
|
|
except KeyboardInterrupt:
|
|
print("Keyboard Interrupt")
|