The Source for Java Technology Collaboration
User: Password:



Bruno Ghisi's Blog

Community: Mobile & Embedded Archives


Why do we write open source code?

Posted by brunogh on June 17, 2008 at 08:55 PM | Permalink | Comments (12)

For some time I was thinking about writing this post and I have just watched Chris DiBona presenting a fantastic session called Open Source is Magic in Google I/O and got motivated. In addition to this, today is Download Day (if you have not downloaded Firefox 3.0 yet, go ahead and do it), so nothing better than write about open source on this Tuesday.

I was deep thinking why people write open source code. I am not talking about why companies do it, I am talking about you, as a developer, do it in your free time. According to a very interesting BCG/OSDN Hacker Survey made in 2002 - I could not easily found it, so Chris got me a copy (thanks!) - it could be extracted 4 groups from the different motivations answered by the public: believers (do it because they think open software should be open), professionals (for work needs and professional status), fun seekers (for non-work need and intellectual simulation) and skill enhancers (for skill improvements).

[Updating] The motivations that made the groups:

I can understand this group segmentation, but I think the time has definitely changed and we - communities, companies and softwares - have definitely evolved. Some years ago, Java was not open source, Firefox and OpenOffice.org were getting more adopters, Ubuntu was not out, companies were not doing contests and giving prizes away, etc, etc, etc. But my big question is, why do you write open source code? I mean, why do you join, for example, java.net, SourceForge, Google Code or freshmeat and commit your code there in order to create a whole community around it? Why do you send code to help a current open source project? Answering this question, I would say that I am a believer because I do it for the knowledge sharing between people, but I definitely do it for the fun too. How fun is sharing your ideas, getting new ones, mixing all together and creating something even more nice?! Talking about fun, would you will invite someone to go out for a glass of water on Friday night? Neim! It is the same as wasting your free time to write something that you do not get excited, it just does not make sense.

So, it is your turn. What do you think about the current period that open source is passing? What do you do for open source and why do you do it? Any other comments you may have, please feel free to add!

PS: I was looking some other presentations in Google I/O and there was a slide showing the book Producing Open Source Software from Karl Fogel. I have read this book some time ago and it has a pretty interesting reading if you want to learn about the nature of maintaining an open source project. Take a look!

Cheers,
Bruno Ghisi



Playing with Mobile Sensor API, Marge and JavaFX Script

Posted by brunogh on June 10, 2008 at 09:05 PM | Permalink | Comments (5)

I am disappointed... I could not go on with my tests envolving phoneME Advanced on iPhone due to iPhone SDK just runs on Mac OS X. Boring week, I bought an iPhone for that and someone thought everybody should have a Mac OS X to use it... what a nice thing! Anyway, let's change plans for now... I found something funnier: let's play with JSR 256 (Mobile Sensor API or MSAPI). But let's use Marge (Bluetooth) and JavaFX Script too!

MSAPI in NetBeans

The current Wireless Toolkit, 2.5.2, does not support MSAPI yet, so you need to make some tricks.

First: Download the JSR 256 RI. If you do not have a Forum Nokia account, go ahead and make one. Unfortunately, it seems the zip is packed for Windows due to the .bat and .exe files inside, but it looks that it is just script files, so probably works on other OS if you adapt.

Second: I suppose you already have NetBeans 6.1 with Mobility Pack, so let's add a new platform into it. Go to Tools->Java Platforms->Add Platform...->Select Java ME MIDP Platform Emulator->Click Next->Select the folder you have extracted the downloaded zip and advance until the end. If everything went well, you probably got a new platform called Prototype 2.0 S60 MIDP Emulator. Great! You are now able to create and compile applications that uses MSAPI specification.

We are not going to emulate the sensors, but if you want, go ahead and start $RI_PATH/tools/simulator/bin/start_sensorSimu.bat.

Starting with MSAPI

From the specification:...it allows Java ME application developers to fetch data easily and uniformly from sensors. A sensor is any measurement data source. Sensors vary from physical sensors such as magnetometers and accelerometers to virtual sensors, which combine and manipulate the data they have received from other kinds of physical sensors. Examples of virtual sensors could include, for example, battery level sensor indicating the remaining charge in a battery, or a field intensity sensor that measures the reception level of the mobile network signal in a mobile phone. The sensor may be connected to the mobile device in different ways, represented by the connection type, examples of which are embedded, short-range wireless, wired, and remote connection type.

The classes and interfaces of this API are defined in the package javax.microedition.sensor.

To start playing with sensors, basically you need to find them in order to get a the SensorInfo references. There are two static methods in SensorManager for that: findSensors passing the sensor url and the overload one passing the quantity and the context of use (if you set null for both parameters, all the supported sensors will be returned). From our demo application:


SensorInfo[] si = SensorManager.findSensors("acceleration",
  SensorInfo.CONTEXT_TYPE_USER);

After that, you can connect into the sensor using the well known Generic Connection Framework (GCF):


String url = si[0].getUrl();
SensorConnection sensor = (SensorConnection) Connector.open(url);

Then, you can start collecting the data. There are two ways of collecting the data in MSAPI: synchronously and asynchronously. In the first, you have to call SensorConnection getData iteratively. In the asynchronous way, you have to register a DataListener, invoking setDataListener and passing a reference of it and a buffer size (this number will be determine the data collecting frequency), that will be responsible for calling the dataReceived method. This method will return the SensorConnection reference, an array containing the data channels (for example, for a 3-axis accelerometer, the array will have length 3) and usually the last parameter will be false when the listener handles the data quickly:


sensor.setDataListener(new DataListener() {
  public void dataReceived(SensorConnection sensor, Data[] data, boolean isDataLost) {
    ...
  }
}, 10);

Our demo: Bluetooth Sensor FX Tetris

The demo of this post is pretty simple. I got the Bluetooth JavaFX Tetris Game and changed the way of interaction. You do not have to type the direction in your mobile anymore, you can now use its accelerometer. Avoid typing, you can get a RSI (Repetitive Strain Injury)! Basically, I have implemented the dataReceived method to process the data collected and send over Bluetooth to the game. It is still missing some better balance in the accelerometer as you can see, but works as a proof of concept.

The code of JavaFX Tetris Game (BluetoothJFXTetris) is under Marge's Demos repository as well as the MIDlet controller (genericbtsensomapper-mobile). Go ahead and checkout them! They are open source! I have tested this demo with my designer friend' Sony Ericsson K850i and worked... as a demo, off course! I have noticed that sometimes the game crashes, I am not sure yet why, but I suspect that is something related to threads and rendering.

Here is a terrible preview video. It was recorded using the phone mentioned in the beginning of the post, probably I will have to record it again, but I could not wait until tomorrow to post about this experiment:


Thanks to Raghavan Srinivas that pushed me up to work on this demo during our fast talk at JavaOne! Cheers!

Have a nice week! :)
Bruno Ghisi



First steps with iPhone and Java...

Posted by brunogh on May 25, 2008 at 09:49 PM | Permalink | Comments (9)

When I was at JavaOne, I sold my soul to devil: I bought an iPhone. Here in Brazil, there is no iPhone being officially selled yet.

Let's start having fun and playing with Java on it:

  1. Unlock your iPhone. Babies can do that before they say mama. More information at Zibri's Blog.
  2. Make it useful: Install Cydia (front-end for Debian APT) to substitute default Installer application. In Installer, go to the Source option, click Edit, Add http://apptapp.saurik.com, Done and then Refresh. Then go to Install option, search for Cydia Installer and install it.
  3. After that, open Cydia and search for the word Java, there are a few stuff part of the iPhone/Java package available in Development menu. You are able to make graphical applications using the UI Framework, which is possible due to JocStrap, a Java/Objective-C bridge. Install iPhone/Java that will bring the necessary stuff (JamVM, etc) for this simple demo. Also, later try to install Jikes, a compiler for version 1.4 and fastjar, an alternative for running jars, because I could not test them yet.

PS: Install OpenSSH in your iPhone and then connect your laptop on its server. Also, install Boss Prefs to be able turn SSH on/off. Finally, do not forget to change you root password using passwd, default password is alpine.

I have created a simple Hello World app into NetBeans. Then I have compiled it, tranfered to iPhone and runned (via SSH).

Code:


public class Main {
public static void main(String[] args) {
System.out.println("Hello World... in Java");
}
}

Screenshot:
java_iphone.png

Community will bring ME world into iPhone as well. The answer for this is phoneME Advanced. Keep and eye and join the mailing lists! As you can see, there are some very nice projects going on!

Have a nice and funny week!

Bruno Ghisi



LWUIT is the way!

Posted by brunogh on May 18, 2008 at 05:49 PM | Permalink | Comments (2)

Forget about what I have said previously, LWUIT (Lightweight UI Toolkit) is the way!

LWUIT was launched at JavaOne 2008 and there are already some nice tutorials and demos about it. I met some of the guys in the Pavillion and I was impressed with the lib, very cool! Another point is that you can also use LWUIT in commercial applications, it was released under the SLA.

