Android Open Source - GlassToPhoneBluetooth Command Send Thread






From Project

Back to project page GlassToPhoneBluetooth.

License

The source code is released under:

MIT License

If you think the Android project GlassToPhoneBluetooth listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package ktlab.lib.connection;
//from  w w  w  .  java2s  . c  o m
import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteOrder;

import android.os.Message;
import android.util.Log;

public class CommandSendThread extends Thread {

    private OutputStream mOut;
    private Message mMessage;
    private ConnectionCommand mCommand;
    private ByteOrder mOrder;

    public CommandSendThread(OutputStream out, ConnectionCommand command,
            Message msg, ByteOrder order) {
        mOut = out;
        mCommand = command;
        mMessage = msg;
        mOrder = order;
    }

    @Override
    public void run() {
        try {
          Log.i("KTLAB", "CommandSendThread#run command type: " + mCommand.type);
            mOut.write(ConnectionCommand.toByteArray(mCommand, mOrder));
        } catch (IOException e) {
          Log.e("KTLAB", "CommandSendThread#run fail: " + e.getMessage());
            mMessage.what = Connection.EVENT_CONNECTION_FAIL;
        }

        mMessage.sendToTarget();
    }
}




Java Source Code List

com.space150.android.glass.camerazoom.DeviceSelectActivity.java
com.space150.android.glass.camerazoom.MainActivity.java
com.zlglassworks.glassbluetoothtest.DeviceSelectDialogFragment.java
com.zlglassworks.glassbluetoothtest.MainActivity.java
ktlab.lib.connection.CommandReceiveThread.java
ktlab.lib.connection.CommandReceiveThread.java
ktlab.lib.connection.CommandSendThread.java
ktlab.lib.connection.CommandSendThread.java
ktlab.lib.connection.ConnectionCallback.java
ktlab.lib.connection.ConnectionCallback.java
ktlab.lib.connection.ConnectionCommand.java
ktlab.lib.connection.ConnectionCommand.java
ktlab.lib.connection.ConnectionThread.java
ktlab.lib.connection.ConnectionThread.java
ktlab.lib.connection.Connection.java
ktlab.lib.connection.Connection.java
ktlab.lib.connection.bluetooth.BluetoothConnectionThread.java
ktlab.lib.connection.bluetooth.BluetoothConnectionThread.java
ktlab.lib.connection.bluetooth.BluetoothConnection.java
ktlab.lib.connection.bluetooth.BluetoothConnection.java
ktlab.lib.connection.bluetooth.ClientBluetoothConnectionThread.java
ktlab.lib.connection.bluetooth.ClientBluetoothConnectionThread.java
ktlab.lib.connection.bluetooth.ClientBluetoothConnection.java
ktlab.lib.connection.bluetooth.ClientBluetoothConnection.java
ktlab.lib.connection.bluetooth.ServerBluetoothConnectionThread.java
ktlab.lib.connection.bluetooth.ServerBluetoothConnectionThread.java
ktlab.lib.connection.bluetooth.ServerBluetoothConnection.java
ktlab.lib.connection.bluetooth.ServerBluetoothConnection.java