Programmers Reference - CSimpleDevice (1)
class CSimpleDevice : public CDevice
#include "ConSys.h"
class CSimpleDevice : public CDevice { public: CSimpleDevice(); virtual ~CSimpleDevice(); virtual void Create(CRegistryKey &aDeviceEntry, const UINT aDeviceNo); virtual BOOLEAN RegisterDataServer(/*const*/ CDeviceServer* aDataServer, const CAddress* aAddress, UINT minPollTime = 0 /* ms */); virtual BOOLEAN DeRegisterDataServer(/*const*/ CDeviceServer* aDataServer); public: DECLARE_DYNCREATE(CSimpleDevice); public: virtual void PollDriver(); #ifdef _DEBUG public: virtual void Dump(CDumpContext &dc) const; virtual void AssertValid() const; #endif };
The CSimpleDevice signals all the data servers forceDataRead when the call to the virtual function PollDriver returns. After starting to notify the data servers, the device immediately calls the PollDriver again. The method PollDriver is pure virtual, and it is the responsibility of the sub class driver to put in synchronizing function with the driver. The CSimpleDevice does not handle data in any way. Buffering, synchronization on data, and intelligent conversion is the responsibility of the sub class.
The devices don't signal a data server if this results in a update frequency larger than the minimum update frequency specified in the registration method.
The drawback of this device is its inability to decide which data servers to poll. The device do not use the address hint for any decision making. The result is that this device will degrade in performance as the amount of addresses that the device supports increase.
For a documentation on haw to use the CSimpleDevce, please refer to the The Device Cookbook.
References:
Last Modified 10 January 2019