當前位置: 首頁>>代碼示例>>Java>>正文


Java BluetoothSocket.getInputStream方法代碼示例

本文整理匯總了Java中android.bluetooth.BluetoothSocket.getInputStream方法的典型用法代碼示例。如果您正苦於以下問題:Java BluetoothSocket.getInputStream方法的具體用法?Java BluetoothSocket.getInputStream怎麽用?Java BluetoothSocket.getInputStream使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.bluetooth.BluetoothSocket的用法示例。


在下文中一共展示了BluetoothSocket.getInputStream方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ConnectedThread

import android.bluetooth.BluetoothSocket; //導入方法依賴的package包/類
public ConnectedThread(BluetoothSocket socket, String socketType) {
    Log.d(TAG, "create ConnectedThread: " + socketType);
    mmSocket = socket;
    InputStream tmpIn = null;
    OutputStream tmpOut = null;

    // Get the BluetoothSocket input and output streams
    try {
        tmpIn = socket.getInputStream();
        tmpOut = socket.getOutputStream();
    } catch (IOException e) {
        Log.e(TAG, "temp sockets not created", e);
    }

    mmInStream = tmpIn;
    mmOutStream = tmpOut;
    mState = STATE_CONNECTED;
}
 
開發者ID:hardik-dadhich,項目名稱:bluetooth-chat-appliction,代碼行數:19,代碼來源:BluetoothChatService.java

示例2: ConnectedThread

import android.bluetooth.BluetoothSocket; //導入方法依賴的package包/類
public ConnectedThread(BluetoothSocket socket, BluetoothDevice device) {
    MLog.d(TAG, "create ConnectedThread");
    mmSocket = socket;
    mmDevice = device;
    InputStream tmpIn = null;
    OutputStream tmpOut = null;

    // Get the BluetoothSocket input and output streams
    try {
        tmpIn = socket.getInputStream();
        tmpOut = socket.getOutputStream();
    } catch (IOException e) {
        Log.e(TAG, "temp sockets not created", e);
    }

    mmInStream = tmpIn;
    mmOutStream = tmpOut;
}
 
開發者ID:victordiaz,項目名稱:phonk,代碼行數:19,代碼來源:PBluetoothClient.java

示例3: ConnectedThread

import android.bluetooth.BluetoothSocket; //導入方法依賴的package包/類
public ConnectedThread(BluetoothSocket socket, String socketType) {
    Log.d(TAG, "create ConnectedThread: " + socketType);
    mmSocket = socket;
    InputStream tmpIn = null;
    OutputStream tmpOut = null;

    // Get the BluetoothSocket input and output streams
    try {
        tmpIn = socket.getInputStream();
        tmpOut = socket.getOutputStream();
    } catch (IOException e) {
        Log.e(TAG, "temp sockets not created", e);
    }

    mmInStream = tmpIn;
    mmOutStream = tmpOut;
}
 
開發者ID:tkmarsh,項目名稱:SmartRC,代碼行數:18,代碼來源:BluetoothChatService.java

示例4: ConnectedThread

import android.bluetooth.BluetoothSocket; //導入方法依賴的package包/類
public ConnectedThread(BluetoothSocket socket) {
    mmSocket = socket;
    InputStream tmpIn = null;
    OutputStream tmpOut = null;

    // Get the input and output streams, using temp objects because
    // member streams are final
    try {
        tmpIn = socket.getInputStream();
        tmpOut = socket.getOutputStream();
    } catch (IOException e) {
        Log.e(Constants.TAG, "Temp sockets not created", e);
    }

    mmInStream = tmpIn;
    mmOutStream = tmpOut;
}
 
開發者ID:bilal-rashid,項目名稱:Lazy-Switches,代碼行數:18,代碼來源:BluetoothService.java

示例5: ConnectedThread

