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)
| 76 | self._activated = False |
| 77 | |
| 78 | def register_slave(self, identifier): |
| 79 | """ |
| 80 | Register an slave device. |
| 81 | |
| 82 | Args: |
| 83 | identifier: an identifier, usually is the device id. |
| 84 | |
| 85 | Returns: a `SlavePipe` object which can be used to communicate with the master device. |
| 86 | |
| 87 | """ |
| 88 | if self._activated: |
| 89 | assert self._queue.empty(), 'Queue is not clean before next initialization.' |
| 90 | self._activated = False |
| 91 | self._registry.clear() |
| 92 | future = FutureResult() |
| 93 | self._registry[identifier] = _MasterRegistry(future) |
| 94 | return SlavePipe(identifier, self._queue, future) |
| 95 | |
| 96 | def run_master(self, master_msg): |
| 97 | """ |
no test coverage detected