예제 #1
0
  private boolean sendContentsToDevice(ContentObject obj) {
    if (obj == null
        || mTransactionBuilder == null
        || !obj.mIsEnabled
        /*|| obj.mId < 0*/ || obj.mFilteredString == null
        || obj.mFilteredString.length() < 1) return false;

    TransactionBuilder.Transaction transaction = mTransactionBuilder.makeTransaction();
    transaction.begin();

    switch (obj.mContentType) {
      case ContentObject.CONTENT_TYPE_NOTIFICATION:
        // Set transaction parameters
        transaction.setCommand(Transaction.COMMAND_TYPE_ADD_NORMAL_OBJ);
        transaction.setIcon(obj.mIconType);
        transaction.setMessage(obj.mId, obj.mFilteredString);

        transaction.settingFinished();
        transaction.sendTransaction();
        break;

      case ContentObject.CONTENT_TYPE_FEED:
      case ContentObject.CONTENT_TYPE_MESSAGING:
        // Set transaction parameters
        transaction.setCommand(Transaction.COMMAND_TYPE_ADD_NORMAL_OBJ);
        transaction.setIcon(obj.mIconType);
        transaction.setMessage(obj.mId, obj.mFilteredString);

        transaction.settingFinished();
        transaction.sendTransaction();
        break;

      case ContentObject.CONTENT_TYPE_EMERGENCY:
        // Set transaction parameters
        transaction.setCommand(Transaction.COMMAND_TYPE_ADD_EMERGENCY_OBJ);
        transaction.setIcon(obj.mIconType);
        transaction.setMessage(obj.mId, obj.mFilteredString);

        transaction.settingFinished();
        transaction.sendTransaction();
        break;

      default:
        return false;
    }

    return true;
  }
예제 #2
0
  private void sendIndicatorSettingToDevice(int code) {
    if (mTransactionBuilder == null && mBtManager != null && mActivityHandler != null) {
      mTransactionBuilder = new TransactionBuilder(mBtManager, mActivityHandler);
    }

    if (mTransactionBuilder != null) {
      TransactionBuilder.Transaction transaction = mTransactionBuilder.makeTransaction();
      transaction.begin();
      transaction.setCommand(TransactionBuilder.Transaction.COMMAND_TYPE_SHOW_INDICATOR);
      transaction.setMessage(code, null);

      transaction.settingFinished();
      transaction.sendTransaction();
    }
  }
예제 #3
0
  private void sendClockStyleToDevice(int style) {
    if (mTransactionBuilder == null && mBtManager != null && mActivityHandler != null) {
      mTransactionBuilder = new TransactionBuilder(mBtManager, mActivityHandler);
    }

    if (mTransactionBuilder != null) {
      TransactionBuilder.Transaction transaction = mTransactionBuilder.makeTransaction();
      transaction.begin();
      transaction.setCommand(TransactionBuilder.Transaction.COMMAND_TYPE_SET_CLOCK_STYLE);
      transaction.setMessage(style, null);

      transaction.settingFinished();
      transaction.sendTransaction();
    }
  }