/protocols/ss7/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/lsm/SubscriberLocationReportRequestIndicationImpl.java

http://mobicents.googlecode.com/ · Java · 975 lines · 613 code · 74 blank · 288 comment · 120 complexity · 0c8b15e199c1546b1ce62b839eefe34b MD5 · raw file

  1. /*
  2. * JBoss, Home of Professional Open Source
  3. * Copyright 2011, Red Hat, Inc. and individual contributors
  4. * by the @authors tag. See the copyright.txt in the distribution for a
  5. * full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.mobicents.protocols.ss7.map.service.lsm;
  23. import java.io.IOException;
  24. import org.mobicents.protocols.asn.AsnException;
  25. import org.mobicents.protocols.asn.AsnInputStream;
  26. import org.mobicents.protocols.asn.AsnOutputStream;
  27. import org.mobicents.protocols.asn.Tag;
  28. import org.mobicents.protocols.ss7.map.api.MAPException;
  29. import org.mobicents.protocols.ss7.map.api.MAPMessageType;
  30. import org.mobicents.protocols.ss7.map.api.MAPOperationCode;
  31. import org.mobicents.protocols.ss7.map.api.MAPParsingComponentException;
  32. import org.mobicents.protocols.ss7.map.api.MAPParsingComponentExceptionReason;
  33. import org.mobicents.protocols.ss7.map.api.primitives.CellGlobalIdOrServiceAreaIdOrLAI;
  34. import org.mobicents.protocols.ss7.map.api.primitives.IMEI;
  35. import org.mobicents.protocols.ss7.map.api.primitives.IMSI;
  36. import org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString;
  37. import org.mobicents.protocols.ss7.map.api.service.lsm.AccuracyFulfilmentIndicator;
  38. import org.mobicents.protocols.ss7.map.api.service.lsm.DeferredmtlrData;
  39. import org.mobicents.protocols.ss7.map.api.service.lsm.LCSClientID;
  40. import org.mobicents.protocols.ss7.map.api.service.lsm.LCSEvent;
  41. import org.mobicents.protocols.ss7.map.api.service.lsm.LCSLocationInfo;
  42. import org.mobicents.protocols.ss7.map.api.service.lsm.SLRArgExtensionContainer;
  43. import org.mobicents.protocols.ss7.map.api.service.lsm.SubscriberLocationReportRequestIndication;
  44. import org.mobicents.protocols.ss7.map.primitives.CellGlobalIdOrServiceAreaIdOrLAIImpl;
  45. import org.mobicents.protocols.ss7.map.primitives.IMEIImpl;
  46. import org.mobicents.protocols.ss7.map.primitives.IMSIImpl;
  47. import org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl;
  48. /**
  49. * TODO add unit test
  50. *
  51. * @author amit bhayani
  52. *
  53. */
  54. public class SubscriberLocationReportRequestIndicationImpl extends LsmMessageImpl implements SubscriberLocationReportRequestIndication {
  55. private static final int _TAG_MSISDN = 0;
  56. private static final int _TAG_IMSI = 1;
  57. private static final int _TAG_IMEI = 2;
  58. private static final int _TAG_NA_ESRD = 3;
  59. private static final int _TAG_NA_ESRK = 4;
  60. private static final int _TAG_LOCATION_ESTIMATE = 5;
  61. private static final int _TAG_AGE_OF_LOCATION_ESTIMATE = 6;
  62. private static final int _TAG_SLR_ARG_EXTENSION_CONTAINER = 7;
  63. private static final int _TAG_ADD_LOCATION_ESTIMATE = 8;
  64. private static final int _TAG_DEFERRED_MT_LR_DATA = 9;
  65. private static final int _TAG_LCS_REFERENCE_NUMBER = 10;
  66. private static final int _TAG_GERAN_POSITIONING_DATA = 11;
  67. private static final int _TAG_UTRAN_POSITIONING_DATA = 12;
  68. private static final int _TAG_CELL_ID_OR_SAI = 13;
  69. private static final int _TAG_H_GMLC_ADDRESS = 14;
  70. private static final int _TAG_LCS_SERVICE_TYPE_ID = 15;
  71. private static final int _TAG_SAI_PRESENT = 17;
  72. private static final int _TAG_PSEUDONYM_INDICATOR = 18;
  73. private static final int _TAG_ACCURACY_FULFILMENT_INDICATOR = 19;
  74. private LCSEvent lcsEvent = null;
  75. private LCSClientID lcsClientID = null;
  76. private LCSLocationInfo lcsLocationInfo = null;
  77. private ISDNAddressString msisdn = null;
  78. private IMSI imsi = null;
  79. private IMEI imei = null;
  80. private ISDNAddressString naEsrd = null;
  81. private ISDNAddressString naEsrk = null;
  82. private byte[] locationEstimate = null;
  83. private Integer ageOfLocationEstimate = null;
  84. private SLRArgExtensionContainer slrArgExtensionContainer = null;
  85. private byte[] addLocationEstimate = null;
  86. private DeferredmtlrData deferredmtlrData = null;
  87. private Byte lcsReferenceNumber = null;
  88. private byte[] geranPositioningData = null;
  89. private byte[] utranPositioningData = null;
  90. private CellGlobalIdOrServiceAreaIdOrLAI cellIdOrSai = null;
  91. private byte[] hgmlcAddress = null;
  92. private Integer lcsServiceTypeID = null;
  93. private Boolean saiPresent = null;
  94. private Boolean pseudonymIndicator = null;
  95. private AccuracyFulfilmentIndicator accuracyFulfilmentIndicator = null;
  96. /**
  97. *
  98. */
  99. public SubscriberLocationReportRequestIndicationImpl() {
  100. super();
  101. }
  102. /**
  103. * @param lcsEvent
  104. * @param lcsClientID
  105. * @param lcsLocationInfo
  106. * @param msisdn
  107. * @param imsi
  108. * @param imei
  109. * @param naEsrd
  110. * @param naEsrk
  111. * @param locationEstimate
  112. * @param ageOfLocationEstimate
  113. * @param slrArgExtensionContainer
  114. * @param addLocationEstimate
  115. * @param deferredmtlrData
  116. * @param lcsReferenceNumber
  117. * @param geranPositioningData
  118. * @param utranPositioningData
  119. * @param cellIdOrSai
  120. * @param hgmlcAddress
  121. * @param lcsServiceTypeID
  122. * @param saiPresent
  123. * @param pseudonymIndicator
  124. * @param accuracyFulfilmentIndicator
  125. */
  126. public SubscriberLocationReportRequestIndicationImpl(LCSEvent lcsEvent, LCSClientID lcsClientID, LCSLocationInfo lcsLocationInfo, ISDNAddressString msisdn,
  127. IMSI imsi, IMEI imei, ISDNAddressString naEsrd, ISDNAddressString naEsrk, byte[] locationEstimate, Integer ageOfLocationEstimate,
  128. SLRArgExtensionContainer slrArgExtensionContainer, byte[] addLocationEstimate, DeferredmtlrData deferredmtlrData, Byte lcsReferenceNumber,
  129. byte[] geranPositioningData, byte[] utranPositioningData, CellGlobalIdOrServiceAreaIdOrLAI cellIdOrSai, byte[] hgmlcAddress,
  130. Integer lcsServiceTypeID, Boolean saiPresent, Boolean pseudonymIndicator, AccuracyFulfilmentIndicator accuracyFulfilmentIndicator) {
  131. super();
  132. this.lcsEvent = lcsEvent;
  133. this.lcsClientID = lcsClientID;
  134. this.lcsLocationInfo = lcsLocationInfo;
  135. this.msisdn = msisdn;
  136. this.imsi = imsi;
  137. this.imei = imei;
  138. this.naEsrd = naEsrd;
  139. this.naEsrk = naEsrk;
  140. this.locationEstimate = locationEstimate;
  141. this.ageOfLocationEstimate = ageOfLocationEstimate;
  142. this.slrArgExtensionContainer = slrArgExtensionContainer;
  143. this.addLocationEstimate = addLocationEstimate;
  144. this.deferredmtlrData = deferredmtlrData;
  145. this.lcsReferenceNumber = lcsReferenceNumber;
  146. this.geranPositioningData = geranPositioningData;
  147. this.utranPositioningData = utranPositioningData;
  148. this.cellIdOrSai = cellIdOrSai;
  149. this.hgmlcAddress = hgmlcAddress;
  150. this.lcsServiceTypeID = lcsServiceTypeID;
  151. this.saiPresent = saiPresent;
  152. this.pseudonymIndicator = pseudonymIndicator;
  153. this.accuracyFulfilmentIndicator = accuracyFulfilmentIndicator;
  154. }
  155. @Override
  156. public MAPMessageType getMessageType() {
  157. return MAPMessageType.subscriberLocationReport_Request;
  158. }
  159. @Override
  160. public int getOperationCode() {
  161. return MAPOperationCode.subscriberLocationReport;
  162. }
  163. /*
  164. * (non-Javadoc)
  165. *
  166. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  167. * SubscriberLocationReportRequestIndication#getLCSEvent()
  168. */
  169. @Override
  170. public LCSEvent getLCSEvent() {
  171. return this.lcsEvent;
  172. }
  173. /*
  174. * (non-Javadoc)
  175. *
  176. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  177. * SubscriberLocationReportRequestIndication#getLCSClientID()
  178. */
  179. @Override
  180. public LCSClientID getLCSClientID() {
  181. return this.lcsClientID;
  182. }
  183. /*
  184. * (non-Javadoc)
  185. *
  186. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  187. * SubscriberLocationReportRequestIndication#getLCSLocationInfo()
  188. */
  189. @Override
  190. public LCSLocationInfo getLCSLocationInfo() {
  191. return this.lcsLocationInfo;
  192. }
  193. /*
  194. * (non-Javadoc)
  195. *
  196. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  197. * SubscriberLocationReportRequestIndication#getMSISDN()
  198. */
  199. @Override
  200. public ISDNAddressString getMSISDN() {
  201. return this.msisdn;
  202. }
  203. /*
  204. * (non-Javadoc)
  205. *
  206. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  207. * SubscriberLocationReportRequestIndication#getIMSI()
  208. */
  209. @Override
  210. public IMSI getIMSI() {
  211. return this.imsi;
  212. }
  213. /*
  214. * (non-Javadoc)
  215. *
  216. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  217. * SubscriberLocationReportRequestIndication#getIMEI()
  218. */
  219. @Override
  220. public IMEI getIMEI() {
  221. return this.imei;
  222. }
  223. /*
  224. * (non-Javadoc)
  225. *
  226. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  227. * SubscriberLocationReportRequestIndication#getNaESRD()
  228. */
  229. @Override
  230. public ISDNAddressString getNaESRD() {
  231. return this.naEsrd;
  232. }
  233. /*
  234. * (non-Javadoc)
  235. *
  236. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  237. * SubscriberLocationReportRequestIndication#getNaESRK()
  238. */
  239. @Override
  240. public ISDNAddressString getNaESRK() {
  241. return this.naEsrk;
  242. }
  243. /*
  244. * (non-Javadoc)
  245. *
  246. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  247. * SubscriberLocationReportRequestIndication#getLocationEstimate()
  248. */
  249. @Override
  250. public byte[] getLocationEstimate() {
  251. return this.locationEstimate;
  252. }
  253. /*
  254. * (non-Javadoc)
  255. *
  256. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  257. * SubscriberLocationReportRequestIndication#getAgeOfLocationEstimate()
  258. */
  259. @Override
  260. public Integer getAgeOfLocationEstimate() {
  261. return this.ageOfLocationEstimate;
  262. }
  263. /*
  264. * (non-Javadoc)
  265. *
  266. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  267. * SubscriberLocationReportRequestIndication#getSLRArgExtensionContainer()
  268. */
  269. @Override
  270. public SLRArgExtensionContainer getSLRArgExtensionContainer() {
  271. return this.slrArgExtensionContainer;
  272. }
  273. /*
  274. * (non-Javadoc)
  275. *
  276. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  277. * SubscriberLocationReportRequestIndication#getAdditionalLocationEstimate()
  278. */
  279. @Override
  280. public byte[] getAdditionalLocationEstimate() {
  281. return this.addLocationEstimate;
  282. }
  283. /*
  284. * (non-Javadoc)
  285. *
  286. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  287. * SubscriberLocationReportRequestIndication#getDeferredmtlrData()
  288. */
  289. @Override
  290. public DeferredmtlrData getDeferredmtlrData() {
  291. return this.deferredmtlrData;
  292. }
  293. /*
  294. * (non-Javadoc)
  295. *
  296. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  297. * SubscriberLocationReportRequestIndication#getLCSReferenceNumber()
  298. */
  299. @Override
  300. public Byte getLCSReferenceNumber() {
  301. return this.lcsReferenceNumber;
  302. }
  303. /*
  304. * (non-Javadoc)
  305. *
  306. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  307. * SubscriberLocationReportRequestIndication#getGeranPositioningData()
  308. */
  309. @Override
  310. public byte[] getGeranPositioningData() {
  311. return this.geranPositioningData;
  312. }
  313. /*
  314. * (non-Javadoc)
  315. *
  316. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  317. * SubscriberLocationReportRequestIndication#getUtranPositioningData()
  318. */
  319. @Override
  320. public byte[] getUtranPositioningData() {
  321. return this.utranPositioningData;
  322. }
  323. /*
  324. * (non-Javadoc)
  325. *
  326. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  327. * SubscriberLocationReportRequestIndication
  328. * #getCellGlobalIdOrServiceAreaIdOrLAI()
  329. */
  330. @Override
  331. public CellGlobalIdOrServiceAreaIdOrLAI getCellGlobalIdOrServiceAreaIdOrLAI() {
  332. return this.cellIdOrSai;
  333. }
  334. /*
  335. * (non-Javadoc)
  336. *
  337. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  338. * SubscriberLocationReportRequestIndication#getSaiPresent()
  339. */
  340. @Override
  341. public Boolean getSaiPresent() {
  342. return this.saiPresent;
  343. }
  344. /*
  345. * (non-Javadoc)
  346. *
  347. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  348. * SubscriberLocationReportRequestIndication#getHGMLCAddress()
  349. */
  350. @Override
  351. public byte[] getHGMLCAddress() {
  352. return this.hgmlcAddress;
  353. }
  354. /*
  355. * (non-Javadoc)
  356. *
  357. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  358. * SubscriberLocationReportRequestIndication#getLCSServiceTypeID()
  359. */
  360. @Override
  361. public Integer getLCSServiceTypeID() {
  362. return this.lcsServiceTypeID;
  363. }
  364. /*
  365. * (non-Javadoc)
  366. *
  367. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  368. * SubscriberLocationReportRequestIndication#getPseudonymIndicator()
  369. */
  370. @Override
  371. public Boolean getPseudonymIndicator() {
  372. return this.pseudonymIndicator;
  373. }
  374. /*
  375. * (non-Javadoc)
  376. *
  377. * @see org.mobicents.protocols.ss7.map.api.service.lsm.
  378. * SubscriberLocationReportRequestIndication
  379. * #getAccuracyFulfilmentIndicator()
  380. */
  381. @Override
  382. public AccuracyFulfilmentIndicator getAccuracyFulfilmentIndicator() {
  383. return this.accuracyFulfilmentIndicator;
  384. }
  385. /*
  386. * (non-Javadoc)
  387. *
  388. * @see
  389. * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#getTag()
  390. */
  391. @Override
  392. public int getTag() throws MAPException {
  393. return Tag.SEQUENCE;
  394. }
  395. /*
  396. * (non-Javadoc)
  397. *
  398. * @see
  399. * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#getTagClass
  400. * ()
  401. */
  402. @Override
  403. public int getTagClass() {
  404. return Tag.CLASS_UNIVERSAL;
  405. }
  406. /*
  407. * (non-Javadoc)
  408. *
  409. * @see
  410. * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#getIsPrimitive
  411. * ()
  412. */
  413. @Override
  414. public boolean getIsPrimitive() {
  415. return false;
  416. }
  417. /*
  418. * (non-Javadoc)
  419. *
  420. * @see
  421. * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#decodeAll
  422. * (org.mobicents.protocols.asn.AsnInputStream)
  423. */
  424. @Override
  425. public void decodeAll(AsnInputStream ansIS) throws MAPParsingComponentException {
  426. try {
  427. int length = ansIS.readLength();
  428. this._decode(ansIS, length);
  429. } catch (IOException e) {
  430. throw new MAPParsingComponentException("IOException when decoding ProvideSubscriberLocationRequestIndication: ", e,
  431. MAPParsingComponentExceptionReason.MistypedParameter);
  432. } catch (AsnException e) {
  433. throw new MAPParsingComponentException("AsnException when decoding ProvideSubscriberLocationRequestIndication: ", e,
  434. MAPParsingComponentExceptionReason.MistypedParameter);
  435. }
  436. }
  437. /*
  438. * (non-Javadoc)
  439. *
  440. * @see
  441. * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#decodeData
  442. * (org.mobicents.protocols.asn.AsnInputStream, int)
  443. */
  444. @Override
  445. public void decodeData(AsnInputStream ansIS, int length) throws MAPParsingComponentException {
  446. try {
  447. this._decode(ansIS, length);
  448. } catch (IOException e) {
  449. throw new MAPParsingComponentException("IOException when decoding ProvideSubscriberLocationRequestIndication: ", e,
  450. MAPParsingComponentExceptionReason.MistypedParameter);
  451. } catch (AsnException e) {
  452. throw new MAPParsingComponentException("AsnException when decoding ProvideSubscriberLocationRequestIndication: ", e,
  453. MAPParsingComponentExceptionReason.MistypedParameter);
  454. }
  455. }
  456. private void _decode(AsnInputStream ansIS, int length) throws MAPParsingComponentException, IOException, AsnException {
  457. AsnInputStream ais = ansIS.readSequenceStreamData(length);
  458. int tag = ais.readTag();
  459. // Decode mandatory lcs-Event LCS-Event,
  460. if (ais.getTagClass() != Tag.CLASS_UNIVERSAL || !ais.isTagPrimitive() || tag != Tag.ENUMERATED) {
  461. throw new MAPParsingComponentException(
  462. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [lcs-Event LCS-Event] bad tag class or not primitive",
  463. MAPParsingComponentExceptionReason.MistypedParameter);
  464. }
  465. int length1 = ais.readLength();
  466. int event = (int) ais.readIntegerData(length1);
  467. this.lcsEvent = LCSEvent.getLCSEvent(event);
  468. tag = ais.readTag();
  469. // Decode mandatory lcs-ClientID LCS-ClientID
  470. if (ais.getTagClass() != Tag.CLASS_UNIVERSAL || ais.isTagPrimitive() || ais.getTag() != Tag.SEQUENCE) {
  471. throw new MAPParsingComponentException(
  472. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [lcs-ClientID LCS-ClientID] bad tag class or not primitive or not Sequence",
  473. MAPParsingComponentExceptionReason.MistypedParameter);
  474. }
  475. this.lcsClientID = new LCSClientIDImpl();
  476. ((LCSClientIDImpl)this.lcsClientID).decodeAll(ais);
  477. tag = ais.readTag();
  478. // Decode mandatory lcsLocationInfo LCSLocationInfo
  479. if (ais.getTagClass() != Tag.CLASS_UNIVERSAL || ais.isTagPrimitive() || ais.getTag() != Tag.SEQUENCE) {
  480. throw new MAPParsingComponentException(
  481. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [lcsLocationInfo LCSLocationInfo] bad tag class or not primitive or not Sequence",
  482. MAPParsingComponentExceptionReason.MistypedParameter);
  483. }
  484. this.lcsLocationInfo = new LCSLocationInfoImpl();
  485. ((LCSLocationInfoImpl)this.lcsLocationInfo).decodeAll(ais);
  486. while (true) {
  487. if (ais.available() == 0)
  488. break;
  489. tag = ais.readTag();
  490. switch (tag) {
  491. case _TAG_MSISDN:
  492. // msisdn [0] ISDN-AddressString OPTIONAL,
  493. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
  494. throw new MAPParsingComponentException(
  495. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [msisdn [0] ISDN-AddressString] bad tag class or not primitive or not Sequence",
  496. MAPParsingComponentExceptionReason.MistypedParameter);
  497. }
  498. this.msisdn = new ISDNAddressStringImpl();
  499. ((ISDNAddressStringImpl)this.msisdn).decodeAll(ais);
  500. break;
  501. case _TAG_IMSI:
  502. // imsi [1] IMSI OPTIONAL,
  503. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
  504. throw new MAPParsingComponentException(
  505. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [imsi [2] IMSI ] bad tag class or not primitive or not Sequence",
  506. MAPParsingComponentExceptionReason.MistypedParameter);
  507. }
  508. this.imsi = new IMSIImpl();
  509. ((IMSIImpl)this.imsi).decodeAll(ais);
  510. break;
  511. case _TAG_IMEI:
  512. // imei [2] IMEI OPTIONAL,
  513. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
  514. throw new MAPParsingComponentException(
  515. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [imei [2] IMEI OPTIONAL, ] bad tag class or not primitive or not Sequence",
  516. MAPParsingComponentExceptionReason.MistypedParameter);
  517. }
  518. this.imei = new IMEIImpl();
  519. ((IMEIImpl)this.imei).decodeAll(ais);
  520. break;
  521. case _TAG_NA_ESRD:
  522. // na-ESRD [3] ISDN-AddressString OPTIONAL,
  523. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
  524. throw new MAPParsingComponentException(
  525. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [na-ESRD [3] ISDN-AddressString] bad tag class or not primitive or not Sequence",
  526. MAPParsingComponentExceptionReason.MistypedParameter);
  527. }
  528. this.naEsrd = new ISDNAddressStringImpl();
  529. ((ISDNAddressStringImpl)this.naEsrd).decodeAll(ais);
  530. break;
  531. case _TAG_NA_ESRK:
  532. // na-ESRK [4] ISDN-AddressString OPTIONAL,
  533. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
  534. throw new MAPParsingComponentException(
  535. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [na-ESRK [4] ISDN-AddressString] bad tag class or not primitive or not Sequence",
  536. MAPParsingComponentExceptionReason.MistypedParameter);
  537. }
  538. this.naEsrk = new ISDNAddressStringImpl();
  539. ((ISDNAddressStringImpl)this.naEsrk).decodeAll(ais);
  540. break;
  541. case _TAG_LOCATION_ESTIMATE:
  542. // locationEstimate [5] Ext-GeographicalInformation OPTIONAL
  543. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
  544. throw new MAPParsingComponentException(
  545. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [locationEstimate [5] Ext-GeographicalInformation OPTIONAL] bad tag class or not primitive or not Sequence",
  546. MAPParsingComponentExceptionReason.MistypedParameter);
  547. }
  548. length1 = ais.readLength();
  549. this.locationEstimate = ais.readOctetStringData(length1);
  550. break;
  551. case _TAG_AGE_OF_LOCATION_ESTIMATE:
  552. // ageOfLocationEstimate [6] AgeOfLocationInformation OPTIONAL,
  553. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
  554. throw new MAPParsingComponentException(
  555. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [ageOfLocationEstimate [6] AgeOfLocationInformation] bad tag class or not primitive or not Sequence",
  556. MAPParsingComponentExceptionReason.MistypedParameter);
  557. }
  558. length1 = ais.readLength();
  559. this.ageOfLocationEstimate = (int) ais.readIntegerData(length1);
  560. break;
  561. case _TAG_SLR_ARG_EXTENSION_CONTAINER:
  562. // slr-ArgExtensionContainer [7] SLR-ArgExtensionContainer
  563. // OPTIONAL,
  564. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || ais.isTagPrimitive()) {
  565. throw new MAPParsingComponentException(
  566. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [slr-ArgExtensionContainer [7] SLR-ArgExtensionContainer] bad tag class or not primitive or not Sequence",
  567. MAPParsingComponentExceptionReason.MistypedParameter);
  568. }
  569. this.slrArgExtensionContainer = new SLRArgExtensionContainerImpl();
  570. ((SLRArgExtensionContainerImpl)this.slrArgExtensionContainer).decodeAll(ais);
  571. break;
  572. case _TAG_ADD_LOCATION_ESTIMATE:
  573. // add-LocationEstimate [8] Add-GeographicalInformation
  574. // OPTIONAL,
  575. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
  576. throw new MAPParsingComponentException(
  577. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [add-LocationEstimate [8] Add-GeographicalInformation] bad tag class or not primitive or not Sequence",
  578. MAPParsingComponentExceptionReason.MistypedParameter);
  579. }
  580. length1 = ais.readLength();
  581. this.addLocationEstimate = ais.readOctetStringData(length1);
  582. break;
  583. case _TAG_DEFERRED_MT_LR_DATA:
  584. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
  585. throw new MAPParsingComponentException(
  586. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [deferredmt-lrData [9] Deferredmt-lrData ] bad tag class or not primitive or not Sequence",
  587. MAPParsingComponentExceptionReason.MistypedParameter);
  588. }
  589. this.deferredmtlrData = new DeferredmtlrDataImpl();
  590. ((DeferredmtlrDataImpl)this.deferredmtlrData).decodeAll(ais);
  591. break;
  592. case _TAG_LCS_REFERENCE_NUMBER:
  593. // lcs-ReferenceNumber [10] LCS-ReferenceNumber OPTIONAL,
  594. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
  595. throw new MAPParsingComponentException(
  596. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [lcs-ReferenceNumber [10] LCS-ReferenceNumber] bad tag class or not primitive or not Sequence",
  597. MAPParsingComponentExceptionReason.MistypedParameter);
  598. }
  599. length1 = ais.readLength();
  600. this.lcsReferenceNumber = ais.readOctetStringData(length1)[0];
  601. break;
  602. case _TAG_GERAN_POSITIONING_DATA:
  603. // geranPositioningData [11] PositioningDataInformation
  604. // OPTIONAL,
  605. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
  606. throw new MAPParsingComponentException(
  607. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [geranPositioningData [11] PositioningDataInformation OPTIONAL,] bad tag class or not primitive or not Sequence",
  608. MAPParsingComponentExceptionReason.MistypedParameter);
  609. }
  610. length1 = ais.readLength();
  611. this.geranPositioningData = ais.readOctetStringData(length1);
  612. break;
  613. case _TAG_UTRAN_POSITIONING_DATA:
  614. // utranPositioningData [12] UtranPositioningDataInfo OPTIONAL,
  615. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
  616. throw new MAPParsingComponentException(
  617. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [utranPositioningData [12] UtranPositioningDataInfo OPTIONAL,] bad tag class or not primitive or not Sequence",
  618. MAPParsingComponentExceptionReason.MistypedParameter);
  619. }
  620. length1 = ais.readLength();
  621. this.utranPositioningData = ais.readOctetStringData(length1);
  622. break;
  623. case _TAG_CELL_ID_OR_SAI:
  624. // cellIdOrSai [13] CellGlobalIdOrServiceAreaIdOrLAI OPTIONAL,
  625. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || ais.isTagPrimitive()) {
  626. throw new MAPParsingComponentException(
  627. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [cellIdOrSai [13] CellGlobalIdOrServiceAreaIdOrLAI] bad tag class or not primitive or not Sequence",
  628. MAPParsingComponentExceptionReason.MistypedParameter);
  629. }
  630. this.cellIdOrSai = new CellGlobalIdOrServiceAreaIdOrLAIImpl();
  631. AsnInputStream ais2 = ais.readSequenceStream();
  632. ais2.readTag();
  633. ((CellGlobalIdOrServiceAreaIdOrLAIImpl)this.cellIdOrSai).decodeAll(ais2);
  634. break;
  635. case _TAG_H_GMLC_ADDRESS:
  636. // h-gmlc-Address [14] GSN-Address
  637. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
  638. throw new MAPParsingComponentException(
  639. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [h-gmlc-Address [14] GSN-Address] bad tag class or not primitive or not Sequence",
  640. MAPParsingComponentExceptionReason.MistypedParameter);
  641. }
  642. length1 = ais.readLength();
  643. this.hgmlcAddress = ais.readOctetStringData(length1);
  644. break;
  645. case _TAG_LCS_SERVICE_TYPE_ID:
  646. // lcsServiceTypeID [15] LCSServiceTypeID OPTIONAL,
  647. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || ais.isTagPrimitive()) {
  648. throw new MAPParsingComponentException(
  649. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [lcsServiceTypeID [15] LCSServiceTypeID] bad tag class or not primitive or not Sequence",
  650. MAPParsingComponentExceptionReason.MistypedParameter);
  651. }
  652. length1 = ais.readLength();
  653. this.lcsServiceTypeID = (int) ais.readIntegerData(length1);
  654. break;
  655. case _TAG_SAI_PRESENT:
  656. // sai-Present [17] NULL OPTIONAL,
  657. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
  658. throw new MAPParsingComponentException(
  659. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [sai-Present [17]] bad tag class or not primitive or not Sequence",
  660. MAPParsingComponentExceptionReason.MistypedParameter);
  661. }
  662. length1 = ais.readLength();
  663. this.saiPresent = true;
  664. break;
  665. case _TAG_PSEUDONYM_INDICATOR:
  666. // pseudonymIndicator [18] NULL OPTIONAL,
  667. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
  668. throw new MAPParsingComponentException(
  669. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [pseudonymIndicator [18] NULL] bad tag class or not primitive or not Sequence",
  670. MAPParsingComponentExceptionReason.MistypedParameter);
  671. }
  672. length1 = ais.readLength();
  673. this.pseudonymIndicator = true;
  674. break;
  675. case _TAG_ACCURACY_FULFILMENT_INDICATOR:
  676. // accuracyFulfilmentIndicator [19] AccuracyFulfilmentIndicator
  677. // OPTIONAL,
  678. if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !ais.isTagPrimitive()) {
  679. throw new MAPParsingComponentException(
  680. "Error while decoding SubscriberLocationReportRequestIndication: Parameter [accuracyFulfilmentIndicator [19] AccuracyFulfilmentIndicator] bad tag class or not primitive or not Sequence",
  681. MAPParsingComponentExceptionReason.MistypedParameter);
  682. }
  683. length1 = ais.readLength();
  684. int indicator = (int) ais.readIntegerData(length1);
  685. this.accuracyFulfilmentIndicator = AccuracyFulfilmentIndicator.getAccuracyFulfilmentIndicator(indicator);
  686. break;
  687. default:
  688. ais.advanceElement();
  689. break;
  690. }
  691. }
  692. }
  693. /*
  694. * (non-Javadoc)
  695. *
  696. * @see
  697. * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#encodeAll
  698. * (org.mobicents.protocols.asn.AsnOutputStream)
  699. */
  700. @Override
  701. public void encodeAll(AsnOutputStream asnOs) throws MAPException {
  702. this.encodeAll(asnOs, Tag.CLASS_UNIVERSAL, Tag.SEQUENCE);
  703. }
  704. /*
  705. * (non-Javadoc)
  706. *
  707. * @see
  708. * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#encodeAll
  709. * (org.mobicents.protocols.asn.AsnOutputStream, int, int)
  710. */
  711. @Override
  712. public void encodeAll(AsnOutputStream asnOs, int tagClass, int tag) throws MAPException {
  713. try {
  714. asnOs.writeTag(tagClass, false, tag);
  715. int pos = asnOs.StartContentDefiniteLength();
  716. this.encodeData(asnOs);
  717. asnOs.FinalizeContent(pos);
  718. } catch (AsnException e) {
  719. throw new MAPException("AsnException when encoding MWStatus: " + e.getMessage(), e);
  720. }
  721. }
  722. /*
  723. * (non-Javadoc)
  724. *
  725. * @see
  726. * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#encodeData
  727. * (org.mobicents.protocols.asn.AsnOutputStream)
  728. */
  729. @Override
  730. public void encodeData(AsnOutputStream asnOs) throws MAPException {
  731. if (this.lcsEvent == null) {
  732. throw new MAPException("Error while encoding SubscriberLocationReportRequestIndication the mandatory parameter lcsEvent is not defined");
  733. }
  734. if (this.lcsClientID == null) {
  735. throw new MAPException("Error while encoding SubscriberLocationReportRequestIndication the mandatory parameter lcsClientID is not defined");
  736. }
  737. if (this.lcsLocationInfo == null) {
  738. throw new MAPException("Error while encoding SubscriberLocationReportRequestIndication the mandatory parameter lcsLocationInfo is not defined");
  739. }
  740. try {
  741. asnOs.writeInteger(Tag.CLASS_UNIVERSAL, Tag.ENUMERATED, this.lcsEvent.getEvent());
  742. } catch (IOException e) {
  743. throw new MAPException("IOException while encoding parameter lcsEvent", e);
  744. } catch (AsnException e) {
  745. throw new MAPException("AsnException while encoding parameter lcsEvent", e);
  746. }
  747. ((LCSClientIDImpl)this.lcsClientID).encodeAll(asnOs);
  748. ((LCSLocationInfoImpl)this.lcsLocationInfo).encodeAll(asnOs);
  749. if (this.msisdn != null) {
  750. // msisdn [0] ISDN-AddressString OPTIONAL,
  751. ((ISDNAddressStringImpl)this.msisdn).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_MSISDN);
  752. }
  753. if (this.imsi != null) {
  754. // imsi [1] IMSI OPTIONAL,
  755. ((IMSIImpl)this.imsi).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_IMSI);
  756. }
  757. if (this.imei != null) {
  758. // imei [2] IMEI OPTIONAL,
  759. ((IMEIImpl)this.imei).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_IMEI);
  760. }
  761. if (this.naEsrd != null) {
  762. // na-ESRD [3] ISDN-AddressString OPTIONAL,
  763. ((ISDNAddressStringImpl)this.naEsrd).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_NA_ESRD);
  764. }
  765. if (this.naEsrk != null) {
  766. // na-ESRK [4] ISDN-AddressString OPTIONAL
  767. ((ISDNAddressStringImpl)this.naEsrk).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_NA_ESRK);
  768. }
  769. if (this.locationEstimate != null) {
  770. // locationEstimate [5] Ext-GeographicalInformation OPTIONAL,
  771. try {
  772. asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LOCATION_ESTIMATE, this.locationEstimate);
  773. } catch (IOException e) {
  774. throw new MAPException("IOException while encoding parameter locationEstimate", e);
  775. } catch (AsnException e) {
  776. throw new MAPException("AsnException while encoding parameter locationEstimate", e);
  777. }
  778. }
  779. // ageOfLocationEstimate [6] AgeOfLocationInformation OPTIONAL,
  780. if (this.ageOfLocationEstimate != null) {
  781. try {
  782. asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_AGE_OF_LOCATION_ESTIMATE, this.ageOfLocationEstimate);
  783. } catch (IOException e) {
  784. throw new MAPException("IOException while encoding parameter ageOfLocationEstimate", e);
  785. } catch (AsnException e) {
  786. throw new MAPException("AsnException while encoding parameter ageOfLocationEstimate", e);
  787. }
  788. }
  789. if (this.slrArgExtensionContainer != null) {
  790. // slr-ArgExtensionContainer [7] SLR-ArgExtensionContainer
  791. ((SLRArgExtensionContainerImpl)this.slrArgExtensionContainer).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_SLR_ARG_EXTENSION_CONTAINER);
  792. }
  793. if (this.addLocationEstimate != null) {
  794. // add-LocationEstimate [8] Add-GeographicalInformation OPTIONAL,
  795. try {
  796. asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_ADD_LOCATION_ESTIMATE, this.addLocationEstimate);
  797. } catch (IOException e) {
  798. throw new MAPException("IOException while encoding parameter addLocationEstimate", e);
  799. } catch (AsnException e) {
  800. throw new MAPException("AsnException while encoding parameter addLocationEstimate", e);
  801. }
  802. }
  803. if (this.deferredmtlrData != null) {
  804. // deferredmt-lrData [9] Deferredmt-lrData
  805. ((DeferredmtlrDataImpl)this.deferredmtlrData).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_DEFERRED_MT_LR_DATA);
  806. }
  807. if (this.lcsReferenceNumber != null) {
  808. // lcs-ReferenceNumber [10] LCS-ReferenceNumber
  809. try {
  810. asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_REFERENCE_NUMBER, new byte[] { this.lcsReferenceNumber });
  811. } catch (IOException e) {
  812. throw new MAPException("IOException while encoding parameter lcs-ReferenceNumber", e);
  813. } catch (AsnException e) {
  814. throw new MAPException("AsnException while encoding parameter lcs-ReferenceNumber", e);
  815. }
  816. }
  817. if (this.geranPositioningData != null) {
  818. // geranPositioningData [11] PositioningDataInformation OPTIONAL,
  819. try {
  820. asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_GERAN_POSITIONING_DATA, this.geranPositioningData);
  821. } catch (IOException e) {
  822. throw new MAPException("IOException while encoding parameter geranPositioningData", e);
  823. } catch (AsnException e) {
  824. throw new MAPException("AsnException while encoding parameter geranPositioningData", e);
  825. }
  826. }
  827. if (this.utranPositioningData != null) {
  828. // utranPositioningData [12] UtranPositioningDataInfo OPTIONAL,
  829. try {
  830. asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_UTRAN_POSITIONING_DATA, this.utranPositioningData);
  831. } catch (IOException e) {
  832. throw new MAPException("IOException while encoding parameter utranPositioningData", e);
  833. } catch (AsnException e) {
  834. throw new MAPException("AsnException while encoding parameter utranPositioningData", e);
  835. }
  836. }
  837. if (this.cellIdOrSai != null) {
  838. // cellIdOrSai [13] CellGlobalIdOrServiceAreaIdOrLAI OPTIONAL,
  839. try {
  840. asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _TAG_CELL_ID_OR_SAI);
  841. int pos = asnOs.StartContentDefiniteLength();
  842. ((CellGlobalIdOrServiceAreaIdOrLAIImpl) this.cellIdOrSai).encodeAll(asnOs);
  843. asnOs.FinalizeContent(pos);
  844. } catch (AsnException e) {
  845. throw new MAPException("AsnException while encoding parameter cellIdOrSai", e);
  846. }
  847. ((CellGlobalIdOrServiceAreaIdOrLAIImpl)this.cellIdOrSai).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_CELL_ID_OR_SAI);
  848. }
  849. if (this.hgmlcAddress != null) {
  850. // h-gmlc-Address [14] GSN-Address OPTIONAL,
  851. try {
  852. asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_H_GMLC_ADDRESS, this.hgmlcAddress);
  853. } catch (IOException e) {
  854. throw new MAPException("IOException while encoding parameter h-gmlc-Address", e);
  855. } catch (AsnException e) {
  856. throw new MAPException("AsnException while encoding parameter h-gmlc-Address", e);
  857. }
  858. }
  859. if (this.lcsServiceTypeID != null) {
  860. // lcsServiceTypeID [15] LCSServiceTypeID OPTIONAL,
  861. try {
  862. asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_SERVICE_TYPE_ID, this.lcsServiceTypeID);
  863. } catch (IOException e) {
  864. throw new MAPException("IOException while encoding parameter lcsServiceTypeID", e);
  865. } catch (AsnException e) {
  866. throw new MAPException("AsnException while encoding parameter lcsServiceTypeID", e);
  867. }
  868. }
  869. if (this.saiPresent != null) {
  870. // sai-Present [17] NULL OPTIONAL,
  871. try {
  872. asnOs.writeNull(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_SAI_PRESENT);
  873. } catch (IOException e) {
  874. throw new MAPException("IOException while encoding parameter sai-Present", e);
  875. } catch (AsnException e) {
  876. throw new MAPException("AsnException while encoding parameter sai-Present", e);
  877. }
  878. }
  879. if (this.pseudonymIndicator != null) {
  880. // pseudonymIndicator [18] NULL OPTIONAL,
  881. try {
  882. asnOs.writeNull(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_PSEUDONYM_INDICATOR);
  883. } catch (IOException e) {
  884. throw new MAPException("IOException while encoding parameter sai-Present", e);
  885. } catch (AsnException e) {
  886. throw new MAPException("AsnException while encoding parameter sai-Present", e);
  887. }
  888. }
  889. if (this.accuracyFulfilmentIndicator != null) {
  890. // accuracyFulfilmentIndicator [19] AccuracyFulfilmentIndicator
  891. // OPTIONAL
  892. try {
  893. asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_ACCURACY_FULFILMENT_INDICATOR, this.accuracyFulfilmentIndicator.getIndicator());
  894. } catch (IOException e) {
  895. throw new MAPException("IOException while encoding parameter accuracyFulfilmentIndicator", e);
  896. } catch (AsnException e) {
  897. throw new MAPException("AsnException while encoding parameter accuracyFulfilmentIndicator", e);
  898. }
  899. }
  900. }
  901. }