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

When it comes time to make the call that you want to log, carry out the following steps:

  1. Set up a LogEntry structure and call LogAddEntry() . The code shown in Logging an SMS Call would 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 4-4 Logging an SMS Call

LogEntry MyEntry ;
dword 		duration;
TimerDateAndTime tdat;
TimerGetDateAndTime(&tdat);
duration = TimerGetCount();
strcpy( MyEntry->LE_number, theNumber);
MyEntry.LE_contactID = recordID;
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