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


Java BluetoothSocket.getOutputStream方法代碼示例

本文整理匯總了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;
}
 
開發者ID:hardik-dadhich,項目名稱:bluetooth-chat-appliction,代碼行數:19,代碼來源:BluetoothChatService.java

示例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.
}
 
開發者ID:FelixWohlfrom,項目名稱:Presenter-Client-Android,代碼行數:29,代碼來源:BluetoothPresenterControl.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, 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());
}
 
開發者ID:fergus825,項目名稱:SmartOrnament,代碼行數:20,代碼來源:ConnectedThread.java

示例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;
}
 
開發者ID:bilal-rashid,項目名稱:Lazy-Switches,代碼行數:18,代碼來源:BluetoothService.java

示例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;
}
 
開發者ID:victordiaz,項目名稱:phonk,代碼行數:19,代碼來源:PBluetoothClient.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;

    // 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

示例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);
}
 
開發者ID:mcr222,項目名稱:pass_the_bomb,代碼行數:27,代碼來源:MessagingThread.java

示例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;
}
 
開發者ID:rlatkdgus500,項目名稱:UnityBluetoothPlugin,代碼行數:17,代碼來源:BluetoothService.java

示例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;
}
 
開發者ID:Mozta,項目名稱:ELM327,代碼行數:23,代碼來源:BluetoothIOGateway.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:ordsen,項目名稱:Snach-Android,代碼行數:16,代碼來源:BluetoothActivity.java

示例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;
}
 
開發者ID:voroshkov,項目名稱:Chorus-RF-Laptimer,代碼行數:15,代碼來源:BluetoothService.java

示例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;
        }
 
開發者ID:favarete,項目名稱:GodotBluetooth,代碼行數:14,代碼來源:GodotBluetooth.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

示例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) {

        }
    }
 
開發者ID:aiyangtianci,項目名稱:BluetoothAPP,代碼行數:58,代碼來源:PrintUtil.java


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