Register an slave device. Args: identifier: an identifier, usually is the device id. Returns: a `SlavePipe` object which can be used to communicate with the master device.
(self, identifier)
| 84 | self.__init__(state["master_callback"]) |
| 85 | |
| 86 | def register_slave(self, identifier): |
| 87 | """ |
| 88 | Register an slave device. |
| 89 | |
| 90 | Args: |
| 91 | identifier: an identifier, usually is the device id. |
| 92 | |
| 93 | Returns: a `SlavePipe` object which can be used to communicate with the master device. |
| 94 | |
| 95 | """ |
| 96 | if self._activated: |
| 97 | assert self._queue.empty(), "Queue is not clean before next initialization." |
| 98 | self._activated = False |
| 99 | self._registry.clear() |
| 100 | future = FutureResult() |
| 101 | self._registry[identifier] = _MasterRegistry(future) |
| 102 | return SlavePipe(identifier, self._queue, future) |
| 103 | |
| 104 | def run_master(self, master_msg): |
| 105 | """ |
no test coverage detected