Bluetooth and service discovery

I am trying to establish bluetooth connection between pc and mobile.my pc is server . i am using avelinkBT.jar from www.atinav.com to do bluetooth coding on server side . it is running well till acceptAndOpen() method called by notifier. it waits for client to connect there.So it means service is registered in SDDB and client on mobile can discover it . but when i run client on mobile it discovers device well but fails to discover the service . i am stuck up with this problem for many days . i am using the same uuid on both side . my client side application work well on emulator of wtk2.2.and discovers the service.
hope somebody helps me out.

have you search in the j2me forum???

Similar Messages

  • Bluetooth rfcomm service discovery

    Hi, I�m trying to use the bluetooth vi�s with Labview 7.1. I have a bluet. chip (zeevo) with its bd address but I don�t know the channel associated with the spp service. I used the rfcomm service discovery block but it says my bluet. chip has no services. The same if a put the bd address of a PDA. Running the vi (on the pc) it gives no error with the address but says there are no services, even if I use the examples I found in the example dir of labview. Where is the problem? Thank you. Eli

    Hello Eli,
    Having followed this and other bluetooth related threads, I've had identical problems to yourself. I'm developing bluetooth apps on a Toshiba Laptop with internal bluetooth card. This unfortunately uses Toshiba's own proprietary drivers, and after locating the Q323183 service pack, installation of this only gave me the Bluetooth monitor and did not allow LabVIEW to recognise the internal card. I've a TDK USB adaptor which comes as part of the blu2i development kit, and this has all the correct drivers bundled on the accompanying CD. I installed the Q328183 service pack and then added the BT Monitor exe separately and was immediately able to use the adaptor with LabVIEW.
    I've also had success with the the D-Link DBT-120 USB adaptor w
    hich can run off the same driver and monitor software. As far as the service search is concerned, I've had similar problems as yourself with these adaptors when running a service search as only the address of the adaptor is returned but no services - I think this is down to the fact that the MS drivers don't provide the adaptor with any services, although it is possible to move data between the PC and a PDA (I have an Ipaq 2210 running some LB7.1 PDA apps for this).
    By installing the TDK software suite for that adaptor, I was then able to find the services with a PDA set up to search for these (using Service Search VI).
    Hope this helps.
    Fadenoid

  • Cannot find where the issue is, Bluetooth service discovery

    Hi there,
    I am developing a client/server bluetooth messaging application and seem to have to run into a brick wall. I am able to perform a device discovery, and the client is able to locate the server, however I am not able to locate the service on the server even though the server and the client are both using the same UUID and service name.
    It gets to the point where it displays the status message, "Service search initiated" and then it seems like nothing else happens. I have been staring at the code for days and tried all sorts of tinkering, but have been unable to get it to work.
    The UUID and service name I am using is:
    48dd1cf559bb41009d0686f7862d26a2
    serverand below is the code for my class that I implement the device and services discovery in:
    import javax.microedition.io.*;
    import java.util.*;
    import java.io.*;
    import javax.bluetooth.*;
    public class SearchForServices implements DiscoveryListener
        private MessageClient client;
        private String StrUUID; //UUID of service
        private String nameOfService; // Name of service
        private LocalDevice local; //local device
        //Discovery Agent
        private DiscoveryAgent discover;
        //store list of found devices
        private Vector devicesFound;
        //table of matching services/ device name & service Record
        private Hashtable servicesFound;
        private boolean searchComplete;
        private boolean terminateSearch;
        public SearchForServices(MessageClient client, String uuid, String nameOfService)
            //create the discovery listener and then perform device and services search
            this.client = client;
            this.StrUUID = uuid;
            this.nameOfService = nameOfService;
             //create service search data structure
            this.servicesFound = new Hashtable();
            try
                //get discovery agent
                local = LocalDevice.getLocalDevice();
                discover = local.getDiscoveryAgent();
                //create storage for device search
                devicesFound = new Vector();
                //begin search: first devices, then services
                this.client.modifyStatus("Searching for devices...");
                discover.startInquiry(DiscoveryAgent.GIAC, this);
            catch(Exception e)
                this.client.reportError("Unable to perform search");
        /////////////Methods related to the device search called automatically///
        public void deviceDiscovered(RemoteDevice remote, DeviceClass rank)
            // a matching device is found.Only store if it's a PC or phone
            int highRankDevice = rank.getMajorDeviceClass();
            int lowRankDevice = rank.getMinorDeviceClass();
            //restrict devices
            if((highRankDevice == 0x0100) || (highRankDevice == 0x0200))
                devicesFound.addElement(remote);
                this.client.modifyStatus("Device Found");
            else
                this.client.reportError("Matching device not found");
        private String deviceName(RemoteDevice remote)
            String name = null;
            try
                name = remote.getFriendlyName(false);           
            catch(IOException e)
                this.client.modifyStatus("Unable to get Friendly name");
            return name;
        public void inquiryCompleted(int inquiryMode)
            showInquiryStatus(inquiryMode);
            //update status
            this.client.modifyStatus("Number of devices found: " + devicesFound.size());
            // start searching for services
            this.client.modifyStatus("Service search initiated");
            findServices(devicesFound, this.StrUUID);
        private void showInquiryStatus(int inquiryMode)
            if(inquiryMode == INQUIRY_COMPLETED)
                this.client.modifyStatus("Device Search Completed");
            else if(inquiryMode == INQUIRY_TERMINATED)
                this.client.modifyStatus("Device Search Terminated");
            else if(inquiryMode == INQUIRY_ERROR)
                this.client.modifyStatus("Error searching for devices");
        //service search////
        private void findServices(Vector devFound, String strUuid)
            //Perform search for services that have a matching UUID
            //and also check service name
            UUID[] uuids = new UUID[1]; //holds UUIDs for searching       
            //add the one for the service in question
            uuids[0] = new UUID(strUuid, false);
            //to include search for service name attribute
            int[] attributes = new int[1];
            attributes[0] = 0x100;      
            //carry out service search for each device
            //terminate search
            this.terminateSearch = false;
            RemoteDevice xremote;
            for(int i=0; i < devFound.size(); i++)
                xremote = (RemoteDevice)devFound.elementAt(i);
                findService(xremote, attributes, uuids);
                if(terminateSearch)
                    break;
            //report status
            if(servicesFound.size() > 0)
                this.client.displayServices(servicesFound);
            else
                this.client.reportError("No Matching services found");
        private void findService(RemoteDevice remote, int[] attributes, UUID[] uuid)
            try
                int transaction = this.discover.searchServices(attributes, uuid, remote, this);      
                searchFinished(transaction);
            catch(BluetoothStateException e)
        private void searchFinished(int transaction)
            this.searchComplete = false;
            while(!searchComplete)
                synchronized(this)
                    try
                        this.wait();
                    catch(Exception e)
        //below methods called automatically during a search for devices
        public void servicesDiscovered(int transID, ServiceRecord[] records)
            for(int i=0; i < records.length; i++)
                if(records[i] != null)
                    //get service records name
                    DataElement servNameElem = records.getAttributeValue(0x0100);
    String sName = (String)servNameElem.getValue();
    //terminate search
    this.terminateSearch = true;
    if(sName.equals(this.nameOfService)) //check name
    RemoteDevice rem = records[i].getHostDevice();
    servicesFound.put(deviceName(rem), records[i]); //add to hashtable
    public void serviceSearchCompleted(int transID, int respCode)
    //wake up the waiting thread for this search, enabling the next services
    //search to commence
    this.searchComplete = true;
    synchronized(this)
    this.notifyAll();
    After doing abit of troubleshooting, I realised that somehow the client is not able to locate the service on the Server, but I do not understand why that should be so, because the UUID and service name are matching on both the client and the server. It just beats me, and I would appreciate it if a 2nd pair of eyes could have a look at the code. Maybe there is something that I am missing.
    Thanks, I do appreciate..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi there,
    I tried a few things such as
    1) Changing the UUID for my application, but that didn't make the system work.
    2) I then went on to modify the implementation and use the selectService() method of the bluetooth class, but still without any luck.
    The only way it works, is if I get the server side to display the connection parameters and I manually enter them into the client side to connect. I do not understand why it is not working the automatic way. I have scanned through my code and logic multiple times, and still cannot figure out what the issue is. :(
    Any help would be appreciated...

  • Bluetooth and J2SE?

    Hi
    Sorry if I posted this topic to the wrong group but it seems to match here.
    I would like to prepare quite simple application which searches for active bluetooth devices in range and lists them. I want to develop it for desktop - my laptop in fact so I intend to use J2SE. Main problem is that I do not know where to start and whether or not it is possible (as far as I know under j2me it can be done)?
    Thank you for any help in advance.
    Best regards

    Hello.
    Test this application:
    CLIENT:
    import java.lang.*;
    import java.io.*;
    import java.util.*;
    import javax.microedition.io.*;
    import javax.bluetooth.*;
    * This class shows a simple client application that performs device
    * and service
    * discovery and communicates with a print server to show how the Java
    * API for Bluetooth wireless technology works.
    public class PrintClient implements DiscoveryListener {
         * The DiscoveryAgent for the local Bluetooth device.
        private DiscoveryAgent agent;
         * The max number of service searches that can occur at any one time.
        private int maxServiceSearches = 0;
         * The number of service searches that are presently in progress.
        private int serviceSearchCount;
         * Keeps track of the transaction IDs returned from searchServices.
        private int transactionID[];
         * The service record to a printer service that can print the message
         * provided at the command line.
        private ServiceRecord record;
         * Keeps track of the devices found during an inquiry.
        private Vector deviceList;
         * Creates a PrintClient object and prepares the object for device
         * discovery and service searching.
         * @exception BluetoothStateException if the Bluetooth system could not be
         * initialized
        public PrintClient() throws BluetoothStateException {
             * Retrieve the local Bluetooth device object.
            LocalDevice local = LocalDevice.getLocalDevice();
             * Retrieve the DiscoveryAgent object that allows us to perform device
             * and service discovery.
            agent = local.getDiscoveryAgent();
             * Retrieve the max number of concurrent service searches that can
             * exist at any one time.
            try {
                maxServiceSearches = Integer.parseInt(
                    LocalDevice.getProperty("bluetooth.sd.trans.max"));
            } catch (NumberFormatException e) {
                System.out.println("General Application Error");
                System.out.println("\tNumberFormatException: " + e.getMessage());
            transactionID = new int[maxServiceSearches];
            // Initialize the transaction list
            for (int i = 0; i < maxServiceSearches; i++) {
                transactionID[i] = -1;
            record = null;
            deviceList = new Vector();
         * Adds the transaction table with the transaction ID provided.
         * @param trans the transaction ID to add to the table
        private void addToTransactionTable(int trans) {
            for (int i = 0; i < transactionID.length; i++) {
                if (transactionID[i] == -1) {
                    transactionID[i] = trans;
                    return;
         * Removes the transaction from the transaction ID table.
         * @param trans the transaction ID to delete from the table
        private void removeFromTransactionTable(int trans) {
            for (int i = 0; i < transactionID.length; i++) {
                if (transactionID[i] == trans) {
                    transactionID[i] = -1;
                    return;
         * Completes a service search on each remote device in the list until all
         * devices are searched or until a printer is found that this application
         * can print to.
         * @param devList the list of remote Bluetooth devices to search
         * @return true if a printer service is found; otherwise false if
         * no printer service was found on the devList provided
        private boolean searchServices(RemoteDevice[] devList) {
            UUID[] searchList = new UUID[2];
             * Add the UUID for L2CAP to make sure that the service record
             * found will support L2CAP.  This value is defined in the
             * Bluetooth Assigned Numbers document.
            searchList[0] = new UUID(0x0100);
             * Add the UUID for the printer service that we are going to use to
             * the list of UUIDs to search for. (a fictional printer service UUID)
            searchList[1] = new UUID("11111111111111111111111111111111", false);
             * Start a search on as many devices as the system can support.
            for (int i = 0; i < devList.length; i++) {
    System.out.println("Length = " + devList.length);
                 * If we found a service record for the printer service, then
                 * we can end the search.
                if (record != null) {
    System.out.println("Record is not null");
                    return true;
                try {
    System.out.println("Starting Service Search on " + devList.getBluetoothAddress());
    int trans = agent.searchServices(null, searchList, devList[i],
    this);
    System.out.println("Starting Service Search " + trans);
    addToTransactionTable(trans);
    } catch (BluetoothStateException e) {
    System.out.println("BluetoothStateException: " + e.getMessage());
    * Failed to start the search on this device, try another
    * device.
    * Determine if another search can be started. If not, wait for
    * a service search to end.
    synchronized (this) {
    serviceSearchCount++;
    System.out.println("maxServiceSearches = " + maxServiceSearches);
    System.out.println("serviceSearchCount = " + serviceSearchCount);
    if (serviceSearchCount == maxServiceSearches) {
    System.out.println("Waiting");
    try {
    this.wait();
    } catch (Exception e) {
    System.out.println("Done Waiting " + serviceSearchCount);
    * Wait until all the service searches have completed.
    while (serviceSearchCount > 0) {
    synchronized (this) {
    try {
    this.wait();
    } catch (Exception e) {
    if (record != null) {
    System.out.println("Record is not null");
    return true;
    } else {
    System.out.println("Record is null");
    return false;
    * Finds the first printer that is available to print to.
    * @return the service record of the printer that was found; null if no
    * printer service was found
    public ServiceRecord findPrinter() {
    * If there are any devices that have been found by a recent inquiry,
    * we don't need to spend the time to complete an inquiry.
    RemoteDevice[] devList = agent.retrieveDevices(DiscoveryAgent.CACHED);
    if (devList != null) {
    if (searchServices(devList)) {
    return record;
    * Did not find any printer services from the list of cached devices.
    * Will try to find a printer service in the list of pre-known
    * devices.
    devList = agent.retrieveDevices(DiscoveryAgent.PREKNOWN);
    if (devList != null) {
    if (searchServices(devList)) {
    return record;
    * Did not find a printer service in the list of pre-known or cached
    * devices. So start an inquiry to find all devices that could be a
    * printer and do a search on those devices.
    /* Start an inquiry to find a printer */
    try {
    agent.startInquiry(DiscoveryAgent.GIAC, this);
    * Wait until all the devices are found before trying to start the
    * service search.
    synchronized (this) {
    try {
    this.wait();
    } catch (Exception e) {
    } catch (BluetoothStateException e) {
    System.out.println("Unable to find devices to search");
    if (deviceList.size() > 0) {
    devList = new RemoteDevice[deviceList.size()];
    deviceList.copyInto(devList);
    if (searchServices(devList)) {
    return record;
    return null;
    * This is the main method of this application. It will print out
    * the message provided to the first printer that it finds.
    * @param args[0] the message to send to the printer
    public static void main(String[] args) {
    PrintClient client = null;
    * Validate the proper number of arguments exist when starting this
    * application.
    if ((args == null) || (args.length != 1)) {
    System.out.println("usage: java PrintClient message");
    return;
    * Create a new PrintClient object.
    try {
    client = new PrintClient();
    } catch (BluetoothStateException e) {
    System.out.println("Failed to start Bluetooth System");
    System.out.println("\tBluetoothStateException: " +
    e.getMessage());
    * Find a printer in the local area
    ServiceRecord printerService = client.findPrinter();
    if (printerService != null) {
    * Determine if this service will communicate over RFCOMM or
    * L2CAP by retrieving the connection string.
    String conURL = printerService.getConnectionURL(
    ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false);
    int index= conURL.indexOf(':');
    String protocol= conURL.substring(0, index);
    if (protocol.equals("btspp")) {
    * Since this printer service uses RFCOMM, create an RFCOMM
    * connection and send the data over RFCOMM.
    RFCOMMPrinterClient printer = new RFCOMMPrinterClient(conURL);
    printer.printJob(args[0]);
    } else if (protocol.equals("btl2cap")) {
    * Since this service uses L2CAP, create an L2CAP
    * connection to the service and send the data to the
    * service over L2CAP.
    L2CAPPrinterClient printer = new L2CAPPrinterClient(conURL);
    printer.printJob(args[0]);
    } else {
    System.out.println("Unsupported Protocol");
    } else {
    System.out.println("No Printer was found");
    * Called when a device was found during an inquiry. An inquiry
    * searches for devices that are discoverable. The same device may
    * be returned multiple times.
    * @see DiscoveryAgent#startInquiry
    * @param btDevice the device that was found during the inquiry
    * @param cod the service classes, major device class, and minor
    * device class of the remote device being returned
    public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {
    System.out.println("Found device = " + btDevice.getBluetoothAddress());
    * Since service search takes time and we are already forced to
    * complete an inquiry, we will not do a service
    * search on any device that is not an Imaging device.
    * The device class of 0x600 is Imaging as
    * defined in the Bluetooth Assigned Numbers document.
    // if (cod.getMajorDeviceClass() == 0x600) {
    * Imaging devices could be a display, camera, scanner, or
    * printer. If the imaging device is a printer,
    * then bit 7 should be set from its minor device
    * class according to the Bluetooth Assigned
    * Numbers document.
    // if ((cod.getMinorDeviceClass() & 0x80) != 0) {
    * Now we know that it is a printer. Now we will verify that
    * it has a rendering service on it. A rendering service may
    * allow us to print. We will have to do a service search to
    * get more information if a rendering service exists. If this
    * device has a rendering service then bit 18 will be set in
    * the major service classes.
    // if ((cod.getServiceClasses() & 0x40000) != 0) {
    deviceList.addElement(btDevice);
    * The following method is called when a service search is completed or
    * was terminated because of an error. Legal status values
    * include:
    * <code>SERVICE_SEARCH_COMPLETED</code>,
    * <code>SERVICE_SEARCH_TERMINATED</code>,
    * <code>SERVICE_SEARCH_ERROR</code>,
    * <code>SERVICE_SEARCH_DEVICE_NOT_REACHABLE</code>, and
    * <code>SERVICE_SEARCH_NO_RECORDS</code>.
    * @param transID the transaction ID identifying the request which
    * initiated the service search
    * @param respCode the response code which indicates the
    * status of the transaction; guaranteed to be one of the
    * aforementioned only
    public void serviceSearchCompleted(int transID, int respCode) {
    System.out.println("serviceSearchCompleted(" + transID + ", " + respCode + ")");
    * Removes the transaction ID from the transaction table.
    removeFromTransactionTable(transID);
    serviceSearchCount--;
    synchronized (this) {
    this.notifyAll();
    * Called when service(s) are found during a service search.
    * This method provides the array of services that have been found.
    * @param transID the transaction ID of the service search that is
    * posting the result
    * @param service a list of services found during the search request
    * @see DiscoveryAgent#searchServices
    public void servicesDiscovered(int transID, ServiceRecord[] servRecord) {
    * If this is the first record found, then store this record
    * and cancel the remaining searches.
    if (record == null) {
    System.out.println("FOund a service " + transID);
    System.out.println("Length of array = " + servRecord.length);
    if (servRecord[0] == null) {
    System.out.println("The service record is null");
    record = servRecord[0];
    System.out.println("After this");
    if (record == null) {
    System.out.println("THe Seocnd try was null");
    * Cancel all the service searches that are presently
    * being performed.
    for (int i = 0; i < transactionID.length; i++) {
    if (transactionID[i] != -1) {
    System.out.println(agent.cancelServiceSearch(transactionID[i]));
    * Called when a device discovery transaction is
    * completed. The <code>discType</code> will be
    * <code>INQUIRY_COMPLETED</code> if the device discovery
    * transactions ended normally,
    * <code>INQUIRY_ERROR</code> if the device
    * discovery transaction failed to complete normally,
    * <code>INQUIRY_TERMINATED</code> if the device
    * discovery transaction was canceled by calling
    * <code>DiscoveryAgent.cancelInquiry()</code>.
    * @param discType the type of request that was completed; one of
    * <code>INQUIRY_COMPLETED</code>, <code>INQUIRY_ERROR</code>
    * or <code>INQUIRY_TERMINATED</code>
    public void inquiryCompleted(int discType) {
    synchronized (this) {
    try {
    this.notifyAll();
    } catch (Exception e) {
    * The RFCOMMPrinterClient will make a connection using the connection string
    * provided and send a message to the server to print the data sent.
    class RFCOMMPrinterClient {
    * Keeps the connection string in case the application would like to make
    * multiple connections to a printer.
    private String serverConnectionString;
    * Creates an RFCOMMPrinterClient that will send print jobs to a printer.
    * @param server the connection string used to connect to the server
    RFCOMMPrinterClient(String server) {
    serverConnectionString = server;
    * Sends the data to the printer to print. This method will establish a
    * connection to the server and send the String in bytes to the printer.
    * This method will send the data in the default encoding scheme used by
    * the local virtual machine.
    * @param data the data to send to the printer
    * @return true if the data was printed; false if the data failed to be
    * printed
    public boolean printJob(String data) {
    OutputStream os = null;
    StreamConnection con = null;
    try {
    * Open the connection to the server
    con =(StreamConnection)Connector.open(serverConnectionString);
    * Sends data to remote device
    os = con.openOutputStream();
    os.write(data.getBytes());
    * Close all resources
    os.close();
    con.close();
    } catch (IOException e2) {
    System.out.println("Failed to print data");
    System.out.println("IOException: " + e2.getMessage());
    return false;
    return true;
    * The L2CAPPrinterClient will make a connection using the connection string
    * provided and send a message to the server to print the data sent.
    class L2CAPPrinterClient {
    * Keeps the connection string in case the application would like to make
    * multiple connections to a printer.
    private String serverConnectionString;
    * Creates an L2CAPPrinterClient object that will allow an application to
    * send multiple print jobs to a Bluetooth printer.
    * @param server the connection string used to connect to the server
    L2CAPPrinterClient(String server) {
    serverConnectionString = server;
    * Sends a print job to the server. The print job will print the message
    * provided.
    * @param msg a non-null message to print
    * @return true if the message was printed; false if the message was not
    * printed
    public boolean printJob(String msg) {
    L2CAPConnection con = null;
    byte[] data = null;
    int index = 0;
    byte[] temp = null;
    try {
    * Create a connection to the server
    con = (L2CAPConnection)Connector.open(serverConnectionString);
    * Determine the maximum amount of data I can send to the server.
    int MaxOutBufSize = con.getTransmitMTU();
    temp = new byte[MaxOutBufSize];
    * Send as many packets as are needed to send the data
    data = msg.getBytes();
    while (index < data.length) {
    * Determine if this is the last packet to send or if there
    * will be additional packets
    if ((data.length - index) < MaxOutBufSize) {
    temp = new byte[data.length - index];
    System.arraycopy(data, index, temp, 0, data.length - index);
    } else {
    temp = new byte[MaxOutBufSize];
    System.arraycopy(data, index, temp, 0, MaxOutBufSize);
    con.send(temp);
    index += MaxOutBufSize;
    * Close the connection to the server
    con.close();
    } catch (BluetoothConnectionException e) {
    System.out.println("Failed to print message");
    System.out.println("\tBluetoothConnectionException: " + e.getMessage());
    System.out.println("\tStatus: " + e.getStatus());
    } catch (IOException e) {
    System.out.println("Failed to print message");
    System.out.println("\tIOException: " + e.getMessage());
    return false;
    return true;
    } // End of method printJob.
    } // End of class L2CAPPrinterClient
    SERVER:
    import java.lang.*;
    import java.io.*;
    import javax.microedition.io.*;
    import javax.bluetooth.*;
    * This class will start an RFCOMM service that will accept data and print it
    * to standard out.
    public class RFCOMMPrintServer {
         * This is the main method of the RFCOMM Print Server application.  It will
         * accept connections and print the data received to standard out.
         * @param args the arguments provided to the application on the command
         * line
        public static void main(String[] args) {
            StreamConnectionNotifier server = null;
            String message = "";
            byte[] data = new byte[20];
            int length;
            try {
                LocalDevice local = LocalDevice.getLocalDevice();
                local.setDiscoverable(DiscoveryAgent.GIAC);
            } catch (BluetoothStateException e) {
                System.err.println("Failed to start service");
                System.err.println("BluetoothStateException: " + e.getMessage());
                return;
            try {
                server = (StreamConnectionNotifier)Connector.open(
                    "btspp://localhost:11111111111111111111111111111111");
            } catch (IOException e) {
                System.err.println("Failed to start service");
                System.err.println("IOException: " + e.getMessage());
                return;
            while (!(message.equals("Stop Server"))) {
                message = "";
                StreamConnection conn = null;
                try {
                    try {
                        conn = server.acceptAndOpen();
                    } catch (IOException e) {
                        System.err.println("IOException: " + e.getMessage());
                        return;
                    InputStream in = conn.openInputStream();
                    length = in.read(data);
                    while (length != -1) {
                        message += new String(data, 0, length);
    System.out.println("Message = " + message);
                        try {
                            length = in.read(data);
                        } catch (IOException e) {
                            break;
    System.out.println("Length = " + length);
                    System.out.println(message);
                    in.close();
                } catch (IOException e) {
                    System.out.println("IOException: " + e.getMessage());
                } finally {
                    if (conn != null) {
                        try {
                            conn.close();
                        } catch (IOException e) {
            try {
                server.close();
            } catch (IOException e) {

  • I just bought an iPhone 4S 3 days ago, but its battery seems to lose 1% every 3-4 minutes. I tuned off some location services, bluetooth, and even siri,  and made its settings similar to my two-year old iPhone 4.  The 4S can last much shorter.

    I just bought an iPhone 4S 3 days ago, but its battery seems to lose 1% every 3-4 minutes. I tuned off some location services, bluetooth, and even siri,  and made its settings similar to my two-year old iPhone 4.  The 4S can last much shorter.  I’m not sure what I can do with the 4S?

    I am having the exact same problem with my iphone 5.
    I took it back to the Apple store 2 days ago and they gave me a new one, but they told me not to restore it from backup cos if something (an app) is corrupted it will happen again. The only thing they could keep was my contacts cos they did something there that allowed them to transfer them to the new phone. I went home, and downloaded only ONE app (facebook), and guess what - THE PROBLEM IS STILL OCCURING ON THE BRAND NEW PHONE! It is driving me insane as I cant get through the day without my phone.
    Really hoping someone has a fix that will work

  • DynaDNS Bonjour and DNS Service Discovery

    Ok I have been useing the Time Capsule from the time it came out I am exspanding my home network and am trying to do it as layed out in this link
    http://dyn.com/support/airport-time-capsule-with-dynamic-dns/ and http://dyn.com/support/bonjour-and-dns-discovery/ but I can not find the settings shown in the screen shots I have firmware 7.6.1 and airport utility 6.1 can I roll back the firmware or get an older copy of the utility so this can be set up? or is it just hidden in a difrent spot.

    To follow along with the screen shots, you will need v5.6 of the AirPort Utility. You can download it directly from Apple here.

  • Problems with Service Discovery: J2ME

    Hi all,
    I am currently trying to develop a mulitplayer bluetooth game and have hit a wall with the service discovery. I have no issues finding the devices both in the emulator and on the devices I am using (Nokia 6230, Nokia 6233 and Sony Ericsson K510). I believe that the problem may lay in either the construction of my searchServices or the sychronization of the methods. The app simiply hangs once the service search is started.
    Below is part of the server class (I have switched the discovery around):
    public synchronized void run(){
            try{
                //retrieve local Bluetooth device
                mLocal = LocalDevice.getLocalDevice();
                //set dicovery agent
                mDiscovery = mLocal.getDiscoveryAgent();
                //set device to discoverable
                mLocal.setDiscoverable(mDiscovery.GIAC);
                //Discover devices
                mDiscovery.startInquiry(mDiscovery.GIAC,this);
                System.out.println("discover");
            }catch(BluetoothStateException e1){
                System.out.println("Bluetooth issue " + e1.getMessage());
            while(mComplete==false){
                mGameCanvas.setText("Device search");
          try{
              System.out.println("deviceProcess");
              if (mDevices.size() == 0){
                  //Cannot find any Bluetooth devices
                  mGameCanvas.setText("No Bluetooth devices found");
                  //Inform the canvas that the inquiry is complete
                  mGameCanvas.setGameState("INQUIRY COMPLETE",false);
                else if (mDevices.size()>0){
                  //Create a RemoteDevice from vector object
                  mGameCanvas.setText("Devices found :"+mDevices.size());
                  for(int i=0;i<mDevices.size();i++){
                      mRemoteFound = (RemoteDevice)mDevices.elementAt(i);
                      System.out.println("Device found= " +mRemoteFound);
                      mServiceDiscover.searchServices(mRemoteFound);
                      mGameCanvas.setText("Searching");
                      wait();
                  mGameCanvas.setText(mServiceDiscover.returnServices());
           }catch (InterruptedException e1) {
               System.out.print("Error "+ e1.getMessage());
         public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod){
           try{
              mGameCanvas.setText(btDevice.getFriendlyName(false));
              //This method is fired every time a device is discovered
              //store the device in a vector for the list
              mDevices.addElement(btDevice);
              System.out.println("Test Device Discovered " + btDevice.getFriendlyName(false));
              System.out.println("mDevices="+mDevices.size() );
          }catch(IOException e1){
              System.out.println(e1.getMessage());
         public void inquiryCompleted(int discType){
           if(discType==INQUIRY_COMPLETED){
                mComplete = true;
        }I am using a game canvas to display a message to the user.
    There is a seperate class for the service discovery:
    //setup the UUID
        static String UUID = "e30c3920857111dc89960002a5d5c51b";
        static UUID BT_UUID = new UUID(UUID, false);
    /**Search for services on remote devices**/
        public void searchServices (RemoteDevice R){
          try{
                UUID[] mList = new UUID[1];
                //Add the UUID's that will be used to search for.
                //The UUID for the Cards service
                mList[0] = BT_UUID;
                System.out.println("Test 3 Search = " + R);
                mTrans = mDiscovery.searchServices(null,mList,R,this);
                System.out.println("Search started" + mTrans);
            }catch(Exception e1){
               System.out.println("Service excep "+e1.getMessage());
        public void servicesDiscovered(int transID,ServiceRecord[] servRecords){
            //There should only be one record
            if(servRecords.length == 1){
              mDevices.addElement(servRecords[0]);
              mServiceFound = true;
            else{
                System.out.println("Error: greater number of services found");
        public synchronized void serviceSearchCompleted(int transID, int respCode){
            if(respCode == 0x01){
                mComplete = true;
                System.out.println("Service search completed");
                //Notify when completed
                synchronized(this){
                    this.notifyAll();
        public String returnServices(){
            String r = "";
            if (mComplete = false){
                r = "NOT COMPLETE";
            else{
                r = "COMPLETE";
            if (mServiceFound==false){
                r = r +"NO_SERVICES";
            else if (mServiceFound==true){
                r = r +mDevices.size() + "_SERVICES_FOUND";
            return r;
        }The app never completes the service inquiry. Is there an issue with the synchronization or is it the service search?
    Any help with this would be massively appriciated

    Hi,
    1 - You shouldn't call an attribute member UUID as it's also a class name.
    2 - I think the first item of mList should be the protocol UUID of the service you search:
    SDP: 0x0001
    RFCOMM:0x0003
    OBEX:0x0008
    and the second one is the service UUID you want to find.
    3 - If that doesn't work, try t separate the search of devices and the search of service.
    1 - search devices
    2 - for all found devices, search service
    Hope that help,
    Jack

  • E66 bluetooth and car connection failed

    Hi All,
    Please help if anyone knows the answer. I have an E66 purchased in Dubai and I live in Dubai. I tried connecting its bluetooth with my car, Volvo XC60. It gets connected and soon disconnects. A friend of mine advised me to remove all contacts in the phone and pair the device with the car and disable the contact synchronization in the car. It is not working at all. How can I succesfully connect the phone to the car. Appreciate your kind support.

    iPhone Support:
    Hands-Free Profile (HFP)
    Headset Profile (HSP)
    iPhone Does Not Support:
    Advanced Audio Distribution Profile (A2DP)
    Audio/Video Remote Control Profile (AVRCP)
    Basic Imaging Profile (BIP)
    Basic Printing Profile (BPP)
    Cordless Telephony Profile (CTP)
    Device ID Profile (DID)
    Dial-up Networking Profile (DUN)
    Fax Profile (FAX)
    File Transfer Profile (FTP)
    General Audio/Video Distribution Profile (GAVDP)
    Generic Access Profile (GAP)
    Generic Object Exchange Profile (GOEP)
    Human Interface Device Profile (HID)
    Intercom Profile (ICP)
    Object Push Profile (OPP)
    Personal Area Networking Profile (PAN)
    Phone Book Access Profile (PBAP)
    Serial Port Profile (SPP)
    Service Discovery Application Profile (SDAP)
    SIM Access Profile (SAP,SIM)
    Synchronisation Profile (synch)
    Video Distribution Profile (vdp)
    Wireless Application Protocol Bearer (WAPB)

  • I have a problem with my Iphone 4s since I did my first update at your Itunes, the bluetooth and the WiFi it is not workinhg anymore.  It is sad that companies like apple are not able to support thier sofware and business.  I went to a apple store at Sout

    I have a problem with my Iphone 4s since I did my first update at your Itunes, the bluetooth and the WiFi it is not workinhg anymore.
    It is sad that companies like apple are not able to support thier sofware and business.
    I went to a apple store at South Park, Charlotte NC,
    and found out the worst customer service (in my case)
    They don't have answers and don't understand about  "dont let any customer go away sad or mad"
    I explain to them that I did everything they said to fix the problem, even to dounload the iOS 6.1.3
    that was supposed to fix the problem.
    they said fix the problem in other phones but not in mine.
    So here I am with no wifi and bluetooth, with apple technicians and experts that don't know what to do with the problem that the sofware they developed cause in my iphone 4s.
    and the solution is for me to pay $199.00 US dollars for a problem that I did not cause.
    wich means to buy something else from apple to fix a problem that it is not my fault.
    Great! what a convenient solution.
    I would like to have an answer from you guys and see if someone there have a better answer for me that shows support, values and integrity as a grest company with solutions for your customers.
    Dont think that I want a new phone, I want mine fixed if is possible.
    Thank you very much and God Bless you!

    Apple isnt here. this is a user based forum for technical questions. The solution is to restart, reset, and restore as new which is in the manual after that get it replaced for hard ware failure. if your within your one year warranty its replaced if it is out of the warranty then it is 199$

  • IOS 7.0.4 iPhone4s Bluetooth and WiFi "Off" but Bluetooth spinning

    As title mentions, I have an iPhone 4S, running iOS 7.0.4 (the latest as of this writing).
    After a holiday trip to Mass., my bluetooth and wifi won't turn back on.  The settings screen shows Airplane mode Off (switch), WiFi Off (word), Bluetooth Off (word).
    When I tap on Bluetooth, instead of seeing the switch, I have a spinner.  It says "location accuracy and nearby services are improved when Bluetooth is turned on." and nothing else on the screen...
    Soft reset, hard reset, reset network settings, backup and restore, so far none of these processes have helped.  Neither has reactivating airplane mode, using the pop-up control center (it will light up the bluetooth B and say "bluetooth: on", but when I visually check on settings, it still says "off" and has the spinner instead of switch).  I've even tried things like rebooting the phone with airplane mode on to see if that would help.
    Due to bluetooth being down, the WiFi switch on it's second screen under settings is disabled and will not activate, even though the pop-up control panel will report the activation of WiFi as well just like it does bluetooth...
    About phone will give me a hex bluetooth address, but wifi address is "N/A".  The one time I found the diagnostics logs, I found a bunch of "bluetooth crashed" messages, cannot find them as of this writing again...
    Not sure if this has any influence or not, but while I was in MA, at my mom's house who has a very old router, I used my iPad mini to do a Facetime call, and during said call my phone was "ringing" like it wanted to take the call, but I ignored it.  WiFi seemed functional at my mom's house, my nephew had no problem playing angry birds before I left, but I didn't do anything else but imessage my wife and make a phone call at the airport until I landed in St. Louis, where I found the bluetooth non-functional.  iPad is, as of this writing, still fully functional.

    I have experienced the same problem and tackled the solutions in very much the same way but to no avail.  Can anyone help as this is very annoying.

  • Error: Unable to start the bluetooth stack service

    HP Pavilion g7-2017us, Windows 7
    After starting up I get the error message: UNABLE TO START THE BLUETOOTH STACK SERVICE.
    First, I don't know what that means ... Second, I don't know how to remedy the problem.
    Can anyone help please? ... THANKS!

    Steps I would suggest are:
    1. Update Bluetooth Device Driver. Steps to update the device driver:
    i. Click on Start
    ii. Select Control Panel
    iii. Select System and maintenance
    iv. Click Device Manager (If you are prompted for an administrator password or confirmation, type the password or provide confirmation.)
    v. In the Device manager locate the Blue tooth device
    vi. Click the Driver tab, and then select Update driver
    If its still not fixed go to step 2
    2. Uninstall the Bluetooth device, restart the computer and install the latest drivers.
    Link for reference: Update a driver
    Broadcom bluetooth Drivers for windows 7 64-bit
    http://h10025.www1.hp.com/ewfrf/wc/softwareDownloadIndex?softwareitem=ob-104112-1&cc=us&dlc=en&lc=en...
    Intel Wireless Drivers for windows 64-bit
    http://h10025.www1.hp.com/ewfrf/wc/softwareDownloadIndex?softwareitem=ob-104707-1&cc=us&dlc=en&lc=en...
    Regards;
    Ray
    I am an HP employee
    Please click the White Kudos star to say thanks for helping.
    Please mark Accept As Solution if my help has solved your problem.

  • How to completely turn off Bluetooth and Wireless

    Hey everybody,
    I'm running Windows XP SP3 via Boot Camp and I was wondering if anyone can assist me in how to completely turn off Bluetooth and Wireless connectivity so that I can reserve as much batter life while being in class taking notes without a plug-in source, but not uninstall. I know there is a Bluetooth control panel and I disabled it there but under "connect to" its still remains there. Basically I want to have the Bluetooth and Wireless turned off completely when I startup and still have the icons shown in the taskbar to let me know that they are still there.
    Thanks!

    Joergen Thomson, I can see that you have the same thoughts like I do, I wish they could release a software that is stable and better then this.
    I dont have the energi or time to report all flaus back to cisco, this product have taking to much of my time and frustration already. Thank you so much for all the time you spend to try get this product stable and hopefully a good product.
    I have a costumer that have a webservice that is IP restricted, For now I have to define more then 93 policys openening for the same service because this doesnt handle address list and groups. And all the times I had to set it back to factory default becasue of HTTP Admin server stopped, VPN Problem, Firmware Upgrades, "Packet Loss" and so on takes alot of time becasue I need to reconfig policies back.
    For now to they release a firmware is stable I have take this piece off the network and put the back a old Fortinet 60 box.

  • HP touchsmart 520, error unable to start bluetooth stack service

    I am wanting to use the bluetooth feature on my Touchsmart 520 for transferring pics, audio files etc.  My periphal device is a Samsung Galaxy S5.   My phone shows that it is paired with my pc, when i try to access via bluetooth I get the error message unable to start bluetooth stack service.  My Touchsmart uses the Broadcom adapter that came with the pc.  Help!!!
     CapnRon1

    Hello @CapnRon1,
    Welcome to the HP Forums, I hope you enjoy your experience! To help you get the most out of the HP Forums I would like to direct your attention to the HP Forums Guide First Time Here? Learn How to Post and More.
    I understand you are having issues transferring files between your Samsung Galaxy S5 and your HP touchsmart 520 Desktop PC. I am providing you with some steps you can try below:
    Step 1. Go to device manager
    Step 2. Right click on "Bluetooth Peripheral Device" that you want
    Step 3. Select "Update Driver Software..."
    Step 4. Choose "Browse my computer for driver software"
    Step 5. Choose "Let me pick from a list of device drivers on my computer"
    Step 6. Select "Ports (COM & LPT)"
    Step 7. Select "Microsoft" at "Manufacturer" list
    Step 8. Finally select "Standard Serial over Bluetooth link"
    If you are still unable to pair with a Bluetooth device try the following:
    Step 1. Search for "Change device" in the Windows 8 Start menu.
    Step 2. Click on where it says Change device installation settings.
    Step 3. Select the No, let me choose what to do option.
    Step 4. Check the automatically get the device app option
    Step 5. Click Save changes to save the settings you just chose
    As well you can try this:
    Step 1: Go to RUN (Windows Logo + R) and type “services.msc” and Enter
    Step 2: Now find “Bluetooth Support Service” and double click on it
    Step 3: Now click on Log On Tab and Type in "Local Service" without quotes
    Step 4. Click on “This Account”
    Step 5: Now remove any passwords leave the password field blank
    Step 6: Underneath the upper left title should be a hyperlink "Start" Click it
    You can also check:
    Power Management tab and unchecked the box that said "Allow the computer to turn off this device to save power."  Problem solved.  Thank you for your willingness and persistance in helping me resolve the issue.
    I would be happy to assist you further is you require it, but first I would encourage you to post your product number for your computer. I am linking an HP Support document below that will show you how to find your product number. As well, if you could indicate which operating system you are using. And whether your operating system is 32-bit or 64-bit as with this and the product number I can provide you with accurate information.
    How Do I Find My Model Number or Product Number?
    Which Windows operating system am I running?
    Is the Windows Version on My Computer 32-bit or 64-bit?
    Please re-post with the requested information and I would be happy to provide you with assistance. Thank you for posting on the HP Forums. Have a great day!
    Please click the "Thumbs Up" on the bottom right of this post to say thank you if you appreciate the support I provide!
    Also be sure to mark my post as “Accept as Solution" if you feel my post solved your issue, it will help others who face the same challenge find the same solution.
    Dunidar
    I work on behalf of HP
    Find out a bit more about me by checking out my profile!
    "Customers don’t expect you to be perfect. They do expect you to fix things when they go wrong." ~ Donald Porter

  • Unable to start Bluetooth stack service

    I'm getting the message "Unable to start Bluetooth stack service" and cannot connect any new bluetooth devices. My notebook is a Pavilion tx 2000. Any ideas??

    Hi,
    Reinstall drivers for bluetooth module.
    ** Say thanks by clicking the "Thumb up" icon which is on the left. **
    ** Make it easier for other people to find solutions, by marking my answer with "Accept as Solution" if it solves your issue. **

  • Automated Web Service Discovery with Java

    Hi,
    I am doing research on Dynamic Web Service Discovery. For that I have to code some implementation. I need to do the following things:
    - Code a J2SE application in which I give the name of web service and/or the required function name.
    - The application dynamically discovers related webservices on the internet.
    - Displays the results for the available Web Services
    Please suggest any other standard for Dynamic Web Service Discovery that can be used in Java.
    I have seen some tutorials using WSDP1.5/2.0 but they are rather old dating back to 2002. I have also seen JAXR, but again it refers to WSDP1.5/2.0
    Any help would be greatly appreciated.
    Thanks in Advance

    Error Messages in the Trace/Log Viewer:
    CX_WS_SECURITY_FAULT : Invalid XML signature | program: CL_ST_CRYPTO==================CP include: CL_ST_CRYPTO==================CM00G line: 48
    A SOAP Runtime Core Exception occurred in method CL_ST_CRYPTO==================CM00G of class CL_ST_CRYPTO==================CP at position id 48  with internal error id 1001  and error text CX_WS_SECURITY_FAULT:Invalid XML signature (fault location is 1  ).
    Invalid XML signature

Maybe you are looking for

  • Why can I not receive iMessages on my iPod touch 4g after updating my iPhone 5 to iOS 7?

    Yes, you read correctly.  I updated my iPhone to iOS 7, and poof!!!  Now iMessages are not being sent to my iPod touch.  What happened?!

  • Msi GTX 760, Multi-Screen, HDMI Color accuracy way better then DVI

    Hi, I'm using two HP Pavillion 23xi screen. At first, I decide to connect one screen using the HDMI output of the video card, and the other one using DVI. There was an astonishing difference between the two. Ok, maybe the screen is the problem. So, I

  • Can't create new files in curlftpfs mounted directory

    Hi All. I'm trying to mount an FTP directory locally so I can use it as a local directory. I have this in my fstab: curlftpfs#USERNAME:[email protected] /media/ftp fuse rw,allow_other,proxy=,uid=500,user 0 0 now, here's the weird thing. I can edit fi

  • How to turn off an application in iOS 4.0

    When running an application, hittin the Home button once wont close the app - the appwill continue to run in the background. The only way (that I know of) how to actually turn off an app is to hit the Home buton twice (enter the multitasking screen),

  • .mov files playing very "noisy"

    hello. I have my website, which has several .mov files, which play individually. Certain ones seem to playback very "noisy" and distorted. The original file seems fine when i play via quicktime, but when you watch online, it doesn't look nearly as go