de.avetana.bluetooth.util
Class DeviceFinderPane

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byde.avetana.bluetooth.util.DeviceFinderPane
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, Cancelable, DiscoveryListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class DeviceFinderPane
extends javax.swing.JPanel
implements java.awt.event.ActionListener, DiscoveryListener, Cancelable

COPYRIGHT:
(c) Copyright 2004 Avetana GmbH ALL RIGHTS RESERVED.

This file is part of the Avetana bluetooth API for Linux.

The Avetana bluetooth API for Linux is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

The Avetana bluetooth API is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

The development of the Avetana bluetooth API is based on the work of Christian Lorenz (see the Javabluetooth Stack at http://www.javabluetooth.org) for some classes, on the work of the jbluez team (see http://jbluez.sourceforge.net/) and on the work of the bluez team (see the BlueZ linux Stack at http://www.bluez.org) for the C code. Classes, part of classes, C functions or part of C functions programmed by these teams and/or persons are explicitly mentioned.



Description:
A JPanel performing an HCI inquiry and storing the result of this inquire in a a JList swing component.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 javax.swing.JButton m_name
           
 javax.swing.JButton m_refresh
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.bluetooth.DiscoveryListener
INQUIRY_COMPLETED, INQUIRY_ERROR, INQUIRY_TERMINATED, SERVICE_SEARCH_COMPLETED, SERVICE_SEARCH_DEVICE_NOT_REACHABLE, SERVICE_SEARCH_ERROR, SERVICE_SEARCH_NO_RECORDS, SERVICE_SEARCH_TERMINATED
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DeviceFinderPane(java.awt.Window owner)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void cancel()
           
 void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod)
          Called when a device is found during an inquiry.
 void doInquiry()
           
 javax.swing.JPanel getCommandPanel()
           
 void inform(java.lang.String message)
           
 void initStack()
           
 void inquiryCompleted(int discType)
          Called when an inquiry is completed.
 void servicesDiscovered(int transID, ServiceRecord[] servRecord)
          Called when service(s) are found during a service search.
 void serviceSearchCompleted(int transID, int respCode)
          Called when a service search is completed or was terminated because of an error.
 void showDialog()
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_refresh

public javax.swing.JButton m_refresh

m_name

public javax.swing.JButton m_name
Constructor Detail

DeviceFinderPane

public DeviceFinderPane(java.awt.Window owner)
                 throws java.lang.Exception
Method Detail

getCommandPanel

public javax.swing.JPanel getCommandPanel()

initStack

public void initStack()
               throws java.lang.Exception
Throws:
java.lang.Exception

deviceDiscovered

public void deviceDiscovered(RemoteDevice btDevice,
                             DeviceClass cod)
Description copied from interface: DiscoveryListener
Called when a device is found during an inquiry. An inquiry searches for devices that are discoverable. The same device may be returned multiple times.

Specified by:
deviceDiscovered in interface DiscoveryListener
Parameters:
btDevice - the device that was found during the inquiry
cod - the service classes, major device class, and minor device class of the remote device
See Also:
DiscoveryAgent.startInquiry(int, javax.bluetooth.DiscoveryListener)

cancel

public void cancel()
Specified by:
cancel in interface Cancelable

servicesDiscovered

public void servicesDiscovered(int transID,
                               ServiceRecord[] servRecord)
Description copied from interface: DiscoveryListener
Called when service(s) are found during a service search.

Specified by:
servicesDiscovered in interface DiscoveryListener
Parameters:
transID - the transaction ID of the service search that is posting the result
See Also:
DiscoveryAgent.searchServices(int[], javax.bluetooth.UUID[], javax.bluetooth.RemoteDevice, javax.bluetooth.DiscoveryListener)

inform

public void inform(java.lang.String message)

showDialog

public void showDialog()

doInquiry

public void doInquiry()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

inquiryCompleted

public void inquiryCompleted(int discType)
Description copied from interface: DiscoveryListener
Called when an inquiry is completed. The discType will be INQUIRY_COMPLETED if the inquiry ended normally or INQUIRY_TERMINATED if the inquiry was canceled by a call to DiscoveryAgent.cancelInquiry(). The discType will be INQUIRY_ERROR if an error occurred while processing the inquiry causing the inquiry to end abnormally.

Specified by:
inquiryCompleted in interface DiscoveryListener
Parameters:
discType - the type of request that was completed; either INQUIRY_COMPLETED, INQUIRY_TERMINATED, or INQUIRY_ERROR
See Also:
DiscoveryListener.INQUIRY_COMPLETED, DiscoveryListener.INQUIRY_TERMINATED, DiscoveryListener.INQUIRY_ERROR

serviceSearchCompleted

public void serviceSearchCompleted(int transID,
                                   int respCode)
Description copied from interface: DiscoveryListener
Called when a service search is completed or was terminated because of an error. Legal status values in the respCode argument include SERVICE_SEARCH_COMPLETED, SERVICE_SEARCH_TERMINATED, SERVICE_SEARCH_ERROR, SERVICE_SEARCH_NO_RECORDS and SERVICE_SEARCH_DEVICE_NOT_REACHABLE. The following table describes when each respCode will be used:
respCodeReason
SERVICE_SEARCH_COMPLETED if the service search completed normally
SERVICE_SEARCH_TERMINATED if the service search request was cancelled by a call to DiscoveryAgent.cancelServiceSearch()
SERVICE_SEARCH_ERROR if an error occurred while processing the request
SERVICE_SEARCH_NO_RECORDS if no records were found during the service search
SERVICE_SEARCH_DEVICE_NOT_REACHABLE if the device specified in the search request could not be reached or the local device could not establish a connection to the remote device

Specified by:
serviceSearchCompleted in interface DiscoveryListener
Parameters:
transID - the transaction ID identifying the request which initiated the service search
respCode - the response code that indicates the status of the transaction