Picture49.png

LWUIT is a UI library that is bundled together with applications and helps content developers in creating compelling and consistent Java ME applications. LWUIT supports visual components and other UI goodies such as theming, transitions, animation and more.

Don't waist your time drawing Canvas, take a look on it!

Bruno Ghisi



J1 is awesome!

Posted by brunogh on May 13, 2008 at 08:52 PM | Permalink | Comments (0)

There is no word to describe what is JavaOne. If I take a try, I would say that is definitely awesome! It rocks! It is the best geek tourism ever!!!

The sessions are great, the speakers are great, the Pavillion is great, the communities, companies, people, all the information, flyers, talks, contests, chats, demos, videos, places, souvenirs, stuff, food, parties, pubs, dinners... the coolest people from the whole world speaking about Java and whatever runs in a JVM!

I will not describe all the sessions and things I have seen, because I could easily write a few of books about it. I suppose everyone have seen different JavaOnes, due to the many information in its atmosphere and because we cannot split ourselves in time... So, I have added some pics that show much more. Follow them to see what happened with me, probably not in this sequence, but I can't remember, I spent a whole week as it was a day! Too much fun!

And the fun was just starting...

...do you know that people are the center of everything that happens?

...I mean, because of a lot of people, all those things happens...

...yes, a lot of... and in everywhere, the Pavillion was awesome to meet them...

...and those people play video games when they are tired... or sometimes just rest...

...you can meet those people in a Smash Mouth concert... who does not like rock?


...I met Aaron Houston there... is he Brazilian?!

...he took me to a cool JavaPosse session... very informal and funny, as you can see...

...then I got my car and it drove me ti the next pub...

...yeah... definitely everybody likes rock!

...a lot of Mobile and Embedded people were there!

...Have you seen all the cool demos we got?


...after some pints, I think I was in Mars...

...and then I encourage myself and got a Marge Duke tattoo...

...I can't remember the rest, but I wake up with Neil Young in the stage... wow...

...then I just discovered that Jonh Cage is Brazilian too... he said don't be shy!

...yes... I tried...

...so, James Gosling just appeared in the CommunityCorner...

...and all his fans liked that!!!


...too much things going on... time to rest, let's watch a movie...


...everybody would be tired after a day like that, don't you think, Roger?

As 24Hrs (do you know Jack Bauer?) episode would say, the following take place between 5th of May and 9th of May... something like that, I cannot remember the hours exactly...

Great to meet everybody and be part of this! It was my pleasure! I got addicted to JavaOne!!!

What a busy day!

Thanks,
Bruno Ghisi



Marging a FX Tetris at JavaOne!

Posted by brunogh on April 27, 2008 at 06:10 PM | Permalink | Comments (11)

Marge (Java Bluetooth Framework) got a mini talk in Community Corner. It will be on Wednesday at 3:30 pm. If are you interested in Bluetooth, JSR 82 (Java Apis for Bluetooth) and Marge, do not miss that! We have integrated a Bluetooth mobile controller for a nice James Weaver's compiled JavaFX Script tetris game! Thanks, Jim!

Here is a preview (updated):

The old video is at http://www.youtube.com/v/ZvVx6RGjCjM

It will be easy to find Marge:

margeinthebackpack.jpg

Here is the last tip, keep an eye on the Mobile and Embedded Wiki page for JavaOne!

I am very excited to meet new people! See you in San Francisco!

Bruno Ghisi



Pics from fisl 9.0

Posted by brunogh on April 22, 2008 at 09:40 AM | Permalink | Comments (0)

The 9th edition of fisl (International Free Software Forum) was huge! 7417 participants from 21 countries talking about open source 12 hours by day during 3 days. Wow! Great atmosphere! Great sessions! Great people! Great ideas, discussions, dinners...

Here are some pics that I got from my terrible camera:

1.JPG
Ale Gomes, from Mobile & Embedded, and Fabiane Nardon, JavaTools Community Leader.

2.JPG
Bruno Souza, Javali, Brazilian Sun Ambassadors, OpenSolaris User Group... did I forgot anyone?

3.JPG
Marge checking out a mobile session with her MSA compliant device!

4.JPG
Lucas Torri, Roger Brinkley and I. Sorry model agencies... no runways, we are busy....

5.JPG
What a nice guy!

6.JPG
Roger Brinkley, Mobile and Embedded Community leader, playing golf during his cool session!


Bluetooth about:

The slides of the session Marge, an open source framework for building Bluetooth applications in Java are available only in pt_BR (pdf and odf). mOOo Impress Controller was used to control the Impress presentation with the mobile and Giant Blue Pong was the demo showed in the end. Thanks for the audience, sorry if we had to hurry up. If you got any doubts, please send an email to us (mailing lists here).

During fisl, we have discovered a very nice thing! Bluecove, a JSR 82 Java SE implementation, is already working over BlueZ, the official Linux Bluetooth protocol stack. There is no release yet, but the snapshots we have tried are stable. Thanks to Vlad Skarzhevskyy, one of the project owners, that virtually helped us to put things working for our demo. Now you can have multiple connections in Linux, something that AvetanaBluetooth (open source) did not allow. Great news! Congrats to the Bluecove team! :)


Thanks,

Bruno Ghisi



Starting with Sun SPOT using NetBeans 6.1

Posted by brunogh on April 11, 2008 at 09:41 PM | Permalink | Comments (6)

If you do not have a Sun SPOT (Figure 1), do not be bored, you can still have a lot of fun! In this entry, I gonna explain how to start programming the world using NetBeans 6.1!



sun_spot2.jpg

Figure 1: Sun SPOT rulez!!!


Downloading NetBeans IDE 6.1


1. Download NetBeans IDE 6.1 (RC1 launched today). A lot of new nice features, take a look in the New and Noteworthy and in the release page for a detailed list.


Installing Sun SPOT plugin


2. Install Sun SPOT plugin into NetBeans. Download com-sun-sunspot-updatecenter.nbm. Now, in NetBeans, go to:
2.1 Tools menu -> Plugin.
2.2 Click on Downloaded tab.
2.3 Click on Add Plugins button and select the file. Then, confirm the installation clicking on Install button and accept the license agreement.
2.4 Finally, go to the Available Plugins tab, mark SunSPOTApplicationTemplate, SunSPOTHostApplicationTemplate and Sun SPOT Info, click on Install button and accept the license agreement.
2.5 You can check that everything is installed going to Installed tab (Figure 2).


PS: David Simmons has blogged about these steps before.


netbeans_spot1.png
Figure 2: Installed tab.


Getting Sun SPOT SDK 3.0 Beta


3. Get the Sun SPOT SDK 3.0 Beta emailing David Simmons, more details here. You will receive a link to download SPOTManager tool, that is a jar that installs the SDK and can run the emulator. Be sure you have at least JDK 1.5 and at least Ant 1.6.5 installed and configured in your system.


Creating the Demo Application


4. Let's make the default demo application work. Go to:
4.1 File menu -> New Project
4.2 Select Java category, select Sun SPOT project and then click Next.
4.3 Leave the default project name and package and click Finish.
4.4 Open org.sunspotworld.StartApplication.java. You can see it extends MIDlet and already has some code. If you are familiar with Java ME, you will not have big problems. But, basically, Sun SPOT arquitecture is CLDC (Connected Limited Device Profile) 1.1 and has IMP (Information Module Profile) in the top - which can be defined as a MIDP (Mobile Information Device Profile) without UI stuff. Also, it has some additional libraries and all this runs in a VM called Squawk, that is characterized by being most written in Java. So, StartApplication implements the abstract methods inherited from the MIDlet (startApp,pauseApp that Squawk never calls and destroyApp). It works in a sand box enviromnent.


The startApp code, in List 1, basically gets an object reference to the singleton eDemo Board and then make its LED blink red for a quarter of second each second. As you, can see, the code is pretty high level and easy to understand.



protected void startApp() throws MIDletStateChangeException {
System.out.println("Hello, world");
new BootloaderListener().start(); // monitor the USB (if connected) and recognize commands from host

long ourAddr = Spot.getInstance().getRadioPolicyManager().getIEEEAddress();
System.out.println("Our radio address = " + IEEEAddress.toDottedHex(ourAddr));

ISwitch sw1 = EDemoBoard.getInstance().getSwitches()[EDemoBoard.SW1];
leds[0].setRGB(100,0,0); // set color to moderate red
while (sw1.isOpen()) { // done when switch is pressed
leds[0].setOn(); // Blink LED
Utils.sleep(250); // wait 1/4 seconds
leds[0].setOff();
Utils.sleep(1000); // wait 1 second
}
notifyDestroyed(); // cause the MIDlet to exit
}


List 1: startApp code.


Running the Demo Application in the emulator


