Class BluetoothCtrl

java.lang.Object
com.unitech.api.bluetooth.BluetoothCtrl

public class BluetoothCtrl extends Object
This controller is used to get the bluetooth information.
  • Field Details

  • Constructor Details

    • BluetoothCtrl

      public BluetoothCtrl(android.content.Context context)
      Instantiates a new Bluetooth ctrl.
      Parameters:
      context - the context
  • Method Details

    • getInstance

      public static BluetoothCtrl getInstance(android.content.Context context)
      Gets instance.
      Parameters:
      context - the context
      Returns:
      the instance
    • getMacAddress

      public android.os.Bundle getMacAddress()
      Get mac address bundle.
      Returns:
      A bundle contains the error code and message
      int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg = bundle.getString("errorMsg");
      String macAddress = bundle.getString("BluetoothMacAddress");
    • getBluetoothConnectStatus

      public android.os.Bundle getBluetoothConnectStatus()
      Get Bluetooth Connect Status
      Returns:
      A bundle contains the error code and message
      int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg=bundle.getString("errorMsg");
      String getBluetoothConnectStatus=bundle.getString("getBluetoothConnectStatus");
    • getBluetoothVersion

      public android.os.Bundle getBluetoothVersion()
      Get Bluetooth Version
      Returns:
      A bundle contains the error code and message
      int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg=bundle.getString("errorMsg");
      String getBluetoothVersion=bundle.getString("getBluetoothVersion");
    • getActiveBluetoothProfile

      public android.os.Bundle getActiveBluetoothProfile()
      Get Active Bluetooth Profile
      Returns:
      A bundle contains the error code and message
      int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg=bundle.getString("errorMsg");
      String getActiveBluetoothProfile=bundle.getString("getActiveBluetoothProfile");
    • enableBluetooth

      public android.os.Bundle enableBluetooth(boolean enabled)
      Enable Bluetooth
      Parameters:
      enabled - the enabled
      Returns:
      A bundle contains the error code and message
      int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg=bundle.getString("errorMsg");
    • setScanMode

      public android.os.Bundle setScanMode(int mode)
      Set Bluetooth scan mode
      Parameters:
      mode - the mode, one of the following:
      20: BluetoothAdapter.SCAN_MODE_NONE
      21: BluetoothAdapter.SCAN_MODE_CONNECTABLE
      23: BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE
      Returns:
      A bundle contains the error code and message
      int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg=bundle.getString("errorMsg");
    • setBluetoothName

      public android.os.Bundle setBluetoothName(String name)
      Set Bluetooth Name
      Parameters:
      name - the name
      Returns:
      A bundle contains the error code and message
      int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg=bundle.getString("errorMsg");