Contacts: 4 Logging Calls

Up: GEOS SDK TechDocs| Up | Prev: 3 Using a Dedicated Contact | Next: 5 To Get More Info on a Contact
LogAddEntry()

If you wish to log incoming or outgoing messages, you will use the LogAddEntry() function, provided by the contlog library. Make sure that you your.gp file contains the line

library contlog

To log a call, carry out the following steps:

  1. Before making the call, set up a LogEntry structure and call LogAddEntry(). The code shown in Logging an SMS Callwould be appropriate for logging an outgoing message; to log an incoming message, substitute LED_RECEIVED for LED_SENT.
  2. Make the call.
  3. When the call is done, call LogAddEntry() again, passing the same LogEntry structure as before, after writing the duration (in seconds) in the LogEntry's LE_duration field. (The previous invokation of LogAddEntry() will have filled in the LogEntry's LE_flags field with correct values.)

Code Display: Logging an SMS Call

LogEntry            MyEntry ;
dword               duration;
TimerDateAndTime    tdat;
TimerGetDateAndTime(&tdat);
duration = TimerGetCount();

strcpy( MyEntry->LE_number, theNumber);
MyEntry.LE_contactID = recordID; /* This is useful only if recordID 
                                  * refers to a record in the device contact
                                  * databse--not a database on a memory card.  
                                  * If this is not the case, then use 
                                  * LECI_INVALID_CONTACT_ID*/
MyEntry.LE_type = LET_SMS;
MyEntry.LE_direction = LED_SENT; 
MyEntry.LE_duration = 1;
MyEntry.LE_dateTime.DAT_year = tdat.TDAT_year;
MyEntry.LE_datetime.DAT_month = tdat.TDAT_month;
MyEntry.LE_datetime.DAT_day = tdat.TDAT_day;
MyEntry.LE_datetime.DAT_hour = tdat.TDAT_hours;
MyEntry.LE_datetime.DAT_minute = tdat.TDAT_minutes;

LogAddEntry( &MyEntry );

/* Send the message, and when done...*/

MyEntry.LE_duration = TimerGetCount() - duration;
LogAddEntry( &MyEntry );

When using the Contact Log library to log a contact, if you don't know the phone number, you can pass LEF_WILDCARD_NUMBER to LogAddEntry() to specify that this call's number should match any phone number. This is only allowed on devices with version numbers "Responder Build 4...." and higher. See Software Version Number for information about finding out the software version of the user's device.


Up: GEOS SDK TechDocs| Up | Prev: 3 Using a Dedicated Contact | Next: 5 To Get More Info on a Contact