5. Put this application to run in the emulator.
5.1 Right click the project and select Build. It will generate the jar in the /$PROJECT_HOME/suite/. If you have a spot device, you could send it directly by right clicking the project and selecting Build Project + Deploy to Sun SPOT , forgetting the next steps.
5.2 Open the emulator (in the ToolManager, go to Solarium tab and then click in the Solarium button). Then, in the emulator, click on the Emulator menu -> New virtual SPOT, you will notice that a Sun SPOT will appear in the squared right area.
5.3 Right click on the Sun SPOT picture, then click Specify application jar file... and select the application jar in /$PROJECT_HOME/suite/, which is the place that the application was built in step 5.1.
5.4 After that, click again on it, then Run MIDlet and StartApplication. Finally, you will see a red LED blinking!!! Wow!



netbeans_spot2.png

Figure 3: NetBeans 6.1, ToolManager, Emulator and the red LED blinking!


Where I go next?


In NetBeans, check the Sun SPOT Info, that you have installed with the plugin, by clicking in the Window menu.
David Simmons' Blog - http://blogs.sun.com/davidgs
Roger Meike's Blog - http://blogs.sun.com/roger
Sun SPOT Feeds (really nice aggregator with more cool blogs) - http://planets.sun.com/SunSPOT/group/SunSPOT
Project Sun SPOT - https://www.sunspotworld.com
Open source Sun SPOT - https://spots.dev.java.net (take a look in its subprojects as well).
Search for spaughts in youtube.com or subscribe the tag feed directly.
Recently, Aaron Houston has organized a conference call about Sun SPOT with Roger Meike and published the nice links we get during it in an email he sent. The links are available here too. Slides here.




PS: I am using this entry for the NetBeans IDE 6.1 Beta Blogging Contest, take a look at http://www.netbeans.org/competition/blog-contest.html for more information about it. Go ahead, make an entry and have a chance to win $500! Good luck for us!




61blog-contest-logo.gif




Thanks! Have a nice weekend!


Program the world!


Bruno Ghisi



Building a Java ME Bluetooth chat in 12 minutes...

Posted by brunogh on April 02, 2008 at 08:05 PM | Permalink | Comments (0)

As it was announced before, Marge 0.5 is out. In this post, I am going to demonstrate an interesting new feature called AutoConnect. AutoConnect is indeed to automatically connect Bluetooth devices. It has some limitations due to some bad implementations and has some scenarios that maybe it is not the best option, but still very interesting and is definitely awesome to make something with a few lines of code! For more information about the new release and this feature, please check http://wiki.java.net/bin/view/Mobileandembedded/HowTo05.

So, nothing better than show a video... [sometimes I think I should have done cinema :) ]... Anyway, if you have not seen any Marge videos yet, try "Project Marge Interview", "My laptop is detecting my presence" and "Giant Blue Pong (my Bluetooth Atari)". Too much talk, take a look at the new "Building a Java ME Bluetooth chat in 12 minutes..." too. Could you not understand what happened in Netbeans code editor? Neither do I!!! It is better to download the full video (30MB). Hope you enjoy!

marduke.png

If you want more about Marge, go to http://marge.dev.java.net. If you want to help, please send an email to owner@marge.dev.java.net. We would love to hear suggestions and have you in our team!

Go ahead! Marge your Bluetooth app!



Palette Components in Visual Mobile Designer (Netbeans Mobility Pack)

Posted by brunogh on March 25, 2008 at 08:18 PM | Permalink | Comments (0)

Do you use Netbeans Mobility Pack? Do you always wanted to know more about all the palette components in Visual Mobile Designer (VMD)? I got an email from netbeans weekly (nbweekly@netbeans.org) with a very nice wiki page!

Original:

Visual Mobile Designer Palette Reference Page

Everything you wanted to know about the Visual Mobile Designer for mobile applications, but were afraid to ask is now revealed. This page gives a complete description of all the components in the VMD palette and includes links to related tutorials for each of the components where available. Get the information you need to make effective use of all the functionality the Mobility pack delivers!

VMD rulez! Enjoy it!

Bruno Ghisi



Anybody could explain me what is going on with Brazilian DTV?

Posted by brunogh on March 08, 2008 at 08:22 PM | Permalink | Comments (6)

Recently, I read Sun Microsystems And SBTVD Forum To Develop Open-Source Java Solution For Brazil's Digital TV System. Ok, looks like a nice news, but is there any reader that could explain me what is really going on?

I will try summarise my point of view, because I am not an expert on it. Brazilian open source middleware, called Ginga, is divided in two main parts: Ginga-ncl, which is uses a Brazilian scripting language called Lua (much used in embedded systems and games) and Ginga-j, which is supposed to be the Java stuff. As far as I know, Ginga-j is compatible with GEM (Globally Executable MHP) and it was having licenses and royalties problems. Also, it was being said that Ginga-j was open source, but things are not really clear, otherwise, probably, I would not being post this entry... how can you drive an open source project without clearity? Where can I download all the stuff? Where is the roadmap? So, Sun published that will help Forum do Sistema Brasileiro de TV Digital Terrestre (Forum SBTVD) to create a new plataform that will take place at Ginga. The announcement says that this platform will be compatible with Ginga, so is it a replacement for Ginga-j? How will be that?

Hope anybody could elucidate us.

Cheers,
Bruno Ghisi



My First JRuby Bluetooth App

Posted by brunogh on January 31, 2008 at 06:54 PM | Permalink | Comments (3)

TV, Coke and a laptop, it is time to have fun!

We are always trying to integrate Marge (Java Bluetooth Framework) with other things. If you remember, in a last post, JavaFX Script was used, now it's time for JRuby! May you don't know, JRuby is Java implementation of the Ruby programming language. I am not a Ruby expert, but I hope I can become, because I am enjoying the language so much. Actually, I enrolled in a pretty interesting free online course by Satish Talim. If you enjoyed the content, be sure you join on March too!

Here we go, no more delays! The basic idea of this post is to show a simple sample application that inquiry for Bluetooth devices, but more than just creating the application, be aware of thinking in the possibilities you can have with JRuby.

What you will need:
  • Download Netbeans IDE 6 (Select All package version, because it comes with Java and Ruby).
  • Get marge-core in Marge repository (you can use Netbeans to checkout from Subversion and generate a jar, because the last version is under development and was not launched yet, we are working on it :) ). Otherwise download the last launched version (0.4.0) and fix the inquiry method.
  • Get a JSR 82 implementation, I have used Avetana for Linux. I have explained it in another post, you can take a look here.

Time to code!
  1. Create a Ruby Project: File -> New Project -> Ruby -> Ruby Application. Click Next, configure your project (create a main.rb file and use a JRuby interpreter) and then click Finish.
  2. Add marge-core and Avetana. Right click in the project -> Properties -> Java and then add the jars in the JRuby classpath.
  3. Add the following code into main.rb. The code is pretty intuitive, because Ruby is! It basically imports some Marge classes (that are going to use Avetana internally), defines a listener that will be called during the inquiry and will print all the devices found. Also, the inquiry will be started by the singleton DeviceDiscoverer.

  4. 
    include Java
    
    include_class 'net.java.dev.marge.inquiry.DeviceDiscoverer'
    include_class 'net.java.dev.marge.inquiry.InquiryListener'
    
    puts 'Inquiring for Bluetooth Devices'
    discoverer = DeviceDiscoverer.instance;
    
    class InquiryListenerAppender 
        include InquiryListener
      def inquiryCompleted(remoteDevices)
        remoteDevices.each { |device| print "#{device.bluetooth_address} - #{device.get_friendly_name true} \n"  }
      end
      def inquiryError
        puts 'Inquiry Error'
      end
      def deviceDiscovered(device,deviceClass)
      end
    end
    
    discoverer.start_inquiry_giac InquiryListenerAppender.new
    

Project Window:
btjruby_1.png

Just insert your Bluetooth USB adapter press F6 to run!
btjruby_2.png

My mobile was found! Before we finish, take a look in this nice effort to integrate Bluetooth/Ruby.

The possibilities are endless...they are always endless...

Cheers,
Bruno Ghisi

Making your ME application looks even better

Posted by brunogh on January 27, 2008 at 06:52 AM | Permalink | Comments (2)

If you think that the most difficult part in writing a Java ME application is make a good looking GUI, you come to the right place. In an old post, I have mention that there are some frameworks/libraries that can help you creating a great GUI in Canvas (MIDP). So, I was googling when I found some interesting lists of projects that could facilitates that. I have not tested all of those projects yet, but, please, feel free to try and report your impressions in this post ;) Most of them are open source, but some have both an open source and a commercial license or just a commercial... Some of them also provide more things, not only GUI stuff...

From http://j2me.ngphone.com/opensource/ui.htm (take a look in this website, there are other lists of nice open source projects):

Others (commercial):

Just setted up a wiki page about it to be used for future references.

