안녕하세요 ~~

android-sdk-windows-1.5_r1을 사용하고 있습니다.

제가 하려고 하는 것은 android bluetooth랑 msp430(firmware)에 탑재되어 있는 bluetooth랑 통신을 주고 받고자 합니다.

먼저 platforms/android-1.5/sources/android/bluetooth라는 것을 저장했습니다.

그 후에 bluetooth에 관계된 open source를 참고해서 코드를 짜려고 하는데

Context.BLUETOOTH_SERVICE를 찾질 못하고 있습니다.

그래서 구글링 해봤더니 package org.bluez 를 포함해야 하는 것 같아서 

찾고 있는 중입니다. ㅠㅠ 

docs/reference/org 안에 저는 apache, json, w3c, xml, xmlpull 이란 directory가 있으며

안에는 html문서만 가득하군요.
 

.java도 아니고 html문서로 구성되어 있는 경우를 첨 봐서 매우 당황스럽습니다. 

한 가르침 주십시요 ^^ 

읽어주셔서 감사합니다.  
  
import java.io.FileDescriptor;
import java.io.FileWriter;
import java.io.IOException;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;

public class BluetoothSnippets extends Activity {

  @Override   
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    final BluetoothDevice bluetooth =
 (BluetoothDevice)getSystemService(Context.BLUETOOTH_SERVICE);

    bluetooth.enable(new IBluetoothDeviceCallback.Stub() {
      @Override
      public void onCreateBondingResult(String _address, int _result)
 throws RemoteException
      {
        BluetoothDevice.RESULT_SUCCESS
      }

      @Override
      public void onEnableResult(int _result) throws RemoteException {
        if (_result == BluetoothDevice.RESULT_SUCCESS) {
          bluetooth.setName("LORE");
          bluetooth.setMode(BluetoothDevice.MODE_DISCOVERABLE);
        }
      }
    });

    bluetooth.startPeriodicDiscovery();
    bluetooth.startDiscovery(true);
   
    bluetooth.listRemoteDevices();
    bluetooth.getRemoteName("address");
   
    String[] devices = bluetooth.listRemoteDevices();

    for (String device : devices) {
      if (!bluetooth.hasBonding(device)) {
        // Set the pairing PIN. In real life it뭩 probably a smart
        // move to make this user enterable and dynamic.
        bluetooth.setPin(device, new byte[] {1,1,1,1});
        bluetooth.createBonding(device, new IBluetoothDeviceCallback.Stub() {
          public void onCreateBondingResult(String _address, int _result) throws RemoteException {
            if (_result == BluetoothDevice.RESULT_SUCCESS) {
              String connectText = "Connected to " + bluetooth.getRemoteName(_address);
              Toast.makeText(getApplicationContext(), connectText, Toast.LENGTH_SHORT);
            }
          }

          public void onEnableResult(int _result) throws RemoteException {}

        });
      }
    }

    bluetooth.listBondings();
    bluetooth.lastSeen("");
    bluetooth.lastUsed("");
    bluetooth.removeBonding("");
   
    // Bluetooth Comms
   
    FileDescriptor localFile;
    RfcommSocket localSocket2 = new RfcommSocket();
    try {
      localFile = localSocket2.create();
    } catch (IOException e) { }

    FileDescriptor remoteFile;

    RfcommSocket localSocket1 = new RfcommSocket();
    try {
      localFile = localSocket1.create();
      localSocket1.bind(null);
      localSocket1.listen(1);
      RfcommSocket remotesocket = new RfcommSocket();
      remoteFile = localSocket1.accept(remotesocket, 10000);
    }
    catch (IOException e) { }

    String remoteAddress = bluetooth.listBondings()[0];

    RfcommSocket localSocket = new RfcommSocket();
    try {
      localFile = localSocket.create();
      // Select an unused port
      if (localSocket.connect(remoteAddress, 0)) {
        FileWriter output = new FileWriter(localFile);
        output.write("Hello, Android");
        output.close();
      }
    } catch (IOException e) { }

    // Bluetooth Headset
   
    BluetoothHeadset headset = new BluetoothHeadset(this);
    headset.connectHeadset("", new IBluetoothHeadsetCallback.Stub() {
      public void onConnectHeadsetResult(String _address, int _resultCode) throws RemoteException {
        if (_resultCode == BluetoothHeadset.RESULT_SUCCESS) {
          // Connected to a new headset device.
        }
      }
    });

    if (headset.getState() == BluetoothHeadset.STATE_CONNECTED) {
      // TODO Perform actions on headset.
    }
   
    headset.close();   
  }
}