×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    11

    Unhappy J2ME client to C# server over Bluetooth?

    Hiya, as part of a project I am currently involved in I have to create a Server-Client application for the desktop and Series 60 devices. The Client should be able to remotely control various PC applications (such as iTunes, WMP, Powerpoint.. etc) over a Bluetooth connection to the Server.

    Now when I started the project I chose to write the client in J2ME MIDP 2.0 and the server in C# (as I was already familiar with it, and I could easily make function calls to Windows applications).

    Now I have pretty much completed the GUI and server side coding, except for the Bluetooth connection itself. However, after looking at my options, it seems as though I have a choice of L2CAP or RFCOMM on the MIDP side.. Of which I can see no way to connect to a C# server. :S

    I have looked around online for any guide related to J2ME -> C# communication over Bluetooth and not really found anything.. I was wondering if any of you could help??

  2. #2
    Registered User
    Join Date
    Apr 2006
    Posts
    11

    Re: J2ME client to C# server over Bluetooth?

    Can anyone provide a snippet of some J2ME code as a client connecting to a server running on a PC... And state any assumptions made?

  3. #3
    Registered User
    Join Date
    Oct 2003
    Posts
    24

    Re: J2ME client to C# server over Bluetooth?

    I have the same problem,
    I'll tanks who can help us

  4. #4
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,104
    Additionally, I do not understand your problem(s). Probably one reason for no answer and no tutorial for this yet.

    In J2ME you use the Java Bluetooth API (JSR-82) and in C# you use a Bluetooth API (either Microsoft, Widcomm, Bluesolei or another one). All you do is Bluetooth communication. This is the bridge between J2ME and C#. You have to learn how to access Bluetooth from J2ME and how to access the Bluetooth software stack you love from C#. Then you have to learn how Bluetooth inquiry (discover) processes work and you are done:
    J2ME <-> JSR-82 <-> Bluetooth link <-> Microsoft or another stack <-> C#

  5. #5
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    105

    Re: J2ME client to C# server over Bluetooth?

    Well, there are tutorials for this and i've gotten a bluetooth pc to connect to a bluetooth mobile phone but not Java and C#. If you want a jsr-82 implementation on the PC, try http://www.benhui.net This jsr-82 implementation will work for a java server and a j2me client.

    Be warned that the jsr-82 on your phone may not be implemented properly and can cause some strange problems.

    There are sample applications there to download

  6. #6
    Registered User
    Join Date
    Apr 2006
    Posts
    11

    Re: J2ME client to C# server over Bluetooth?

    Ok I guess I have figured out some things, I wanted to quickly and simply connect the two apps together, so I found out about the: "DiscoveryAgent.selectService();" commands, taking in UUID, security lvl, and a master inputs. This assumes I know the server side information as well, which I will, so then what do I have to do? Do I use the string returned by this to open the connection?? and then just send away??

    Also if ANYONE can help me implementing a really quick "rough and ready" C# server (or provide me a bit of code to get me going..) that would be REALLY great

  7. #7
    Registered User
    Join Date
    Oct 2003
    Posts
    24

    Re: J2ME client to C# server over Bluetooth?

    i already write a client j2me app that use spp and java server using benhui tutorial (http://www.benhui.net/ tutorials)
    and worsk well

    For c# server (or client) i see that here (http://franson.com/bluetools/ ) there are good sdk for write .net bt application.

    Now im away from work and come back around 26April and i cant work on it, anyway maybe u can do it easly using bluetools

  8. #8
    Registered User
    Join Date
    Apr 2006
    Posts
    11

    Re: J2ME client to C# server over Bluetooth?

    Ok im not really understanding this, so I was wondering if one of you could point me in the right direction?

    My code is now publicly available as a .java OR as a netbeans mobility project rar'd up here:

    .JAVA

    RAR'D Netbeans Prj

  9. #9
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    105

    Re: J2ME client to C# server over Bluetooth?

    Heh, I looked at your code and thats your entire source code! why dont you just isolate your bluetooth connection functions and post that instead so other people wouldn't have to sort through all that code

  10. #10
    Registered User
    Join Date
    Apr 2006
    Posts
    11

    Re: J2ME client to C# server over Bluetooth?

    well the code i have is here: (But a bit more spread out than this..) I get errors like "cannot find symbol "uuid" : class uuid " and "non-static method method selectService cannot be referenced from a static context"

    I think this is less to do with the code and more to do with the placement of the code, hence why i put the full .java in there.. If u can open the project in Netbeans it becomes VERY clear where the problem lies.

    Code:
    import javax.bluetooth.*;
    
    private static final String uuidString = "00112233445566778899AABBCCDDEEFF";
    
        /** This method initializes UI of the application.
         */
        private void initialize() {
            UUID uuid = new uuid(uuidString, false);
            String url = DiscoveryAgent.selectService(uuid, NOAUTHENTICATE_NOENCRYPT, false);
            
            getDisplay().setCurrent(get_LoadingScreen());
            // Insert post-init code here
        }

  11. #11
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    105

    Re: J2ME client to C# server over Bluetooth?

    Okay cool, anyway i've had similar problems before with the UUID anyway. I don't have time right now to load up netbeans and try to look at it (coz work ends in 30 mins :P). But I can offer some advice.

    #1 "cannot find symbol "uuid" : class uuid " - I used to have problems initializing UUID's so just try to make sure they are initialized in a test application with ntohing else but UUID's and see if that compiles.. I fixed it by changing the order of my imports (If i remember right)

    #2 "non-static method method selectService cannot be referenced from a static context" - Try making your uuid non-static because it does not have to be static and maybe that would help.. im not sure about any of this btw but come monday ill try and have a look at it

  12. #12
    Registered User
    Join Date
    Apr 2006
    Posts
    11

    Re: J2ME client to C# server over Bluetooth?

    Ok, fantastic, I'll try some of the suggested things out and have a general play around, see what happens..

    Thanks!

  13. #13
    Registered User
    Join Date
    Apr 2006
    Posts
    11

    Re: J2ME client to C# server over Bluetooth?

    Ok some new code has been uploaded which is now pretty much complete except for the initial connection code, so if someone could take a look in netbeans or another IDE that would be great...

    Please check out the .java OR package links below to download.

  14. #14
    Registered User
    Join Date
    Apr 2006
    Posts
    11

    Re: J2ME client to C# server over Bluetooth?

    Any chance anyone could take a peek today?

  15. #15
    Registered User
    Join Date
    May 2006
    Posts
    1

    Re: J2ME client to C# server over Bluetooth?

    hey
    Can u plz show the code of the C# server, i have almost the same application but i couldnt find any help how to write a server using c#
    thx

Page 1 of 2 12 LastLast

Similar Threads

  1. J2ME Client to receive WAP Push
    By fluffy_bunny in forum Mobile Java General
    Replies: 7
    Last Post: 2009-02-01, 15:27
  2. server client architecture
    By Onib in forum Symbian C++
    Replies: 4
    Last Post: 2005-05-25, 07:50
  3. Bluetooth Programming in J2ME with 6600
    By wing0custom in forum Bluetooth Technology
    Replies: 1
    Last Post: 2004-02-06, 18:45
  4. Test GPRS modem with Microsoft SQL Server 2000
    By chadahamat2704 in forum Digital Rights Management & Content Downloading
    Replies: 0
    Last Post: 2003-03-13, 07:36
  5. Replies: 0
    Last Post: 2003-03-03, 12:46

Posting Permissions

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