1
2
3
4
5 package net.sf.atmodem4j.core.gsm;
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 public class Pdu {
40
41
42
43
44 public boolean isCompressed() {
45 return compressed;
46 }
47
48
49
50
51 public void setCompressed(boolean compressed) {
52 this.compressed = compressed;
53 }
54
55
56
57
58 public Encoding getEncoding() {
59 return data.getEncoding();
60 }
61
62
63
64
65 public void setEncoding(Encoding encoding) {
66 switch (encoding) {
67 case TEXT_7BIT:
68 data = new UserData.Text7Bit();
69 break;
70 case DATA_8BIT:
71 data = new UserData.Data8Bit();
72 break;
73 case TEXT_16BIT:
74 data = new UserData.Text16Bit();
75 break;
76 }
77 }
78
79
80
81
82 public String getSmscAddress() {
83 return smscAddress;
84 }
85
86
87
88
89 public void setSmscAddress(String smscAddress) {
90 this.smscAddress = smscAddress;
91 }
92
93
94
95
96 public short getPartIndex() {
97 return partIndex;
98 }
99
100
101
102
103 public void setPartIndex(short partIndex) {
104 this.partIndex = partIndex;
105 }
106
107
108
109
110 public short getPartCount() {
111 return partCount;
112 }
113
114
115
116
117 public void setPartCount(short partCount) {
118 this.partCount = partCount;
119 }
120
121
122
123
124 public int getMsgId() {
125 return msgId;
126 }
127
128
129
130
131 public void setMsgId(int msgId) {
132 this.msgId = msgId;
133 }
134
135
136
137
138 public UserData getUserData() {
139 return data;
140 }
141
142
143
144
145 public void setUserData(byte[] data, int userDataLength, int userDataHeaderLength) {
146 this.data.decodePduData(data, userDataLength, userDataHeaderLength);
147 }
148
149 public static enum Encoding {
150
151 TEXT_7BIT, DATA_8BIT, TEXT_16BIT
152 };
153
154 public static class EncodingException extends Exception {
155 private static final long serialVersionUID = -8158245714142434697L;
156
157 EncodingException(String message) {
158 super(message);
159 }
160
161 }
162
163 public static enum TimeToLife {
164
165 HOURS, DAYS, WEEKS
166 };
167
168 private String smscAddress;
169 private boolean compressed;
170 private short partIndex;
171 private short partCount;
172 private int msgId;
173 private UserData data;
174
175 public String getText() {
176 return data.getText();
177 }
178
179 }