You Are Here:

Community: Developer Discussion Boards

#1 Old JSR-135 (camera) and eSWT integration - 2009-03-09, 19:39

Join Date: Feb 2009
Posts: 7
jredfern
Offline
Registered User
Dear forum members,

I've developed an application with eSWT for s60 5th edition and would like to add photo-taking capabilities. In order to do this it looks like I need to use the VideoControl object from JSR-135. This object seems to return an Item gui object for AWT or a Canvas object for LCDUI, from which the picture taking is performed. Is it possible to do picture taking from within an eSWT application? Perhaps it's possible somehow to capture the background of the LCDUI Canvas object and paint the image onto an eSWT Canvas object? Any help would be greatly appreciated.

Best regards,

Jim
Reply With Quote

#2 Old Re: JSR-135 (camera) and eSWT integration - 2009-03-10, 13:40

Join Date: Nov 2008
Posts: 35
gorkem.ercan
Offline
Registered User
Good news, JSR-135 actually supports eSWT on S60 3rd Ed FP2 and 5th Ed. Here is a snippet that shows how to initialize VideoPlayer for eSWT.
Code:
// creating player
   player = Manager.createPlayer("capture://video");
   player.realize();
// Grab the video control and set it to the current display. 
   VideoControl vcCam = (VideoControl) player.getControl("VideoControl");
//setting VideoControl to eSWT control
   Control control = (Control) vcCam.initDisplayMode(GUIControl.USE_GUI_PRIMITIVE, Control.class.getName());
// setting control to shell
   control.setParent(shell);
The rest of the code for taking the picture is indifferent from LCDUI.
Reply With Quote

#3 Old Re: JSR-135 (camera) and eSWT integration - 2009-03-10, 19:19

Join Date: Feb 2009
Posts: 7
jredfern
Offline
Registered User
Hi Gorkem,

Thanks for the response, which seemed exactly what I hoped for :). I've used CaptureMidlet.java as the basis for my MIDlet, which is a LCDUI based camera demo (and works on my 5800). However when I run my eSWT MIDlet on the 5800 I get the following exception:

Code:
Error
java.lang.Error
SymbianOS error = -1 : General:
System error
It seems to exception on the line:
Code:
player = Manager.createPlayer("capture://video");
I haven't been able to test it on the 5th edition 0.9 emulator which doesn't seem to support camera emulation.


I've included my simple test case below, perhaps you can see the problem?

Code:
import java.io.IOException;

import javax.microedition.media.Manager;
import javax.microedition.media.MediaException;
import javax.microedition.media.Player;
import javax.microedition.media.control.GUIControl;
import javax.microedition.media.control.VideoControl;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

import org.eclipse.ercp.swt.mobile.MobileShell;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;

public class ESWT_Test extends MIDlet implements Runnable {
	
	private Thread thread;

    protected void startApp() throws MIDletStateChangeException {
        if ( thread == null ) {
        		//The GUI needs to run in a separate thread than the MIDlet
            thread = new Thread( this );
            thread.start();
        }
    }

    protected void pauseApp() {

    }

    protected void destroyApp( boolean unconditional ) throws MIDletStateChangeException {

    }
    
    public void run() {
    	MobileShell shell = null;
    	shell = new MobileShell(SWT.RESIZE | SWT.MIN |SWT.MAX | SWT.CLOSE);
    	shell.setSize(240,350);
    	shell.setText("Hello");
    	shell.setLayout(new FormLayout());
    	
		// creating player
		Player player = null;

		try {
			player = Manager.createPlayer("capture://video");
		} catch (IOException e) {
			e.printStackTrace();
		} catch (MediaException e) {
			e.printStackTrace();
		}
		
		try {
			player.realize();	
			player.prefetch();	
		} catch (MediaException e) {
			e.printStackTrace();
		}		
		
		// Grab the video control and set it to the current display.
		VideoControl vcCam = (VideoControl) player.getControl("VideoControl");
		// setting VideoControl to eSWT control
		Control control = (Control) vcCam.initDisplayMode(
				GUIControl.USE_GUI_PRIMITIVE, Control.class.getName());
		// setting control to shell
		control.setParent(shell);    	
		try {
			player.start();
		} catch (MediaException e) {
			e.printStackTrace();
		}
		
    	shell.open();
    	Display display = shell.getDisplay();
    	while(!shell.isDisposed()) {
    		if(!display.readAndDispatch())
    			display.sleep();
    	}
    	display.dispose();
    }  	       
}
Many thanks,
Jim
Reply With Quote

#4 Old Re: JSR-135 (camera) and eSWT integration - 2009-03-12, 03:50

Join Date: Feb 2009
Posts: 7
jredfern
Offline
Registered User
Additionally, getting the system property "supports.video.capture" whilst using the lcdui Display results in "true" on the 5800. However getting that property on the same phone whilst using the eswt display results in null! Perhaps I'm making a mistake but I can't see it.. Any help would be greatly appreciated

Jim
Reply With Quote

#5 Old Re: JSR-135 (camera) and eSWT integration - 2009-03-18, 01:24

Join Date: Feb 2009
Posts: 7
jredfern
Offline
Registered User
Dear forum members + nokia employees,

I've been in touch with Gorkem and he's discovered that there was a problem on early 5800s with MMAPI when used with eSWT. This is causing the camera to be unusable with eSWT on the 5800. The MMAPI team have notified us that a fix has been released to S60 5th ed. and the 5800 will be get it in the next software update.

Please can anyone let me know when the next 5800 software update is due for release?

Best wishes,

Jim
Reply With Quote

#6 Old Re: JSR-135 (camera) and eSWT integration - 2009-03-27, 19:26

Join Date: Feb 2009
Posts: 7
jredfern
Offline
Registered User
Dear all,

I've found a solution for this problem, when I want to use the camera I'm using the push registry to restart the app and startup with LCDUI. When the photo is taken it restarts in eSWT mode again!

I have another question regarding eSWT. I'm using the ScrolledComposite helper class which exists in the org.eclipse.ercp.swt.demo module in Eclipse CVS. It's great as far as functionality goes, but visually tears as it's being scrolled (upon stopping scrolling it looks fine again). Does anyone have a suggestion for how to avoid this visual tearing?

Many thanks,

Jim Redfern
Reply With Quote

#7 Old Re: JSR-135 (camera) and eSWT integration - 2009-08-18, 14:10

Join Date: Jul 2009
Posts: 5
simonem
Offline
Registered User
Anyone knows if this problem has been solved in the last firmware update release of the 5800 (v31.0.0.15)?
Thanks
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