DynExp
Highly flexible laboratory automation for dynamically changing experiments.
|
Defines a hardware adapter for serial communication. Logical const-ness: see declaration of class DynExp::Object. More...
Classes | |
struct | endl |
Type denoting the end of a line when piped to operator<<(endl) More... | |
Public Types | |
using | ParamsType = SerialCommunicationHardwareAdapterParams |
Type of the parameter class belonging to this Object type. Declare this alias in every derived class with the respective parameter class accompanying the derived Object . More... | |
using | ConfigType = SerialCommunicationHardwareAdapterConfigurator |
Type of the configurator class belonging to this Object type. Declare this alias in every derived class with the respective configurator class accompanying the derived Object . More... | |
Public Types inherited from DynExp::HardwareAdapterBase | |
using | ParamsType = HardwareAdapterParamsBase |
Type of the parameter class belonging to this Object type. Declare this alias in every derived class with the respective parameter class accompanying the derived Object . More... | |
using | ConfigType = HardwareAdapterConfiguratorBase |
Type of the configurator class belonging to this Object type. Declare this alias in every derived class with the respective configurator class accompanying the derived Object . More... | |
Public Types inherited from DynExp::Object | |
using | ParamsType = ParamsBase |
Type of the parameter class belonging to this Object type. Declare this alias in every derived class with the respective parameter class accompanying the derived Object . More... | |
using | ParamsTypeSyncPtrType = Util::SynchronizedPointer< ParamsType > |
Alias for the return type of Object::GetParams(). Parameters wrapped into Util::SynchronizedPointer can be accessed in a thread-safe way. More... | |
using | ParamsConstTypeSyncPtrType = Util::SynchronizedPointer< const ParamsType > |
Alias for the return type of Object::GetParams() const. Parameters wrapped into Util::SynchronizedPointer can be accessed in a thread-safe way. More... | |
using | ConfigType = ConfiguratorBase |
Type of the configurator class belonging to this Object type. Declare this alias in every derived class with the respective configurator class accompanying the derived Object . More... | |
using | ParamsGetterType = Util::CallableMemberWrapper< Object, decltype(&Object::GetParams)> |
Invoking an instance of this alias is supposed to call Object::GetParams() of the instance the Util::CallableMemberWrapper has been constructed with. More... | |
Public Member Functions | |
SerialCommunicationHardwareAdapter (const std::thread::id OwnerThreadID, ParamsBasePtrType &&Params) | |
Constructs a hardware adapter instance. More... | |
virtual | ~SerialCommunicationHardwareAdapter ()=0 |
virtual std::string | GetName () const override |
Returns the name of this Object type. More... | |
virtual std::string | GetCategory () const override |
Returns the category of this Object type. More... | |
auto | GetLineEnding () const |
Getter for LineEnding. Thread-safe since LineEnding only changes when Object::Reset() is called (itself calling ResetImpl(dispatch_tag<HardwareAdapterBase>) which calls Init() ). LineEnding is still std::atomic since QSerialCommunicationHardwareAdapterWorker running in DynExpCore's worker thread might read it anytime - even if there is no Object instance which makes use of this hardware adapter instance. More... | |
std::string | ReadLine () const |
Calls ReadIntoBuffer() before it extracts the first line from the read buffer. More... | |
std::string | ReadAll () const |
Calls ReadIntoBuffer() before it extracts the entire content from the read buffer. More... | |
std::string | WaitForLine (unsigned int NumTries=10, std::chrono::milliseconds DelayBetweenTries=std::chrono::milliseconds(10)) const |
Calls ReadLine() for NumTries times until a line is received. Makes the calling thread sleep for DelayBetweenTries in between the calls to ReadLine() . More... | |
void | Clear () const |
Clears the content and state flags of the read buffer (ReadBuffer) as well as possible internal buffers of the underlying hardware interface. More... | |
void | Flush () const |
Flushes the underlying hardware interface and calls ReadIntoBuffer() . More... | |
const SerialCommunicationHardwareAdapter & | operator>> (std::stringstream &OutStream) const |
Writes the read buffer's content into OutStream calling ReadAll() . More... | |
const SerialCommunicationHardwareAdapter & | operator<< (endl) const |
Writes a new line calling Write_endl() . More... | |
const SerialCommunicationHardwareAdapter & | operator<< (const std::stringstream &InStream) const |
Writes the input parameter calling Write() . Also writes endl at the end automatically. More... | |
const SerialCommunicationHardwareAdapter & | operator<< (const std::string &Text) const |
Writes the input parameter calling Write() . Also writes endl at the end automatically. More... | |
const SerialCommunicationHardwareAdapter & | operator<< (const std::string_view Text) const |
Writes the input parameter calling Write() . Also writes endl at the end automatically. More... | |
const SerialCommunicationHardwareAdapter & | operator<< (const char *Text) const |
Writes the input parameter calling Write() . Also writes endl at the end automatically. More... | |
const SerialCommunicationHardwareAdapter & | operator<< (const char Char) const |
Writes the input parameter calling Write() . Also writes endl at the end automatically. More... | |
template<typename T > | |
auto & | operator<< (const T &Value) const |
Writes the input parameter calling Write() . Also writes endl at the end automatically. More... | |
Public Member Functions inherited from DynExp::HardwareAdapterBase | |
HardwareAdapterBase (const std::thread::id OwnerThreadID, ParamsBasePtrType &&Params) | |
Constructs a hardware adapter instance. More... | |
virtual | ~HardwareAdapterBase ()=0 |
void | ResetException () const |
Sets LastException to nullptr in a thread-safe way. More... | |
bool | IsConnected () const noexcept |
Determines the connection status of the hardware interface. More... | |
Public Member Functions inherited from Util::INonCopyable | |
INonCopyable (const INonCopyable &)=delete | |
INonCopyable & | operator= (const INonCopyable &)=delete |
Public Member Functions inherited from DynExp::Object | |
ItemIDType | GetID () const noexcept |
Returns the ID of this Object instance. Thread-safe since ID is const. More... | |
std::string | GetCategoryAndName () const |
Builds a string from an Object's category and name to allow the user to identify an Object's type. More... | |
void | EnsureReadyState (bool IsAutomaticStartup) |
Ensures that this Object instance is ready by possibly starting its worker thread or by opening connections to hardware devices. More... | |
void | CheckLinkedObjectStates () const |
Checks whether Object instances this instance uses are in a ready state. Override CheckLinkedObjectStatesChild() to implement this behavior. More... | |
void | Reset () |
Resets this Object instance (including all its derived classes) by calling ResetImpl() . A reset implies that the derived classes reload all their parameters from Params and that all LinkedObjectWrapper instances owned by this Object instance become invalidated. More... | |
void | BlockIfUnused (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) |
Blocks this Object instance setting Object::IsBlocked to true. Refer to Object::IsBlocked for the consequences. More... | |
ParamsConstTypeSyncPtrType | GetParams (const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const |
Locks the mutex of the parameter class instance Params assigned to this Object instance and returns a pointer to the locked Params. More... | |
ParamsTypeSyncPtrType | GetParams (const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) |
Locks the mutex of the parameter class instance Params assigned to this Object instance and returns a pointer to the locked Params. More... | |
auto | GetObjectName (const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const |
Returns the name of this Object instance. More... | |
bool | IsSharedUsageEnabled (const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const |
Returns whether shared usage has been enabled for this Object instance. Refer to ParamsBase::UsageType. More... | |
void | SetWarning (std::string Description, int ErrorCode) const |
Setter for Object::Warning. Sets the warning by a description and an error code. More... | |
void | SetWarning (const Util::Exception &e) const |
Setter for Object::Warning. Sets the warning by retrieving the warning data from an exception e . More... | |
void | ClearWarning () const |
Resets Object::Warning. More... | |
auto | GetWarning () const |
Returns Object::Warning in a thread-safe way by copying its internal data. More... | |
std::exception_ptr | GetException (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) const |
Returns a pointer to the exception which has caused this Object instance to fail. More... | |
bool | IsReady () const |
Returns wheter this Object instance is ready (e.g. it is running or connected to a hardware device) and not blocked (refer to Object::IsBlocked). More... | |
auto | GetUseCount (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) const |
Counts the registered useres in a thread-safe way. More... | |
bool | IsUnused (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) const |
Returns whether this Object instance is used by other instances. More... | |
auto | GetUserIDs (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) const |
Returns a list of the IDs of the registered users in a thread-safe way. More... | |
auto | GetUserNamesString (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) const |
Builds a string describing which users are registered containing their object names, categories and type names in a thread-safe way. More... | |
Static Public Member Functions | |
constexpr static auto | Name () noexcept |
Every derived class has to redefine this function. More... | |
constexpr static auto | Category () noexcept |
Every derived class has to redefine this function. More... | |
constexpr static std::array< char, 2 > | LineEndingToChar (SerialCommunicationHardwareAdapterParams::LineEndingType LineEnding) noexcept |
Converts SerialCommunicationHardwareAdapterParams::LineEndingType to two characters being used as the respective line ending. More... | |
constexpr static unsigned int | GetLineEndingLength (SerialCommunicationHardwareAdapterParams::LineEndingType LineEnding) noexcept |
Determines the amount of characters required to express a line ending type defined by SerialCommunicationHardwareAdapterParams::LineEndingType. More... | |
constexpr static auto | GetMaxBufferSize () noexcept |
Defines the maximal size of the hardware adapter's (read) buffer. More... | |
Static Public Member Functions inherited from DynExp::HardwareAdapterBase | |
constexpr static auto | Category () noexcept |
Every derived class has to redefine this function. More... | |
Static Public Member Functions inherited from DynExp::Object | |
static std::string | CategoryAndNameToStr (const std::string &Category, const std::string &Name) |
Builds a string from an Object's category and name to allow the user to identify an Object's type. More... | |
Protected Member Functions | |
void | InsertIntoBuffer (const std::string &String) const |
This method can be called from derived classes to manually insert data into the read buffer. This can be especially useful if there is some callback mechanism which notifies the derived object as soon as data is available. If this mechanism is used, it is fine to let the overridden Read() method just return en empty string. This function is thread-safe. More... | |
Protected Member Functions inherited from DynExp::HardwareAdapterBase | |
void | ThrowException (std::exception_ptr Exception) const |
Stores Exception in LastException, wraps it in a Util::ForwardedException and throws the wrapped excetion by calling Util::ForwardException(). More... | |
void | ThrowExceptionUnsafe (std::exception_ptr Exception) const |
Stores Exception in LastException, wraps it in a Util::ForwardedException and throws the wrapped excetion by calling Util::ForwardException(). More... | |
void | SetExceptionUnsafe (std::exception_ptr Exception) const |
Stores Exception in LastException. More... | |
auto | GetExceptionUnsafe () const |
Getter for LastException. More... | |
Protected Member Functions inherited from Util::ILockable | |
ILockable ()=default | |
~ILockable ()=default | |
LockType | AcquireLock (const std::chrono::milliseconds Timeout=DefaultTimeout) const |
Locks the internal mutex. Blocks until the mutex is locked or until the timeout duration is exceeded. More... | |
Protected Member Functions inherited from Util::INonCopyable | |
constexpr | INonCopyable ()=default |
~INonCopyable ()=default | |
Protected Member Functions inherited from DynExp::Object | |
Object (const std::thread::id OwnerThreadID, ParamsBasePtrType &&Params) | |
Constructs an Object instance. More... | |
virtual | ~Object ()=0 |
void | EnsureCallFromOwningThread () const |
Asserts that the call to this function is performed from the thread which constructed this Object instance (the thread with the id stored in Object::OwnerThreadID). More... | |
ParamsTypeSyncPtrType | GetNonConstParams (const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const |
Allows derived Objects to edit their own parameters - even in const task functions (for instruments) or event functions (for modules). More... | |
auto | LockUserList (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) |
Locks the user list for thread-safe manipulation. More... | |
void | DeregisterAllUnsafe () |
Deregisters all users and notifies them that they need to check the states of their used linked objects. More... | |
auto | GetUseCountUnsafe () |
auto | GetUserNamesStringUnsafe () const |
bool | IsUnusedUnsafe () |
Returns whether this Object instance is used by other instances (not thread-safe). More... | |
Private Member Functions | |
void | Init () |
Initializes the instance at construction or in case Object::Reset() is called. More... | |
void | ResetImpl (dispatch_tag< HardwareAdapterBase >) override final |
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every derived class gets called - starting from DynExp::Object, descending the inheritance hierarchy. More... | |
virtual void | ResetImpl (dispatch_tag< SerialCommunicationHardwareAdapter >) |
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every derived class gets called - starting from DynExp::Object, descending the inheritance hierarchy. More... | |
Not thread-safe | |
AcquireLock() has to be called manually before and returned LockType has to be still in scope. | |
void | ReadIntoBuffer () const |
Calls Read() to retrieve data from the underlying hardware interface. Writes the retrieved data to the read buffer (ReadBuffer). More... | |
void | ClearReadBuffer () const |
Clears the content and state flags of the read buffer (ReadBuffer) More... | |
bool | CheckOverflow () const |
Checks whether the length of the read buffer (ReadBuffer) exceeds the maximal allowed length given by GetMaxBufferSize() . More... | |
Override, not thread-safe | |
Override by derived classes. AcquireLock() has to be called manually before and returned LockType has to be still in scope. | |
virtual void | ClearChild () const |
Clears internal buffers of the underlying hardware interface. More... | |
virtual void | FlushChild () const |
Flushes the underlying hardware interface. More... | |
virtual std::string | Read () const =0 |
Reads a string from the underlying hardware interface. More... | |
virtual void | Write (const std::string &String) const =0 |
Writes a string to the underlying hardware interface. More... | |
virtual void | Write_endl () const =0 |
Writes end of the line characters to the underlying hardware interface. More... | |
Private Attributes | |
std::atomic< SerialCommunicationHardwareAdapterParams::LineEndingType > | LineEnding = SerialCommunicationHardwareAdapterParams::LineEndingType::LF |
Copy of SerialCommunicationHardwareAdapterParams::LineEnding to avoid locking the corresponding SerialCommunicationHardwareAdapterParams instance every time data is read or sent. Refer to GetLineEnding() . More... | |
std::string | LineEndingString |
String corresponding to LineEnding. Refer to LineEndingToChar() More... | |
std::stringstream | ReadBuffer |
Buffer storing data read from the underlying physical hardware. More... | |
Additional Inherited Members | |
Public Attributes inherited from DynExp::Object | |
LinkedObjectWrapperOnlyType | LinkedObjectWrapperOnly |
Allow exclusive access to some of Object's private methods to any LinkedObjectWrapper<T>. More... | |
Static Public Attributes inherited from DynExp::HardwareAdapterBase | |
static constexpr auto | ShortTimeoutDefault = std::chrono::milliseconds(10) |
Default timeout e.g. used as a default for calls to Object::GetException(). More... | |
static constexpr auto | HardwareOperationTimeout = std::chrono::milliseconds(100) |
Default timeout used to lock the mutex provided by the base class Util::ILockable to synchronize access to the hardware interface in between multiple instrument threads. More... | |
Static Public Attributes inherited from Util::ILockable | |
static constexpr std::chrono::milliseconds | DefaultTimeout = std::chrono::milliseconds(10) |
Duration which is used as a default timeout within all methods of this class if no different duration is passed to them. More... | |
Static Public Attributes inherited from DynExp::Object | |
static constexpr std::chrono::milliseconds | GetParamsTimeoutDefault = std::chrono::milliseconds(100) |
Default timeout used by Object::GetParams() to lock the mutex of the parameter instance assigned to this Object instance. More... | |
Protected Types inherited from Util::ILockable | |
using | MutexType = std::timed_mutex |
using | LockType = std::unique_lock< MutexType > |
Defines a hardware adapter for serial communication. Logical const-ness: see declaration of class DynExp::Object.
Definition at line 261 of file HardwareAdapter.h.
struct DynExp::SerialCommunicationHardwareAdapter::endl |
Type denoting the end of a line when piped to operator<<(endl)
Definition at line 270 of file HardwareAdapter.h.
using DynExp::SerialCommunicationHardwareAdapter::ConfigType = SerialCommunicationHardwareAdapterConfigurator |
Type of the configurator class belonging to this Object
type. Declare this alias in every derived class with the respective configurator class accompanying the derived Object
.
Definition at line 265 of file HardwareAdapter.h.
using DynExp::SerialCommunicationHardwareAdapter::ParamsType = SerialCommunicationHardwareAdapterParams |
Type of the parameter class belonging to this Object
type. Declare this alias in every derived class with the respective parameter class accompanying the derived Object
.
Definition at line 264 of file HardwareAdapter.h.
DynExp::SerialCommunicationHardwareAdapter::SerialCommunicationHardwareAdapter | ( | const std::thread::id | OwnerThreadID, |
ParamsBasePtrType && | Params | ||
) |
Constructs a hardware adapter instance.
OwnerThreadID | Thread id of the thread owning the Object instance to be constructed. |
Params | Parameter class instance to be assigned to the Object instance to be constructed. |
Util::InvalidArgException | is thrown if OwnerThreadID is an invalid thread id or if Params is nullptr. |
Definition at line 140 of file HardwareAdapter.cpp.
|
pure virtual |
Definition at line 136 of file HardwareAdapter.cpp.
|
inlinestaticconstexprnoexcept |
Every derived class has to redefine this function.
Definition at line 278 of file HardwareAdapter.h.
|
private |
Checks whether the length of the read buffer (ReadBuffer) exceeds the maximal allowed length given by GetMaxBufferSize()
.
Definition at line 327 of file HardwareAdapter.cpp.
void DynExp::SerialCommunicationHardwareAdapter::Clear | ( | ) | const |
Clears the content and state flags of the read buffer (ReadBuffer) as well as possible internal buffers of the underlying hardware interface.
Definition at line 194 of file HardwareAdapter.cpp.
|
inlineprivatevirtual |
Clears internal buffers of the underlying hardware interface.
Reimplemented in DynExp::QSerialCommunicationHardwareAdapter.
Definition at line 467 of file HardwareAdapter.h.
|
private |
Clears the content and state flags of the read buffer (ReadBuffer)
Definition at line 321 of file HardwareAdapter.cpp.
void DynExp::SerialCommunicationHardwareAdapter::Flush | ( | ) | const |
Flushes the underlying hardware interface and calls ReadIntoBuffer()
.
Definition at line 202 of file HardwareAdapter.cpp.
|
inlineprivatevirtual |
Flushes the underlying hardware interface.
Reimplemented in DynExp::QSerialCommunicationHardwareAdapter.
Definition at line 468 of file HardwareAdapter.h.
|
inlineoverridevirtual |
Returns the category of this Object
type.
Reimplemented from DynExp::HardwareAdapterBase.
Definition at line 311 of file HardwareAdapter.h.
|
inline |
Getter for LineEnding. Thread-safe since LineEnding only changes when Object::Reset() is called (itself calling ResetImpl(dispatch_tag<HardwareAdapterBase>)
which calls Init()
). LineEnding is still std::atomic since QSerialCommunicationHardwareAdapterWorker
running in DynExpCore's
worker thread might read it anytime - even if there is no Object
instance which makes use of this hardware adapter instance.
Definition at line 321 of file HardwareAdapter.h.
|
staticconstexprnoexcept |
Determines the amount of characters required to express a line ending type defined by SerialCommunicationHardwareAdapterParams::LineEndingType.
LineEnding | Line ending type |
Definition at line 510 of file HardwareAdapter.h.
|
inlinestaticconstexprnoexcept |
Defines the maximal size of the hardware adapter's (read) buffer.
Definition at line 301 of file HardwareAdapter.h.
|
inlineoverridevirtual |
Returns the name of this Object
type.
Implements DynExp::Object.
Reimplemented in DynExp::HardwareAdapterSerialPort, and DynExp::HardwareAdapterTcpSocket.
Definition at line 310 of file HardwareAdapter.h.
|
private |
Initializes the instance at construction or in case Object::Reset() is called.
Definition at line 291 of file HardwareAdapter.cpp.
|
protected |
This method can be called from derived classes to manually insert data into the read buffer. This can be especially useful if there is some callback mechanism which notifies the derived object as soon as data is available. If this mechanism is used, it is fine to let the overridden Read()
method just return en empty string. This function is thread-safe.
String | String to write to the buffer |
Util::InvalidStateException | is thrown if fail flags of ReadBuffer are set after writing to it. |
Definition at line 276 of file HardwareAdapter.cpp.
|
staticconstexprnoexcept |
Converts SerialCommunicationHardwareAdapterParams::LineEndingType to two characters being used as the respective line ending.
LineEnding | Line ending type |
Definition at line 499 of file HardwareAdapter.h.
|
inlinestaticconstexprnoexcept |
Every derived class has to redefine this function.
Definition at line 276 of file HardwareAdapter.h.
const SerialCommunicationHardwareAdapter & DynExp::SerialCommunicationHardwareAdapter::operator<< | ( | const char * | Text | ) | const |
Writes the input parameter calling Write()
. Also writes endl
at the end automatically.
Text | Text to write |
SerialCommunicationHardwareAdapter
instance the function is invoked on Definition at line 256 of file HardwareAdapter.cpp.
const SerialCommunicationHardwareAdapter & DynExp::SerialCommunicationHardwareAdapter::operator<< | ( | const char | Char | ) | const |
Writes the input parameter calling Write()
. Also writes endl
at the end automatically.
Char | Single character to write |
SerialCommunicationHardwareAdapter
instance the function is invoked on Definition at line 266 of file HardwareAdapter.cpp.
const SerialCommunicationHardwareAdapter & DynExp::SerialCommunicationHardwareAdapter::operator<< | ( | const std::string & | Text | ) | const |
Writes the input parameter calling Write()
. Also writes endl
at the end automatically.
Text | Text to write |
SerialCommunicationHardwareAdapter
instance the function is invoked on Definition at line 236 of file HardwareAdapter.cpp.
const SerialCommunicationHardwareAdapter & DynExp::SerialCommunicationHardwareAdapter::operator<< | ( | const std::string_view | Text | ) | const |
Writes the input parameter calling Write()
. Also writes endl
at the end automatically.
Text | Text to write |
SerialCommunicationHardwareAdapter
instance the function is invoked on Definition at line 246 of file HardwareAdapter.cpp.
const SerialCommunicationHardwareAdapter & DynExp::SerialCommunicationHardwareAdapter::operator<< | ( | const std::stringstream & | InStream | ) | const |
Writes the input parameter calling Write()
. Also writes endl
at the end automatically.
InStream | Stream whose contents to write |
SerialCommunicationHardwareAdapter
instance the function is invoked on Definition at line 226 of file HardwareAdapter.cpp.
|
inline |
Writes the input parameter calling Write()
. Also writes endl
at the end automatically.
T | Type of the value to write |
Value | Value to write converting it to a string with Util::ToStr() |
SerialCommunicationHardwareAdapter
instance the function is invoked on Definition at line 408 of file HardwareAdapter.h.
const SerialCommunicationHardwareAdapter & DynExp::SerialCommunicationHardwareAdapter::operator<< | ( | endl | ) | const |
Writes a new line calling Write_endl()
.
SerialCommunicationHardwareAdapter
instance the function is invoked on Definition at line 217 of file HardwareAdapter.cpp.
const SerialCommunicationHardwareAdapter & DynExp::SerialCommunicationHardwareAdapter::operator>> | ( | std::stringstream & | OutStream | ) | const |
Writes the read buffer's content into OutStream
calling ReadAll()
.
OutStream | Stream to write the read data to |
SerialCommunicationHardwareAdapter
instance the function is invoked on Definition at line 210 of file HardwareAdapter.cpp.
|
privatepure virtual |
Reads a string from the underlying hardware interface.
Implemented in DynExp::QSerialCommunicationHardwareAdapter.
std::string DynExp::SerialCommunicationHardwareAdapter::ReadAll | ( | ) | const |
Calls ReadIntoBuffer()
before it extracts the entire content from the read buffer.
Definition at line 167 of file HardwareAdapter.cpp.
|
private |
Calls Read()
to retrieve data from the underlying hardware interface. Writes the retrieved data to the read buffer (ReadBuffer).
Util::InvalidStateException | is thrown if fail flags of ReadBuffer are set after writing to it. |
Definition at line 307 of file HardwareAdapter.cpp.
std::string DynExp::SerialCommunicationHardwareAdapter::ReadLine | ( | ) | const |
Calls ReadIntoBuffer()
before it extracts the first line from the read buffer.
Definition at line 146 of file HardwareAdapter.cpp.
|
finaloverrideprivatevirtual |
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl()
of every derived class gets called - starting from DynExp::Object, descending the inheritance hierarchy.
Implements DynExp::HardwareAdapterBase.
Definition at line 299 of file HardwareAdapter.cpp.
|
inlineprivatevirtual |
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl()
of every derived class gets called - starting from DynExp::Object, descending the inheritance hierarchy.
Reimplemented in DynExp::QSerialCommunicationHardwareAdapter.
Definition at line 435 of file HardwareAdapter.h.
std::string DynExp::SerialCommunicationHardwareAdapter::WaitForLine | ( | unsigned int | NumTries = 10 , |
std::chrono::milliseconds | DelayBetweenTries = std::chrono::milliseconds(10) |
||
) | const |
Calls ReadLine()
for NumTries
times until a line is received. Makes the calling thread sleep for DelayBetweenTries
in between the calls to ReadLine()
.
NumTries | Number of attempts to read a line from the read buffer |
DelayBetweenTries | Time to wait between subsequent attempts to read a line |
Definition at line 179 of file HardwareAdapter.cpp.
|
privatepure virtual |
Writes a string to the underlying hardware interface.
String | String to write |
Implemented in DynExp::QSerialCommunicationHardwareAdapter.
|
privatepure virtual |
Writes end of the line characters to the underlying hardware interface.
Implemented in DynExp::QSerialCommunicationHardwareAdapter.
|
private |
Copy of SerialCommunicationHardwareAdapterParams::LineEnding to avoid locking the corresponding SerialCommunicationHardwareAdapterParams
instance every time data is read or sent. Refer to GetLineEnding()
.
Definition at line 493 of file HardwareAdapter.h.
|
private |
String corresponding to LineEnding. Refer to LineEndingToChar()
Definition at line 495 of file HardwareAdapter.h.
|
mutableprivate |
Buffer storing data read from the underlying physical hardware.
Definition at line 496 of file HardwareAdapter.h.