Hi - any luck with this? I'm trying to figure out how to get Call Information
from the Phone Events (i.e. when phnEvtDisconnectInd happens). I had been
pulling Call Information from the Call Log database from the Phone app, however
that information does not seem to be available until after the phone call is
completed.
Here's some code to do that (if it might help):
typedef struct CallInfoHeaderStruct {
UInt16 nullbytes; // 4 NULL Bytes
DateType date; // call date
UInt8 hours; // using 0 - 23 hours
UInt8 minutes; // 0 - 59 minutes
UInt32 duration; // seconds duration of the call
} CallInfoHeader;
Err GetLastCallInfo(CallInfoHeader * headerP, Char * contactP, Char * numberP) {
Err error = 0;
DmOpenRef dbP;
MemHandle CallInfoH;
MemPtr CallInfoP;
Char contactnumber[40]; // buffer to get contact and number info
Char * numbersearch;
// Open the Phone Call Log Database
dbP = DmOpenDatabaseByTypeCreator('call', 'HsPh', dmModeReadOnly );
if (!dbP) {
return 1;
}
CallInfoH = DmQueryRecord(dbP, 0); // gets the latest call record
CallInfoP = MemHandleLock(CallInfoH);
// Copy the CallInfoHeader
error = MemMove(headerP, CallInfoP, sizeof(CallInfoHeader));
// Copy the Phone Number and Contact Info, if any
error = MemMove(contactnumber, CallInfoP + 10, MemPtrSize(CallInfoP) -
sizeof(CallInfoHeader));
StrCopy(contactP, contactnumber);
numbersearch = StrChr(contactnumber, 0) + 1;
StrCopy(numberP, numbersearch);
MemHandleUnlock(CallInfoH);
DmCloseDatabase(dbP);
return 0;
}
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/