Package javax.bluetooth

Examples of javax.bluetooth.RemoteDevice


                Short psmShort            = Short.decode(psmString);
                short psm                 = psmShort.shortValue();
                BluetoothStack bluetooth  = BluetoothStack.getBluetoothStack();
                LocalDevice localDev      = LocalDevice.getLocalDevice();
                DiscoveryAgent discovery  = localDev.getDiscoveryAgent();
                RemoteDevice remoteDevice = discovery.getRemoteDevice(remoteAddrLong);
                if (remoteDevice != null) {
                    JSR82Channel channel = new JSR82Channel();
                    bluetooth.connectL2CAPChannel(channel, remoteDevice, psm);
                    return channel;
                }
View Full Code Here


    /** @see javax.bluetooth.DiscoveryListener#inquiryCompleted(int) */
    public void inquiryCompleted(int discType) {
        top.removeAll();
        for (int i = 0; i < devList.size(); i++) {
            RemoteDevice remoteDev = (RemoteDevice)devList.get(i);
            JLabel devLabel = new JLabel(devIcon);
            devLabel.addMouseListener(new RemoteDeviceMouseListener(devLabel, this, remoteDev)); // add a mouse listener to the bluetooth device
            devLabel.setText(remoteDev.getBluetoothAddress());
            top.add(devLabel);
        }
        top.revalidate();
        statusLabel.setText("Inquiry in Completed.");
    }
View Full Code Here

    else
    {
      Log.append("Bluetooth Devices: \n");
      for (int i = 0; i <deviceCount; i++)
      {
        RemoteDevice remoteDevice=(RemoteDevice)vecDevices.elementAt(i);
        String t = i + ": \"" + remoteDevice.getFriendlyName(true) + "\"";
        Log.append(t + "\n");
      }
    }
    UUID[] uuidSet = new UUID[1];
    if (ScanForUUID != null)
      uuidSet[0]=new UUID(ScanForUUID, true);
    else
      uuidSet[0]=new UUID("ACDC", true);

    for (int i = 0; i < vecDevices.capacity(); i++)
    {
      RemoteDevice remoteDevice=(RemoteDevice)vecDevices.elementAt(i);
      String t = remoteDevice.getFriendlyName(true);
      agent.searchServices(null,uuidSet,remoteDevice,bluetoothServiceDiscovery);
      try
      {
        synchronized(lock)
        { lock.wait(); }
View Full Code Here

            return connect(stringToAddress(target), mode, pin);
        else
        {
            // We have a device name. Try and locate it in the list of known
            // devices
            RemoteDevice dev = getKnownDevice(target);
            if (dev != null)
                // Found a match connect to it
                return connect(stringToAddress(dev.getBluetoothAddress()), mode, pin);
            return null;
        }
    }
View Full Code Here

   * (those who have been paired before) into the BTDevice Object.
   * @param fName Friendly-Name of the device
   * @return BTDevice Object or null, if not found.
   */
  public static RemoteDevice getKnownDevice(String fName) {
    RemoteDevice btd = null;
    //look the name up in List of Known Devices
    Vector devList = getKnownDevicesList();
    if (devList.size() > 0) {
      for (int i = 0; i < devList.size(); i++) {
        btd = (RemoteDevice) devList.elementAt(i);
        if (btd.getFriendlyName(false).equals(fName)) {
          return btd;
        }
      }
    }
    return null;
View Full Code Here

          int codRecord = (retCod[0] << 8) + retCod[1];
          codRecord = (codRecord << 8) + retCod[2];
          codRecord = (codRecord << 8) + retCod[3];
         
          final DeviceClass deviceClass = new DeviceClass(codRecord);
          final RemoteDevice rd = new RemoteDevice(nameToString(name), addressToString(device), retCod);
         
          // Spawn a separate thread to notify in case doesn't return immediately:
          Thread t = new Thread() {
            public void run() {
              // Make sure only one notify thread is running at a time using notifyToken
View Full Code Here

        {
          System.arraycopy(replyBuf, 2, device, 0, ADDRESS_LEN);
                    System.arraycopy(replyBuf, 9, name, 0, NAME_LEN);
          System.arraycopy(replyBuf, 25, retCod, 0, 4);
          // add the Element to the Vector List
          retVec.addElement(new RemoteDevice(nameToString(name), addressToString(device), retCod));
        }
        else if (replyBuf[1] == MSG_INQUIRY_STOPPED)
        {
          cmdComplete();
          // Fill in the names 
          for (int i = 0; i < retVec.size(); i++) {
            RemoteDevice btrd = ((RemoteDevice) retVec.elementAt(i));
            String s = btrd.getFriendlyName(false);
            if (s.length() == 0) {
              String nm = lookupName(btrd.getDeviceAddr());
              btrd.setFriendlyName(nm);
            }
          }
          return retVec;
        }
      }
View Full Code Here

   * Connects to node as master
   */
  public BTConnection connect(){
    BTConnection btc = null;

    RemoteDevice btrd = remoteNode.getRemoteDevice();

    int iCount = 0;
    while (true) {
      if(iCount==10) {
        iCount = 3;
View Full Code Here

   */
  public static List<Node> knownNodes() {
    List<Node> nodes = new ArrayList<Node>();
    Enumeration deviceEnumeration = Bluetooth.getKnownDevicesList().elements();
    while (deviceEnumeration.hasMoreElements()) {
      RemoteDevice device = (RemoteDevice)deviceEnumeration.nextElement();
      nodes.add(new Node(device));
    }
    byte[] cod = {0,0,3,3};
    nodes.add(new Node(new RemoteDevice("SERVER9","000C78336E6E",cod)));
    return nodes;
  }
View Full Code Here

   * @param Node
   */
  public BTConnection connect(){
    BTConnection btc = null;

    RemoteDevice btrd = remoteNode.getRemoteDevice();
    int iCount = 0;
    while (true) {
      if(iCount==10) {
        iCount = 3;
      }
View Full Code Here

TOP

Related Classes of javax.bluetooth.RemoteDevice

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.