3939control_client = MQTTClient (control_config , logger = control_logger )
4040
4141# Set up the terminal
42- term = MqttTerminal (device_client , topic_prefix = "/ test" )
42+ term = MqttTerminal (device_client , topic_prefix = "test" )
4343
4444
4545async def send_file (buffer : BytesIO ):
@@ -48,7 +48,7 @@ async def send_file(buffer: BytesIO):
4848 seq = 0
4949 props = format_properties ("tty0" , seq )
5050 await control_client .publish (
51- "/ test/tty/in" , "cp test.txt" .encode ("utf-8" ), properties = props
51+ "test/tty/in" , "cp test.txt" .encode ("utf-8" ), properties = props
5252 )
5353
5454 # Send the file in 4-byte chunks; close when done
@@ -62,7 +62,7 @@ async def send_file(buffer: BytesIO):
6262 seq = - 1
6363 props = format_properties ("tty0" , seq )
6464 logger .debug (f"Sending chunk { seq } of size { len (chunk )} : { chunk !r} " )
65- await control_client .publish ("/ test/tty/in" , chunk , properties = props )
65+ await control_client .publish ("test/tty/in" , chunk , properties = props )
6666 if seq == - 1 :
6767 break
6868
@@ -84,7 +84,7 @@ async def get_file(buffer: BytesIO):
8484 seq = 0
8585 props = format_properties ("tty0" , seq )
8686 await control_client .publish (
87- "/ test/tty/in" , "cat test.txt" .encode (), properties = props
87+ "test/tty/in" , "cat test.txt" .encode (), properties = props
8888 )
8989
9090 # Wait until the received buffer gets populated with the response
@@ -107,7 +107,7 @@ async def device_handler():
107107# Handler for control messages that logs and stores them
108108async def control_handler (buffer ):
109109 async for topic , payload , _retained , properties in control_client .queue :
110- if topic == "/ test/tty/err" :
110+ if topic == "test/tty/err" :
111111 logger .error (f"Control received error: { payload .decode ('utf-8' )} " )
112112 else :
113113 buffer .write (payload ) # Don't decode yet
@@ -118,8 +118,8 @@ async def control_handler(buffer):
118118async def main ():
119119 # Connect all clients and the terminal
120120 await control_client .connect (True )
121- await control_client .subscribe ("/ test/tty/out" )
122- await control_client .subscribe ("/ test/tty/err" )
121+ await control_client .subscribe ("test/tty/out" )
122+ await control_client .subscribe ("test/tty/err" )
123123 await device_client .connect (True )
124124 await term .connect ()
125125
0 commit comments