Monday, March 15, 2010

Display GIF image using J2me

Peace upon you,
displaying gif is a common problem in j2me if u search about it in google u will find many classes used to encode gif but it's simply as shown in this code:

player = Manager.createPlayer(getClass().getResourceAsStream("/Image path"),
"image/gif");
player.realize();

if ((vidc = (VideoControl) player.getControl("VideoControl")) != null) {
videoItem = (Item) vidc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, null);
//vidc.setDisplaySize(240, 140);
}

append(videoItem);
midlet.getDisplay().setCurrent(this);
while (true) {
player.start();
}

Enjoy
Happy coding;-)

Thursday, August 2, 2007

Connecting mobile to PC

Peace upon you
There are many ways to establish connection between mobile and Personal computer. First you can use AT commands but my essay focus on using Bluetooth to establishing the connection. J2SE used in personal computers does not support the JSR-82 API by default. There are many frameworks that allow you to work with BlueTooth with J2SE. Framewoks such as :

ROCOCO Software's Bluetooth development tools and technology licensing kit use standard Java application programming interfaces (APIs) for Bluetooth wireless technology (JABWT or JSR82). I think it isn't free but you can download non-commerical use demo.

avetanaBluetooth is a JSR-82 implementation provides Bluetooth functionalities to Java software in a standardized way. avetanaBluetooth is available for Windows (98SE - XP SP2), MacOS X, Linux and WM
2003SE - WM5 plattforms. but it is'nt free you can download demo that will expire after 14 days, it Force you to connect to limited number of PC because you must specify the BT addresses of PC that you want to connect to.


BlueCove is a LGPL licensed JSR-82 implementation on Java Standard Edition (J2SE) that currently interfaces with the Microsoft Bluetooth stack. Originally developed by Intel Research and currently maintained by volunteers . you can download src code from
http://bluecove.sourceforge.net/ . I used before at VIDETA. it's based on Microsoft Bluetooth stack, To know is your BT supported by windows bluetooth stack check this list http://support.microsoft.com/default.aspx?kbid=841803
If you found your BT in the list, Congratulation you are lucky so consult the BT vendor's website to know how to configure your BT to be adapted by windows BT stack. In my VIDETA case I use Toshiba Corporation bluetooth specification 2.0, 1.2, 1.1 but I must configure it to be supported by windows bluetooth stack because the default is Widcomm stack and BlueCove didn't support it.
hopefully I cleared something to you.

Salam

Tuesday, July 31, 2007

dialogue 2ejabshan guy hehe :D‎

Peace upon you
Since three weeks Amr Eissa was send me cool message, When I read it -every time- I laugh a lot and a lot and still read this when I open my inbox. so I presenting this message that perhaps make you happy.This message contain a conversation between female reporter (who work at foreign Newspaper) and egyptian guy(mowatin ma67ooon).

A foreign Newspaper wants to publish a report about the life inEgypt,So they send a female reporter to interview the commoncitizen in Egypt..when she arrives at Cairo..she picks a randomguy, and starts her interview.
Reporter: Hi

Egyptian: We 3alkom el salam ya 2otta

Reporter: Do you speak English?
Egyptian: Berfect

Reporter: Do you mind if i interview u?
Egyptian: No, i dont have a mind

Reporter: What's your name?
Egyptian: Taha

Reporter: Sex?
Taha: I love it
Reporter: Oh no, i meant male or female?
Taha (yelling): what do you sink?
Reporter: It's just for the sake of the report..never mind...male....
Taha: yas male..and i can brove it any time you want

Reporter: No,thanks,I'll take you for your word...so..how do you find life here in Egypt?
Taha: Egybt..very nice cantry..nice wezar..nice food..byramidz

Reporter: oh well..beside the weather and the pyramids..what else do you like in your country?
Taha: Byramids,nice wezar,nice food

Reporter: Ok..let's move on..what do you do?
Taha: I am very well, sank you

Reporter: No, I mean do you have a job?
Taha (looking around him and whispering): Jobat?..no i dont have any(jobat)..lessa mastaba7nash..do you have a (job) with you?..we can esmoke it in my car..dont warry about bolice

Reporter: Oh my god, DO YOU WORK?
Taha: Yas yas..Taxi drivar

Reporter: What do you think about the traffic problem in egypt?
Taha: Very big broblem..very much cars..you see?..but za guvurment is trying to make it bettar..zey did za circle street and za me7war street..and zey make all streets one way so if you go..you cant comeback..niahahaha3

Reporter: What about the economic problems in Egypt?
Taha: I do not undurstand what u say

Reporter: I mean..how do u deal with money problems in Egypt?
Taha: No NO NO..Egybt very rich cantry...we have alot of cotton..alot of water..and we have byramidz

Reporter: So do you make a lot of money?
Taha: No no.. it is not legal to make money..one frend i know make money at home..and he go to brizon..if you make money at home..you can only give it to za banzeena man..zey take any money

Reporter: let me rephrase..since Egypt is a rich country.. do you have a lot of money?
Taha: me?! ..Not alot..but I eat and drink Al7amdulelah?

Reporter: Then where does all the money go?
Taha: Guvurment

Reporter: And what does the government do with the money?
Taha: Zey Build circle street,me7war street and make all streets one way

Reporter: well, Ok...Do you vote?
Taha: What duz zat mean?

Reporter: Do you choose your president
Taha: Mubarak?
Reporter: yes
Taha(nervously): i didnt give my voice..but if i was..i will give him my voice
Reporter: Why him?
Taha: Because he was an airoblane in za war..he waz za leadar airoblane Reporter: But there are no wars right now
Taha: But if we have war..you see?...we know we will have a very good airoblane in it

