Checking whether the flip is open on RAZR | developer.brewmp.com Checking whether the flip is open on RAZR | developer.brewmp.com

Developer

Checking whether the flip is open on RAZR

Forums:

Hello All -

I've got a problem here, that, if you'll follow my train of thought for a second, has the consequence that I need to be able to find out if the flip is open or closed on a Motorola V3C RAZR when I start.

Our application can be running when the flip is closed, either due to SMS wakeup or alarms. The V3C has an excellent voice recognition facility, which can be accessed only from the native idle screen, or by tapping the button on a Bluetooth headset. With that headset, it's possible to access the recognition app even with the flip closed. My observed behavior in every BREW app I've seen is that tapping the headset button sends the application a key message, specifically with AVK_CLR as the wParam. No BREW application I've seen can correctly handle the dedicated key on the clamshell for voice command (it is, however, softkey 3).

Our application may be several levels nested in dialogs, and pressing CLR brings you up a level, so, as I've seen in many other apps, tapping the headset's button will move you up a level until you eventually reach the root screen and exit the app. What I want to do is close our application if the user presses the headset button, but AFAIK, there is no way of differentiating that from the user just pressing the CLR key. The user cannot press the CLR key with the flip closed, so if our app gets a CLR with the flip closed, we can exit gracefully, instead of forcing the user to tap the button possibly several times with no feedback.

Problem is, the IFlip interface requires BREW 3.14, and this phone is BREW 3.12. Is there any way of determining whether the flip is opened or closed at any particular moment? I may not be running when the EVT_FLIP event arrives, so I cannot save my state or anything like that. I don't need angle in degrees or anything, just determining flip state.

Alternately, if anybody knows how I can tell that the headset button has been tapped, I'd like to know that too. Also, does anybody know how to launch the Motorola speech recognition app from a BREW program? I know that's a long shot, but I thought I'd ask.

Try ISHELL_GetDeviceInfoEx() with AEE_DEVICESTATE_FLIP_OPEN.
-Erik

Try ISHELL_GetDeviceInfoEx() with AEE_DEVICESTATE_FLIP_OPEN.
-Erik

ebrowne wrote:Try ISHELL_GetDeviceInfoEx() with AEE_DEVICESTATE_FLIP_OPEN.
-Erik
Doh!
Thanks.

ebrowne wrote:Try ISHELL_GetDeviceInfoEx() with AEE_DEVICESTATE_FLIP_OPEN.
-Erik
Doh!
Thanks.

I've done the following:
#include "AEEFlip.h"
IFlip * pIFlip;
AEEFlipInfo * pFlipInfo;
boolean pbSupport;
int result;
ISHELL_CreateInstance(((AEEApplet*)GETAPPINSTANCE())->m_pIShell, AEECLSID_FLIP, (void **)&pIFlip);
result = IFLIP_IsSupport(pIFlip,FLIP_PARM_IS_SUPPORT,0,pbSupport);
Dunno why there is a space in teh pbSupport var. above.. the message board did that.
Results are some type of error:
'int (IFlip *,AEEFlipInfo *,int16,int32 *,int32 *)' : cannot convert parameter 5 from 'boolean' to 'int32 *'
'int (IFlip *,AEEFlipInfo *,int16,int32 *,int32 *)' : cannot convert parameter 4 from 'int' to 'int32 *'
'int (IFlip *,AEEFlipInfo *,int16,int32 *,int32 *)' : cannot convert parameter 1 from 'int' to 'IFlip *'
Suggestions, ideas, much appreciated

I've done the following:
#include "AEEFlip.h"
IFlip * pIFlip;
AEEFlipInfo * pFlipInfo;
boolean pbSupport;
int result;
ISHELL_CreateInstance(((AEEApplet*)GETAPPINSTANCE())->m_pIShell, AEECLSID_FLIP, (void **)&pIFlip);
result = IFLIP_IsSupport(pIFlip,FLIP_PARM_IS_SUPPORT,0,pbSupport);
Dunno why there is a space in teh pbSupport var. above.. the message board did that.
Results are some type of error:
'int (IFlip *,AEEFlipInfo *,int16,int32 *,int32 *)' : cannot convert parameter 5 from 'boolean' to 'int32 *'
'int (IFlip *,AEEFlipInfo *,int16,int32 *,int32 *)' : cannot convert parameter 4 from 'int' to 'int32 *'
'int (IFlip *,AEEFlipInfo *,int16,int32 *,int32 *)' : cannot convert parameter 1 from 'int' to 'IFlip *'
Suggestions, ideas, much appreciated

Well, here is the signature of IFLIP_IsSupport():
int IFLIP_IsSupport(IFLIP * pIFlip, AEEFlipInfo * pFlipInfo, int16 nParmID, boolean * pbSupport)And they are different, what BREW version are you using? This signature is from 3.1.5.
First error:'int (IFlip *,AEEFlipInfo *,int16,int32 *,int32 *)' : cannot convert parameter 5 from 'boolean' to 'int32 *'You need fix your 5th parameter to pass in the address of pbSupport since the function is expecting an pointer:IFLIP_IsSupport(pIFlip, FLIP_PARM_IS_SUPPORT, 0, &pbSupport);Second error:
'int (IFlip *,AEEFlipInfo *,int16,int32 *,int32 *)' : cannot convert parameter 4 from 'int' to 'int32 *'The 4th parameter is the parameter ID according to the reference. So it should be FLIP_PARM_IS_SUPPORT:IFLIP_IsSupport(pIFlip, NULL, FLIP_PARM_IS_SUPPORT, &pbSupport);Third error:
I don't know why this is an error. You already properly declared a pointer to an IFlip interface. Maybe this error will disappear once you get fix the other two.
HTH

Well, here is the signature of IFLIP_IsSupport():
int IFLIP_IsSupport(IFLIP * pIFlip, AEEFlipInfo * pFlipInfo, int16 nParmID, boolean * pbSupport)And they are different, what BREW version are you using? This signature is from 3.1.5.
First error:'int (IFlip *,AEEFlipInfo *,int16,int32 *,int32 *)' : cannot convert parameter 5 from 'boolean' to 'int32 *'You need fix your 5th parameter to pass in the address of pbSupport since the function is expecting an pointer:IFLIP_IsSupport(pIFlip, FLIP_PARM_IS_SUPPORT, 0, &pbSupport);Second error:
'int (IFlip *,AEEFlipInfo *,int16,int32 *,int32 *)' : cannot convert parameter 4 from 'int' to 'int32 *'The 4th parameter is the parameter ID according to the reference. So it should be FLIP_PARM_IS_SUPPORT:IFLIP_IsSupport(pIFlip, NULL, FLIP_PARM_IS_SUPPORT, &pbSupport);Third error:
I don't know why this is an error. You already properly declared a pointer to an IFlip interface. Maybe this error will disappear once you get fix the other two.
HTH