Finally, do not forget the Netbeans Mobility Pack specific MIDP components - login screen, splash screen, wait screen, file browser, pim browser, sms composer, table item,... - that are freely available for you. Also, be sure that the target mobile device(s) of you app does not implement JSR 226 (Scalable 2D Vector Graphics API for J2METM), otherwise you could make a beautiful stuff with SVG. Keep an eye in the future with JavaFX Script, could you imagine it running in your device?!

Cheers,
Bruno Ghisi

JSR 82 brainstoming with Sean O'Sullivan

Posted by brunogh on January 20, 2008 at 09:23 AM | Permalink | Comments (2)

Hello!

This is my first entry in 2008 and I wish an amazing year for everybody!

Sean O'Sullivan, the CTO of Rococo Software, is going to present a session called "Past, Present and Future of JSR 82 (Java Bluetooth APIs)" in Mobile & Embedded Developer Days. Don't miss that, registration is still open! If you, unfortunately, won't be able to travel to California and be in the event, check the live broadcast as well.

He lovely gave us an email interview/preview... here we go:

Short Bio

As the CTO of Rococo, Sean drives the company's technical strategy and vision. Background is in middleware and distributed systems. From a technical perspective, his interests are distributed systems, embedded software, and the space where the web meets the plain old telephony system.

Rococo Story

Rococo was founded in 2000, and began exploring potential product applications in the (then new) Mobile Java arena. Focused on Java and Bluetooth at the end of 2000, and then applied for and was accepted as members of the JSR82 Expert Group. We then helped work on defining JSR82 in the standards group, following the JCP process, while in parallel, we worked on creating a set of tools that supported the standard, as well as our own OEM, licence-able version of the standard.

Our short set of milestones since then:

Mar 02: Launched our Bluetooth Simulator on the same day the JSR82 standard was completed at Java World
Jun 02: Released our Linux DevKit
Q4 02: Launched our Technology Licensing Kit (TLK) - OEM source-code product for companies wishing to add JSR82 support to their devices.
Q1 2003: First commercial deal for our TLK with Ericsson Technology Licensing (a big deal for us - ETL was then the leading Bluetooth Stack Provider in the world!)
Q3 2003: Licensed TLK to Aplix to include JSR82 in their Java Virtual Machine - another big deal for us, due to their penetration in the mobile handset industry
Q3 2005: Licensed to Esmertec to include JSR82 in their Java Virtual Machine - another key milestone, demonstrating growing acceptance for JSR82 in the Java Virtual Machine business, and JSR becoming a requirement in mid-range handsets
2006-2007: Large scale deployments of Rococo's JSR82 technology via our licensing deals, sees our software ship on Motorola, Sony Ericsson and other handsets. Shipments grow to over 100 million units.
2008: Rococo now investing more in JSR82 technology, porting to new platforms, and proposing potential follow-on standards to JSR82

Why Bluetooth? Why Java?

Bluetooth:
When we analysed the technology back in 2000, we very much liked it's potential ubiquity. By virtue of its design goals, and the vision of the SIG, Bluetooth was always intended to be a short-range wireless standard that could be in many, many devices "close to us" : phones, sensors, set top boxes, home gateways, cars, watches etc. We thought this was very exciting, and had the potential to unleash a significant wave of innovation for applications and services that work "around you" - in the home, in the car, amongst "your stuff". I think we're only really seeing that come to pass now in 2008. And if you look at the new stuff in Bluetooth (low power and high bandwidth in UWB), I think we'll see some fantastic applications arrive in the shops over the next 12-18 months.

Java:
With Java - we bought its potential as an application delivery and execution platform that could go "anywhere". We studied it, and - even accepting the potential limits of the "write once run everywhere" vision, we believed it would be one of the only standards-based platform technologies to really penetrate devices, machines, consumer electronics.

We thought the combination of both technologies was potentially a great fit. And so the focus on JSR82 was natural for us, and has been a niche in terms of focus, but a good niche! :-)

What do you think about possible improvements into the current JSR 82?

There are many areas in which JSR82 could be improved. To be fair to it - it was originally designed to provide some basic, core APIs for Bluetooth in Java, and to quite an extent, it slavishly followed the existing Bluetooth Stack functionality, and stayed away from trying to ad ease-of-use, or higher level abstractions for developers etc. In a way - this was a good thing - it didn't try to do too much - it just focused on getting an initial, functional and useful set of APIs delivered and adopted in the market. That's now happened, and it's time to take a look at what else could be added or provided as enhancements to the core standard. I think there are potentially three main areas for consideration:

1) Admin/housekeeping/helper classes
2) APIs for common application areas
3) New APIs to expose some of the new functionality coming available with the new capabilities in Bluetooth (UWB, ULP, NFC etc)

In the first case, for example, as you have done with the Marge project, you have provided some really useful ease-of-use abstractions for common things that most developers need to do when using JSR82. These are exactly the kinds of higher level services that might be appropriate in a new version of the standard, or in a follow-on standard that builds on JSR82.

In the second case, I think there's scope for some common APIs to cover, for example, gaming (scoreboard management, player join and leave, in-game communication,) medical (APIs for sensing, storing, sharing specific health care data acquired by a local device), automotive (OSGi integration plus other common automotive specific APIs) and metering. These are just some of our thoughts - I'm sure other people can suggest some other compelling application-specific APIs, which could be defined and significantly lower the bar for new application development in these areas.

Finally, it's definitely time to take a good look at what the Ultra Low Power (ULP ) and Ultra WideBand (UWB) developments in Bluetooth could mean for application developers. With these capabilities, we're seeing Bluetooth move into Set Top Boxes, Machine-2-Machine (M2M) and sensor-based areas, among others. It's like that we could define new APIs that enable developers to take maximum advantage of the new capabilities becoming available in Bluetooth, and now is the time to start planning and defining those APIs.

How do you see the future of Java/Bluetooth integration and JSR 82?

Right now - we're pleased with the extent of the deployment of JSR82, primarily in phones. Rococo also has seen its implementation used in well over 100 million phones to date.

We're now beginning to see it also being used in these new areas: M2M communication, Set Top Boxes and Home Gateways, and in medical applications and in the car. I think the potential for the standard, and any follow-on, is very strong, as the number of devices that will have both Bluetooth and Java on-board is only going one way : up! :-) Any time both technologies are present of the same device, there's a pretty strong case for including JSR82. If you look at the general market dynamics for Java (especially mobile Java) and for Bluetooth, I think it's clear we're only at the early stages of the potential deployment and usage of the Java/Bluetooth standard.

You are going to present a very interesting session in Developer Days, how will be that? What your audience can expect?

Yes - I'm still writing my slides at the minute - so ask me later! :-)

Seriously: we were delighted to be accepted to give a talk at the conference - it's a brilliant line up of talks over the few days. We're going to just cover some background to JSR82, to explain a little bit of history to the standard, and then talk about where JSR82 might go down the line. I'll probably cover some thoughts on what's good and what needs improvement in the standard, and maybe mention Android if there's time. As I say - ask me later :-)

Anything else you may want to say?

Thanks for the opportunity to say a few words. Your blog is always excellent - and we're fans of the work you guys have been doing with Marge!


Wow!!! Great content! Don't forget to keep an eye in Rococo's Weblog too.

Cheers,
Bruno Ghisi



Developing OpenOffice.org Extensions in Java!

Posted by brunogh on December 06, 2007 at 06:17 PM | Permalink | Comments (6)

Hello guys!

It's Friday! It's already December! What a great day to write about OpenOffice.org, which is lovely abbreviated as OOo. A lot of people have asked me about how mOOo Impress Controller was built. I am not too old yet - getting older this Sunday :) - but I have some stories to tell.

In the begining of this year, I was at fisl 8.0 (International Free Software Forum)*, which is one of the biggest open source Latin America conferences and happens in the south of Brazil. If you like to talk about software, open source, Linux, culture, meet people, etc, etc, etc you should be there once! The 8th edition was definitely very special, I have met a lot of nice people, including people from Mobile & Embedded Community and Louis Suarez Potts. Please, froze this part, because we will get back here later, but now I have to start a new paragraph. As you can see, this post looks like that crazy movies that goes forward and reward, starts from the end... yeah, and this entry really starts from the end, if you have looked in the RSS description, I have written "You can develop extensions for your OpenOffice.org suite... with Java! Wow! There is a huge community around it, plugins to make your life easy, good documentation... so, what are you waiting for?!"... don't worry, we will get there.

At that time of fisl 8.0, I had a very experimental demo running on Eclipse. The demo was made of two applications written in Java: a mobile (Java ME/MIDP) and a desktop (Java SE) one. The mobile was able to communicate, over Bluetooth, with the desktop side and the both used a XML protocol to interact. So, the mobile was able to navigate through the desktop file system, filtering for all the Impress OOo presentations that was being found. Also, the mobile was able to send a request to start a presentation file and after started, it was able to control the presentation, advancing and going back in the slides. It was something like that, but, as you guys know Murphy's Law, things are not always perfect and I can guarantee things get worse when you deal with demo applications. Anyway, the demo was not completely integrated with OOo, it was a just a demo invoking OOo Api. So, regarding what I have said in the last paragraph, I have met Louis and he was the guy that has gave the motivation to create a real OOo extension, after he has explained more about what was that, how Java would help that and son on.

