47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
#include "sensoritem.h"
|
|
|
|
SensorItem::SensorItem(QObject *parent) : QObject(parent)
|
|
{
|
|
clean();
|
|
}
|
|
|
|
SensorItem::~SensorItem()
|
|
{
|
|
clean();
|
|
}
|
|
|
|
SensorItem::SensorItem(const SensorItem & item) : QObject()
|
|
{
|
|
copyData(item);
|
|
}
|
|
|
|
SensorItem & SensorItem::operator= (const SensorItem & item)
|
|
{
|
|
copyData(item);
|
|
return *this;
|
|
}
|
|
|
|
void SensorItem::clean()
|
|
{
|
|
m_byte_offset = -1; // 字节偏移值
|
|
m_bit_offset = -1; // 字节内位偏移值
|
|
m_name.clear(); // 名称
|
|
m_type = -1; // 传感器类型
|
|
}
|
|
|
|
void SensorItem::copyData(const SensorItem & item)
|
|
{
|
|
m_byte_offset = item.m_byte_offset ; // 字节偏移值
|
|
m_bit_offset = item.m_bit_offset ; // 字节内位偏移值
|
|
m_name = item.m_name ; // 名称
|
|
m_type = item.m_type; // 传感器类型
|
|
}
|
|
|
|
void SensorItem::setItemValue(int woffset, int boffset, QString name, int type)
|
|
{
|
|
m_byte_offset = woffset ; // 字节偏移值
|
|
m_bit_offset = boffset ; // 字节内位偏移值
|
|
m_name = name ; // 名称
|
|
m_type = type; // 传感器类型
|
|
}
|