当前位置: 首页>>代码示例>>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;未经允许,请勿转载。