@@ -60,7 +60,7 @@ def connect(self, selfstream: RemoteIn[T], otherstream: RemoteOut[T]) -> None:
6060 def broadcast (self , selfstream : Out [T ], value : T ): ...
6161
6262
63- class LCMTransport (Transport [T ]):
63+ class PubSubTransport (Transport [T ]):
6464 topic : str
6565 type : type
6666
@@ -69,9 +69,17 @@ def __init__(self, topic: str, type: type):
6969 self .type = type
7070
7171 def __str__ (self ) -> str :
72- return colors .green ("LCM(" ) + colors .blue (self .topic ) + colors .green (")" )
72+ return (
73+ colors .green (f"{ self .__class__ .__name__ } (" )
74+ + colors .blue (self .topic )
75+ + colors .green (")" )
76+ )
7377
74- def broadcast (self , selfstream : Out [T ], value : T ): ...
78+
79+ class LCMTransport (PubSubTransport [T ]): ...
80+
81+
82+ class ZenohTransport (PubSubTransport [T ]): ...
7583
7684
7785class State (enum .Enum ):
@@ -176,8 +184,6 @@ class In(Stream[T]):
176184 def __str__ (self ):
177185 return super ().__str__ () + ("" if not self .connection else f" <- { self .connection } " )
178186
179- def subscribe (self , cb ): ...
180-
181187 def __reduce__ (self ): # noqa: D401
182188 if self .owner is None or not hasattr (self .owner , "ref" ):
183189 raise ValueError ("Cannot serialise Out without an owner ref" )
@@ -187,10 +193,18 @@ def __reduce__(self): # noqa: D401
187193 def state (self ) -> State : # noqa: D401
188194 return State .UNBOUND if self .owner is None else State .READY
189195
196+ # actual message passing implementation
197+ def connect_remote (self ):
198+ self ._transport .connect (self .connection )
199+
200+ def disconnect_remote (self ):
201+ self ._transport .disconnect ()
202+
203+ def subscribe (self , cb ): ...
204+
190205
191206class RemoteIn (RemoteStream [T ]):
192207 def connect (self , other : RemoteOut [T ]) -> None :
193- print ("CONENCT REQU" , other )
194208 return self .owner .connect_stream (self .name , other ).result ()
195209
196210
0 commit comments