Reporter: what about the last 26 years ?
Taha: I got marry..and have 3ala2 and Amira..and drive taxi

Reporter: No, i meant what did Mubarak do for Egypt in the last 26 years
Taha: He build circle street, me7war street and make all streets one way

Reporter: Thank you very much for your time Mr. Taha
Taha: No broblem,only 10 bound

Reporter: I never said i will pay you for this
Taha: Ok..just give me the (job) then..we smoke, and make head
Reporter: Grrrrrrrr
Taha: ok ok..need a Taxi?

copied,,

Wednesday, July 25, 2007

Are you Addicted to Blogging ?


peace upon you
This cool test that test your addiction to Blogging.
My result is:


Do you think i'm Addicted?
Any way try it, http://mingle2.com/
salam

Friday, June 29, 2007

J2ME BlueTooth programming(Episode 2)

Peace upon you,
I apology about delaying but I'm sure you forgive me this delay because you know I'm really so busy. In first episode we got introduction about BT and also knew BT Features.Ok let's dig into more details. In this episode after reading it, you should knew terminology of Bluetooth Network Topology , Bluetooth Communication Types , Java BlueTooth API (JABWT) and The Bluetooth protocol stack.


Bluetooth Network Topology
When two or more Bluetooth-enabled devices come within range and establish a connection, a personal area network is formed. A personal area network can either be a piconet or a scatternet.

  • Piconet: Is a single master and up to seven slaves. No matter what kind Bluetooth devices are involved (whether they are phones, access points, PDAs,laptops, headsets, etc.) The master of the piconet is the one that initiates the connection. The device that accepts the connection automatically becomes the slave. Master/slave roles are not predefined; so if a piconet exists between a laptop and a PDA, either device could be the master or the slave.

  • Scatternet: Is a scatternet is essentially a chain of piconets. A scatternet is formed when the slave of a piconet also become the master of its own piconet. Figure 1.0 show the Piconet and Scatternet.


Bluetooth Communication Types

There are three types of communication protocols defined inside Bluetooth technology:

    • OBEX: The "Object Exchange" communication Protocol is used to Exchange Physical data such as Files, images, and so on in binary Format.

    • L2CAP: The "Logical Link Control and Adaptation Protocol" used to send Packets between host and client.

    • RFCOM: The "Radio Frequency COMMunication" is very easy and not Complicated .it is used to stream simple data.


Java Bluetooth API (JABWT)

Sun Java has introduced the Bluetooth JSR82 API package.
http://jcp.org/aboutJava/communityprocess/final/jsr082/ The JSR82 API has capability to provide all three kinds of communications: Obex, L2CAP, or RFCOMM.

  1. javax.bluetooth The core Bluetooth API.

  2. javax.obex The Object Exchange (OBEX) API.


*So what is the JSR-82?

The JSR-82 is the official Java Bluetooth API, which was standardized by Motorola and the following companies in the Java Community Process

  • Sun Microsystems.

  • IBM.

  • Nokia.

  • Sony Ericsson.

  • Symbian.

You can find a list of commercially available JSR-82 device
http://www.javabluetooth.com/jsr82devices.html on our JSR-82 Devices page.



The Bluetooth protocol stack

What's the purpose of the Bluetooth stack? The stack is the piece of software (and firmware) that controls your Bluetooth device. Figure 2 details the protocol stack.



  • The bottom layer of the stack is the HCI, the Host Controller Interface. This layer is literally the interface between the host (your computer or Hardware) and the controller (the Bluetooth device). As you can see, all other layers go through the HCI.
  • The layer above the HCI is L2CAP, the Logical Link Controller Adaptation Protocol. This layer acts as the data multiplexer for all other layers.
  • The next layer is BNEP, the Bluetooth Network Encapsulation Protocol. Using BNEP, you can run other networking protocols, such as IP, TCP, and UDP, over Bluetooth.
  • RFCOMM is known as the virtual serial port protocol because it allows a Bluetooth device to simulate the functions of a serial port.
  • The OBEX protocol layer is implemented above the RFCOMM layer and is useful when you want to transfer data as an object, such as files.
  • SDP is the Service Discovery Protocol layer, which is used whenever you want to find services on a remote Bluetooth device.
  • The final two layers, AVCTP and AVDTP are used for the control and distribution of audio and video over Bluetooth. AVCTP and AVDTP are relatively new additions to the Bluetooth protocol; they are used when you want to control the functions of a media player or if you want stream audio in stereo.

In the next episode I will expose to you simple chat program between two mobiles.Be wiz us

salam

J2ME Bluetooth programming (Episode 2)



Peace upon you,



I apology about delaying but I'm sure you forgive me this delay because you know I'm really so busy. In first episode we got introduction about BT and also knew BT Features.Ok let's dig into more details. In this episode after reading it, you should knew terminology of Bluetooth Network Topology , Bluetooth Communication Types and Java BlueTooth API (JABWT)




Bluetooth Network Topology



When two or more Bluetooth-enabled devices come within range and establish a connection, a personal area network is formed. A personal area network can either be a piconet or a scatternet.






  • Piconet: Is a single master and up to seven slaves. No matter what kind Bluetooth devices are involved (whether they are phones, access points, PDAs,laptops, headsets, etc.) The master of the piconet is the one that initiates the connection. The device that accepts the connection automatically becomes the slave. Master/slave roles are not predefined; so if a piconet exists between a laptop and a PDA, either device could be the master or the slave.



  • Scatternet: Is a scatternet is essentially a chain of piconets. A scatternet is formed when the slave of a piconet also become the master of its own piconet.