From 37d412108a7d50774e641a09b81d1d7709356ac7 Mon Sep 17 00:00:00 2001 From: zimoch Date: Thu, 24 Feb 2011 16:11:21 +0000 Subject: [PATCH] Add dummy interface --- src/CONFIG_STREAM | 2 ++ src/DummyInterface.cc | 76 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 src/DummyInterface.cc diff --git a/src/CONFIG_STREAM b/src/CONFIG_STREAM index 8912f50..546398a 100644 --- a/src/CONFIG_STREAM +++ b/src/CONFIG_STREAM @@ -30,6 +30,8 @@ SYNAPPS_RECORDS += scalcout # asynDriver interface is added automatically # if ASYN is defined in your RELEASE file. # BUSSES += Debug +BUSSES += Debug +BUSSES += Dummy # You may add more format converters # This requires the naming convention diff --git a/src/DummyInterface.cc b/src/DummyInterface.cc new file mode 100644 index 0000000..db5331f --- /dev/null +++ b/src/DummyInterface.cc @@ -0,0 +1,76 @@ +/*************************************************************** +* StreamDevice Support * +* * +* (C) 2011 Dirk Zimoch (dirk.zimoch@psi.ch) * +* * +* This is the interface to a "dummy" bus driver for * +* StreamDevice. It does not provide any I/O functionality. * +* * +* If you do any changes in this file, you are not allowed to * +* redistribute it any more. If there is a bug or a missing * +* feature, send me an email and/or your patch. If I accept * +* your changes, they will go to the next release. * +* * +* DISCLAIMER: If this software breaks something or harms * +* someone, it's your problem. * +* * +***************************************************************/ + +#include "StreamBusInterface.h" +#include "StreamError.h" +#include "StreamBuffer.h" + +class DummyInterface : StreamBusInterface +{ + DummyInterface(Client* client); + + // StreamBusInterface methods + bool lockRequest(unsigned long lockTimeout_ms); + bool unlock(); + +protected: + ~DummyInterface(); + +public: + // static creator method + static StreamBusInterface* getBusInterface(Client* client, + const char* busname, int addr, const char* param); +}; + +RegisterStreamBusInterface(DummyInterface); + +DummyInterface:: +DummyInterface(Client* client) : StreamBusInterface(client) +{ + // Nothing to do +} + +DummyInterface:: +~DummyInterface() +{ + // Nothing to do +} + +StreamBusInterface* DummyInterface:: +getBusInterface(Client* client, + const char* busname, int addr, const char*) +{ + if (strcmp(busname, "dummy") == 0) + { + DummyInterface* interface = new DummyInterface(client); + return interface; + } + return NULL; +} + +bool DummyInterface:: +lockRequest(unsigned long lockTimeout_ms) +{ + return false; +} + +bool DummyInterface:: +unlock() +{ + return false; +}