import android.bluetooth.BluetoothSocket; //導入方法依賴的package包/類
public ConnectedThread(BluetoothSocket socket) {
    Log.d(TAG, "create ConnectedThread");
    mmSocket = socket;
    InputStream tmpIn = null;
    OutputStream tmpOut = null;

    // Get the BluetoothSocket input and output streams
    try {
        tmpIn = socket.getInputStream();
        tmpOut = socket.getOutputStream();
    } catch (IOException e) {
        Log.e(TAG, "temp sockets not created", e);
    }

    mmInStream = tmpIn;
    mmOutStream = tmpOut;
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:18,代碼來源:BluetoothChatService.java

示例6: MessagingThread

import android.bluetooth.BluetoothSocket; //導入方法依賴的package包/類
/**
 * Creates a messaging thread with the socket (and player behind socket).
 *
 * @param socket socket that represents the bluetooth connection
 */
public MessagingThread(BluetoothSocket socket) {
    System.out.println("Starting messaging thread " + socket.getRemoteDevice().getName());
    mmSocket = socket;
    InputStream tmpIn = null;
    OutputStream tmpOut = null;

    // Get the input and output streams, using temp objects because
    // member streams are final
    try {
        tmpIn = socket.getInputStream();
        tmpOut = socket.getOutputStream();
    } catch (IOException e) { }

    //the streams are used in order to receive and send data
    mmInStream = tmpIn;
    mmOutStream = tmpOut;

    //store this messaging thread in the map with all the messaging threads per player
    remoteDevice = mmSocket.getRemoteDevice();
    BluetoothServices.putInMessagingThreadMap(getRemotePlayer(),this);
}
 
開發者ID:mcr222,項目名稱:pass_the_bomb,代碼行數:27,代碼來源:MessagingThread.java

示例7: ConnectedThread

import android.bluetooth.BluetoothSocket; //導入方法依賴的package包/類
public ConnectedThread(BluetoothSocket socket) {
    Log.d(TAG, "create ConnectedThread");
    mmSocket = socket;
    InputStream tmpIn = null;
    OutputStream tmpOut = null;

    try {
        tmpIn = socket.getInputStream();
        tmpOut = socket.getOutputStream();
    } catch (IOException e) {
        Log.e(TAG, "temp sockets not created", e);
    }

    mmInStream = tmpIn;
    mmOutStream = tmpOut;
}
 
開發者ID:rlatkdgus500,項目名稱:UnityBluetoothPlugin,代碼行數:17,代碼來源:BluetoothService.java

示例8: ConnectedThread

import android.bluetooth.BluetoothSocket; //導入方法依賴的package包/類
public ConnectedThread(BluetoothSocket socket, String socketType)
{
    MyLog.d(TAG, "create ConnectedThread: " + socketType);

    mmSocket = socket;
    InputStream tmpIn = null;
    OutputStream tmpOut = null;

    // Get the BluetoothSocket input and output streams
    try
    {
        tmpIn = socket.getInputStream();
        tmpOut = socket.getOutputStream();
    }
    catch (IOException e)
    {
        MyLog.e(TAG, "temp sockets not created", e);
    }

    mmInStream = tmpIn;
    mmOutStream = tmpOut;
}
 
開發者ID:Mozta,項目名稱:ELM327,代碼行數:23,代碼來源:BluetoothIOGateway.java

示例9: call

import android.bluetooth.BluetoothSocket; //導入方法依賴的package包/類
@Override
public BluetoothSocket call() throws Exception {
	BluetoothSocket s = connectionTask.call();
	InputStream in = s.getInputStream();
	while (in.available() == 0) {
		LOG.info("Waiting for data");
		Thread.sleep(1000);
	}
	LOG.info("Data available");
	return s;
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:12,代碼來源:DroidtoothPlugin.java

示例10: ConnectedThread

import android.bluetooth.BluetoothSocket; //導入方法依賴的package包/類
public ConnectedThread(BluetoothSocket socket, String socketType) {
    mmSocket = socket;
    InputStream tmpIn = null;
    OutputStream tmpOut = null;

    // Get the BluetoothSocket input and output streams
    try {
        tmpIn = socket.getInputStream();
        tmpOut = socket.getOutputStream();
    } catch (IOException e) { }

    mmInStream = tmpIn;
    mmOutStream = tmpOut;
}
 
開發者ID:voroshkov,項目名稱:Chorus-RF-Laptimer,代碼行數:15,代碼來源:BluetoothService.java

示例11: ConnectedThread

import android.bluetooth.BluetoothSocket; //導入方法依賴的package包/類
public ConnectedThread(BluetoothSocket socket) {
    mmSocket = socket;
    InputStream tmpIn = null;
    OutputStream tmpOut = null;

    // Get the input and output streams, using temp objects because
    // member streams are final
    try {
        tmpIn = socket.getInputStream();
        tmpOut = socket.getOutputStream();
    } catch (IOException e) { }

    mmInStream = tmpIn;
    mmOutStream = tmpOut;
}
 
開發者ID:pooi,項目名稱:Nearby,代碼行數:16,代碼來源:RecordVitalSignActivity.java

示例12: ConnectedThread

import android.bluetooth.BluetoothSocket; //導入方法依賴的package包/類
public ConnectedThread(BluetoothSocket newSocket) {

            InputStream tmpIn = null;
            OutputStream tmpOut = null;

            try {
                tmpIn = newSocket.getInputStream();
                tmpOut = newSocket.getOutputStream();
            } catch (IOException e) { }

            mmInStream = tmpIn;
            mmOutStream = tmpOut;
        }
 
開發者ID:favarete,項目名稱:GodotBluetooth,代碼行數:14,代碼來源:GodotBluetooth.java

示例13: ConnectedThread

import android.bluetooth.BluetoothSocket; //導入方法依賴的package包/類
public ConnectedThread(BluetoothSocket socket) {
    Log.d(TAG, "create ConnectedThread");
    mmSocket = socket;
    InputStream tmpIn = null;
    OutputStream tmpOut = null;

    // Get the BluetoothSocket input and output streams
    try {
        tmpIn = socket.getInputStream();
        tmpOut = socket.getOutputStream();
    } catch (IOException e) {
        Log.e(TAG, "temp sockets not created", e);
    }

    mmInStream = tmpIn;
    mmOutStream = tmpOut;
    mState = STATE_CONNECTED;

    mmIConsole = new IConsole(mmInStream, mmOutStream, new IConsole.DataListener() {
        @Override
        public void onData(IConsole.Data data) {
            //Log.i(TAG, "mConnectedThread: onData");
            // Share the sent message back to the UI Activity
            mHandler.obtainMessage(Constants.MESSAGE_DATA, -1, -1, data)
                    .sendToTarget();
        }

        @Override
        public void onError(Exception e) {
            Log.e(TAG, "mConnectedThread Error: ", e);

            if (e instanceof IOException)
                connectionLost();
        }
    }, /* new IConsole.DebugListener() {
        @Override
        public void onRead(byte[] buffer) {
            if (buffer.length > 0) {
                String hexbuf = IConsole.byteArrayToHex(buffer);

                // Send the obtained bytes to the UI Activity
                mHandler.obtainMessage(Constants.MESSAGE_READ, hexbuf.length(), -1, hexbuf.getBytes())
                        .sendToTarget();
            }
        }

        @Override
        public void onWrite(byte[] buffer) {
            String hexbuf = IConsole.byteArrayToHex(buffer);

            // Share the sent message back to the UI Activity
            mHandler.obtainMessage(Constants.MESSAGE_WRITE, -1, -1, hexbuf.getBytes())
                    .sendToTarget();
        }
    }*/ null);
}
 
開發者ID:haraldh,項目名稱:iconsole-android,代碼行數:57,代碼來源:BluetoothChatService.java

示例14: RemoteItConnectionBluetooth

import android.bluetooth.BluetoothSocket; //導入方法依賴的package包/類
public RemoteItConnectionBluetooth(BluetoothSocket socket) throws IOException
{
	super(socket.getInputStream(), socket.getOutputStream());
	
	this.socket = socket;
}
 
開發者ID:Elbehiry,項目名稱:Pc-Control,代碼行數:7,代碼來源:RemoteItConnectionBluetooth.java


注:本文中的android.bluetooth.BluetoothSocket.getInputStream方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。