After the event, Lucas Torri and I have completely rewritten that demo as an Add-On extension, which later was called mOOo Impress Controller. So, we are now in the main part of this entry: you can easily create OOo extensions in Java. I said easily! There are plugins for Eclipse and for Netbeans IDE (help localizing it to your language). Basically, to put any of those plugins working, you just need to install an OOo SDK and also have an OOo suite or any other compatible installed, for example, StarOffice. Just be careful with the versions to keep things working fine. Get started now! Here it goes very useful links:

Go ahead! Make something that looks like your way! Automate any task that you always wanted in your suite! Make something different! Let me know!!!

Have a great weekend!

Bruno Ghisi


* Call for Papers for fisl 9.0 are already open and goes until 20th of December. The event will be on April, 17-19 in Porto Alegre, Rio Grande do Sul, Brazil.

SDN update and Mobility resources

Posted by brunogh on November 09, 2007 at 05:14 PM | Permalink | Comments (0)

Hi, this is just good news! SDN (Sun Developer Network) got a new front page look and structure. What a great job! I also enjoyed to know that hCalendar microformats are being used in the Sun Tech Days navigation link, as they describe in the SDN Program News weblog.

According to Matt Thompson, in an email to Aaron Houston, fowarded to Java Champions list,


"Rather than just a redesign, the team responsible (consisting of a team led by Jill Welch and our SDN content team, joined with the .SUN org, and software mktg org) created a model for us to be able to continue to evolve this site to meet the needs of both Sun's traditional developer base and the new developers we are trying to attract as we move forward.

Next steps:
This is only the first step. Over the next 12 months we are planning on integrating more community infrastructure underneath SDN (thus enabling better community engagement, community contributions, discussions, etc.)".


Wow! Great start! If you are starting in the Java world or if you are already a developer, SDN is definitly a good place to find great content and get involved! Keep an eye in the videos, blogs, articles, tips... also, check the Mobility Topics in SDN! ;)

So here is the second part of the title, if you are also looking for Java ME, do not forget to explore Mobile & Embedded Community, there are great open source projects (if you got an idea of project, you can host on it or you can also link your project, if it is hosted in another place), podcasts, forums, blogs... and we do have a wiki with a lot of nice content, and specially one for the ME Application Developers Project, which contains interesting applications, take a look in how they were made! In addition, recently, I have made some updates in the JSR 82 wiki page and it can be a nice place if you want to start with Java/Bluetooth. So, you can contribute with us in the way you want, maybe in the forums, improving the current wiki, helping in the projects... we are looking foward it!

This post was all about community! Simple!


Have a great weekend!
Bruno Ghisi



Call for Papers for Java M&E Developer Days is ending!

Posted by brunogh on October 18, 2007 at 03:18 PM | Permalink | Comments (2)

As it was announced in Terrence Barr's Blog before, Mobile & Embedded Community is hosting the first Java Mobile & Embedded Developer Days Conference. The Call for Papers will end on 31, October. There are few days left, so don't miss the time!

Fill the form below and submit your ideas to submissions@developerdays.dev.java.net.

Subject Line: <Presentation format> - <Title>

Title: <insert your title here>
Format: <technical session, panel, lightening talk, poster presentation, hands-on talk>
Target Audience: <Intermediate or Advanced> 
Abstract: <keep it short - we all have other jobs ;-)>
Bio: <short biography of the speaker. Web pages, blogs, past speaking, etc>

Check some suggestions and other stuff in the Developers Day wiki page. Also, there is a nice podcast about the conference, and recently, some Community Stars have made a round table podcast and have talked a little about it too.

Go now!

Cheers,
Bruno Ghisi

10 points around JavaFX

Posted by brunogh on October 11, 2007 at 02:52 PM | Permalink | Comments (9)

I did not have time to post about some news I got around JavaFX before, due to many things I've been doing in the last weeks. Now is the time! I have attended, weeks ago, to a conference call with some Java Champions and Sun people. It was a really great discussion and there are some points that I want to share. Here is the list of them in bullet form:
  • JavaFX Script and Consumer JRE (or Consumer Release or, now, Project Hamburg) improve experiences and moves attention to client-side. Keep an eye in Chet Haase's Blog for more around Consumer JRE.
  • As an advantage against others (Silverlight, Flash, etc), JavaFX Script has the Java plataform (scalability, reliability, portability... and, do not forget, a huge community).
  • JavaFX Script will be community-driven as an open source project (check OpenJFX Community, JavaFX Compiler) and it means, in some way, no company controlling it alone.
  • JavaFX Script runtime can be standalone, Java Web Start or Applet.
  • Sun is working in an authoring tool (WYSIWYG) for designers and content authors.
  • Sun is working in improvements in the actual Netbeans plugin for developers.
  • A lot of stuff will be available for the first quarter of 2008.
  • JavaFX Mobile will support MIDP (Mobile Information Device Profile) on CDC (Connected Device Configuration). You will be able to run JavaFX Script, existing Midlets as well as CDC apps. (Hey, I want to talk about it. Looks pretty weird MIDP on CDC at first sight, but, remember, Midlets have the biggest percentual in the market now and you need to keep supporting the existing applications).
  • There is a JavaFX Mobile emulator internally at Sun that they are playing with.
  • JavaFX Mobile developer phones and emulators will be available fairly early in the new year.
Also, take a look in the Champion Yakov Fain post about the conference call too. Thanks Aaron Houston for organizing it. He have posted, in the Java Champions page, a JavaFX presentation from Sun Tech Days (Boston) and one from Midwest Java Tech Day. Good stuff!

Do not miss the next chapters around JavaFX, looks that Santa Claus will keep the gifts for the next year! :)

Thanks,
Bruno Ghisi

JustJava 2007 Goes Mobile

Posted by brunogh on October 05, 2007 at 07:54 PM | Permalink | Comments (1)

Hello everybody! I have just came back from JustJava 2007 in São Paulo! JustJava is a Brazilian event created by SouJava, 6 years ago. It is a pretty nice event and developers come from all around the country to share their experiences in all the different Java areas. It is definitely a good place to learn and meet new people. This year we also got something really special there: a Java ME track! Thanks to Mauricio Leal and all the other guys for the efforts in order to make it possible!

What I can say is that the event was great! And the ME track too! We got great speakers talking about a lot of different mobile subjects and also great project authors interacting with people, like Floggy team. One thing that I have noticed was that there were a lot of developers interested in ME during the sessions, which is fantastic! It looks that we are growing fast and fast! Another cool stuff was the JustJava mobile application, people could easily install it in a stand and quickly check the sessions timetable! Neto Marin is working on it to publish here in Mobile & Embedded Community as an open source project. In the end of the day, after the sessions, we also got Muvucas, which was an informal conversation with a group of people talking about interesting subjects in different rooms. So nice!

Lucas Torri and I have presented a direct and objective session about Bluetooth, JSR 82 and Project Marge. We have used mOOo Impress Controller to control our OpenOffice.org Impress presentation with the mobile, while being aware of the time that was running. Basically, mOOo IC is a Swing Impress Add-On (desktop) and a Java ME client (mobile) that communicates over Bluetooth to change slides (I can talk about it and OOo extensions in another post). In the end of our session, we have showed the Giant Blue Pong demo! Remember Atari Pong Game? Yeah, something like it! You definitely do not need those new video games to have fun with Bluetooth controllers... all you need is Java! We have "made" (it is not finished and probably never will, it is a demo!) a Java SE game and a Java ME application to control the pad in the game. So, we have projected the game in the screen (and it became so BIGGG!) and invited two guys in the auditorium to play against each other using the two mobiles, each guy was controlling a pad. It was really funny to see people participating! In the end of the game we gave some t-shirts and Netbeans CDs (thanks Sun Brazil for that), so nobody lose. There is a video in portuguese, made in the end of the first day by Robison Brito, that shows we playing it. The game was not working perfect at the time the video was made, we have fixed some bugs and accelerated the ball movements after that, but you can get a picture of what was the Giant Blue Pong. I've posted, above, a photo during the session (Eduardo Guerra, "MundoJava" magazine editor is in the left playing with the mobile :) ).

giantbluepong.JPG


Unfortunately, I could not stay in the event until the last day (Friday), which is bad, because there were nice sessions that I would like to attend... but I came back earlier for a good reason: my graduation! It will be tomorrow! So, my next post will be as a new grad :) Thanks for all the people I have met in JustJava 2007! You guys rock! JustJava 2007 was awesome! Congrats for everybody that helped to organize it!

Have a great weekend!

Bruno Ghisi



My First FX Bluetooth App

