CSS-WC Servers

Modules: dvbcss.protocol.server.wc

The WallClockServer class implements a standalone CSS-WC server.

The server can be started and stopped. While running it runs in its own separate thread of execution in the background.

An example server is provided in this package.

Example usage

To use it, you need to provide a clock object that represents the “wall clock”. Although it is not required, it is recommended to set the tick rate of that clock to match the required tick rate of the wall clock (1e9 ticks per second).

First, create the clock:

from dvbcss.clock import SysClock

mfe = 45

sysClock = SysClock(tickRate=1000000000, maxFreqErrorPpm=mfe)
wallClock = sysClock

The server will need to know the potential maximum frequency error and measurement precision of the clock. Fortunately the SysClock already estimates this and it is passed through any dependent clocks.

Fortunately the SysClock internally estimates the measurement precision automatically when it is created. It also defaults to assuming the maximum frequency error is 500ppm, unless you specify otherwise.

Maximum frequency error will depend on oscillator accuracy in the hardware the code is running on, and whether an NTP client is running (and which therefore may slew the clock).

For example, above we have guessed that the combined worst case of NTP client slew and hardware oscillator accuracy is approx 45 ppm:

So next we create and start the wall clock server.

from dvbcss.protocol.wc.server import WallClockServer

wcServer = WallClockServer(wallClock)
wcServer.start()

Classes

WallClockServer

class dvbcss.protocol.server.wc.WallClockServer(wallClock, precision=None, maxFreqError=None, bindaddr='0.0.0.0', bindport=6677, followup=False)[source]

A CSS-WC server.

Pass it a clock object and information on clock precision and frequency stability, and tell it which network interface to listen on.

Call start() and stop() to start and stop the server. It runs in its own separate thread in the background.

You can optionally ask this server to operate in a mode where it will send follow-up responses. Note, however, that in this implementation the transmit-timevalue reported in the follow-up response is not guaranteed to be more accurate. This option exists primarily to check whether a Wall Clock Client has implemennted handling of follow-up responses at all.

Parameters:
  • wallClock – (:class:dvbcss.clock.ClockBase) The clock to be used as the wall clock for protocol interactions
  • precisionSecs – (float) Optional. Override using the precision of the provided clock and instead use this value. It is the precision (in seconds) to be reported for the clock in protocol interactions
  • maxFreqErrorPpm – (float) Optional. Override using the rootMaxFreqError() of the clock and instead use this value. It is the clock maximum frequency error in parts-per-million
  • bindaddr – (str, ip address) The ip address of the network interface to bind to, e.g. “127.0.0.1”. Defaults to “0.0.0.0” which binds to all interfaces.
  • bindport – (int) The port number to bind to (defaults to 6677)
  • followup – (bool) Set to True if the Wall Clock Server should send follow-up responses. Defaults to False.
run()[source]

Internal method - the main runloop of the thread.

Runs in a loop calling the handle() method of the object assigned to the handler property whenever a UDP packet is received.

Does not return until the _pleaseStop attribute of the object has been set to True

start()[source]

Starts the wall clock server running. It runs in a thread in the background.

stop()[source]

Stops the wall clock server running. Does not return until the thread has terminated.