katgpucbf.dsim.server module
katcp server.
- class katgpucbf.dsim.server.DeviceServer(sender: Sender, descriptor_sender: DescriptorSender, heap_sets: list[HeapSet], adc_sample_rate: float, sample_bits: int, dither_seed: int, *args, **kwargs)[source]
Bases:
DeviceServerkatcp server.
- Parameters:
sender – Sender which is streaming data out. It is halted when the server is stopped.
heap_sets – Heap sets which can be transmitted (must have length 3). The first element must be currently set on sender.
adc_sample_rate – Sampling rate in Hz
sample_bits – Number of bits per output sample
dither_seed – Dither seed (used only to populate a sensor).
*args – Passed to base class
**kwargs – Passed to base class
- async on_stop() None[source]
Extension point for subclasses to run shutdown code.
This is called after the TCP server has been shut down and all in-flight requests have been completed or cancelled, but before service tasks are cancelled. Subclasses should override this function rather than
stop()to run late shutdown code because this is called before the flag is set to wake upjoin().It is only called if the server was running when
stop()was called.
- async request_signals(ctx, signals_str: str, period: int | None = None) int[source]
Update the signals that are generated.
- Parameters:
signals_str – Textural description of the signals. See the docstring for parse_signals for the language description. The description must produce one signal per polarisation.
period – Period for the generated signal. It must divide into the value indicated by the
max-periodsensor. If not specified, the value ofmax-periodis used.
- Returns:
First timestamp which will use the new signals
- Return type:
timestamp
- async set_signals(signals: Sequence[Signal], signals_str: str, period: int | None = None) int[source]
Change the signals
request_signals().This is the implementation of
request_signals(). See that method for description of the parameters and return value (signals is the parsed version of signals_str).