hello ,
I tried to use RProperty
I did not understand from examples what is this [ const TUid KMyPropertyCat = {0x10012345}; ]
and this is my code in caller
Code:
LOCAL_C void MainL()
{
console->Write(_L("Hello, world caller!\n"));
// Define RProperty key
TUint EMyPropertyKey = 0;
// Define RProperty category
const TUid KMyPropertyCat = {0x10012345};
// Defining policy
static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
static _LIT_SECURITY_POLICY_C1(KPowerMgmtPolicy,ECapabilityPowerMgmt);
// Define a property to be integer type
TInt result = RProperty::Define(EMyPropertyKey,RProperty::EInt,KAllowAllPolicy,KPowerMgmtPolicy);
//Check if existed
if (result != KErrAlreadyExists)
{
User::LeaveIfError(result);
}
// Subscribe to the property to notified when changed
RProperty property;
TInt r = property.Attach(KMyPropertyCat,EMyPropertyKey,EOwnerThread);
User::LeaveIfError(r);
// Wait for the previously attached property to be updated
// TRequestStatus status;
// property.Subscribe(status);
// User::WaitForRequest(status);
// Call other application
_LIT(KMyExeFile,"hello_called.exe");
_LIT(KMyExeFileCmd,"");
RProcess proc;
User::LeaveIfError(proc.Create(KMyExeFile,KMyExeFileCmd));
// start the process running! Don't forget this.
proc.Resume();
// Notification complete, retrieve the value.
TInt aValue;
property.Get(aValue);
// Close property, delete it and return value to ServiceL
property.Close();
property.Delete(EMyPropertyKey);
proc.Close(); // Closes the handle, not the process.
}
and this is the code for called applciation
Code:
LOCAL_C void MainL()
{
console->Write(_L("Hello, world called!\n"));
// Define RProperty key
TUint EMyPropertyKey = 0;
// Define RProperty category
const TUid KMyPropertyCat = {0x10012345};
// Subscribe to the property to notified when changed
RProperty property;
TInt result = property.Attach(KMyPropertyCat,EMyPropertyKey,EOwnerThread);
User::LeaveIfError(result);
// Set the RProperty value
result = RProperty::Set(KMyPropertyCat,EMyPropertyKey,5);
User::LeaveIfError(result);
console->Write(_L("Called end !\n"));
}
what do you think is there any thing logically wrong
thanks