You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.4 KiB
66 lines
1.4 KiB
#ifndef __DEVICE_NODE_HEADER__
|
|
#define __DEVICE_NODE_HEADER__
|
|
|
|
#include "../../components/base/basicEngine.h"
|
|
#include "../../components/base/basicEvent.h"
|
|
#include "cmdNodeConveyor.h"
|
|
|
|
// The node record must be missing this many validations in a row before the node is deleted: a single failed
|
|
// read (SQLite busy - queries fail at once, no busy wait) deleted the node (a camera dropped its stream)
|
|
#ifndef NODE_DATA_MISSES_TO_REBUILD
|
|
#define NODE_DATA_MISSES_TO_REBUILD 3
|
|
#endif
|
|
|
|
class deviceNode : public cmdNodeConveyor, public basicEngine
|
|
{
|
|
private:
|
|
protected:
|
|
|
|
basicLogCollection * m_pLog;
|
|
dataBinder * m_pDBC;
|
|
DBC_NODE_DATA m_sNodeData;
|
|
uint8_t m_nNodeDataMisses; // validate(): node record not read N times in a row
|
|
|
|
public:
|
|
|
|
explicit deviceNode(uint32_t id);
|
|
explicit deviceNode(DBC_NODE_DATA * Data);
|
|
virtual ~deviceNode();
|
|
|
|
uint32_t getNodeID() const
|
|
{
|
|
return m_sNodeData.node_id;
|
|
}
|
|
|
|
uint32_t getDeviceID() const
|
|
{
|
|
return m_sNodeData.aux_id;
|
|
}
|
|
|
|
uint32_t getDeviceParam() const
|
|
{
|
|
return m_sNodeData.aux_parameter;
|
|
}
|
|
|
|
ARGUS_NODE_TYPE getNodeType() const
|
|
{
|
|
return (ARGUS_NODE_TYPE) m_sNodeData.type;
|
|
}
|
|
|
|
bool isNodeOnline(void) const
|
|
{
|
|
return m_sNodeData.online;
|
|
}
|
|
|
|
virtual bool reset()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
virtual bool validate();
|
|
};
|
|
|
|
typedef std::vector<deviceNode *> vectorDeviceNodes;
|
|
typedef std::map<uint32_t, deviceNode *> mapDeviceNode2Id;
|
|
|
|
#endif
|