Android Open Source - GlassToPhoneBluetooth Command Send Thread

From Project

Back to project page GlassToPhoneBluetooth.


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.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;

    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;


Java Source Code List