当前位置: 首页>>代码示例>>Java>>正文


Java BluetoothSocket.getInputStream方法代码示例

本文整理汇总了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;
}
 
开发者ID:hardik-dadhich,项目名称:bluetooth-chat-appliction,代码行数:19,代码来源:BluetoothChatService.java

示例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;
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:19,代码来源:PBluetoothClient.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) {
    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

示例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;
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:18,代码来源:BluetoothChatService.java

示例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);
}
 
开发者ID:mcr222,项目名称:pass_the_bomb,代码行数:27,代码来源:MessagingThread.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;

    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

示例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;
}
 
开发者ID:Mozta,项目名称:ELM327,代码行数:23,代码来源:BluetoothIOGateway.java

示例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;
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:12,代码来源:DroidtoothPlugin.java

示例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;
}
 
开发者ID:voroshkov,项目名称:Chorus-RF-Laptimer,代码行数:15,代码来源:BluetoothService.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:pooi,项目名称:Nearby,代码行数:16,代码来源:RecordVitalSignActivity.java

示例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;
        }
 
开发者ID:favarete,项目名称:GodotBluetooth,代码行数:14,代码来源:GodotBluetooth.java

示例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);
}
 
开发者ID:haraldh,项目名称:iconsole-android,代码行数:57,代码来源:BluetoothChatService.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


注:本文中的android.bluetooth.BluetoothSocket.getInputStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。