0

Bluetooth通信でPCに文字列を送信して、Androidプログラムをテストする必要があります。

文字列をarduinoに正確に送信するこのアプリを見つけました

http://www.elecfreaks.com/829.html

arduino を使用せずに、このアプリで文字列を PC に送信できますか?

前もって感謝します

4

1 に答える 1

0

Bluetooth サーバーとして機能する Java アプリケーションを作成し、それを Bluetooth クライアント アプリでのテストに使用できます。

これにはBluecove ライブラリが必要です。コード スニペットの例を次に示します。

UUID serialUUID = new UUID("1101", true);
String SERVICE_URL = "btspp://localhost:" + serialUUID
        + ";name=My Bluetooth Server;authorize=false;authenticate=false";

StreamConnectionNotifier connectionNotifier = 
                          (StreamConnectionNotifier) Connector.open(SERVICE_URL);

System.out.println("Server is waiting for client ... \n URL=" + SERVICE_URL);

// Wait until client connects i.e. a blocking method
StreamConnection connection = connectionNotifier.acceptAndOpen();

RemoteDevice remoteDevice = RemoteDevice.getRemoteDevice(connection);
System.out.println("Client connected: "+remoteDevice.getBluetoothAddress());

// Communicate with the device using the below I/O streams
InputStream iStream = connection.openInputStream();
OutputStream oStream = connection.openOutputStream();
于 2013-04-27T23:30:55.970 に答える