Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 163
Registered: ‎04-16-2009
My Device: Not Specified

Re: App stops receiving bps events.

I did almost a full play through of a mission which is about 1 hour without hitting the problem.  I disabled the bps_set_verbosity just for giggles and sure enough I got the bug again within 5 minutes.  I'm going to do more testing tonight to see if there is a relation ship that the logging happens to fix it.  It sounds like to me that either it's a memory corruption error on my end, which I really thought it could be or maybe there is a race condition with the events and the logging is slowing it down enough.

Developer
Posts: 163
Registered: ‎04-16-2009
My Device: Not Specified

Re: App stops receiving bps events.

So far I get the problem when bps_set_verbosity isn't set or if it's set to 1.  I have yet to get the problem when it's set to 2 but once and awhile instead of spitting out event 0 it give me a event 13157992.

 

[BPS:INFO] EVENTQUEUE timed out while waiting for event
[BPS:INFO] BPS returning event 0
[BPS:INFO] EVENTQUEUE timed out while waiting for event
[BPS:INFO] BPS returning event 0
[BPS:INFO] BPS returning event 13157992
[BPS:INFO] EVENTQUEUE timed out while waiting for event
[BPS:INFO] BPS returning event 0

Retired
Posts: 3
Registered: ‎10-26-2011
My Device: Bold 9700
My Carrier: Rogers

Re: App stops receiving bps events.

As a temporary workaround (while we investigate), can you try pulling screen events directly rather than through BPS?  Basically call screen_get_event with a timeout of 0 each time you call bps_get_event().

 

Developer
Posts: 541
Registered: ‎05-17-2009
My Device: Not Specified

Re: App stops receiving bps events.

So my problem returned and I have no idea why. With light touch event usage there is no problem. After doing exceessive panning, tap gestures would not be detected. For me bps_get_event seems to be delivering events, but the gestures stop being detected and my gesture callback never gets called. I have done a workaround by continuing using bps_get_event and treating each event as a "pan" event (see the gestures sample) and not using gesture sets. It seems to be working for now.

 

Anyways, sorry for interjecting with this information into LMcRae's thread since my problem seems to be different, although related. Just thought it may be useful somehow.

 

Scott

Retired
Posts: 3
Registered: ‎10-26-2011
My Device: Bold 9700
My Carrier: Rogers

Re: App stops receiving bps events.

It's entirely possible that these are related issues. Can you also try why we recommended above -- bypassing bps for screen events and getting these (screen) events directly in your event loop?

Developer
Posts: 163
Registered: ‎04-16-2009
My Device: Not Specified

Re: App stops receiving bps events.

I haven't tried your suggestion yet.  When I fix one of the bug I mentioned, the Win32 version started to crash yester day in the nvogl driver.  So it really feels like a memory corruption bug on my end that when giggled around pops up in a different spot.  I purchased a copy of BoundsChecker and spent the day sprinkling asserts everywhere.  Imanaged to find a couple of memory leaks but nothing else. 

 

I think until I get it running solid on Win32 I again I can't expect the Playbook version to run.  Oddly enough it runs on the iPad but I'm sure it's just dumb luck.

Developer
Posts: 541
Registered: ‎05-17-2009
My Device: Not Specified

Re: App stops receiving bps events.

[ Edited ]
It's entirely possible that these are related issues. Can you also try why we recommended above -- bypassing bps for screen events and getting these (screen) events directly in your event loop?

I believe the problems are related somehow. My code is different than LMcRae's and I integrate touch events differently within my program design, so to use screen_get_event it would take a fair bit of changing, I could lose a day. My first attempt at using screen_get_event  didn't work (an error on my end that I couldn't find). I have spent 3-4 days on this issue, and now that I have a working solution I have chosen just to move forward with it.

 

I'd like to help out since my application is producing the issue, so If the problem comes up again or I get free time, I will try screen_get_event over bps_get_event.

 

Thanks,

Scott

Developer
Posts: 163
Registered: ‎04-16-2009
My Device: Not Specified

Re: App stops receiving bps events.

Ok.  I have the win32 version running with zero problems.  The bug was OpenGL related only and driver specific.  I'm very confident at this point that I have no bug as BoundsChecked isn't find any, the app is running on 2 win 32 machines and the iPhone and iPad.

 

I went back to the Playbook and it's the same problem.  I have made an attempt to just use screen event s and by pas the bps events but now I get now events.  I suspect I don't know how to do what you're suggesting.  Can you give me some pseudo code?

 

Below is what I tried.

 

#ifdef BPS_EVENTS
    while( true )
    {
        bps_event_t* event = NULL;

    	bps_get_event( &event, 1 );

        if ( event )
        {
        	int	domain = bps_event_get_domain( event );

        	if ( domain == screen_get_domain() )
        	{
        		screen_event_t	screenEvent = screen_event_get_event( event );

        		handleScreenEvent( screenEvent );
        	}
        	else
        	if ( domain == navigator_get_domain() )
        	{
        		handleNavigatorEvent( event );
        	}
        	else
            if ( domain == dialog_get_domain() )
            {
                handleDialogEvent( event );
            }
            else
            {
            	log.verbose( Str( "QnxApp::onUpdate: unknown event domain %d", domain ) );
            }
        }
        else
        {
        	break;
        }
    }
#else
	while( !screen_get_event( m_ScreenContext, m_screenEvent, 0 ) )
	{
		handleScreenEvent( m_screenEvent );
	}
#endif

 

Developer
Posts: 163
Registered: ‎04-16-2009
My Device: Not Specified

Re: App stops receiving bps events.

I was given what feels like a solution by support offline.  I have run with this today and so far it hasn't failed.  Below is my event loop.  NOTE that you have to not call screen_request_events( m_ScreenContext ).  The idea is that bps events and screen events are polled separately.

 

bool QnxApp::onUpdate()
{
	Logger&	log	= getLogger();

    while( true )
    {
        bps_event_t* event = NULL;

    	bps_get_event( &event, 1 );

        if ( event )
        {
        	int	domain = bps_event_get_domain( event );

        	if ( domain == navigator_get_domain() )
        	{
        		handleNavigatorEvent( event );
        	}
        	else
            if ( domain == dialog_get_domain() )
            {
                handleDialogEvent( event );
            }
            else
            {
            	log.verbose( Str( "QnxApp::onUpdate: unknown event domain %d", domain ) );
            }
        }
        else
        {
        	break;
        }
    }

    while( true )
    {
		screen_event_t	screenEvent;
		screen_create_event( &screenEvent );

		if ( screen_get_event( m_ScreenContext, screenEvent, 0 ) != 0 )
		{
        	log.verbose(  "QnxApp::onUpdate: error getting screen event" );
			break;
		}

		// Returns false if the type is SCREEN_EVENT_NONE
		if ( handleScreenEvent( screenEvent ) == false )
			break;
    }

	m_Game.onUpdate();

	return (m_bQuit == false) ? true : false;
}

 

Highlighted
Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: App stops receiving bps events.

NDK Beta 2 came out and in the release notes, what I interpret to be the issue you had, is resolved.
---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.