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
ConstructorsConstructorDescriptionBluetoothCtrl(android.content.Context context) Instantiates a new Bluetooth ctrl. -
Method Summary
Modifier and TypeMethodDescriptionandroid.os.BundleenableBluetooth(boolean enabled) Enable Bluetoothandroid.os.BundleGet Active Bluetooth Profileandroid.os.BundleGet Bluetooth Connect Statusandroid.os.BundleGet Bluetooth Versionstatic BluetoothCtrlgetInstance(android.content.Context context) Gets instance.android.os.BundleGet mac address bundle.android.os.BundlesetBluetoothName(String name) Set Bluetooth Nameandroid.os.BundlesetScanMode(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(android.content.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 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
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");
-