How to specify validity period

Q: Is it possible to specify a validity period, when sending SMS messages. We can see that TSMSSubmit has 2 properties that looks to be handling validity periods, but we can't get them to work. The properties are TSMSSubmit.VP and TSMSSubmit.VPTZ

Are these the right properties for controlling validityperiods, and do you know how to use them correctly?


A:

yes it's correct, there are 3 properties

TSMSSubmit: class
    property VP: TDateTime read FVP write FVP;
    property VPTZ: ShortInt read FVPTZ write FVPTZ;
    property VPF: Byte index pdutsVPF read GetPDUType2Bits write SetPDUType2Bits;

and

function DTToValPer(DT: TDateTime): Byte;
function ValPerToDT(VP: Byte): TDateTime;

usage when preparing a PDU message:

case VPF of
  vpfAbsolute: S:= '"'+EncodeTextStamp(VP, VPTZ)+'"';
  vpfRelative: S:= IntToStr(DTToValPer(VP));

Q: When using vpfAbsolute how do I use VP and VPTZ properties? Let us say, that i want to send a SMS message with a validity period of 5 minutes what would I assign to VP and VPTZ?


A: You should use relative time - 5min since "now". Absolute let set any time but I think it's useless:

aSMS.VPF:= vpfRelative;
aSMS.VP := 5{min}/24/60;   // 5min as TDateTime