mirror of
https://github.com/OMGeeky/flucto-heisskleber.git
synced 2025-12-28 07:18:09 +01:00
* WIP: Added async file reader. * Async resampling and synchronization refactored. * Add async mqtt publisher. Remove queue from joint. * Add async zmq publisher and subscriber. * Modify integration tests for streaming. * Name refactoring resampler. * Added async source/sink to factory. * Refactor joint and add integration tests. * Add termcolor dev dependency * Add conosole source and sink * Add cli interface for different protocols * Removed files unfit for merge. * Fix review requests. * Restore use of $MSB_CONFIG_DIR for now. It seems that the default behaviour is not looking for .config/heisskleber * Remove version test, causing unnecessary failures.
28 lines
759 B
Python
28 lines
759 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(broker="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")
|