pylabrobot.hamilton.transport.text_tcp.parse_discovery_reply#

pylabrobot.hamilton.transport.text_tcp.parse_discovery_reply(data: bytes, sender: str) → HamiltonInstrumentInfo | None#

Read one datagram that may be a machine’s answer to the discovery broadcast.

A reply repeats the broadcast header and then gives bdc_<key> <value> pairs separated by spaces. A value is either a bare token, as a number is, or text in double quotes, which may contain spaces. The order of the keys does not matter.

Parameters:
  • data (bytes) – The datagram as received.

  • sender (str) – The address it came from, used as the machine’s address if the reply does not give a valid one.

Returns:

What the machine said, or None if the datagram is not a machine’s reply.

Return type:

HamiltonInstrumentInfo | None