Author Topic: Routines inside SmsListIntem Event  (Read 1585 times)

jboavida

  • Newbie
  • *
  • Posts: 3
    • View Profile
Routines inside SmsListIntem Event
« on: January 21, 2009, 12:34:51 am »
Hi,

Can I put something inside SmsListItem event or not ?

When I read the contents to a MemoBox (like the example you provided) the reading of say 25 messages takes about 5 seconds.
If I have something that takes more than a few miliseconds to execute if takes about 4 minutes to read the messages and takes the CPU up to 100%.

Example I have inside SmsList the following:

Code: [Select]
SaveMessage(aSms.Phone,aSms.Datetime,aSms.Text);

This procedure simply creates a new record on a dataset and fetches the data.
Does not take that long...

Is SmsListItem Event time critical? I call smslist with the wait argument false.

It is best to save the data to a memory record and fetch to database later ?

Thanks in advance

Joaquim

« Last Edit: January 21, 2009, 12:37:49 am by jboavida »

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Routines inside SmsListIntem Event
« Reply #1 on: January 21, 2009, 04:47:04 am »
Hello Joaquim

Yes, you are right, the getting SMS list is time critical process.
Current release of TnrGsm sends get list command to device and raises OnSmsListItem event on every list item.
Therefore if your OnSmsListItem handler takes long runtime, you can get timeouts or missing messages.

I recommend you to use OnSmsListItem event for place every messages in your own memory buffer (or list).
After that when SmsList is finished, you can save content of your memory cash into database.

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