Posted by brunogh on September 11, 2007 at 07:21 PM | Permalink | Comments (13)

Hey! Today I felt a desire to create something with JavaFX Script and Bluetooth. If you are not familiar with JavaFX, JavaFX Script and so on, take a look in a new and very good Joshua Marinacci's post about it.

I have created an application that allows you to inquiry for devices that are with Bluetooth turned on. It is pretty simple in terms of UI (user interface) and functionality, but the goal here is to show a little of JavaFX Script working with Java.

Here is what you need in this tutorial:

Insert the Bluetooth USB Adpater in your computer, start Netbeans and create a JavaFX project (File->New Project... and select JavaFX and then JavaFX Application), add the two jars in the project classpath and paste the following BTInquiryFX.fx code (note in the code that Marge is used just to start an inquiry - passing an InquiryListener - and to cancel it).

BTInquiryFX.fx


import javafx.ui.*;
import java.lang.*;

import javax.bluetooth.RemoteDevice;
import javax.bluetooth.DeviceClass;
import javax.bluetooth.DiscoveryAgent;

import net.java.dev.marge.inquiry.DeviceDiscoverer;
import net.java.dev.marge.inquiry.InquiryListener;

    class Model {
        attribute inquiryListener: InquiryListener;
        attribute foundDevices : RemoteDevice[];
        attribute inquiryBtnEnabled : Boolean;
        attribute cancelBtnEnabled : Boolean;
    }

    var model = Model {
        var: self
        inquiryBtnEnabled : true
        cancelBtnEnabled : false
        inquiryListener : new InquiryListener() {
                    operation deviceDiscovered(device: RemoteDevice, deviceClass: DeviceClass) {
                        insert device as last into self.foundDevices; 
                    }

                    operation inquiryCompleted(devices: RemoteDevice[]) {
                        self.inquiryBtnEnabled = true;
                        self.cancelBtnEnabled = false;
                    }

                    operation inquiryError() {
                        self.foundDevices = null;
                        MessageDialog {
                            title: "Error"
                            message: "Inquiry Error"
                            visible: true
                        }
                        self.inquiryBtnEnabled = true;
                        self.cancelBtnEnabled = false;
                    }
            }
    };

    Frame {
            title: "BTInquiryFX"
            width: 400
            height: 200
            resizable: false
            content: BorderPanel {
                top: Label {
                    text: "Found Devices:"
                    }
                center: ListBox {
                     cells: bind foreach (device in model.foundDevices)
                        ListCell {
                                text: "{device.getFriendlyName(false)} - {device.getBluetoothAddress()}"
                        }
                }
                bottom: FlowPanel {
                    content:
                        [Button {
                             text: "Inquiry"
                             enabled : bind model.inquiryBtnEnabled
                             action: operation() {
                                DeviceDiscoverer.getInstance().startInquiry(DiscoveryAgent.GIAC, model.inquiryListener);
                                model.foundDevices = null;
                                model.inquiryBtnEnabled = false;
                                model.cancelBtnEnabled = true;
                             }
                        }, Button {
                             text: "Cancel"
                             enabled : bind model.cancelBtnEnabled
                             action: operation() {
                                DeviceDiscoverer.getInstance().cancelInquiry();
                                model.inquiryBtnEnabled = true;
                                model.cancelBtnEnabled = false;
                             }
                        }]
                }
            }
            visible: true
        };

Screenshots

Then... run it! Here is what we got...

btinquiryfx1.png

and after the inquiry is completed...

btinquiryfx2.png

my mobile was found! My mobile runs Java too!!! ;)


PS: Learn more about JavaFX Script in Project OpenJFX. You can find good tutorials, fresh releases, plugins for Eclipse and Netbeans, a lot of good support, demo applications... Try it now!


Cheers,

Bruno Ghisi

JSR 82 is not only for mobiles!

Posted by brunogh on September 04, 2007 at 04:59 AM | Permalink | Comments (13)

How could you create Java SE Bluetooth applications, since JSR 82 (Java Apis for Bluetooth) was made thinking in Java ME? In this entry, I am going to explain some aspects around it and also give some tips in order to you start doing Bluetooth desktop applications. In addition, we are going to talk a little about the GCF (Generic Connection Framework).

JSR 82 (Java Apis for Bluetooth) uses GCF, which is an extensible framework intended to support all kind of connections. GCF was defined in CLDC (Connected Limited Device Configuration) 1.0 and CLDC is a usual Java ME configuration for mobile phones. CLDC does not specify the actual supported network protocols or mandate implementations of any specific networking protocols, they are made at the profile level, such as, for example, MIDP (Mobile Information Device Profile). Read this C. Enrique Ortiz's article in order to get more information about GCF.

GCF does not only works in CLDC, it can run in CDC (Connected Device Configuration) - differing from CLDC, CDC requires two protocols to be implemented: File access and Datagram capability, and profiles will extend others - and it is also provided to the Java SE platform as an optional package with JSR 197 (Generic Connection Framework Optional Package for the J2SETM Platform), which is derivated from CLDC 1.1 and mandates a minimum of protocols: Socket, HTTP, File and Datagram. Having GCF in Java SE means that you can use JSR 82 to make compliant desktop applications, you will just need a JSR 82 implementation for that in your classpath. There is a lot of them for different OS (operating system) that runs in different Bluetooth stacks, but I recommend you to try some open source ones:

  • Bluecove, which runs over Windows (WIDCOMM, BlueSoleil and Microsoft Bluetooth stack found in Windows XP SP2 and newer) and [updated] at the moment it is not JSR-82 certified implementation (has not passed in all the TCK tests, take a look in Vlad's comment in this entry for more explanation) [updated], but they also have plans to extend it to Linux. Take a look in a cool interview about this project here.
  • Avetana, which has a open source version that runs over Linux (BlueZ stack). Lucas Torri used Avetana on the experiments that he have posted.

So, after you got a JSR 82 implementation, you will need a USB Bluetooth dongle - if your desktop does not have a Bluetooth hardware support, because a lot of notebooks are coming with it - and then you can start coding and creating applications that use your desktop, such as, for example, something to communicate with your mobile, remote controllers and so on. Also, Project Marge has a framework on the top of JSR 82 that facilitates a lot of Bluetooth stuff and it is compatible with Java SE. My final advice is that Rococo has a 100% Java free simulator (for non commercial use), called Impronto Simulator. You can use it to test your Java SE Bluetooth code in a simulated environment, it is quite cool before deploying. Take a try doing something and sent me your feedback! ;)

Have a great week!

Bruno Ghisi



What's coming in NetBeans Mobility Pack 6.0?

Posted by brunogh on August 07, 2007 at 10:59 AM | Permalink | Comments (4)

Hi all! I've downloaded Netbeans IDE 6.0 M10 - M10 is the last milestone for feature development - last weekend to take a new look in the Mobility Pack 6.0 that is coming. The Mobility Pack 6.0 will be now part of the Standard and Full version of Netbeans, you do not need to install it anymore, just if you get the Basic version. Netbeans 6.0 is planned to be available in the end of the year.

So, let's talk about the news around Mobility Pack 6.0. We are definitely going to have a lot of improvements that will make ME developers even more happy! Some of things that I have noticed and tried:

  • A lot of change in UI (User Interface) stuff in order to improve usability, like in the Projects Window you will not only see the packages, but now you will see things divided into Source Package, Resources, Project Configuration.
  • Project Configuration Management was improved, so now it is easy to add Configurations and manipulate them, in order to, for example, have different deploys for your application and easily make them directly in the Projects Window.
  • Mobility Deployment Manager was upgraded to allow you to create several instances of each deployment type - such as File Copy, FTP (File Transfer Protocol) and new types that were inserted - and then associate any of these instances to a Project Configuration.
  • Web Services API (JSR 172) stub compiler was rewritten and now have support for Base64 type, it is able to parse documentation from methods and has a better generated code.
  • One of my favorites... Visual Mobile Designer (VMD) 2 is coming! In this new version, we will have a lot of improvements in terms of functionality and usability, some of them are: its UI has changed a lot (this new style looks better!), an Analyzer that shows what commands and/or resources were no longer being used and shows a MIDP-1.0 compliancy checker. You have new things in your Pallete too:
    • In Flow area (easier to make and understand MIDlets flow graphically with these new stuff!): Entry Point (represents a method), Call Point (represents a code fragment), If (flow forking based on a specific condition), Switch (similar to If but you can specify Switch Case on it), List Action (you can put in a Command, so the List containing the Command will have a method to process the List Element that was selected, by default, all the List have a Command like that, but needs to be setted true to be showed), Previous Screen Action (an icon that represents to go to the previous screen, really useful for Back Buttons).
    • Displayables area (Four new Custom Components): FileBrowser (is a List) for the JSR 75 FileConnection Optional Package, PIMBrowser (is a List) for the JSR 75 PIM Optional Package, LoginScreen (is a Canvas) for authentication purposes with username and password, SMSComposer (is a Canvas) for sending SMS (Short Message Service) easily. You can fin them at $NETBEANS6_HOME/mobility8/modules/ext/nb_midp_components.jar.
  • One of the biggest features was the merge of CDC and CLDC in a unique Mobility Pack (CDC development got a lot of evolution because of that too).
  • Game developers will like that: in this new pack we are going to have the Game Builder, which is a visual editing support for MIDP 2.0 Game API including creation and editing of Sprites, TiledLayers and their arrangement into Scenes.


