Go to the documentation of this file.
65 #ifndef MTBFILECOMMUNICATOR_H
66 #define MTBFILECOMMUNICATOR_H
XsFilePos logFileReadPosition() const override
Retrieve the read position of the log file.
bool isPortOpen() const override
bool reopenPort(OpenPortStage stage=OPS_Full, bool skipDeviceIdCheck=false) override
Reopens the port.
xsens::ThreadPool::TaskId m_loadFileTaskId
OpenPortStage
Port opening stages.
bool openPort(const XsPortInfo &portInfo, OpenPortStage stage=OPS_Full, bool detectRs485=false) override
Opens a port.
virtual XsResultValue readLogFile(XsDevice *device) override
Read a log file into cache.
std::shared_ptr< IoInterfaceFile > m_ioInterfaceFile
XsTimeStamp logFileDate() const override
Retrieve the date of the open log file.
bool doTransaction(const XsMessage &msg, XsMessage &rcv, uint32_t timeout) override
Pretend to be a live system.
XsMessage readMessageFromStartOfFile(uint8_t msgId, int maxMsgs=0) override
Read a message from the start of the open file.
A class that is used for the communcation with a mtb file.
The low-level file communication class.
MtbFileCommunicator()
Default constructor.
std::deque< XsMessage > readMessagesFromStartOfFile(uint8_t msgId, int maxMsgs=0) override
Read multiple similar messages from the start of the open file.
void resetLogFileReadPosition(void) override
Restart reading from the start of the open log file.
static Communicator * construct()
Constructs new MtbFileCommunicator.
XsResultValue
Xsens result values.
uint32_t timeoutToMaxMessages(uint32_t timeout) const
A rather stupid function that tries to convert a live timeout into a number of messages.
void closePort() override
Closes the open port.
unsigned int TaskId
A type definition of a task ID.
XsResultValue gotoConfig(bool detectRs485=false) override
Request a device to go to config mode.
XsPortInfo portInfo() const override
A base struct for a communication interface.
void setKeepAlive(bool enable) override
Either disable or enable (default) the keep alive mechanism (if supported by the device)
void prepareForDestruction() override
Prepares for the destruction.
std::deque< XsMessage > * m_extractedMessages
bool writeMessage(const XsMessage &message) override
Write message to the device.
Contains a descriptor for opening a communication port to an Xsens device.
bool isDockedAt(Communicator *other) const override
Returns true if the other device is docked at this device.
Interface class for protocol handlers.
bool openLogFile(const XsString &filename) override
Open a log file for input.
XsMessage readMessage(uint8_t msgId=0) override
Read a message from the open file.
bool isLoadLogFileInProgress() const override
Structure for storing a single message.
XsFilePos logFileSize() const override
Retrieve the size of the open log file in bytes.
void closeLogFile() override
Close the log file.
void completeAllThreadedWork()
Completes all threaded work.
bool isReadingFromFile() const override
Return whether we are reading from file.
MessageExtractor * m_extractor
void loadLogFile(XsDevice *device) override
Load a log file with thread pool.
void setGotoConfigTimeout(uint32_t timeout) override
Set the timeout for the gotoConfig function.
XsResultValue getDeviceId() override
Request a device to get device ID.
virtual XsMessage readNextMessage()
Read the next message from the open file.
void abortLoadLogFile() override
Abort a process that takes a long time to complete.
void flushPort() override
Flushes all remaining data on the open port.
void waitForLastTaskCompletion() override
Wait for the last processing task to complete in the threadpool.
virtual XsResultValue readSinglePacketFromFile() override
Read a single XsDataPacket from an open log file.
XsString logFileName() const override
Retrieve the name of the open log file or an empty string if no log file is open.
int64_t XsFilePos
The type that is used for positioning inside a file.
A 0-terminated managed string of characters.
XsResultValue gotoMeasurement() override
Request a device to go to measurement mode.
void addProtocolHandler(IProtocolHandler *handler) override
Add the protocol handler.
This class contains method to set, retrieve and compare timestamps.