Welcome to WiFi-Forum

Go Back   WiFi-Forum - Wi-Fi Discussion Forum > Bluetooth Discussion Forums > BlueTooth Forum
Reply
 
Thread Tools Display Modes
  #1  
Old 05-27-2007, 08:36 AM
mihirdm mihirdm is offline
Junior Member
 
Join Date: May 2007
Location: MUMBAI
Posts: 2
Default Help with Nokia 6600 to computer communication

Hi,
i have developed a code for Nokia 6600 to talk to Computer. the only thing where it get's stuck is the UUID stuff. i am not sure what value to specify in for the UUID and the attribute set while opening the connection to the computer via the Nokia 6600 code.
Code:
public void connect(String s)throws IOException {

        String UUID = new UUID("1101",false).toString();//1101 00112233445566778899AABBCCDDEEFF
        System.out.println("UUID is....."+UUID);
        int discoveryMode = DiscoveryAgent.GIAC; 
        LocalDevice device = null;
        // no paring needed
    
        try {
            device = LocalDevice.getLocalDevice();
            device.setDiscoverable(DiscoveryAgent.GIAC);
            String url = "btspp://localhost:" + UUID + ";name=PCServerCOMM";
            System.out.println("URL is....."+url);
            synchronized (this) 
            {
                notifier = (StreamConnectionNotifier) Connector.open(url);
                servRecord = device.getRecord(notifier);
                System.out.println("SERVRECORD is....."+servRecord);
                StreamConnection conn= notifier.acceptAndOpen();
                DataOutputStream out = conn.openDataOutputStream();
                out.writeUTF(s);
                /*LocalDevice local =  LocalDevice.getLocalDevice();
                DiscoveryAgent agent = local.getDiscoveryAgent();
                String connString = agent.selectService(
                new UUID("1101", false),
                ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false);
                */
                /*try {
                    // Connect to the server and send 'Hello, World'
                   /* StreamConnection conn = (StreamConnection)
                        Connector.open(connString);

                    OutputStream out = conn.openOutputStream();
                    out.write("Hello, World".getBytes());
                    out.close();
                    conn.close();

                    System.out.println("Message sent correctly");
                } catch (IOException e) {
                    System.out.println("IOException: ");
                    System.out.println(e.getMessage());
                }
*/
                
               }

        }
        catch(IOException e) {
            System.out.println("IOException");
        }
        catch(Exception e)    {
            System.out.println("exception of url");
            e.printStackTrace();
        }
    }
}
this is the code on the computer so that the mobile can communicate.
in the constructor of my class.
Code:
System.out.println("Entering Client constructor");
        localDevice = LocalDevice.getLocalDevice();
        discoveryAgent = localDevice.getDiscoveryAgent();
        //System.out.println(localDevice.getRecord().getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,true));
        device = new RemoteDevice[10];
// Starts inquiry for devices in the proximity and waits till the 
//inquiry is completed.
        System.out.println("\nSearching for Devices...\n");
        discoveryAgent.startInquiry(DiscoveryAgent.GIAC,this);
        synchronized(this){
            this.wait();    
        }

//Once the Device inquiry is completed it starts searching for the 
//required service. service search is done with the given uuid. 
//After starting each search it waits for the result. If the
//connectionURL is null, ie, if No service Records obtained, then 
//it continues search in the next device detected.
// server 86b4d249fb8844d6a756ec265dd1f6a3 
// client 86b4d249fb8844d6a756ec265dd1f6a3
        String UUID = new UUID("0003",false).toString();//1101 00112233445566778899AABBCCDDEEFF
        System.out.println("UUID is....."+UUID);        
        String url = "btspp://localhost:" + UUID + ";name=PCServerCOMM";

        int[] attrSet = null;
        UUID[] uuids = new UUID[1];
        //uuids[0] = new UUID("0003",false); //Vid 1001 and Pid 1131.
        //for(int i = 0; i< count;i++) {
            System.out.println("Starting to search services...");
            //int transactionid = discoveryAgent.searchServices(attrSet,uuids,device[i],this);
            //System.out.println("Starting to search services transaction id..."+transactionid);
            //if(transactionid != -1){
                /*StreamConnection connection = getconnection();
                op  = connection.openOutputStream();
                ip  = connection.openInputStream();
                readData();*/
                notifier = (StreamConnectionNotifier) Connector.open(url);
                //servRecord = localDevice.getRecord(notifier);
                //System.out.println("SERVRECORD is....."+servRecord);
                StreamConnection conn= notifier.acceptAndOpen();
                DataInputStream in = conn.openDataInputStream();
                in.readUTF();
                synchronized(this){
                    System.out.println("Starting to wait after searching the service..");
                    this.wait();
                }
u can clearly see that i've tried lot of stuff. pls help at the earliest. thanks a million.
Reply With Quote
Reply


Thread Tools
Display Modes

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Actual Firmware of ALL Nokia GSM's: OCT 05 Henk Loosbroek Nokia Forum 10 12-10-2006 03:01 AM
www.tipcell.com sell: nokia 9500 lcd tipcell alt.cellular.bluetooth 0 03-06-2006 10:44 PM
For Sell The Nokia 3310 $25usd, Nokia 1100 $30usd felixadebayo Nokia Forum 0 01-24-2006 02:10 AM
For Sell The Nokia N90 $180usd, N92 $220usd, N70 $140usd 8800 $140usd felixadebayo Nokia Forum 0 01-24-2006 02:05 AM




All times are GMT -7. The time now is 04:54 AM.

vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd. All Contents Copyright © Wifi-Forum.com