Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F123781241
hriboard.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jul 29, 13:31
Size
2 KB
Mime Type
text/x-c++
Expires
Thu, Jul 31, 13:31 (2 d)
Engine
blob
Format
Raw Data
Handle
27715802
Attached To
R2671 HHRI-software
hriboard.h
View Options
#ifndef HRIBOARD_H
#define HRIBOARD_H
#include <QObject>
#include <QList>
#include <QSerialPort>
#include "syncvar.h"
/** @defgroup HriBoard HRI board
* @brief Interface to the HRI board.
*
* @addtogroup HriBoard
* @{
*/
/**
* @brief Class to interface with a HRI board.
*
* After creating an instance of this class, connect your custom slot functions
* to the signals
*
* Then, call openLink() to establish the communication link with the board.
* If successfull, this object will automatically request the synchronized
* variables list, and call the given slot function. You can then inspect this
* link and find useful variables to stream or modify. To operate on these
* SyncVars, create one SyncVarPointer per SyncVar, and associate them to an
* actual SyncVar with the associate() method.
*
*/
class
HriBoard
:
public
QObject
{
Q_OBJECT
public:
HriBoard
();
void
openLink
(
QString
comPortName
);
void
setStreamedVars
(
QList
<
SyncVarPointerBase
*>
varsToStream
);
bool
associate
(
SyncVarPointerBase
&
svp
,
QString
name
);
void
writeRemoteVar
(
SyncVar
*
var
);
void
readRemoteVar
(
SyncVar
*
var
);
static
QStringList
getComPorts
();
public
slots
:
void
onReceivedData
();
signals:
void
syncVarsListReceived
(
const
QList
<
SyncVar
>
&
syncVars
);
void
syncVarsUpdated
();
protected:
void
sendPacket
(
comm_PcMessage
messageType
,
QByteArray
dataBytes
=
QByteArray
());
private:
QSerialPort
serial
;
///< Serial port to communicate with the board.
QList
<
SyncVar
>
syncVars
;
///< SyncVars list.
QList
<
SyncVar
*>
streamedVars
;
///< List of pointers to the SyncVars streamed by the board.
QByteArray
rxBuffer
;
///< Byte buffer used for receiving bytes from the board.
int
rxCurrentMessageType
;
///< Type of the board message being interpreted.
int
rxBytesCount
;
///< Number of bytes of the board message being interpreted.
quint8
firstHalfByte
;
///< First byte of a data byte.
quint8
rxDataBytesBuffer
[
1024
];
///< Temporary buffer to store the data bytes (made of two received bytes) of the message being interpreted.
int
streamID
;
///< Identifier of the current streaming configuration, to check if the received streaming packet correspond to the request.
int
streamPacketSize
;
///< Expected size of a streaming packet [byte].
};
/**
* @}
*/
#endif
Event Timeline
Log In to Comment