本文整理汇总了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;
}