readme.txt

来自「s60源码」· 文本 代码 · 共 30 行

TXT
30
字号
The System Agent notification of Inbox status (KUidInboxStatus) has a 'feature':

As an sms message is received by the phone, the system first sets the state variable with the status corresponding to the 
current messages in the Inbox. It then immediately updates it with the status corresponding to the Inbox state after the 
message has been received.

So if there are no unread messages in the Inbox to start, and a message is received the system will set the status to 
ESAInboxEmpty and then immediately to ESADocumentsInInbox. In this case the status will have previously already been 
ESAInboxEmpty so the setting of this again has no effect on observers.

However, this is all done twice. So if the Inbox is empty and a message is received the Stave Variable gets rapidly set to:
ESAInboxEmpty,
ESADocumentsInInbox,
ESAInboxEmpty,
ESADocumentsInInbox.

A program using RSystemAgent::NotifyOnEvent() to be notified of a change in Inbox status needs to enable the Event Buffer 
to ensure these rapid changes in state Variable are caught. This is why RSystemAgent::SetEventBufferEnabled() is called in 
this example code. Without the Event Buffer typically the last state variable change was missed, leaving the displayed 
status of the Inbox as Empty, when in fact it had an unread message in it.

The reason the above is happening is due to two separate objects updating the KUidInboxStatus state variable. The first is 
CInboxOutboxObserver, which looks like it does everything correctly. The second is CNcnMsvSessionObserver. According to the 
comment in the source file this sets the KUidInboxStatus state variable to ensure the envelope indicator is updated 
appropriately - even though the CInboxOutboxObserver has already set it.

What this all means for the output of this test code is that when a message is received the inbox status flickers from 
Empty -> Has Docs -> Empty -> Has Docs.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?