Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

i use the sample code INotify to study how implement own INotifier Interface. and i changed the code and debug it, i found that BREW Shell Manage INotifier Interface as below:

1. when the INotifier Interface be registered first time by IShell_RegisterNotify, then BREW Shell will automatic create its instance and call _SetMask. when it be registered next time, BREW Shell will not creat it again, only will call _SetMask.

2. Only when the last App which registered with the INotifier call IShell_RegisterNotify() and passed mask as 0, brew shell will release this INotifier.

3. when BREW Exit, if the INotifier still exist(creat because of register), BREW Shell will release it.

but, for _SetMask , i got confused, i do not know how it work. i change the code as :

in INotifierUsage App:

case EVT_KEY:
// We come here when a key is pressed on the handset keypad. Call
// the IMenuCtl handle event function to handle this key press.
// If this key press corressponds to an Up/Down arrow
// key press, this event will be handled by the IMenuCtl object
// in moving to the next menu item (in the given direction).
// If the key is neither Up/Down, the IMenuCtl the key press
// is not handled, hence, return FALSE.
if(AVK_1 == wParam)
{
AEECLSID clsNotifier= AEECLSID_NOTIFIER_APP;
AEECLSID clsNotify = AEECLSID_NOTIFY_APP;

ISHELL_RegisterNotify (pMe->a.m_pIShell, 0x01009FF0, clsNotifier, 0x00000001);
return TRUE;
}

if(AVK_2 == wParam)
{
AEECLSID clsNotifier= AEECLSID_NOTIFIER_APP;
AEECLSID clsNotify = AEECLSID_NOTIFY_APP;

ISHELL_RegisterNotify (pMe->a.m_pIShell, clsNotify, clsNotifier, 0x00000008);
return TRUE;
}

if(AVK_3 == wParam)
{
AEECLSID clsNotifier= AEECLSID_NOTIFIER_APP;
AEECLSID clsNotify = AEECLSID_NOTIFY_APP;
ISHELL_RegisterNotify (pMe->a.m_pIShell, 0x01009FF0, clsNotifier, 0);

return TRUE;
}
if(AVK_4 == wParam)
{
AEECLSID clsNotifier= AEECLSID_NOTIFIER_APP;
AEECLSID clsNotify = AEECLSID_NOTIFY_APP;

ISHELL_RegisterNotify (pMe->a.m_pIShell, clsNotify, clsNotifier, 0);

return TRUE;
}

in INotifier.c

void NotifierClass_SetMask(INotifier* po, const uint32 * dwMask)
{
NotifierClass * pMe = (NotifierClass *)po;
int timerPeriod = 3000; // Timer period in MS
...................................................

when i debug, i press 1,2,3,4, and then i catched:

when press 1, INotifier instance be created and NotifierClass_SetMask be called(
* dwMask is 0x00000001)

when press 2, NotifierClass_SetMask be called(
* dwMask is 0x00000001, why? why it is not 0x00000009)

when press 3,NotifierClass_SetMask be called(
* dwMask is 0x00000008, why now it is correct)

when press 4, INotifier instance be released.

then , how _SetMask work, how BREW Shell pass the mask, why when press 2, the mask passed in is not 0x00000009(0x00000001|0x00000008)

who can help me

thanks a lot