Ejemplo n.º 1
0
  /**
   * 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) {
    // #if DEBUG
    log.debug("FoundDEV= " + btDevice.getBluetoothAddress());
    // #endif
    int minorDeviceClass;
    int majorDeviceClass;

    /**
     * optimization:work only with possible DiABlu Servers Major Device Class 00001 (256) Computers
     * Minor Device Class 0000010 (4) Desktop Workstation " " " " 0000100 (8) Server Class Server "
     * " " " 0000110 (12) Laptop see: Bluetooth Assigned Numbers Document
     */
    majorDeviceClass = cod.getMajorDeviceClass();
    minorDeviceClass = cod.getMinorDeviceClass();
    // #if DEBUG
    log.debug("Adding dev(" + majorDeviceClass + "/" + minorDeviceClass + ")");
    // #endif
    deviceList.addElement(btDevice);
  }
Ejemplo n.º 2
0
  /* DiscoveryListener methods: */
  public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {
    // System.err.println(btDevice.getFriendlyName(false) + " discovered.");
    /*
    System.err.println("Major = " + cod.getMajorDeviceClass());
    System.err.println("Minor = " + cod.getMinorDeviceClass());
    System.err.println("Service = " + cod.getServiceClasses());
    System.err.println("GPS_MAJOR = " + GPS_MAJOR);
    System.err.println("Authenticated? " + btDevice.isAuthenticated());
    */

    if ((cod.getMajorDeviceClass() & GPS_MAJOR) == GPS_MAJOR) {
      if (btDevice.isAuthenticated()) { // Check if paired.
        this.btDevice = btDevice;
        da.cancelInquiry(this);
      }
    }
  }
Ejemplo n.º 3
0
 public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {
   if (cod.getMajorDeviceClass() == NXTID) remote = btDevice;
 }