Author Topic: Reading and Deleting SMS after OnSmsReceived Event  (Read 899 times)

Gerhard@DCE

  • Newbie
  • *
  • Posts: 2
    • View Profile
Reading and Deleting SMS after OnSmsReceived Event
« on: August 29, 2013, 08:05:18 am »
How is the procedure of event OnSmsListItem working ?

After firing SmsList(True) I'll get back all SMS in GSM-Memory but cannot detect the end of list for initiating the deletion sequence.
I cannot see an idSms with value 0 after end of list.

Thanks for feedback
Gerhard

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Reading and Deleting SMS after OnSmsReceived Event
« Reply #1 on: August 29, 2013, 08:57:34 am »
Hello

You can see how GSMDemo detects end of SMS list:

Code: [Select]
procedure TForm1.nrGsm1SmsListItem(Sender: TObject; aMem: String;
  idSms: Integer; aSms: TnrPduSms);
begin
  if aSms <> nil then begin
    if aSms.Report then begin
      Memo2.Lines.Add('REPORT: ' + aMem + ',' + IntToStr(idSms) + ' ======= ');
      Memo2.Lines.Add(aSms.ReportText);
    end else begin
      Memo2.Lines.Add('SMS: ' + aMem + ',' + IntToStr(idSms) + ' ======= ');
      Memo2.Lines.Add(aSms.Text);
    end;
  end else Memo2.Lines.Add('======= GET SMS LIST DONE!!! =============');
end;

Last event call sets aSms = nil

Roman Novgorodov
DeepSoftware llc
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

henry64

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: Reading and Deleting SMS after OnSmsReceived Event
« Reply #2 on: September 23, 2013, 10:04:36 am »
How is the procedure of event OnSmsListItem working ?

After firing SmsList(True) I'll get back all SMS in GSM-Memory but cannot detect the end of list for initiating the deletion sequence.
I cannot see an idSms with value 0 after end of list.

Thanks for feedback
Gerhard

I think you also have to set your nrGsm to store messages on the device, so you cannot use the "nsmSkipSave" if you want to read the smslist