submit.addOptionalParameter(new Tlv(SmppConstants.TAG_MESSAGE_PAYLOAD, textBytes, "message_payload")); } else {
public void writeOptionalParameters(ChannelBuffer buffer, PduTranscoderContext context) throws UnrecoverablePduException, RecoverablePduException { if (this.optionalParameters == null) { return; } for (Tlv tlv : this.optionalParameters) { if (tlv.getTagName() == null) { tlv.setTagName(context.lookupTlvTagName(tlv.getTag())); } ChannelBufferUtil.writeTlv(buffer, tlv); } }
protected int findOptionalParameter(short tag) { if (this.optionalParameters == null) { return -1; } int i = 0; for (Tlv tlv : this.optionalParameters) { if (tlv.getTag() == tag) { return i; } i++; } // if we get here, we didn't find the parameter by tag return -1; }
@Override public void write(TlvSet tlvSet, javolution.xml.XMLFormat.OutputElement xml) throws XMLStreamException { if (tlvSet.optionalParameters != null && tlvSet.optionalParameters.size() > 0) { for (int i1 = 0; i1 < tlvSet.optionalParameters.size(); i1++) { Tlv tlv = tlvSet.optionalParameters.get(i1); TlvProxy tlvProxy = new TlvProxy(); tlvProxy.tag = tlv.getTag(); tlvProxy.value = tlv.getValue(); xml.add(tlvProxy, TLV, TlvProxy.class); } } } };
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("TlvSet ["); if (this.optionalParameters != null) { boolean isFirst = true; for (Tlv tlv : this.optionalParameters) { if (isFirst) isFirst = false; else sb.append(", "); sb.append(tlv.getTagName()); sb.append("="); try { sb.append(tlv.getValueAsString()); } catch (TlvConvertException e) { } } } sb.append("]"); return sb.toString(); }
switch(this.tlvValueTypeToMatch) { case BYTE: val = (new Byte(tlv.getValueAsByte())).toString(); break; case INT: val = (new Integer(tlv.getValueAsInt())).toString(); break; case STRING: default: val = tlv.getValueAsString(); break;
String val = tlv.getValueAsString(); deliveryReceiptData.setTlvReceiptedMessageId(val); } catch (TlvConvertException e) { if (tlv != null) { try { byte val = tlv.getValueAsByte(); deliveryReceiptData.setTlvMessageState(new Integer(val)); } catch (TlvConvertException e) {
public String getValueAsString() throws TlvConvertException { return getValueAsString("ISO-8859-1"); }
for(Tlv tlv: tlvSet.getOptionalParameters()){ this.tbTlvTagValue.setText((new Short(tlv.getTag())).toString()); this.tbTlvValue.setText((new Integer(tlv.getValueAsInt())).toString());
/** * Returns the size of this TLV in bytes. Basically, its always 4 bytes * plus the length of the value. Two bytes for tag and two byte for length * and then the length of the value itself. Primarily used for encoding * the PDU. * @return */ public int calculateByteSize() { return 4 + getUnsignedLength(); }
} else { try { byte tempInterfaceVersion = scInterfaceVersion.getValueAsByte(); if (tempInterfaceVersion >= SmppConstants.VERSION_3_4) { this.interfaceVersion = SmppConstants.VERSION_3_4;
data = messagePaylod.getValue();
protected int calculateByteSizeOfOptionalParameters() { if (this.optionalParameters == null) { return 0; } int optParamLength = 0; // otherwise, add length of each tlv for (Tlv tlv : this.optionalParameters) { optParamLength += tlv.calculateByteSize(); } return optParamLength; }
protected int findOptionalParameter(short tag) { if (this.optionalParameters == null) { return -1; } int i = 0; for (Tlv tlv : this.optionalParameters) { if (tlv.getTag() == tag) { return i; } i++; } // if we get here, we didn't find the parameter by tag return -1; }
@Override public void write(TlvSet tlvSet, javolution.xml.XMLFormat.OutputElement xml) throws XMLStreamException { if (tlvSet.optionalParameters != null && tlvSet.optionalParameters.size() > 0) { for (int i1 = 0; i1 < tlvSet.optionalParameters.size(); i1++) { Tlv tlv = tlvSet.optionalParameters.get(i1); TlvProxy tlvProxy = new TlvProxy(); tlvProxy.tag = tlv.getTag(); tlvProxy.value = tlv.getValue(); xml.add(tlvProxy, TLV, TlvProxy.class); } } } };
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("TlvSet ["); if (this.optionalParameters != null) { boolean isFirst = true; for (Tlv tlv : this.optionalParameters) { if (isFirst) isFirst = false; else sb.append(", "); sb.append(tlv.getTagName()); sb.append("="); try { sb.append(tlv.getValueAsString()); } catch (TlvConvertException e) { } } } sb.append("]"); return sb.toString(); }
public String getValueAsString() throws TlvConvertException { return getValueAsString("ISO-8859-1"); }
/** * Returns the size of this TLV in bytes. Basically, its always 4 bytes * plus the length of the value. Two bytes for tag and two byte for length * and then the length of the value itself. Primarily used for encoding * the PDU. * @return */ public int calculateByteSize() { return 4 + getUnsignedLength(); }
} else { try { byte tempInterfaceVersion = scInterfaceVersion.getValueAsByte(); if (tempInterfaceVersion >= SmppConstants.VERSION_3_4) { this.interfaceVersion = SmppConstants.VERSION_3_4;