本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例14: RemoteItConnectionBluetooth
import android.bluetooth.BluetoothSocket; //導入方法依賴的package包/類
public RemoteItConnectionBluetooth(BluetoothSocket socket) throws IOException
{
super(socket.getInputStream(), socket.getOutputStream());
this.socket = socket;
}