Page 987 - 3-2
P. 987

(2)  라즈베리파이 관련 소스
            ******************** < Bluetooth.java > ***********************************

            /*
             *
             * webnautes@naver.com
             *
             *  참고
             * http://www.kotemaru.org/2013/10/30/android-bluetooth-sample.html
             */


            import java.io.BufferedReader;
            import java.sql.*;
            import java.io.BufferedWriter;
            import java.io.IOException;
            import javax.bluetooth.BluetoothStateException;
            import javax.bluetooth.LocalDevice;
            import javax.bluetooth.RemoteDevice;
            import javax.bluetooth.UUID;
            import javax.microedition.io.Connector;
            import javax.microedition.io.StreamConnection;
            import javax.microedition.io.StreamConnectionNotifier;
            import java.io.InputStream;
            import java.io.InputStreamReader;
            import java.io.OutputStream;
            import java.io.OutputStreamWriter;
            import java.io.PrintWriter;
            import java.io.Reader;
            import java.nio.charset.Charset;
            import java.nio.charset.StandardCharsets;
            import java.util.Date;


            public class Bluetooth{
                public static void main(String[] args){
                    log("Local Bluetooth device...\n");
                    LocalDevice local = null;
                            try {
                                    local = LocalDevice.getLocalDevice();   //  시도해보기
                            } catch (BluetoothStateException e2) {


                            }


                    log( "address: " + local.getBluetoothAddress() );       //  출력
                    log( "name: " + local.getFriendlyName() );      // 출력


                    Runnable r = new ServerRunable();

                                                         - 987 -
   982   983   984   985   986   987   988   989   990   991   992