For more around this fresh version, go to Mobility Milestones in Netbeans Wiki, there are detailed pages for each milestone, and VMD has its own page as well. Got curious? Download Netbeans 6.0 M10 and have a look yourself about what is coming (note that some things are still getting more stable)! Netbeans 6.0 will have a lot of other improvements, including in the code editor, which was one of the biggest complains about users of other IDEs. Great! Have a nice week!

Thanks,

Bruno Ghisi

Elucidating JavaFX (Including JavaFX Mobile)

Posted by brunogh on July 29, 2007 at 09:57 PM | Permalink | Comments (6)

I have seen a lot of people asking questions about JavaFX Mobile and I decided to make a short directly entry about it and about JavaFX as a whole.

JavaFX was announced some months ago at JavaOne 2007. As you have heard, "it is a new family of Sun products based on Java technology and targeted at the high impact, rich content market". The first two products are JavaFX Script and JavaFX Mobile.

JavaFX Script "is a highly productive scripting language that enables content developers to create rich media and content for deployment on Java environments". JavaFX Script comes from Chris Oliver's project, which, initially, was called F3 (Form Follows Function). Take a look at Project OpenJFX for more information around JavaFX Script, you can find good tutorials, demos and discussions. You definitely should get started with JavaFX Script. I did and what I can say is that it is pretty cool! You can get Netbeans IDE and install the plugins or you can also try it a little bit with the JavaFXPad. I loved the way you can experiment the language with this last tool, because everything you type into the code editor is displayed in the canvas, so interactive! Another cool stuff is that JavaFX puglin for NetBeans 6.0 will come with a JavaFXPad integration! Also, to get started, do not forget to take a look in the language reference.

JavaFX Mobile "is a complete, pre-integrated software system for advanced mobile devices designed to enable developers to author rich, high-impact content and network-based services". JavaFX Mobile was built around open source technologies (Linux and Java) and comes from SavaJe Mobile Plataform, which was presented at JavaOne 2006 in the Jasper S20 phone.

So, how things get connected? JavaFX Mobile will run JavaFX applications, as well as keep supporting Java applications. In the near future, OEMs (Original Equipment Manufacturer) will be able to put JavaFX Mobile into their devices (and set-top boxes, Blu-ray Disc...). According to Jacob Lehrbaum in a recent podcast (posted here at Mobile & Embedded Community previously), Sun is working with handset manufacturers and mobile operators partners to deliver the first devices with JavaFX Mobile until the end of 2008. A lot of details around it are still being worked, but the fact is that we have good news to keep looking in Java for the mobile future: we are working to reduce fragmentation - MSA is coming in this way, take a look in my second post for more information about it - and JavaFX product family is coming to help us creating rich content and improving user experiences. Let's stay tuned, things are very very promising!

Thanks,

Bruno Ghisi



Does "High-level x Low-level APIs in MIDP" Mean "Portability x Usability"?!

Posted by brunogh on June 29, 2007 at 12:37 PM | Permalink | Comments (2)

In MIDP (Mobile Information Device Profile), all UI (user interface) classes can be found in the javax.microedition.lcdui package. This package basically contains two sets of APIs: high-level and low-level. So, what is the difference between them? How do you choose and balance the advantages and disadvantages of these two groups? Here we go...

If you are looking for portability, which means having a single version of your application and have it running in all devices, you can use the high-level API. But why? All the components across this API depend on the mobile implementation, so they are rendered by the mobile, which is good, because you will not have to care about things like how to handle different screens sizes, for example. On the other hand, you will have less control over the UI, which means you can not do what you want, the mobile will give the last word in terms of UI and your application could look different in the variety of mobiles. Anyway, this API is huge and you can find a lot of components (subclasses of the Screen and Item classes): Alert, ChoiceGroup, CustomItem (an abstract class for customizable items, since MIDP 2.0), DateField, Form, Gauge, ImageItem, List, Spacer (since MIDP 2.0), StringItem, TextBox and TextField. Now, in MIDP 3.0, we will get some other components (and a lot of improvements and useful classes too): FileSelector, that has a screen to allows the user to select a file from file system; and TabbedPane, which allows the navigation between screens by selecting the corresponding tab. But what about the second group?

The major low-level API classes are Canvas and Graphics, they allow the developer to have greater control over the UI, which is good for usability, because you can make things as your wish and as your application users wishes. However, the developer has the responsibility for drawing and rendering the display and that means problems in portability. Probably if you use low-level APIs and want that your application could run in a lot of devices, you will need to port it (or get all mobile characteristics at runtime and render things dynamically), which means adapt it for specific devices or family of them. Do not forget, all of these work because we have a lot of differences between devices and things are not always pretty easy (not now, yet, but things are getting really really better ;) ). But, where does this low-level API apply? Mobile Games use Canvas (or extending GameCanvas in a concrete class, after MIDP 2.0)! However, low-level API is not only about games, I have seen some cool applications using it and good frameworks providing extra portable (in some way) components as well.

More and more, people do not only want something that works, they want things working, but with the additional of a great visual stuff (and portable applications as well)! That is why, in Java ME, we are having a lot of improvements in this aspect over the years, for example, nowadays, with JSR 226 (Scalable 2D Vector Graphics API for J2ME). If you want to understand more about all this Java ME UI context, including UI in other profiles and how could be the future with SVG, 3D Graphics and so on, I do recommend you to read this recent Bruce Hopkins' article. I forgot to tell, you can mix both high-level and low-level APIs in your application! Forget, you can mix whatever you want to make your application look even better... and portable too! That is the way! Have a good weekend!


Thanks,

Bruno Ghisi



Would You Like to Receive a Content Over Bluetooth? Yes / No

Posted by brunogh on June 12, 2007 at 12:10 PM | Permalink | Comments (8)

Let is talk about mobile marketing, I mean, a special kind of it. This is not a marketing text, because I am not a marketing guy, but I have to say that I like this kind of subject in some way and I will try to show some things in this entry. So, mobile marketing is meant to describe marketing on, or with, a mobile device, for example, a mobile phone. This concept has started to become so popular because of SMS (Short Message Service), a long time ago. Today we are watching a lot of new possibilities of doing mobile marketing and one, that got popular, is over (via) Bluetooth, also called Bluetooth marketing. Bluetooth marketing is a kind of proximity marketing due to its distance limitation. Take a look in my first post to get introduced about Bluetooth technology.

But what is Bluetooth marketing? Let me see... imagine some kind of content-management system with a Bluetooth distribution function that detects Bluetooth enabled devices in an area and tries to send - it could use different algorithms to choose someone - a content to them, for example, an image, video, text, music, Java application and so on. I mean try to send, because the device owner needs to accept the incoming stuff, it is permission-based (although in some cases you do not want to be invaded like that, because you are not interesting in it) and, in addition, is free of charge. So, this concept of Bluetooth marketing has started around 2003 in Europe, but just some time ago we got some big companies campaigns doing it. Anyway, forget about dates and cases, imagine all this stuff in malls, stores, museums, events, sport stadiums, airports, these are some examples of places where they are doing it now. In addition, there is a, at least, different and interesting, point of view of using Bluetooth for marketing purposes, I was reading Mike Foley's blog recently and he has posted something about green marketing and Bluetooth.

You are probably thinking about the combination of broadcasting and media content which, a lot of times, results on spam. I will not discuss in this entry if Bluetooth marketing is a special kind of spam (Bluespam) or not, but I think there are right ways of using it and wrong ones, so each case is a particularly case. There are some scenarios and situations that it could apply. One fact is that, in a recent study, on March of this year, the Bluetooth SIG has announced that Bluetooth continues to grow in popularity with an average of 81% of consumers aware of the technology. It is really good to know that common people already know what is Bluetooth and this can be considered a relevant data for people that want to create new services based on Bluetooth.

