@Override
  protected void _decode(AsnInputStream asnIS, int length)
      throws CAPParsingComponentException, IOException, AsnException {

    this.roVolumeSinceLastTariffSwitch = -1;
    this.roVolumeTariffSwitchInterval = -1;

    AsnInputStream ais = asnIS.readSequenceStreamData(length);
    while (true) {
      if (ais.available() == 0) break;

      int tag = ais.readTag();

      if (ais.getTagClass() == Tag.CLASS_CONTEXT_SPECIFIC) {

        switch (tag) {
          case _ID_roVolumeSinceLastTariffSwitch:
            if (!ais.isTagPrimitive())
              throw new CAPParsingComponentException(
                  "Error while decoding "
                      + _PrimitiveName
                      + ".roVolumeSinceLastTariffSwitch: Parameter is not primitive",
                  CAPParsingComponentExceptionReason.MistypedParameter);
            this.roVolumeSinceLastTariffSwitch = (int) ais.readInteger();
            break;
          case _ID_roVolumeTariffSwitchInterval:
            if (!ais.isTagPrimitive())
              throw new CAPParsingComponentException(
                  "Error while decoding "
                      + _PrimitiveName
                      + ".roVolumeTariffSwitchInterval: Parameter is not primitive",
                  CAPParsingComponentExceptionReason.MistypedParameter);
            this.roVolumeTariffSwitchInterval = (int) ais.readInteger();
            break;
          default:
            ais.advanceElement();
            break;
        }
      } else {
        ais.advanceElement();
      }
    }
  }
示例#2
0
  private void _decode(AsnInputStream ansIS, int length)
      throws MAPParsingComponentException, IOException, AsnException {
    this.signalInfo = null;
    this.protocolId = null;
    this.extensionContainer = null;

    AsnInputStream ais = ansIS.readSequenceStreamData(length);
    while (true) {
      if (ais.available() == 0) break;

      int tag = ais.readTag();
      if (ais.getTagClass() == Tag.CLASS_UNIVERSAL) {
        switch (tag) {
          case Tag.ENUMERATED:
            int code = (int) ais.readInteger();
            this.protocolId = ProtocolId.getProtocolId(code);
            break;
          case Tag.STRING_OCTET:
            if (!ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding "
                      + _PrimitiveName
                      + ".signalInfo: Parameter extensionContainer is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            this.signalInfo = new SignalInfoImpl();
            ((SignalInfoImpl) this.signalInfo).decodeAll(ais);
            break;
          case Tag.SEQUENCE:
            if (ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding "
                      + _PrimitiveName
                      + ".extensionContainer: Parameter extensionContainer is primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            this.extensionContainer = new MAPExtensionContainerImpl();
            ((MAPExtensionContainerImpl) this.extensionContainer).decodeAll(ais);
            break;
          default:
            ais.advanceElement();
            break;
        }
      }
    }

    if (this.protocolId == null || this.signalInfo == null)
      throw new MAPParsingComponentException(
          "Error while decoding " + _PrimitiveName + ": protocolId and signalInfo must not be null",
          MAPParsingComponentExceptionReason.MistypedParameter);
  }
  private void _decode(AsnInputStream ansIS, int length)
      throws CAPParsingComponentException, IOException, AsnException {

    this.elementaryMessageID = 0;
    this.variableParts = null;
    boolean elementaryMessageIDFound = false;

    AsnInputStream ais = ansIS.readSequenceStreamData(length);
    while (true) {
      if (ais.available() == 0) break;

      int tag = ais.readTag();

      if (ais.getTagClass() == Tag.CLASS_CONTEXT_SPECIFIC) {
        switch (tag) {
          case _ID_elementaryMessageID:
            this.elementaryMessageID = (int) ais.readInteger();
            elementaryMessageIDFound = true;
            break;
          case _ID_variableParts:
            this.variableParts = new ArrayList<VariablePart>();

            AsnInputStream ais2 = ais.readSequenceStream();
            while (true) {
              if (ais2.available() == 0) break;

              ais2.readTag();
              VariablePartImpl val = new VariablePartImpl();
              val.decodeAll(ais2);
              this.variableParts.add(val);
            }
            break;

          default:
            ais.advanceElement();
            break;
        }
      } else {
        ais.advanceElement();
      }
    }

    if (this.variableParts == null || !elementaryMessageIDFound)
      throw new CAPParsingComponentException(
          "Error while decoding "
              + _PrimitiveName
              + ": elementaryMessageID and variableParts are mandatory but not found",
          CAPParsingComponentExceptionReason.MistypedParameter);
  }
示例#4
0
  private void _decode(AsnInputStream ansIS, int length)
      throws MAPParsingComponentException, IOException, AsnException {
    AsnInputStream ais = ansIS.readSequenceStreamData(length);

    locationInformation = false;
    subscriberState = false;
    extensionContainer = null;
    currentLocation = false;
    requestedDomain = null;
    imei = false;
    msClassmark = false;
    mnpRequestedInfo = false;

    while (true) {
      if (ais.available() == 0) break;

      int tag = ais.readTag();

      if (ais.getTagClass() == Tag.CLASS_CONTEXT_SPECIFIC) {
        switch (tag) {
          case _ID_locationInformation:
            if (!ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding RequestedInfo: Parameter is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            ais.readNull();
            this.locationInformation = Boolean.TRUE;
            break;
          case _ID_subscriberState:
            if (!ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding RequestedInfo: Parameter is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            ais.readNull();
            this.subscriberState = Boolean.TRUE;
            break;
          case _ID_extensionContainer:
            if (ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding RequestedInfo: Parameter is primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            extensionContainer = new MAPExtensionContainerImpl();
            ((MAPExtensionContainerImpl) extensionContainer).decodeAll(ais);
            break;
          case _ID_currentLocation:
            if (!ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding RequestedInfo: Parameter is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            ais.readNull();
            this.currentLocation = Boolean.TRUE;
            break;
          case _ID_requestedDomain:
            if (!ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding RequestedInfo: Parameter is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            int i1 = (int) ais.readInteger();
            this.requestedDomain = DomainType.getInstance(i1);
            break;
          case _ID_msclassmark:
            if (!ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding RequestedInfo: Parameter is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            ais.readNull();
            this.msClassmark = Boolean.TRUE;
            break;
          case _ID_imei:
            if (!ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding RequestedInfo: Parameter is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            ais.readNull();
            this.imei = Boolean.TRUE;
            break;
          case _ID_mnpRequestedInfo:
            if (!ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding RequestedInfo: Parameter is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            ais.readNull();
            this.mnpRequestedInfo = Boolean.TRUE;
            break;
          default:
            ais.advanceElement();
            break;
        }
      } else {
        ais.advanceElement();
      }
    }
  }