×

Discussion Board

Results 1 to 15 of 15
  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    14

    PC suite functionlity in Java Program

    Hi,

    My name is Jelle and I am a software developer student, for my thesis I have to design software that is able to detect Bluetooth devices (mobile phones actually) and be able to show new incoming text messages (sms). Of course that’s only the beginning of my thesis, but I have to start somewhere. I found all these things in the Nokia PC suit software and I was wondering how it works. Which codes are used to detect the Bluetooth devices, which are used to detect and incoming sms?

    The application I’m making will be sold with a mobile phone and I was hoping I could be a Nokia, that’s why I turn to this forum for help! You can contact me here or on jelle.vanregenmortel@verhaert.com or on jelle.vanregenmortel@student.denayer.wenk.be , hopefuly someone can help me!

    Thanks in advance,

    Jelle

  2. #2
    Nokia Developer Expert
    Join Date
    May 2007
    Location
    Mexico D.F
    Posts
    351

    Re: PC suite functionlity in Java Program

    Hello and wish you good luck in your project.
    Let me just tell you that you won't be able to do what you plan using java technology.

    For such a task you will have to rely either in symbian or any other native technology or you can even use AT commands. Reason: it's not possible to retrieve normal incoming messages using J2ME due to the sandbox model it works with.
    :Ruben

  3. #3
    Registered User
    Join Date
    Sep 2009
    Posts
    14

    Re: PC suite functionlity in Java Program

    Quote Originally Posted by rdrincon View Post
    Hello and wish you good luck in your project.
    Let me just tell you that you won't be able to do what you plan using java technology.

    For such a task you will have to rely either in symbian or any other native technology or you can even use AT commands. Reason: it's not possible to retrieve normal incoming messages using J2ME due to the sandbox model it works with.
    Hi Ruben,

    Thank you very much for the reply. When I started my project, I used AT commands, just like you say. Sending a text message was easy and worked right away but receiving (eg reading inbox or get a warning when you have a new message) didn't. These are the AT commands I used :

    AT+CMGL="ALL"
    AT+CMGR="ALL"
    AT+CMGL="REC READ"
    ...

    All the commands returned with the 'error' message. I send the commands in a hyper terminal, like I said the sending commands worked just fine but the reading ones did not. Got any suggestions? If the AT commands work, it would be a solution to my problem and I wouldn't need the Java program...

    Thanks in advance,

    Jelle

  4. #4
    Nokia Developer Expert
    Join Date
    May 2007
    Location
    Mexico D.F
    Posts
    351

    Re: PC suite functionlity in Java Program

    I have used this framework in the past and worked fine after some adjustments.

    http://www.daimi.au.dk/~jones/sms/report/report.html

    Also, please let us know what is the phone you are using.
    Last edited by rdrincon; 2009-09-07 at 15:17.
    :Ruben

  5. #5
    Registered User
    Join Date
    Sep 2009
    Posts
    14

    Re: PC suite functionlity in Java Program

    Quote Originally Posted by rdrincon View Post
    I have used this framework in the past and worked fine after some adjustments.

    http://www.daimi.au.dk/~jones/sms/report/report.html

    Also, please let us know what is the phone you are using.
    Hi Ruben,

    The phone I'm using is the Nokia 2600 (Classic I think, although it is the latest model). I read the site you gave me and tried the TestComm function, I got some building errors and contacted Mr. Thomsen. I did found in one of the libraries that he also uses the same AT command as I'am so I have my doubts it is gonna work...

    Greetings Jelle

  6. #6
    Registered User
    Join Date
    Sep 2009
    Posts
    14

    Re: PC suite functionlity in Java Program

    Hi Ruben (and everyone else who wants to help...)

    Have you found the AT Commands for the nokia 2600? I've tryed to make the program work, the one that was in your url but it uses the same AT's as I do sending with hyperterminal so that's no good for me...

    Thanks in advance!

    Jelle

  7. #7
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,105
    Quote Originally Posted by jelle_vr View Post
    StreamConnection conn = (StreamConnection)Connector.open("btspp://001FDFC57E65:1");
    Is the Dial-up Networking (DUN) profile on RFComm channel 1? Please do a complete device and service search for 0x1103L instead.
    Quote Originally Posted by jelle_vr View Post
    out.write("AT\r\n".getBytes());
    Please, do not issue a CR LN but only a CR. This is explained in ITU-T V.250 which explains the AT command basics. Furthermore, in Java land you should .flush() whenever you want to send something of a Output, regardless whether it works without flush. Using getBytes() without an encoding is dangerous in Java as the platform encoding is used. This is no problem for J2ME as ISO-8859-1 should be the default, however, in nowadays I recommend to use UTF-8 as it is US-ASCII compatible.

  8. #8
    Registered User
    Join Date
    Sep 2009
    Posts
    14

    Re: PC suite functionlity in Java Program

    Hi Traud,

    Thx for the reply, a few question though :


    Quote Originally Posted by traud View Post
    Is the Dial-up Networking (DUN) profile on RFComm channel 1? Please do a complete device and service search for 0x1103L instead.Please, do not issue a CR LN but only a CR. This is explained in ITU-T V.250 which explains the AT command basics.
    Yeah you're right, I allready did that too (the CR only). I don't know about the DUN being on channel 1, that's all new for me. Should I change the chanel to 0x1103L?

    Like : StreamConnectin conn = (StreamConnection)Connector.open("btspp://001FDFC57E65:0x1103L"); ?

    Quote Originally Posted by traud View Post
    Furthermore, in Java land you should .flush() whenever you want to send something of a Output, regardless whether it works without flush. Using getBytes() without an encoding is dangerous in Java as the platform encoding is used. This is no problem for J2ME as ISO-8859-1 should be the default, however, in nowadays I recommend to use UTF-8 as it is US-ASCII compatible.
    I've tried to use the flush methode, but I can't get it to work, should it be something like :

    out.flush("AT/r"); or something like that, but you can't flush a string so what should it be then?

    Thank you soooo much!

    Greetings Jelle

  9. #9
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,105
    Quote Originally Posted by jelle_vr View Post
    Code:
    StreamConnectin conn = (StreamConnection)Connector.open("btspp://001FDFC57E65:0x1103L");
    That connection URL is not valid, see chapter 10.3 of the JSR-82 specification. 0x1103L is a UUID for a service search which will give you a connection URL and the current RFComm channel number like your 1.

    If you are new to J2ME, MIDlets and Bluetooth, I recommend to start with a book or tutorials rather than code examples as you will have to debug a lot on your own. There are a lot of bugs, tweaks and lessons to be learnt. Bluetooth is complicated. I do not have a good J2ME book at hand right now, however, start with the references of this one for JSR-82 (perhaps your library has its previous edition) or read at least the PDF coming with the specification. If you like to start with tutorials, continue here…
    Quote Originally Posted by jelle_vr View Post
    Code:
    out.flush("AT/r")
    In Java, you fill a stream with the various write methods and after filling that (possible buffered) stream, you issue a simple .flush(). See the API for more details. If you are new to Java, too, I recommend to start again with a book …

    However, all this does not matter, I think. You should check the scope of your thesis as fast as possible and then go up several layers and use exiting libraries.

  10. #10
    Registered User
    Join Date
    Sep 2009
    Posts
    14

    Re: PC suite functionlity in Java Program

    Quote Originally Posted by traud View Post
    Bluetooth is complicated. I do not have a good J2ME book at hand right now, however, start with the references of this one for JSR-82 (perhaps your library has its previous edition) or read at least the PDF coming with the specification.
    I have the JSR-82 book you mention, and I have read it, that is where I got the idea it should be channel one, they used 1 in every example too. I didn't have the package they used so I couldn't compile most of the examples. Also they keep talkin about client and server while I only want the pc to send data and the phone to echo a result (just like the nokia pc suite software). I don't want to install a program on the phone...

    Quote Originally Posted by traud View Post
    In Java, you fill a stream with the various write methods and after filling that (possible buffered) stream, you issue a simple .flush(). See the API for more details. If you are new to Java, too, I recommend to start again with a book …
    I tried :

    out.write("AT\r\n".getBytes());
    out.flush;

    But you advised me not to use getBytes() because of the encoding hazards. Thats why I changed it. I'm not new to programming. I've been programming in C for more then 4 years, and one year in java. You are right about the bluetooth part, that's so new for me. That's why I'm asking for help 'cause this is the final part I have to figure out before I can start developing my program!

    Thanks mate,

    Jelle

  11. #11
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,105
    If you have problems with the book, I recommend to read the PDF coming with the specification.
    – Do you know how to start an inquiry (device search)?
    – Do you know how to start a service search?
    or said differently, if you code psm/channel numbers in JSR-82, you either do something very wrong or you really, really know what you are doing.

    javax.bluetooth.DiscoveryAgent is your friend. For the start, use
    Code:
    UUID uuid = new UUID(0x1103L);
    int security = ServiceRecord.NOAUTHENTICATE_NOENCRYPT;
    boolean master = false;
    LocalDevice local = LocalDevice.getLocalDevice();
    DiscoveryAgent agent = local.getDiscoveryAgent();
    String name = agent.selectService(uuid, security, master);
    StreamConnection connection = (StreamConnection) Connector.open(name);
    OutputStream out = connection.openOutputStream();
    …
    char return = '\r'; // allows to change it anytime
    String command = "AT" + return;
    byte[] b = command.getBytes("UTF-8")
    out.write(b);
    out.flush();
    …
    out.close();
    connection.close();

  12. #12
    Registered User
    Join Date
    Sep 2009
    Posts
    14

    Re: PC suite functionlity in Java Program

    Quote Originally Posted by traud View Post
    If you have problems with the book, I recommend to read the PDF coming with the specification.
    – Do you know how to start an inquiry (device search)?
    – Do you know how to start a service search?
    or said differently, if you code psm/channel numbers in JSR-82, you either do something very wrong or you really, really know what you are doing.

    javax.bluetooth.DiscoveryAgent is your friend. For the start, use
    Code:
    UUID uuid = new UUID(0x1103L);
    int security = ServiceRecord.NOAUTHENTICATE_NOENCRYPT;
    boolean master = false;
    LocalDevice local = LocalDevice.getLocalDevice();
    DiscoveryAgent agent = local.getDiscoveryAgent();
    String name = agent.selectService(uuid, security, master);
    StreamConnection connection = (StreamConnection) Connector.open(name);
    OutputStream out = connection.openOutputStream();
    …
    char return = '\r'; // allows to change it anytime
    String command = "AT" + return;
    byte[] b = command.getBytes("UTF-8")
    out.write(b);
    out.flush();
    …
    out.close();
    connection.close();
    Traud,

    You're a hero, thank you so much, everything works fine now, I finally got 'OK' back, like it is supose to. You were right about the UUID being the problem! Again thank you so much, I hope someday I can return the favor!

    Cheers, Jelle

  13. #13
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,105
    Thanks, but please remember: AT commands are very limited in Nokia land. Near to forgetable. Thanks Nokia.

    If you are new to all of this, I recommend a (real and recent) Sony Ericsson, as you have so many technologies you can choose and explore there, all with a single device.

  14. #14
    Registered User
    Join Date
    Sep 2009
    Posts
    14

    Re: PC suite functionlity in Java Program

    Quote Originally Posted by traud View Post
    Thanks, but please remember: AT commands are very limited in Nokia land. Near to forgetable. Thanks Nokia.

    If you are new to all of this, I recommend a (real and recent) Sony Ericsson, as you have so many technologies you can choose and explore there, all with a single device.
    Yeah so I learned the hard way, I only need to read the inbox and be able to delete messages... Two option not suported with at commands by nokia, although my phone is recent! And again as you say, other devices do not limit them...

    Also I would like to thank you again, you helped me so much and so good!

    Cheers mate, keep up the good work!

  15. #15
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,105
    Code:
    ATE0+CNMI=,2
    should be your friend in Sony Ericsson land.

Similar Threads

  1. An issue with PC Suite and N73 .
    By user0110 in forum PC Suite API and PC Connectivity SDK
    Replies: 2
    Last Post: 2007-09-27, 07:41
  2. N95 and PC Suite
    By lachee in forum General Development Questions
    Replies: 2
    Last Post: 2007-06-15, 22:03
  3. Help required regarding NOKIA N91 & PC SUITE
    By Gemini-Phoenix in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2007-01-12, 18:52
  4. Problem in connecting 7650 and PC Suite...
    By moschous in forum Bluetooth Technology
    Replies: 1
    Last Post: 2003-05-26, 15:54
  5. Problems in PC suite
    By Yoshitaka in forum PC Suite API and PC Connectivity SDK
    Replies: 8
    Last Post: 2003-04-10, 19:48

Posting Permissions

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