forked from DSheirer/sdrtrunk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CSBKMessageFactory.java
452 lines (434 loc) · 26.1 KB
/
CSBKMessageFactory.java
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
* ****************************************************************************
*/
package io.github.dsheirer.module.decode.dmr.message.data.csbk;
import io.github.dsheirer.bits.CorrectedBinaryMessage;
import io.github.dsheirer.module.decode.dmr.DMRSyncPattern;
import io.github.dsheirer.module.decode.dmr.message.CACH;
import io.github.dsheirer.module.decode.dmr.message.data.SlotType;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.Hytera08Acknowledge;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.Hytera68Acknowledge;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraAdjacentSiteInformation;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraAloha;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraAnnouncement;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraCsbko44;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraCsbko47;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraSmsAvailableNotification;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraXPTPreamble;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraXPTSiteState;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityMaxAloha;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityPlusCSBKO_60;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityPlusDataRevertWindowAnnouncement;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityPlusDataRevertWindowGrant;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityPlusNeighbors;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityPlusPreamble;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityPlusSiteStatus;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.ConnectPlusCSBKO_16;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.ConnectPlusDataChannelGrant;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.ConnectPlusDataRevertWindowAnnouncement;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.ConnectPlusDataRevertWindowGrant;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.ConnectPlusNeighborReport;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.ConnectPlusOTAAnnouncement;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.ConnectPlusRegistrationRequest;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.ConnectPlusRegistrationResponse;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.ConnectPlusTalkgroupAffiliation;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.ConnectPlusTerminateChannelGrant;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.ConnectPlusVoiceChannelUser;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.Aloha;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.Clear;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.MoveTSCC;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.Preamble;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.Protect;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.acknowledge.Acknowledge;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.acknowledge.AcknowledgeStatus;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.acknowledge.RegistrationAccepted;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.ahoy.Ahoy;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.ahoy.AuthenticateRegisterRadioCheck;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.ahoy.CancelCall;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.ahoy.ServiceRadioCheck;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.ahoy.StunReviveKill;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.ahoy.UnknownAhoy;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.announcement.AdjacentSiteInformation;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.announcement.AnnounceChannelFrequency;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.announcement.AnnounceWithdrawTSCC;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.announcement.Announcement;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.announcement.CallTimerParameters;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.announcement.LocalTime;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.announcement.MassRegistration;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.announcement.VoteNowAdvice;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.grant.BroadcastTalkgroupVoiceChannelGrant;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.grant.DuplexPrivateDataChannelGrant;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.grant.DuplexPrivateVoiceChannelGrant;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.grant.PrivateDataChannelGrant;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.grant.PrivateVoiceChannelGrant;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.grant.TalkgroupDataChannelGrant;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.standard.grant.TalkgroupVoiceChannelGrant;
import io.github.dsheirer.module.decode.dmr.message.data.header.MBCHeader;
import io.github.dsheirer.module.decode.dmr.message.data.mbc.MBCContinuationBlock;
import io.github.dsheirer.module.decode.dmr.message.data.mbc.UnknownMultiCSBK;
import io.github.dsheirer.module.decode.dmr.message.type.AnnouncementType;
import io.github.dsheirer.module.decode.dmr.message.type.ServiceKind;
import java.util.List;
/**
* Factory for creating DMR CSBK and Multi-Block CSBK messages
*/
public class CSBKMessageFactory
{
/**
* Creates a CSBK Message
* @param pattern that was transmitted
* @param message contents
* @param cach instance
* @param slotType instance
* @param timestamp of the message
* @param timeslot the message was transmitted on
* @return constructed CSBK mesage
*/
public static CSBKMessage create(DMRSyncPattern pattern, CorrectedBinaryMessage message, CACH cach, SlotType slotType,
long timestamp, int timeslot)
{
CSBKMessage csbk = null;
if(message != null)
{
Opcode opcode = CSBKMessage.getOpcode(message);
switch(opcode)
{
case STANDARD_ACKNOWLEDGE_RESPONSE_INBOUND_TSCC:
case STANDARD_ACKNOWLEDGE_RESPONSE_OUTBOUND_TSCC:
case STANDARD_ACKNOWLEDGE_RESPONSE_INBOUND_PAYLOAD:
case STANDARD_ACKNOWLEDGE_RESPONSE_OUTBOUND_PAYLOAD:
switch(Acknowledge.getReason(message))
{
case TS_REGISTRATION_ACCEPTED:
csbk = new RegistrationAccepted(pattern, message, cach, slotType, timestamp, timeslot);
break;
case TS_ACCEPTED_FOR_STATUS_POLLING_SERVICE:
csbk = new AcknowledgeStatus(pattern, message, cach, slotType, timestamp, timeslot);
break;
default:
csbk = new Acknowledge(pattern, message, cach, slotType, timestamp, timeslot);
break;
}
break;
case STANDARD_AHOY:
ServiceKind serviceKind = Ahoy.getServiceKind(message);
switch(serviceKind)
{
case AUTHENTICATE_REGISTER_RADIO_CHECK_SERVICE:
csbk = new AuthenticateRegisterRadioCheck(pattern, message, cach, slotType, timestamp, timeslot);
break;
case CANCEL_CALL_SERVICE:
csbk = new CancelCall(pattern, message, cach, slotType, timestamp, timeslot);
break;
case SUPPLEMENTARY_SERVICE:
csbk = new StunReviveKill(pattern, message, cach, slotType, timestamp, timeslot);
break;
case FULL_DUPLEX_MS_TO_MS_PACKET_CALL_SERVICE:
case FULL_DUPLEX_MS_TO_MS_VOICE_CALL_SERVICE:
case INDIVIDUAL_VOICE_CALL_SERVICE:
case INDIVIDUAL_PACKET_CALL_SERVICE:
case INDIVIDUAL_UDT_SHORT_DATA_CALL_SERVICE:
case TALKGROUP_PACKET_CALL_SERVICE:
case TALKGROUP_UDT_SHORT_DATA_CALL_SERVICE:
case TALKGROUP_VOICE_CALL_SERVICE:
csbk = new ServiceRadioCheck(pattern, message, cach, slotType, timestamp, timeslot);
break;
default:
csbk = new UnknownAhoy(pattern, message, cach, slotType, timestamp, timeslot);
break;
}
break;
case STANDARD_ALOHA:
csbk = new Aloha(pattern, message, cach, slotType, timestamp, timeslot);
break;
case STANDARD_ANNOUNCEMENT:
switch(Announcement.getAnnouncementType(message))
{
case ADJACENT_SITE_INFORMATION:
csbk = new AdjacentSiteInformation(pattern, message, cach, slotType, timestamp, timeslot);
break;
case ANNOUNCE_OR_WITHDRAW_TSCC:
csbk = new AnnounceWithdrawTSCC(pattern, message, cach, slotType, timestamp, timeslot);
break;
case CALL_TIMER_PARAMETERS:
csbk = new CallTimerParameters(pattern, message, cach, slotType, timestamp, timeslot);
break;
case LOCAL_TIME:
csbk = new LocalTime(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MASS_REGISTRATION:
csbk = new MassRegistration(pattern, message, cach, slotType, timestamp, timeslot);
break;
case VOTE_NOW_ADVICE:
csbk = new VoteNowAdvice(pattern, message, cach, slotType, timestamp, timeslot);
break;
default:
csbk = new Announcement(pattern, message, cach, slotType, timestamp, timeslot);
break;
}
break;
case STANDARD_BROADCAST_TALKGROUP_VOICE_CHANNEL_GRANT:
csbk = new BroadcastTalkgroupVoiceChannelGrant(pattern, message, cach, slotType, timestamp,
timeslot);
break;
case STANDARD_CLEAR:
csbk = new Clear(pattern, message, cach, slotType, timestamp, timeslot);
break;
case STANDARD_DUPLEX_PRIVATE_DATA_CHANNEL_GRANT:
csbk = new DuplexPrivateDataChannelGrant(pattern, message, cach, slotType, timestamp, timeslot);
break;
case STANDARD_DUPLEX_PRIVATE_VOICE_CHANNEL_GRANT:
csbk = new DuplexPrivateVoiceChannelGrant(pattern, message, cach, slotType, timestamp, timeslot);
break;
case STANDARD_PRIVATE_DATA_CHANNEL_GRANT_SINGLE_ITEM:
csbk = new PrivateDataChannelGrant(pattern, message, cach, slotType, timestamp, timeslot);
break;
case STANDARD_PRIVATE_VOICE_CHANNEL_GRANT:
csbk = new PrivateVoiceChannelGrant(pattern, message, cach, slotType, timestamp, timeslot);
break;
case STANDARD_PROTECT:
csbk = new Protect(pattern, message, cach, slotType, timestamp, timeslot);
break;
case STANDARD_TALKGROUP_DATA_CHANNEL_GRANT_SINGLE_ITEM:
csbk = new TalkgroupDataChannelGrant(pattern, message, cach, slotType, timestamp, timeslot);
break;
case STANDARD_TALKGROUP_VOICE_CHANNEL_GRANT:
csbk = new TalkgroupVoiceChannelGrant(pattern, message, cach, slotType, timestamp, timeslot);
break;
case STANDARD_MOVE_TSCC:
csbk = new MoveTSCC(pattern, message, cach, slotType, timestamp, timeslot);
break;
case STANDARD_PREAMBLE:
csbk = new Preamble(pattern, message, cach, slotType, timestamp, timeslot);
break;
case HYTERA_68_ALOHA:
csbk = new HyteraAloha(pattern, message, cach, slotType, timestamp, timeslot);
break;
case HYTERA_08_ANNOUNCEMENT:
case HYTERA_68_ANNOUNCEMENT:
AnnouncementType announcementType = HyteraAnnouncement.getAnnouncementType(message);
switch(announcementType)
{
case ADJACENT_SITE_INFORMATION:
csbk = new HyteraAdjacentSiteInformation(pattern, message, cach, slotType, timestamp, timeslot);
break;
default:
csbk = new HyteraAnnouncement(pattern, message, cach, slotType, timestamp, timeslot);
break;
}
break;
case HYTERA_68_XPT_PREAMBLE:
csbk = new HyteraXPTPreamble(pattern, message, cach, slotType, timestamp, timeslot);
break;
case HYTERA_68_XPT_SITE_STATE:
csbk = new HyteraXPTSiteState(pattern, message, cach, slotType, timestamp, timeslot);
break;
case HYTERA_08_ACKNOWLEDGE:
csbk = new Hytera08Acknowledge(pattern, message, cach, slotType, timestamp, timeslot);
break;
case HYTERA_08_CSBKO_44:
csbk = new HyteraCsbko44(pattern, message, cach, slotType, timestamp, timeslot);
break;
case HYTERA_08_CSBKO_47:
csbk = new HyteraCsbko47(pattern, message, cach, slotType, timestamp, timeslot);
break;
case HYTERA_68_ACKNOWLEDGE:
csbk = new Hytera68Acknowledge(pattern, message, cach, slotType, timestamp, timeslot);
break;
case HYTERA_68_CSBKO_62:
csbk = new HyteraSmsAvailableNotification(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CAPMAX_ALOHA:
csbk = new CapacityMaxAloha(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CAPPLUS_NEIGHBOR_REPORT:
csbk = new CapacityPlusNeighbors(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CAPPLUS_PREAMBLE:
csbk = new CapacityPlusPreamble(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CAPPLUS_SYSTEM_STATUS:
csbk = new CapacityPlusSiteStatus(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CAPPLUS_DATA_WINDOW_ANNOUNCEMENT:
csbk = new CapacityPlusDataRevertWindowAnnouncement(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CAPPLUS_DATA_WINDOW_GRANT:
csbk = new CapacityPlusDataRevertWindowGrant(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CONPLUS_CSBKO_10:
csbk = new ConnectPlusOTAAnnouncement(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CONPLUS_CSBKO_16:
csbk = new ConnectPlusCSBKO_16(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CONPLUS_REGISTRATION_REQUEST:
csbk = new ConnectPlusRegistrationRequest(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CONPLUS_REGISTRATION_RESPONSE:
csbk = new ConnectPlusRegistrationResponse(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CONPLUS_TALKGROUP_AFFILIATION:
csbk = new ConnectPlusTalkgroupAffiliation(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CAPPLUS_CSBKO_60:
csbk = new CapacityPlusCSBKO_60(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CONPLUS_DATA_CHANNEL_GRANT:
csbk = new ConnectPlusDataChannelGrant(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CONPLUS_NEIGHBOR_REPORT:
csbk = new ConnectPlusNeighborReport(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CONPLUS_TERMINATE_CHANNEL_GRANT:
csbk = new ConnectPlusTerminateChannelGrant(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CONPLUS_VOICE_CHANNEL_USER:
csbk = new ConnectPlusVoiceChannelUser(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CONPLUS_DATA_WINDOW_ANNOUNCEMENT:
csbk = new ConnectPlusDataRevertWindowAnnouncement(pattern, message, cach, slotType, timestamp, timeslot);
break;
case MOTOROLA_CONPLUS_DATA_WINDOW_GRANT:
csbk = new ConnectPlusDataRevertWindowGrant(pattern, message, cach, slotType, timestamp, timeslot);
break;
}
if(csbk == null)
{
csbk = new UnknownCSBKMessage(pattern, message, cach, slotType, timestamp, timeslot);
}
}
//Check CRC and set valid flag
if(csbk != null)
{
csbk.checkCRC();
}
return csbk;
}
/**
* Creates a multi-block CSBK message
* @param header for the Multi-Block CSBK (MBC)
* @param continuationBlocks that form the rest of the message
* @return message
*/
public static CSBKMessage create(MBCHeader header, List<MBCContinuationBlock> continuationBlocks)
{
CSBKMessage csbk;
Opcode opcode = header.getOpcode();
switch(opcode)
{
case STANDARD_ANNOUNCEMENT:
AnnouncementType announcementType = Announcement.getAnnouncementType(header.getMessage());
switch(announcementType)
{
case ADJACENT_SITE_INFORMATION:
csbk = new AdjacentSiteInformation(header.getSyncPattern(), header.getMessage(), header.getCACH(),
header.getSlotType(), header.getTimestamp(), header.getTimeslot(), getBlock1(continuationBlocks));
break;
case ANNOUNCE_OR_WITHDRAW_TSCC:
csbk = new AnnounceWithdrawTSCC(header.getSyncPattern(), header.getMessage(), header.getCACH(),
header.getSlotType(), header.getTimestamp(), header.getTimeslot(), getBlock1(continuationBlocks));
break;
case CHANNEL_FREQUENCY_ANNOUNCEMENT:
csbk = new AnnounceChannelFrequency(header.getSyncPattern(), header.getMessage(), header.getCACH(),
header.getSlotType(), header.getTimestamp(), header.getTimeslot(), getBlock1(continuationBlocks));
break;
case VOTE_NOW_ADVICE:
csbk = new VoteNowAdvice(header.getSyncPattern(), header.getMessage(), header.getCACH(),
header.getSlotType(), header.getTimestamp(), header.getTimeslot(), getBlock1(continuationBlocks));
break;
default:
csbk = new UnknownMultiCSBK(header, continuationBlocks);
break;
}
break;
case STANDARD_BROADCAST_TALKGROUP_VOICE_CHANNEL_GRANT:
csbk = new BroadcastTalkgroupVoiceChannelGrant(header.getSyncPattern(), header.getMessage(), header.getCACH(),
header.getSlotType(), header.getTimestamp(), header.getTimeslot(), getBlock1(continuationBlocks));
break;
case STANDARD_CLEAR:
csbk = new Clear(header.getSyncPattern(), header.getMessage(), header.getCACH(), header.getSlotType(),
header.getTimestamp(), header.getTimeslot(), getBlock1(continuationBlocks));
break;
case STANDARD_DUPLEX_PRIVATE_DATA_CHANNEL_GRANT:
csbk = new DuplexPrivateDataChannelGrant(header.getSyncPattern(), header.getMessage(), header.getCACH(),
header.getSlotType(), header.getTimestamp(), header.getTimeslot(), getBlock1(continuationBlocks));
break;
case STANDARD_DUPLEX_PRIVATE_VOICE_CHANNEL_GRANT:
csbk = new DuplexPrivateVoiceChannelGrant(header.getSyncPattern(), header.getMessage(), header.getCACH(),
header.getSlotType(), header.getTimestamp(), header.getTimeslot(), getBlock1(continuationBlocks));
break;
case STANDARD_MOVE_TSCC:
csbk = new MoveTSCC(header.getSyncPattern(), header.getMessage(), header.getCACH(), header.getSlotType(),
header.getTimestamp(), header.getTimeslot(), getBlock1(continuationBlocks));
break;
case STANDARD_PRIVATE_DATA_CHANNEL_GRANT_SINGLE_ITEM:
csbk = new PrivateDataChannelGrant(header.getSyncPattern(), header.getMessage(), header.getCACH(),
header.getSlotType(), header.getTimestamp(), header.getTimeslot(), getBlock1(continuationBlocks));
break;
case STANDARD_PRIVATE_VOICE_CHANNEL_GRANT:
csbk = new PrivateVoiceChannelGrant(header.getSyncPattern(), header.getMessage(), header.getCACH(),
header.getSlotType(), header.getTimestamp(), header.getTimeslot(), getBlock1(continuationBlocks));
break;
case STANDARD_TALKGROUP_DATA_CHANNEL_GRANT_SINGLE_ITEM:
csbk = new TalkgroupDataChannelGrant(header.getSyncPattern(), header.getMessage(), header.getCACH(),
header.getSlotType(), header.getTimestamp(), header.getTimeslot(), getBlock1(continuationBlocks));
break;
case STANDARD_TALKGROUP_VOICE_CHANNEL_GRANT:
csbk = new TalkgroupVoiceChannelGrant(header.getSyncPattern(), header.getMessage(), header.getCACH(),
header.getSlotType(), header.getTimestamp(), header.getTimeslot(), getBlock1(continuationBlocks));
break;
case HYTERA_08_ANNOUNCEMENT:
case HYTERA_68_ANNOUNCEMENT:
AnnouncementType hyteraAnnouncementType = HyteraAnnouncement.getAnnouncementType(header.getMessage());
switch(hyteraAnnouncementType)
{
case ADJACENT_SITE_INFORMATION:
csbk = new HyteraAdjacentSiteInformation(header.getSyncPattern(), header.getMessage(), header.getCACH(),
header.getSlotType(), header.getTimestamp(), header.getTimeslot(), getBlock1(continuationBlocks));
break;
default:
csbk = new UnknownMultiCSBK(header, continuationBlocks);
break;
}
break;
default:
csbk = new UnknownMultiCSBK(header, continuationBlocks);
break;
}
//Check CRC and set valid flag
if(csbk != null)
{
csbk.checkCRC();
}
return csbk;
}
/**
* Extracts the first block from the list
* @param blocks containing zero or more blocks
* @return first block or null
*/
private static MBCContinuationBlock getBlock1(List<MBCContinuationBlock> blocks)
{
if(blocks != null && blocks.size() >= 1)
{
return blocks.get(0);
}
return null;
}
}