asdsad

by ramesh12 » Mon, 22 Feb 2010 15:07:26 GMT


Sponsored Links
 asdsd

--



Other Threads

1. Say halo to all members

Hi All,

I am a new member in this group. Currently, i am working on the
Android framework layer.

Now focusing on Bluetooth, Wifi and GPS level. If you guys are
interested in this topic, we should discuss further.

Thanks


Regards



Sam

-- 

2. Zephyr HxM BT and HTC Legend Bluetooth issues

Hi,

I have bought myself a Zephyr HxM BT device and I am trying to listen to its
messages in a simple application.
I have paired the Device to my HTC Legend and I can establish a connection
but everytime I call the read() or available() method on my InputStream I
get a NullPointerException.

Has anyone succeed in getting information off this device?  I have tried to
establish the connection by reflection on the "createRfcommSocket" method
but this throws a MethodNotFound Exception on my device.
Any help would be appreciated.
Thanks,
Dennis

below is my Listener class:
HXMListener(BluetoothDevice device) {
            this.device = device;
            this.open = true;
            if (device != null){
                createSocket(device);
            }
        }

        /**
         * @param device
         */
        private void createSocket(BluetoothDevice device) {
            try {

                socket = device.createRfcommSocketToServiceRecord(HXM_UUID);
                in = socket.getInputStream();
                /**
                 * BluetoothDevice hxm =
                 * BluetoothAdapter.getDefaultAdapter().getRemoteDevice
                 * ("00:07:80:97:62:a3"); Method m =
                 * hxm.getClass().getMethod("createRfcommSocket", new
                 * Class[]{int.class}); socket =
(BluetoothSocket)m.invoke(hxm,
                 * Integer.valueOf(1)); socket.connect();
                 */
            } catch (IOException e) {
                Log.d(TAG,
                        "Unable to open Socket streams for " + socket);
                writeToHXMFile("Unable to open Socket streams for " +
socket);
                // tidy up the socket
                try {
                    if (socket != null) {
                        socket.close();
                    }
                } catch (IOException e1) {
                    Log.d(TAG,
                            "Unable to close Socket for " + socket);
                }
            }
        }

        private void connectionFailed() {
            Log.d(TAG, "Connection Failed");
            writeToHXMFile("Connection Failed");
        }

        /*
         * (non-Javadoc)
         *
         * @see java.lang.Runnable#run()
         */
        @Override
        public void run() {
            boolean connected = false;
            while (!connected && open) {
                try {
                    socket.connect();
                    connected = true;
                } catch (IOException e) {
                    connectionFailed();
                    Log.d(TAG, "Failed", e);
                    // Close the socket
                    try {
                        socket.close();
                    } catch (IOException e2) {
                        Log.d(
                                TAG,
                                "unable to close() "
                                        + "socket during connection failure"
                                        ,e);
                    }

                }
                finally{
                    createSocket(device);

                }
            }
            byte[] b = new byte[1];
            while(open){
                writeToHXMFile("Listening...");
                try {
//                    //FIXME in.available keeps throwing a null pointer
//                    while(open && in.available()<0){
//                        Thread.currentThread();
//                        Thread.sleep(10);
////                        Log.d(TAG, "Waiting...");
//                    }
                    //now we have the message lets read it to this
                    String s = "";
//                    while(open && in.available()>0){
                        s+= in.read(b);
//                    }
                    //now we have read it all
                    Log.d(TAG+"_INPUT", s);
                    writeToHXMFile("COMPLETE "+ s);
                } catch (IOException e) {
                    Log.d(TAG, "IO Exception ", e);
                    writeToHXMFile("IO Excep" + e);
                    open = false;

                }


            }
            try {
                in.close();
                socket.close();
            } catch (IOException e) {
                in = null;
                socket = null;
            }
        }



        private void writeToHXMFile(final String string) {
            runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    bluetoothMessageBox.setText(string);
                    Log.d("SOCKET MESSAGE",string);
                }
            });

        }

        public void close() {
            open = false;
        }

    }

-- 

3. Sending UDP's

4. Trace flow of method call on android for implementing for JVMTI

5. Ad Hoc/Netfilter

6. Regarding language support

7. HTC Hero Error Downgrade