public override byte[] GetMessageBytes() { if (_vMessageBytes != null) { return(_vMessageBytes); } //Otherwise, check if the 'message_payload' field is used Tlv.Tlv tlv = VTlv.GetTlvByTag(Tag.MessagePayload); if (tlv == null) { return(null); } return(tlv.RawValue); }
protected override byte[] GetBodyData() { ByteBuffer buffer = new ByteBuffer(256); buffer.Append(EncodeCString(VServiceType)); buffer.Append(VSourceAddress.GetBytes()); buffer.Append(VDestinationAddress.GetBytes()); buffer.Append((byte)VEsmClass); buffer.Append(_vProtocolId); buffer.Append((byte)_vPriorityFlag); buffer.Append(EncodeCString(_vScheduleDeliveryTime)); buffer.Append(EncodeCString(_vValidityPeriod)); buffer.Append((byte)VRegisteredDelivery); buffer.Append(_vReplaceIfPresent ? (byte)1 : (byte)0); buffer.Append((byte)VDataCoding); buffer.Append(_vSmDefalutMessageId); //Check if vMessageBytes is not null if (_vMessageBytes == null) { //Check whether optional field is used if (VTlv.GetTlvByTag(Tag.MessagePayload) == null) { //Create an empty message _vMessageBytes = new byte[] { 0x00 }; } } if (_vMessageBytes == null) { buffer.Append(0); } else { buffer.Append((byte)_vMessageBytes.Length); buffer.Append(_vMessageBytes); } return(buffer.ToBytes()); }