DeviceServer
class DeviceServer : public karabo::xms::SignalSlotable
@brief The DeviceServer class hosts device instances
The DeviceServer class hosts device instances. It monitors the system for new class plugins appearing and notifies the distributed system of these and their static information.
Functions
| Name | Description |
|---|---|
| expectedParameters | Static properties of the device server to : inject these properties to |
| DeviceServer | The constructor expects a configuration Hash. |
| isRunning | Check if the device server is running Return : |
| autostartDevices | It just launches devices that marked to be started by server automatically. |
| prepareInstantiate | Helper to create input passed to instantiate. |
| instantiate | Helper for instantiateDevices - e.g. provides the (async) reply for slotStartDevice. |
| slotTimeTick | A slot called by the time-server to synchronize this device with the timing system. |
| timeTick | Helper function for internal time ticker deadline timer to provide internal clock that calls 'onTimeUpdate' for every id even if slotTimeTick is called less often. |
Function Details
DeviceServer
DeviceServer(const karabo::data::Hash&)
The constructor expects a configuration Hash. The following configuration options are supported:
- serverId: a string giving the server's id
- init: a json string containing configurations for device that are to be automatically started by the server
- connection: a Hash containing the connection information for a karabo::net::Broker
- pluginDirectory: a path to the plugin directory for this device server
- heartbeatInterval: interval in seconds at which this server sends heartbeats to the distributed system
`` :
autostartDevices
void autostartDevices()
It just launches devices that marked to be started by server automatically.
expectedParameters
KARABO_CONFIGURATION_BASE_CLASS /** * Static properties of the device server * @param to inject these properties to */ static void expectedParameters(karabo::data::Schema&)
Static properties of the device server
to
: inject these properties to
instantiate
void instantiate(const std::string& deviceId, const std::string& classId, const data::Hash& config, const SignalSlotable::AsyncReply& asyncReply)
Helper for instantiateDevices - e.g. provides the (async) reply for slotStartDevice.
isRunning
bool isRunning() const
Check if the device server is running
Return :
prepareInstantiate
std::tuple<std::string, std::string, data::Hash> prepareInstantiate(const data::Hash& configuration)
Helper to create input passed to instantiate.
Returns a tuple of the deviceId, the classId and the configuration.
slotTimeTick
void slotTimeTick(unsigned long long id, unsigned long long sec, unsigned long long frac, unsigned long long period)
A slot called by the time-server to synchronize this device with the timing system.
id:
: current train id
sec:
: current system seconds
frac:
: current fractional seconds
period:
: interval between subsequent ids in microseconds
timeTick
void timeTick(const boost::system::error_code ec, unsigned long long newId)
Helper function for internal time ticker deadline timer to provide internal clock that calls 'onTimeUpdate' for every id even if slotTimeTick is called less often.
ec
: error code indicating whether deadline timer was cancelled
id:
: current train id