• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 
March 28, 2024, 09:50:11 am

News:

SMF - Just Installed!


Best way to delete messages

Started by jboavida, January 19, 2009, 09:18:15 am

Previous topic - Next topic

jboavida

Hi,
I'm evaluating this (so it seems) excellent VCL, and I have a question:

The system is going to detect a SMS, process it, store it in a database and delete it form the phone.
This is working fine.

But, in case that the PC is disconnected, the modem still gets is messages, so I need to check everytime that the appication is started if there are unread messages on the phone. I do that by using the SmsList that fires the SmsListItem event.
In this event I process the messages and delete them. My problem is here. I get timeouts. I think that the VCL uses the message index to control the loop or something.

Obviously I have to delete the messages out of the SmsListItem event. What and where is the best way to do it? Is there a way to delete all the messages at same time?

Thanks in advance

Joaquim

Roman Novgorodov

Hello Joaquim

Thank you for your interest to our product.

About timeouts.
You can play with serial port settings for increase the stability of connection.

About mass deleting.
There is no such method.
We need think more before add so dangerous method into class :-)

You can call TnrGsm.SmsDelete(aIndex: integer) in loop and change Index from 1 up to maximum index of SMS for your phone.
This method can return False if SMS is not found but you can ignore this error.

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

jboavida

Thanks Roman,

How about using a global variable that is incremented every time the SMSListItem is fired? In that way I will know the maximum number of SMS in the phone and use it the the delete loop. Is that Ok?

Tks

Joaquim

Roman Novgorodov

Joaquim

You can try to use code like following:

var MaxSmsIndex, i:integer;
begin
  nrGsm1.MemRead := 'ME';
  MaxSmsIndex := nrGsm1.MemReadTotal;
  for i := 1 to MaxSmsIndex do begin
     nrGsm1.SmsDelete(i);
     Application.ProcessMessages();
  end;
end;


Good luck!

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