Attach
후에 클라이언트는 TRequestStatus
참조를 전달하는 속성에 Subscribe
어딘가에 있습니다. 비동기 이벤트가 발생하면 서버가 요청 상태 속성을 커널을 통해 알립니다 (속성이 변경된 경우). 예제 소스 코드가 올바른 방법으로 구현되면 액티브 개체 (AO; CActive
파생 클래스)가 붙어 있으며이 AO의 iStatus
은 RProperty API로 전달됩니다. 이 경우 속성이 변경되면 AO의 RunL
함수가 호출됩니다.
활성 객체 프레임 워크를 이해하고 실제로는 거의 사용하지 않는 것이 심비안에서 필수적입니다. 불행히도 나는 정말 좋은 설명을 온라인으로 찾지 못했다. (그들은 Symbian OS Internals에서 꽤 잘 설명되어있다.) 적어도 this page은 빠른 예제를 제공한다.
예CActive
당신의 CMyActive 서브 클래스의 ConstructL
에서
:
CKeyEventsClient* iClient;
RProperty iProperty;
// ...
void CMyActive::ConstructL()
{
RProcess myProcess;
TSecureId propertyCategory = myProcess.SecureId();
// avoid interference with other properties by defining the category
// as a secure ID of your process (perhaps it's the only allowed value)
TUint propertyKey = 1; // whatever you want
iClient = CKeyEventsClient::NewL(propertyCategory, propertyKey, ...);
iClient->OpenNotificationPropertyL(&iProperty);
// ...
CActiveScheduler::Add(this);
iProperty.Subscribe(iStatus);
SetActive();
}
속성이 변경되었을 때 귀하의 RunL가 호출됩니다 점에서
void CMyActive::RunL()
{
if (iStatus.Int() != KErrCancel) User::LeaveIfError(iStatus.Int());
// forward the error to RunError
// "To ensure that the subscriber does not miss updates, it should
// re-issue a subscription request before retrieving the current value
// and acting on it." (from docs)
iProperty.Subscribe(iStatus);
TInt value; // this type is passed to RProperty::Define() in the client
TInt err = iProperty.Get(value);
if (err != KErrNotFound) User::LeaveIfError(err);
SetActive();
}
그래, 소스 프로젝트 구독은 어디서나 호출되지 않으므로 아직 기능이없는 것 같습니다. 예를 들어 주셔서 감사합니다, 거기에보고 내가 그들이 속성 값에 액세스하는 데 도움이되는지 확인합니다. 그래서 당신의 의견으로 RProperty를 통해 통신을 수신 할 수 있도록 그 구현 (구독 외)에서 누락 된 무엇입니까? – lurscher
몇 가지 초안 예제를 추가했습니다. – MrTJ
이제 DLL에 ProtServ 기능이 있어야한다는 것을 알았습니다. 한 번 소프트웨어를 출시 할 계획이라면 Nokia는 왜 그런 질문을 할 수 있습니까? http://www.developer.nokia.com/Community/Wiki/Capabilities_%28Symbian_Signed%29/ProtServ_Capability – MrTJ