private void setParameters( String carrierCode, NetworkIdentificationPlanValue networkIdentificationPlanValue, NetworkIdentificationTypeValue networkIdentificationTypeValue) throws MAPException { if (carrierCode == null || networkIdentificationPlanValue == null || networkIdentificationTypeValue == null) throw new MAPException( "Error when encoding " + _PrimitiveName + ": carrierCode, networkIdentificationPlanValue or networkIdentificationTypeValue is empty"); if (!(carrierCode.length() == 3 || carrierCode.length() == 4)) throw new MAPException( "Error when encoding " + _PrimitiveName + ": carrierCode lenght should be 3 or 4"); ByteArrayOutputStream stm = new ByteArrayOutputStream(); int octOne = 0; octOne = octOne | (networkIdentificationTypeValue.getCode() << 4); octOne = octOne | networkIdentificationPlanValue.getCode(); stm.write(octOne); try { TbcdString.encodeString(stm, carrierCode); } catch (MAPException e) { throw new MAPException(e); } this.data = stm.toByteArray(); if (carrierCode.length() == 3) { this.data[2] = (byte) (this.data[2] & THREE_OCTET_CARRIER_CODE_MASK); } }
public NetworkIdentificationPlanValue getNetworkIdentificationPlanValue() { if (this.data == null || this.data.length == 0) return null; int planValue = this.data[0]; return NetworkIdentificationPlanValue.getInstance(planValue & NETWORK_IND_PLAN_MASK); }