-
Notifications
You must be signed in to change notification settings - Fork 7
/
ciecsignal.cpp
71 lines (61 loc) · 1.63 KB
/
ciecsignal.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "ciecsignal.h"
#include "ctools.h"
#include <QDebug>
CIECSignal::CIECSignal()
{
description = "new tag";
}
CIECSignal::CIECSignal(uint16_t addr, uchar type, QString descr)
{
SetAddress(addr);
SetType(type);
this->quality = 0;
this->description = descr;
//this->descr = "";
}
/*CIECSignal::CIECSignal(uint16_t addr, uchar type, QString description)
{
SetAddress(addr);
SetType(type);
this->descr = description;
}*/
void CIECSignal::SetKey(uint key)
{
this->key = key;
address = key & 0x00FFFFFFu;
typeID = (key &0xFF000000u)>>24;
}
void CIECSignal::SetAddress(quint32 ioa)
{
address = ioa;
key &= 0xFF000000;
key |= ioa;
}
void CIECSignal::SetType(uchar type)
{
typeID = type;
key &=0x00FFFFu;
key |= type<<24;
}
QString CIECSignal::GetValueString()
{
QString result;
result = "addr: " + QString::number(this->address) +
" value: ";
switch (typeID)
{
case 3: result += value.toUInt(); break;
case 30: result += (value==1) ? "true" : "false"; break;
case 31: result += value.toUInt(); break;
case 32: result += QString::number(value.toUInt());break;
case 33: result += QString::number( value.toUInt());break;
case 34: result += QString::number(value.toUInt());break;
case 35: result += QString::number(value.toInt());break;
case 36: result += QString::number(value.toFloat());break;
}
//QString::number(this->value);
result += " type: " + QString::number(this->typeID)+
" quality: " + QString::number(this->quality) +
" Time: " + this->timestamp.GetTimeString();
return result;
}