F' Serial Port Type #1099
-
In #1036 the idea of the Serial port type in F' got brought up, and I wanted to bring that point into a new discussion to get some more clarification. @LeStarch's answer was:
Let's say I have a component that wants to send a vector of <x,y,z> data, all F32, to the generic hub. In order to do so, would I need to create a primitive float array of these three values, and then pass them into an And then the topology would look something like:
I also have access to a custom port type for this vector that sends the three F32 values as separate args. Is there something I could change with that port definition to accomplish the same thing as above? Is there one method that is recommended over the other? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Serial types can attach to anything. Thus you can attach an F32Triple port as described above directly to the serial port. No need to serialize data yourself. This is the utility of Serial ports, they pass the already present data serialized buffer through untouched. Topology looks like the following. I used the port type name
As you can see, you don't need to change your port definition at all. Just hook it right up. The system then does the following:
You can use serial ports in the opposite direction too.
Here the buffer you get will be automatically deserialized into our 3 F32 arguments. The GenericHub ignores the content inside the buffer, adds metadata, sends it, and the other hub removes the metadata and sends that out another connection. Thus it is just like an asynchronous port call, but spans an address. |
Beta Was this translation helpful? Give feedback.
-
Not quite. I believe it is loke this:
Only one side of the connection is serial. |
Beta Was this translation helpful? Give feedback.
Not quite. I believe it is loke this:
Only one side of the connection is serial.