package art.servers.fleetserver.radio.sepura; import art.servers.fleetserver.Shared; import art.servers.fleetserver.controller.ControllerRadioSepura; public class MOD_10_1243 { /** * 7.2.21 +CTSDSR - SDS Received * * Description * This unsolicited message carries the contents of a received SDS message * * Response * +CTSDSR: ,[],[],,,[,] * * Defined values * (for Trunked / Direct Mode) * 12 SDS type 4 * 13 Status * 108 SDS type 4 (incoming message to MT copied to TE) * 109 Status (incoming message to MT copied to TE) * 140 SDS Type 4 (outgoing message from MT copied to TE) * 141 Status (outgoing message from MT copied to TE) * * (for Gateway Mode) * 12 SDS type 4 (terminating message) * 13 Status (terminating message) * 44 SDS type 4 (passing message from DMO to TMO) * 45 Status (passing message from DMO to TMO) * 76 SDS type 4 (passing message from TMO to DMO) * 77 Status (passing message from TMO to DMO) * * * Calling party identity, format dependant on * * * 0 SSI * 1 TSI * 3 PABX external subscriber number * 4 E164 external subscriber number * * * Called party identity, format dependant on * * * 0 SSI * 1 TSI * * * number of bits in the user data. * * * Optional element indicating an encrypted message, set to the value '1'. * * * Message and SDS-TL header. This is encoded in ASCII Hex * * Example * {0D}{0A}+CTSDSR: 108,214000806014302,1,214000806010005,1,81{0D}{0A}03809BF3B11E401BC8950{0D}{0A} */ public static CTSDSR CTSDSR(ControllerRadioSepura radio, String command, String data) throws Exception { String[] parts = command.split(","); try { CTSDSR ctsdr = new CTSDSR(); ctsdr.service = Integer.parseInt(parts[0]); ctsdr.callingPartyIdentity = parts[1]; ctsdr.callingPartyIdentityType = Integer.parseInt(parts[2]); ctsdr.calledPartyIdentity = parts[3]; ctsdr.calledPartyIdentityType = Integer.parseInt(parts[4]); ctsdr.userData = data; int length = (int)(Math.ceil((double)Integer.parseInt(parts[5]) / 4.0) * 4.0); if ((data.length() * 4) != length) { throw new Exception(Shared.configuration.getMessage("Length error") + " [" + command + "]" + "[" + data + "]"); } return ctsdr; } catch (Exception e) { throw new Exception(Shared.configuration.getMessage("Indication error") + " [" + command + "]" + "[" + data + "]"); } } }