So, let is bring all these ideas to our java world! You can create softwares that uses its concepts - in a right way - with JSR 82 (Java Apis for Bluetooth) using, particularly, the APIs for OBEX - which is in javax.obex package - for sending content (take a look in the end of my second post that introduces OBEX) and the core Bluetooth API - which is in javax.bluetooth package - for inquiring for devices and searching for services on these found devices. After that, you can put it to run in your mobile or notebook. But why would you do something like that? Imagine a scenario that you got a lecture as a speaker, you probably will not want to make your listeners get a pen to write down your contact information in the end of it, it can be much more simple in this case! You can just tell them to turn on the Bluetooth in their devices and, then, they will be asked to receive your business card (vCard) during the presentation. I was just kidding, but in this case it could be a good idea! Another one, I have been in some computing events that, in the end of a presentation, the speaker used to throw some t-shirts for the public. I never get one, I am thin and not so tall, I do not want to fight for a t-shirt! I definitly would prefer to turn on my Bluetooth and try to get it by lucky, maybe by a Java Bluetooth Promo System. So, any other good uses of Bluetooth marketing concepts or services using Bluetooth (do not need to be related to marketing)? Post them! I want to see a brainstorming of crazy ones! Have a good week!


Cheers,

Bruno Ghisi



Globalize y[our] mobile applications!

Posted by brunogh on June 04, 2007 at 01:33 PM | Permalink | Comments (7)

I have heard the phrase "Mobile is global" in a JavaOne 2007 session video and I have started thinking about it. You can find deep meanings for the word global, but, for me, a good one is crossing cultures! So, have you ever heard about software internationalization (i18n)? Do you know what software localization (l10n) is? Before I try to explain these concepts, just imagine how many countries, languages, writing systems, hourly spindles, calendar systems and money types we have in our world. I can guarantee, it is a lot!

In simple words, i18n is closely related to the structure that a software can has - for example, isolating resources such as messages (externalizing strings), and access them at runtime - to allow it to be localized. Localize a software is make it adapted to the desired locale (country/region and language). But, do not think that l10n is made just by translating words, documents or changing images. It can be much more complex, because, remember, you will be dealing with another culture, language and conviction! As I have seen before, sometimes, because of that, user interfaces needs to be rebuild as well. Think about it, for example:

if(!you are Arabian){
Think about the Arabic writing system, as far as I know, they write from the right to the left.
} else {
Think about the American writing system, they write from the left to the right.
}
Is not so different to you? Got the global view?!

So, let is get our focus to mobile development and talk a little bit about JSR 238, which is also called Mobile Internationalization API (MIA). Before this specification, internationalization in MIDP/CLDC used to be much more difficult. MIDP did not have things to treat it well and people used to create its own classes to handle this stuff. According to JSR 238, this API provides culturally correct data formatting (by javax.microedition.global.Formatter class), sorting of text strings (by javax.microedition.global.StringComparator class) and application resource processing (by javax.microedition.global.ResourceManager class). That is a great start in order to globalize our MIDlets!

The basic idea of MIA to help the resource processing is having one or more resource files - also called bundles, it is like a property files in Java SE - in a binary format for each locale that you want inside the jar file structure, like /global/{locale}/{Resourcefile}.res (note that locale follows the format en-US, cs-CZ, etc). If you want a common resource to be accessed, just put it in the global folder directly, like /global/Common.res. After that, the locale can be loaded and you will get the structure to access the strings and images at runtime by code. Download the JSR 238 RI, it contains a ResourceMaker to create the binary file. For the sorting, if you want to use it, you will have to implement a compare method that is avaiable to manage two strings. And finally, for the formatter, you can use the Formatter class that will adapt the dates, times, numbers, and currencies for the desired locale. You probably now want more code details, so take a look in our community demo box, there is three cool MIDlets examples of these things!

But, all these stuff does not make sense at all, because JSR 238 is an optional package. So, how could we make global applications if a lot of devices does not support MIA? I got the solution! Guess what?! Another point to MSA (take look in my last post to get familiar with it), it is mandatory on its main group! So, life will be much easier after we got a lot of umbrella-compliant mobiles, we are walking for that! Do not forget to try JSR 238! Thanks!


See you,

Bruno Ghisi



Thanks MSA! ...No more OBEX (Bluetooth) Self-Made Implementations!

Posted by brunogh on May 21, 2007 at 09:24 PM | Permalink | Comments (6)

Fragmentation in Java mobile environment is something well known by developers. It is caused most of because the variety that exists between devices characteristics and its implementations.

Trying to help in this way, in middle of 2003, the JTWI (Java Technology for Wireless Industry) was launched, defined by the JSR 185. The objective of JTWI was trying to make things more standardized and compatible, specifying technologies that must be included in all JTWI-compliant devices. But since that, the number of mobiles have increased a lot, as well as the number of JSRs. So, in the end of last year, the final release of MSA (Mobile Service Architecture) was published, in order to advance one more step in this natural evolution.

MSA is for CLDC and it is defined by the JSR 248 (take a look in MSA Advanced, defined by JSR 249, if you want to know about CDC). It can be compared as a kind of JTWI evolution, made in order to maximize the number of applications that can run on a handset, because it will make available a set of JSRs (familiar, updated and new ones). MSA specifies two plataforms that a MSA-compliant device can support: MSA or MSA subset, the subset was made for devices with less power. The both contains mandatory and conditionally mandatory JSRs. The mandatories should always be implemented in MSA-compliant devices, although the conditional mandatories would depends on the availability of the technology in the respective device such as, for example, Bluetooth (for JSR 82) and, maybe, GPS (for JSR 179).

The figure below shows the MSA structure:




MSA helps the set of its JSRs, because it makes some clarifications on them (reducing ambiguities, so manufacturers will make less misunderstood too!). In addition, it obligates an umbrella of APIs and technologies, so this can minimize the fragmentation problem as well and then, consequently, helps the whole mobile technology! But you are probably thinking that we are almost in the end of this entry and you have not understood why the name OBEX (Object exchange) is in the title, let me explain (I swear it will be the last paragraph)!

The JSR 82 (Java APIs for Bluetooth) is divided in two main packages: the core Bluetooth API and the APIs for OBEX. OBEX is a communication protocol based on request/response - to simplify, try to imagine something more elaborated, like HTTP - that allows to exchange objects, such as files, images, calendar entries (vCalendar), business cards (vCard), among other things. It can runs over Infrared, TCP or RFCOMM, which the last type is used for Bluetooth. The fact is that there are still a lot of devices with Bluetooth that did not implement the OBEX package, because it used to be optional in JSR 82. In these past conditions, if you would like to make an application that uses OBEX and runs in a lot of devices, you certainly would implement it by yourself using RFCOMM, manipulating bit by bit or trying to find an open source implementation to use. So, a directly benefit of MSA in JSR 82 - if the device supports the Bluetooth wireless technology, because this JSR is conditional mandatory in MSA - is that it will be mandatory to implement OBEX package as well. Got it? That means that you will be able to easily build applications that exchange cards, send images to printings, among other ones that use complex communication stuff, without having to care about low level implementations! Java ME plataform is so cool! We are growing! ;)


See you,

Bruno Ghisi



I'd like a Java Application With Bluetooth Sauce, Please.

Posted by brunogh on May 16, 2007 at 08:20 PM | Permalink | Comments (8)

Hi, I am new here! As my first post, I would like to talk about something that I love, which is wireless technologies. Because this term is so huge and there are a lot of different types for different kind of situations, let's get focused on a emergent one called Bluetooth.

Bluetooth is a low power, low cost and short-range technology that is inteded to replace the cables connecting fixed devices and portables. One of the big advantages of Bluetooth, in my opinion, is that it has a Special Interest Group (SIG) that drives the development of the technology and brings it to the market. Until here, nothing new, it looks like another group, but let me explain... the SIG is composed of more than 8,000 member companies that works in different areas, such as telecommunications, computing, automotive, music, apparel, industrial automation and network industries! As you can see, there are a lot of people interested in making Bluetooth grows!

I think that the first time I saw Bluetooth was in a mobile store, I have asked the salesman about something that later got known as mobile phone headset. Have you ever tried to get your hands free (have fun with this youtube advertisement video)? But, after that, a lot of things were invented (and still being!) using Bluetooth, mixing not only new products, but also services. Very briefly, let me just say what has appeared in the media and is in my mind now: cars that you can talk on the phone while is driving, a jacket that allows you to change a music while you are climbing a mountain, sunglasses with hands free for mobiles, watches that synchronizes with the cellphone, a pen that you can write in a whiteboard while it is being transfered to your pc (looks really cool for brainstorming meetings, forget about taking a shot of the whiteboard with your cam!), a bus/train system that tells you when you have arrived in your destination, companies doing Bluetooth marketing (also called as mobile marketing over Bluetooth, we will come back about it in another post), public services available for everyone with a Bluetooth enabled (city maps, museum guides and son on), multiplayer games and some weeks ago, was officially released the first television with Bluetooth! Wow!

There is one more thing I can not forget, in the end of the last year, the Bluetooth SIG has announced that was sold more than one billion of Bluetooth enabled device, most of then mobiles. Can you imagine this number? It is bigger than the number of computers in the world!

With all these facts, that is the part that Java appears! We got a JSR for Bluetooth! It is the JSR 82, which is also called JABWT, Java Apis for Bluetooth. We can talk a little bit more about it in another post! Hope you liked it! ;)

See you,

Bruno Ghisi





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds