Package javax.bluetooth

Examples of javax.bluetooth.LocalDevice


     *
     * @return Array of discovered wiimotes.
     */
    private Vector<Wiimote> discoverWiimotes() throws IOException {
        WiimoteDeviceDiscovery deviceDiscovery = new WiimoteDeviceDiscovery(lock);
        LocalDevice localDevice = LocalDevice.getLocalDevice();
        Log.write("Your Computers Bluetooth MAC: " + localDevice.getBluetoothAddress());

        Log.write("Starting device inquiry...");
        DiscoveryAgent discoveryAgent = localDevice.getDiscoveryAgent();
        discoveryAgent.startInquiry(DiscoveryAgent.GIAC, deviceDiscovery);


        try {
            synchronized (lock) {
View Full Code Here


        throw new RuntimeException("Can't populate a Local Record. Population is only possible for Records obtained from a RemoteDevice.");
    }

    /** @see javax.bluetooth.ServiceRecord#getConnectionURL(int, boolean) */
    public String getConnectionURL(int requiredSecurity, boolean mustBeMaster) {
        LocalDevice localDev;
        try { localDev = LocalDevice.getLocalDevice(); }
        catch (BluetoothStateException e) {
            e.printStackTrace();
            return null;
        }
        String url = "btl2cap://" + localDev.getBluetoothAddress() + ":";
        DataElement protocolDescriptorListElement = (DataElement)attributes.get(new Integer(4));
        if (protocolDescriptorListElement == null)
            throw new IllegalArgumentException("Service Record is not propperly populated. Protocol Descriptor is missing.");
        Enumeration protocolDescriptorList = (Enumeration)protocolDescriptorListElement.getValue();
        while (protocolDescriptorList.hasMoreElements()) {
View Full Code Here

            catch (IOException e) { System.out.print("ServiceRecord.populateRecord(attrIDs) failed. " + e); }
        }
    }

    public BluetoothClient() throws BluetoothStateException {
        LocalDevice localDev = LocalDevice.getLocalDevice();
        System.out.println("Local Bluetooth Name is " + localDev.getFriendlyName());
        localDev.setDiscoverable(DiscoveryAgent.GIAC);
        DiscoveryAgent discovery = localDev.getDiscoveryAgent();
        discovery.startInquiry(DiscoveryAgent.GIAC, this);
    }
View Full Code Here

* @author Christian Lorenz
*/
public class BluetoothServiceProvider {
    public static final void main(String[] args) throws Exception {
        BluetoothStack.init(new BluetoothTCPClient("192.168.10.2", 2600));
        LocalDevice localDev = LocalDevice.getLocalDevice();
        localDev.setDiscoverable(DiscoveryAgent.GIAC);
        L2CAPConnectionNotifier connNotifier = (L2CAPConnectionNotifier)Connector.open("btl2cap://localhost:3;");
        ServiceRecord serviceRecord = connNotifier.getRecord();
        serviceRecord.setAttributeValue(256, new DataElement(DataElement.STRING, "Tini Demo Service"));
        connNotifier.acceptAndOpen();
    }
View Full Code Here

        bluetooth.send_HCI_HC_Change_Local_Name("TINI BLUE");
        bluetooth.send_HCI_HC_Write_Scan_Enable((byte)0x03);
        bluetooth.send_HCI_HC_Write_Event_Filter_Connection_Setup((byte)0x02);
        bluetooth.send_HCI_HC_Write_Event_Filter_Inquiry_Result();
        SDPServer sddb = SDPServer.getSDPServer();
        LocalDevice localDev = LocalDevice.getLocalDevice();
        //System.out.println("Local Bluetooth Name is "+localDev.getFriendlyName());
        //System.out.println("IAC is "+localDev.getDiscoverable());
        //System.out.println("set Discoverable "+localDev.setDiscoverable(DiscoveryAgent.GIAC));
        //System.out.println("IAC is "+localDev.getDiscoverable());
        DiscoveryAgent discovery = localDev.getDiscoveryAgent();
        System.out.println("Inquiry:" + discovery.startInquiry(DiscoveryAgent.GIAC, this));
    }
View Full Code Here

                int endIndex              = url.indexOf(';', 22);
                String psmString          = url.substring(23, endIndex);
                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

  public static String Scan(Form Log, String ScanForUUID) throws Exception
  {
    BluetoothServiceDiscovery bluetoothServiceDiscovery=new BluetoothServiceDiscovery();
    //display local device address and name
    LocalDevice localDevice = LocalDevice.getLocalDevice();
    //find devices
    DiscoveryAgent agent = localDevice.getDiscoveryAgent();

    agent.startInquiry(DiscoveryAgent.GIAC, bluetoothServiceDiscovery);
    try
    {
      synchronized(lock)
View Full Code Here

  {
      if (Connection == null)
        return false;
      try
      {
        LocalDevice localDevice = LocalDevice.getLocalDevice();
        Send(localDevice.getFriendlyName());

        return true;
      }
      catch(NullPointerException NPE)
      {
View Full Code Here

            _conn = null;

            _uuidSet = new UUID[1];
            _uuidSet[0] = uid ;
           
            LocalDevice localDevice = LocalDevice.getLocalDevice();
            _discoveryAgent = localDevice.getDiscoveryAgent();
            _discoveryAgent.startInquiry(DiscoveryAgent.GIAC, this);
            _timer = new TimerClient(Sudoku.TIMEOUT_GAME_SEC);
            _active = 1;
         } catch (Exception e) {
            System.out.println(e);
View Full Code Here

    private final Client mClient;
    private final ExecutorService mWriteThread = Executors.newSingleThreadExecutor();
    private final Object STREAM_WRITE_LOCK = new Object();

    public GlassConnection() {
        LocalDevice localDevice;
        try {
            localDevice = LocalDevice.getLocalDevice();
            mDiscoveryAgent = localDevice.getDiscoveryAgent();
        } catch (BluetoothStateException e) {
            e.printStackTrace();
        }
        mClient = new Client();
    }
View Full Code Here

TOP

Related Classes of javax.bluetooth.LocalDevice

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.