Package com.unitech.api.bluetooth
Class BluetoothCtrl
java.lang.Object
com.unitech.api.bluetooth.BluetoothCtrl
This controller is used to get the bluetooth information.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBundleenableBluetooth(boolean enabled) Enable BluetoothBundleGet Active Bluetooth ProfileBundleGet Bluetooth Connect StatusBundleGet Bluetooth Versionstatic BluetoothCtrlgetInstance(Context context) Gets instance.BundleGet mac address bundle.BundlesetBluetoothName(String name) Set Bluetooth NameBundlesetScanMode(int mode) Set Bluetooth scan mode
-
Field Details
-
BUNDLE_ERROR_CODE
- See Also:
-
BUNDLE_ERROR_MSG
- See Also:
-
RESULT_CODE_ERROR
public static final int RESULT_CODE_ERROR- See Also:
-
RESULT_CODE_SUCCESS
public static final int RESULT_CODE_SUCCESS- See Also:
-
RESULT_KEY_BT_MAC
- See Also:
-
-
Constructor Details
-
BluetoothCtrl
public BluetoothCtrl(Context context) Instantiates a new Bluetooth ctrl.- Parameters:
context- the context
-
-
Method Details
-
getInstance
Gets instance.- Parameters:
context- the context- Returns:
- the instance
-
getMacAddress
public 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 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 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 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 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 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
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");
-