本文整理匯總了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) {
}
}