本文整理汇总了Java中android.bluetooth.BluetoothSocket.getOutputStream方法的典型用法代码示例。如果您正苦于以下问题:Java BluetoothSocket.getOutputStream方法的具体用法?Java BluetoothSocket.getOutputStream怎么用?Java BluetoothSocket.getOutputStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.bluetooth.BluetoothSocket
的用法示例。
在下文中一共展示了BluetoothSocket.getOutputStream方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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包/类
/**
* Initiate the transmission using a given socket.
*
* @param socket The socket to connect to
* @param control The parent remote control object
* @param device The BluetoothDevice that has been connected
*/
ConnectedThread(BluetoothSocket socket, RemoteControl control, BluetoothDevice device) {
mSocket = socket;
mRemoteControl = control;
mDevice = device;
mMessageBuffer = new StringBuffer();
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);
}
mInStream = tmpIn;
mOutStream = tmpOut;
// State will be set to connected once the version information is exchanged and we
// found a common protocol version set to use.
}
示例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, Context context,Handler handler) {
vibrator = (Vibrator) context.getSystemService(VIBRATOR_SERVICE);
mSocket = socket;//被管理的Socket
mHandler=handler;
this.context=context;
InputStream tmpIn = null;
OutputStream tmpOut = null;
//无论是客户端的Socket还是服务端的Socket,都有输入输出流
try {
tmpIn = socket.getInputStream();
tmpOut = socket.getOutputStream();
} catch (IOException e) { }
mInStream = tmpIn;
mOutStream = tmpOut;
// 获得远程设备的输出缓存字符流,相当于找了一个大的管道,可以通向远程设备,发数据的必经管道
mBw = new BufferedWriter(new PrintWriter(mOutStream));
//mHandler=new Handler(Looper.getMainLooper());
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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);
}
示例9: 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;
}
示例10: 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;
}
示例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 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;
}
示例13: 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;
}
示例14: RemoteItConnectionBluetooth
import android.bluetooth.BluetoothSocket; //导入方法依赖的package包/类
public RemoteItConnectionBluetooth(BluetoothSocket socket) throws IOException
{
super(socket.getInputStream(), socket.getOutputStream());
this.socket = socket;
}
示例15: printTest
import android.bluetooth.BluetoothSocket; //导入方法依赖的package包/类
public static void printTest(BluetoothSocket bluetoothSocket, Bitmap bitmap) {
try {
PrintUtil pUtil = new PrintUtil(bluetoothSocket.getOutputStream(), "GBK");
// 店铺名 居中 放大
pUtil.printAlignment(1);
pUtil.printLargeText("解忧杂货店");
pUtil.printLine();
pUtil.printAlignment(0);
pUtil.printLine();
pUtil.printTwoColumn("时间:", "2017-05-09 15:50:41");
pUtil.printLine();
pUtil.printTwoColumn("订单号:", System.currentTimeMillis() + "");
pUtil.printLine();
pUtil.printTwoColumn("付款人:", "VitaminChen");
pUtil.printLine();
// 分隔线
pUtil.printDashLine();
pUtil.printLine();
//打印商品列表
pUtil.printText("商品");
pUtil.printTabSpace(2);
pUtil.printText("数量");
pUtil.printTabSpace(1);
pUtil.printText(" 单价");
pUtil.printLine();
pUtil.printThreeColumn("iphone6", "1", "4999.00");
pUtil.printThreeColumn("测试一个超长名字的产品看看打印出来会怎么样哈哈哈哈哈哈", "1", "4999.00");
pUtil.printDashLine();
pUtil.printLine();
pUtil.printTwoColumn("订单金额:", "9998.00");
pUtil.printLine();
pUtil.printTwoColumn("实收金额:", "10000.00");
pUtil.printLine();
pUtil.printTwoColumn("找零:", "2.00");
pUtil.printLine();
pUtil.printDashLine();
pUtil.printBitmap(bitmap);
pUtil.printLine(4);
} catch (IOException e) {
}
}