-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSmsDcs.cpp
66 lines (56 loc) · 1.18 KB
/
SmsDcs.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
#include "SmsDcs.h"
SmsDcs::SmsDcs()
{
dcs = 0;
}
void SmsDcs::setDcs(unsigned char charSet, unsigned char msgClass, bool setClass, bool compressed, bool autoDelete)
{
DcsGeneralCoding gc;
gc.msgClass = msgClass;
gc.charSet = charSet;
gc.setClass = setClass;
gc.compressed = compressed;
if (autoDelete)
{
gc.subGroup = 0x01;
}
else
{
gc.subGroup = 0x00;
}
dcs = *(unsigned char *)&gc;
}
void SmsDcs::setDcs(MESSAGE_WAITING type, bool active, bool Gsm7, bool autoDelete)
{
DcsMessageWaiting mw;
mw.type = type;
mw.active = active;
mw.reserved = 0;
if (autoDelete)
{
mw.subGroup = 0x0C;
}
else if (Gsm7)
{
mw.subGroup = 0x0D;
}
else
{
mw.subGroup = 0x0E;
}
dcs = *(unsigned char *)&mw;
}
void SmsDcs::setDcs(MESSAGE_CLASS msgClass, bool Gsm7)
{
DcsMessageClass mc;
mc.msgClass = msgClass;
/* ture: GSM7 or false: 8-bit */
mc.charSet = Gsm7;
mc.reserved = 0;
mc.subGroup = 0x0F;
dcs = *(unsigned char *)&mc;
}
string SmsDcs::format()
{
return I2H(dcs);
}