java.lang.Object | |
↳ | com.samsung.android.knox.ex.peripheral.PeripheralManager |
Deprecated in API level 37
Public interface to manage peripheral service
API level 34 |
Knox 3.7.1 |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | RESULT_CODE_FAIL_PERMISSION_ERROR | Deprecated in API level 37 | |||||||||
int | RESULT_CODE_FAIL_SERVICE_UNAVAILABLE | Deprecated in API level 37 | |||||||||
int | RESULT_CODE_FAIL_WRONG_ARGUMENT | Deprecated in API level 37 | |||||||||
int | RESULT_CODE_INVALID | Deprecated in API level 37 | |||||||||
int | RESULT_CODE_SUCCESS | Deprecated in API level 37 |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
| |||||||||||
Deprecated
in API level 37
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Deprecated in API level 37
Indicates that callee doesn't have permission
API level 34 |
KNOX 3.7.1 |
Deprecated in API level 37
Indicates that peripheral service is not available
API level 34 |
KNOX 3.7.1 |
Deprecated in API level 37
Indicates that argument is wrong
API level 34 |
KNOX 3.7.1 |
Deprecated in API level 37
Indicates that plugin is not available
API level 34 |
KNOX 3.7.1 |
Deprecated in API level 37
Indicates success
API level 34 |
KNOX 3.7.1 |
Deprecated in API level 37
API for making beep sound in the peripheral. (only for peripherals which support this functionality)
peripheralId | peripheral id to update firmware.getAvailablePeripherals(PeripheralResultListener) retrieves list of available peripheralId. |
---|---|
milliseconds | duration to make beep sound (milliseconds) |
option | Bundle data (optional) if option has key 'PeripheralConstants.BeepSoundEffect.REPEAT_INT', peripheral makes beep sound multiple time as value of this key, otherwise, makes beep sound only once. 'PeripheralConstants.BeepSoundEffect.INTERVAL_INT' is need to config interval time (milliseconds) |
listener | listener to deliver result. |
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong. SecurityException | If caller does not have required permissions |
---|
Bundle option = new Bundle(); // optional option.putInt(PeripheralConstants.BeepSoundEffect.INTERVAL_INT, 500); // optional option.putInt(PeripheralConstants.BeepSoundEffect.REPEAT_INT, 3); // optional // option is 'repeat 3 times, interval is 500 milliseconds PeripheralManager.getInstance(context).beep(mPeripheralId, milliseconds, option, new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'beep' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'beep' function failed } }); |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 35 |
KNOX 3.8 |
Global Scope |
Deprecated in API level 37
API to clear memory of peripheral device
peripheralId | peripheral id to clear memory.getAvailablePeripherals(PeripheralResultListener) retrieves list of available peripheralId. |
---|---|
clearOption | Clear option. PeripheralConstants.DataClearOption |
listener | listener to deliver result. |
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
PeripheralManager.getInstance(context).clearMemory(peripheralId, clearOption new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'clearMemory' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'clearMemory' function failed } }); |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API for connecting specified bluetooth peripheral.
This could be used when peripheral is disconnected unexpectedly for following reasons (ex. out of range, battery off..).
getBluetoothPeripherals(String, PeripheralResultListener)
retrieves Bluetooth peripheral list have paired before.
peripheral | BluetoothDevice to connect. |
---|---|
listener | listener to deliver result. |
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong. SecurityException | If caller does not have required permissions |
---|
mPeripheralManager.connectPeripheral(device, new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'connectPeripheral' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'connectPeripheral' function failed } }); |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 35 |
KNOX 3.8 |
Global Scope |
Deprecated in API level 37
API to disable PeripheralService.
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 34 |
KNOX 3.7.1 |
Global Scope |
enable(Bundle)
isEnabled()
Deprecated in API level 37
API for disconnecting specified peripheral.
peripheralId | peripheral id to update firmware.getAvailablePeripherals(PeripheralResultListener) retrieves list of available peripheralId. |
---|---|
listener | listener to deliver result. |
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong. SecurityException | If caller does not have required permissions |
---|
mPeripheralManager.disconnectPeripheral(peripheralId, new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'disconnectPeripheral' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'disconnectPeripheral' function failed } }); |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 35 |
KNOX 3.8 |
Global Scope |
Deprecated in API level 37
API for showing specified text on the display of the peripheral. (only for peripherals which support this functionality)
peripheralId | peripheral id to update firmware.getAvailablePeripherals(PeripheralResultListener) retrieves list of available peripheralId. |
---|---|
text | text message to show in peripheral screen |
milliseconds | time to show text message (milliseconds) |
option | Bundle data (optional) if option has key 'PeripheralConstants.DisplayText.CLEAR_DISPLAY_BOOL' and the value is 'false', peripheral display doesn't clear screen and appends test message. otherwise (option is null or empty or 'PeripheralConstants.DisplayText.CLEAR_DISPLAY_BOOL' is true), peripheral clears screen(display) and shows text message. |
listener | listener to deliver result. |
RESULT_CODE_SUCCESS
if success,RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong. SecurityException | If caller does not have required permissions |
---|
Bundle option = new Bundle(); // optional option.putBoolean(PeripheralConstants.DisplayText.CLEAR_DISPLAY_BOOL, false); // optional PeripheralManager.getInstance(context).displayText(mPeripheralId, text, milliseconds, option, new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'displayText' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'displayText' function failed } }); |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 35 |
KNOX 3.8 |
Global Scope |
Deprecated in API level 37
API to enable PeripheralService by using Profile.
This API applies profile to PeripheralService.
Once PeripheralService is enabled with wrong profile,
you should disable PeripheralService by disable()
and enable PeripheralService with new profile.
Profile hierarchy
Layer | Key | Data Type | etc |
Profile | KEY_PROFILE_NAME_STR |
String | Mandatory. Since 3.7.1 |
Profile | KEY_PLUGIN_BUNDLE_LIST |
List<Bundle> | Mandatory. Since 3.7.1 |
Plugin | KEY_PLUGIN_NAME_STR |
String | Mandatory. Since 3.7.1 |
Plugin | KEY_PLUGIN_PACKAGE_NAME_STR |
String | Mandatory. Since 3.7.1 |
Plugin | KEY_PERIPHERAL_BUNDLE_LIST |
List<Bundle> | Mandatory. Since 3.7.1 |
Peripheral | KEY_PERIPHERAL_NAME_STR |
String | Mandatory. Since 3.7.1 |
Peripheral | KEY_PERIPHERAL_CONNECTIVITY_BUNDLE_LIST |
List<Bundle> | Mandatory. Since 3.7.1 |
Connectivity | KEY_PERIPHERAL_CONNECTIVITY_TYPE_STR |
String | Mandatory. Since 3.7.1 |
Connectivity | KEY_PERIPHERAL_CONNECTIVITY_IDENTIFIER_STR |
String | Mandatory. Since 3.7.1 |
Connectivity | KEY_PERIPHERAL_BARCODE_DATA_PROCESS_MODE_STR |
String | Optional. Since 3.7.1 |
Connectivity | KEY_PERIPHERAL_PREFIX_STR |
String | Optional. Since 3.7.1 |
Connectivity | KEY_PERIPHERAL_SUFFIX_STR |
String | Optional. Since 3.7.1 |
Connectivity | KEY_PERIPHERAL_BARCODE_ENABLE_TIMESTAMP_BOOL |
boolean | Optional. Since 3.7.1 |
Connectivity | KEY_PERIPHERAL_ENABLE_BEEP_SOUND_BOOL |
boolean | Optional. Since 3.7.1 |
Connectivity | KEY_PERIPHERAL_ENABLE_CHECK_DUPLICATED_BARCODE_BOOL |
boolean | Optional. Since 3.7.1 |
Connectivity | KEY_PERIPHERAL_BARCODE_ENABLED_SYMBOLOGY_LIST |
List<String> | Optional. Since 3.7.1 | Connectivity | KEY_PERIPHERAL_BARCODE_ENABLED_OPTION_LIST |
List<String> | Optional. Since 3.7.1 |
profile | peripheral profile |
---|
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
Belows are just temporary sample code. usage may be changed
// if peripheralService is enabled, disable peripheralService to change profile. if (PeripheralManager.getInstance(context).isEnabled()) { PeripheralManager.getInstance(context).disable(); } PeripheralManager.getInstance(context).enable(getProfile()); private Bundle getProfile() { Bundle bundle = new Bundle(); bundle.putString(KEY_PROFILE_NAME_STR, "test_profile_2021-01-11"); Bundle pluginBundle = getPlugin(); ArrayList |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API to get connected peripheral devices from all plugins
listener | listener to which result is to be delivered. |
---|
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.public void getAvailablePeripheral(Context context) { PeripheralManager peripheralManager = PeripheralManager.getInstance(context); peripheralManager.getAvailablePeripherals(new PeripheralResultListener() { public void onSuccess(Bundle bundle) { getPeripheralList(bundle); } public void onFail(int errorCode, String description) { // invoked if fail to call getAvailablePeripheral. } }); } private List |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API for getting all paired bluetooth peripherals.
option | option for getting bluetooth peripheral.ALL : retrieves all paired bluetooth devices.RECENT : retrieves latest paired bluetooth devices. |
---|---|
listener | listener to deliver result. |
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong. SecurityException | If caller does not have required permissions |
---|
mPeripheralManager.getBluetoothPeripherals(PeripheralConstants.BtPeripheralListOption.ALL, new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'getBluetoothPeripherals' function succeeds ArrayList |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 35 |
KNOX 3.8 |
Global Scope |
Deprecated in API level 37
API to get configuration of specified peripheral PeripheralResultListener.onResult retrieves data which is listed in param List<String> keyList from specified peripheral (param peripheralId). supported keys
peripheralId | peripheral id to get configuration from.getAvailablePeripherals(PeripheralResultListener) retrieves list of available peripheralId. |
---|---|
keyList | list of keys. PeripheralResultListener.onSuccess retrieves values of these keys |
listener | listener to which result is to be delivered. |
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.Belows are just temporary sample code. usage may be changed
private void getConfiguration(Context context, String peripheralId) { ArrayList |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API to get Connection Profile. Connection Profile means profile of BLUETOOTH, class of USB
peripheralId | peripheral id to update firmware.getAvailablePeripherals(PeripheralResultListener) retrieves list of available peripheralId. |
---|---|
listener | listener to deliver result. |
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
PeripheralManager.getInstance(context).getConnectionProfile(peripheralId, new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'getConnectionProfile' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'getConnectionProfile' function failed } }); |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API to get information of all peripherals and plugins
listener | listener to which result is to be delivered. |
---|
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.Belows are just temporary sample code. usage may be changed
PeripheralManager.getInstance(context).getInformation( new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'getInformation' function succeeds PeripheralHelperInfo info = new PeripheralHelperInfo(bundle); } public void onFail(int errorCode, String description) { // invoked when 'getInformation' function failed } }); public class PeripheralHelperInfo { List |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API to create an instance of PeripheralManager class.
context | context of the application or service using this class |
---|
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API for getting barcode data required for discovery and pairing of bluetooth peripheral.
device discovers Bluetooth peripheral before time-out DISCOVER_TIMEOUT
or calling stopPairingPeripheral(PeripheralResultListener)
peripheralId | peripheral id to update firmware.getAvailablePeripherals(PeripheralResultListener) retrieves list of available peripheralId. |
---|---|
listener | listener to deliver result. |
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong. SecurityException | If caller does not have required permissions |
---|
mPeripheralManager.getPairingBarcodeData(peripheralId, new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'getPairingBarcodeData' function succeeds String barcode = bundle.getString(PeripheralConstants.KEY_RESULT_BARCODE_DATA_STR); } public void onFail(int errorCode, String description) { // invoked when 'getPairingBarcodeData' function failed } }); |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 35 |
KNOX 3.8 |
Global Scope |
Deprecated in API level 37
API to get stored data. barcode data is stored in peripheral, if data process mode is STORE
peripheralId | peripheral id to get stored data.getAvailablePeripherals(PeripheralResultListener) retrieves list of available peripheralId. |
---|---|
listener | listener to deliver result. NOTE : listener notifies 'get stored data is started'. doesn't retrieve stored barcode data. PeripheralDataListener.onReceive(), which is registered by registerDataListener retrieves barcode data. |
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.PeripheralManager.getInstance(context).getStoredData(peripheralId, new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'getStoredData' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'getStoredData' function failed } }); |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API for getting all supported peripheral list from all plugins, regardless of current connection status.
listener | listener to which result is to be delivered. |
---|
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.public void getSupportedPeripherals(Context context) { PeripheralManager peripheralManager = PeripheralManager.getInstance(context); peripheralManager.getSupportedPeripherals(new PeripheralResultListener() { public void onSuccess(Bundle bundle) { getPeripheralList(bundle); } public void onFail(int errorCode, String description) { // invoked if fail to call getSupportedPeripherals. } }); } private List |
API level 35 |
KNOX 3.8 |
Global Scope |
Deprecated in API level 37
API to check whether PeripheralService is enabled or not.
true
if service is enabled, false
otherwise.API level 34 |
KNOX 3.7.1 |
Global Scope |
enable(Bundle)
Deprecated in API level 37
API to check whether PeripheralService is started or not.
true
if service is started, false
otherwise.API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API to register listener which retrieves barcode data
listener | listener to which barcode data is to be delivered. |
---|
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
Belows are just temporary sample code. usage may be changed
PeripheralManager.getInstance(context).registerDataListener( new PeripheralDataListener() { public void onSuccess() { // invoked when 'registerDataListener' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'registerDataListener' function failed } public void onReceive(int eventType, Bundle data) { PeripheralHelperData barcodeData = new PeripheralHelperData(data); } }); public class PeripheralHelperData { String mPeripheralId; String mName; String mModel; String mSerialNumber; String mDataType; List |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API to register listener which retrieves information of all peripherals and plugins
listener | listener to which information is to be delivered. |
---|
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
PeripheralManager.getInstance(context).registerInfoListener(
new PeripheralResultListener() {
public void onSuccess(Bundle data) {
// invoked when 'registerInfoListener' function succeeds
// same bundle data is retrieved |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API to register listener which retrieves state change from peripherals
listener | listener to which state is to be delivered. |
---|
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
Belows are just temporary sample code. usage may be changed
PeripheralManager.getInstance(context).registerStateListener( new PeripheralStateListener() { public void onSuccess() { // invoked when 'registerStateListener' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'registerStateListener' function failed } public void onStateChange(final int eventType, final Bundle bundle) { // invoked when receiving state event if (eventType == PeripheralConstants.EventType.CONNECTION_CHANGED) { PeripheralHelperConnectionState state = new PeripheralHelperConnectionState(bundle); } else if (eventType == PeripheralConstants.EventType.ERROR_RECEIVED) { PeripheralHelperErrorState state = new PeripheralHelperErrorState(bundle); } } }); public class PeripheralHelperConnectionState { List |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API to reset peripheral configuration
peripheralId | peripheral id to reset peripheral configuration.getAvailablePeripherals(PeripheralResultListener) retrieves list of available peripheralId. |
---|---|
resetOption | peripheral reset option.
Please find PeripheralConstants.DataResetOption |
listener | listener to deliver result. |
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
PeripheralManager.getInstance(context).resetPeripheral(peripheralId, resetOption new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'resetPeripheral' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'resetPeripheral' function failed } }); |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 35 |
KNOX 3.8 |
Global Scope |
Deprecated in API level 37
API to set configuration of specified peripheral. supported keys
Key | Data Type | etc |
KEY_PERIPHERAL_BARCODE_DATA_PROCESS_MODE_STR |
String | Since 3.7.1 |
KEY_PERIPHERAL_PREFIX_STR |
List<Bundle> | Since 3.7.1 |
KEY_PERIPHERAL_SUFFIX_STR |
String | Since 3.7.1 |
KEY_PERIPHERAL_BARCODE_ENABLE_TIMESTAMP_BOOL |
List<Bundle> | Since 3.7.1 |
KEY_PERIPHERAL_ENABLE_BEEP_SOUND_BOOL |
String | Since 3.7.1 |
KEY_PERIPHERAL_ENABLE_CHECK_DUPLICATED_BARCODE_BOOL |
List<Bundle> | Since 3.7.1 |
KEY_PERIPHERAL_BARCODE_ENABLED_SYMBOLOGY_LIST |
String | Since 3.7.1 |
KEY_PERIPHERAL_BARCODE_ENABLED_OPTION_LIST |
List<Bundle> | Since 3.7.1 |
peripheralId | peripheral id to set configuration.getAvailablePeripherals(PeripheralResultListener) retrieves list of available peripheralId. |
---|---|
data | key and value to set configuration |
listener | listener to which result is to be delivered. |
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
Belows are just temporary sample code. usage may be changed
public void setConfiguration(Context context, String peripheralId) { Bundle bundle = new Bundle(); bundle.putString(KEY_PERIPHERAL_BARCODE_DATA_PROCESS_MODE_STR, PeripheralConstants.BarcodeDataProcessMode.WEDGE); bundle.putString(KEY_PERIPHERAL_PREFIX_STR, "test_prefix"); bundle.putString(KEY_PERIPHERAL_SUFFIX_STR, "test_suffix"); bundle.putBoolean(KEY_PERIPHERAL_BARCODE_ENABLE_TIMESTAMP_BOOL, true); bundle.putBoolean(KEY_PERIPHERAL_ENABLE_BEEP_SOUND_BOOL, true); // symbology list ArrayList |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API to change Connection Profile. (ex. SPP -> HID) Connection Profile means profile of BLUETOOTH, class of USB
peripheralId | peripheral id to update firmware.getAvailablePeripherals(PeripheralResultListener) retrieves list of available peripheralId. |
---|---|
connectionProfile | Connection profile. Please find PeripheralConstants.ConnectionProfile |
listener | listener to deliver result. |
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong. SecurityException | If caller does not have required permissions |
---|
PeripheralManager.getInstance(context).setConnectionProfile(peripheralId, mode new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'setConnectionProfile' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'setConnectionProfile' function failed } }); |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API to start PeripheralService.
Note : listener.onSuccess() doesn't guarantee profile validity.
PeripheralService broadcasts intent ACTION_SERVICE_START
to notify result of profile validation since Knox3.8(API level 35)
listener | listener to which result is to be delivered. |
---|
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
PeripheralManager.getInstance(context).start(profile, new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'start' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'start' function failed } }); // broadcastReceiver. register this receiver with intentFilter(PeripheralConstants.ACTION_SERVICE_START) .... new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(PeripheralConstants.ACTION_SERVICE_START)) { int errorCode = intent.getIntExtra(PeripheralConstants.EXTRA_SERVICE_START_RESULT, PeripheralConstants.ErrorCode.ERROR_FRAMEWORK_UNKNOWN); String desc = intent.getStringExtra(PeripheralConstants.EXTRA_SERVICE_START_DESCRIPTION); if (errorCode == PeripheralConstants.ErrorCode.ERROR_NONE) { // profile is valid } else { // profile it not valid Log.e(TAG, "profile is invalid : " + desc); } } } } |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API to enable auto trigger mode
peripheralId | peripheral id to enable auto trigger mode.getAvailablePeripherals(PeripheralResultListener) retrieves list of available peripheralId. |
---|---|
listener | listener to deliver result. |
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
PeripheralManager.getInstance(context).startAutoTriggerMode(peripheralId, clearOption new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'startAutoTriggerMode' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'startAutoTriggerMode' function failed } }); |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 35 |
KNOX 3.8 |
Global Scope |
Deprecated in API level 37
API to start barcode scan
peripheralId | peripheral id to start barcode scan.getAvailablePeripherals(PeripheralResultListener) retrieves list of available peripheralId. |
---|---|
listener | listener to deliver result. NOTE : listener notifies 'barcode scan is started'. doesn't retrieve barcode data. PeripheralDataListener.onReceive(), which is registered by registerDataListener retrieves barcode data. |
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
Belows are just temporary sample code. usage may be changed
PeripheralManager.getInstance(context).startBarcodeScan(peripheralId, new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'startBarcodeScan' function succeeds // this function doesn't retrieve barcode data // barcode data is notified by |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API to stop PeripheralService.
listener | listener to which result is to be delivered. |
---|
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
PeripheralManager.getInstance(context).stop( new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'stop' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'stop' function failed } }); |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API to disable auto trigger mode
peripheralId | peripheral id to disable auto trigger mode.getAvailablePeripherals(PeripheralResultListener) retrieves list of available peripheralId. |
---|---|
listener | listener to deliver result. |
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
PeripheralManager.getInstance(context).stopAutoTriggerMode(peripheralId, clearOption new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'stopAutoTriggerMode' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'stopAutoTriggerMode' function failed } }); |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 35 |
KNOX 3.8 |
Global Scope |
Deprecated in API level 37
API for stopping ongoing discovery and pairing of bluetooth peripheral.
getPairingBarcodeData(String, PeripheralResultListener)
starts discovering Bluetooth peripherals.
listener | listener to deliver result. |
---|
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong. SecurityException | If caller does not have required permissions |
---|
mPeripheralManager.stopPairingPeripheral( new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'stopPairingPeripheral' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'stopPairingPeripheral' function failed } }); |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 35 |
KNOX 3.8 |
Global Scope |
Deprecated in API level 37
API to unregister listener which retrieves barcode data
listener | listener to which barcode data is to be delivered. |
---|
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API to unregister listener which retrieves information of all peripherals and plugins
listener | listener to which information is to be delivered. |
---|
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API to unregister listener which retrieves state change from peripherals
listener | listener to which state is to be delivered. |
---|
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong.SecurityException | If caller does not have required permissions |
---|
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 34 |
KNOX 3.7.1 |
Global Scope |
Deprecated in API level 37
API for making vibration in the peripheral. (only for peripherals which support this functionality)
peripheralId | peripheral id to update firmware.getAvailablePeripherals(PeripheralResultListener) retrieves list of available peripheralId. |
---|---|
milliseconds | duration to make vibration (milliseconds) |
option | Bundle data (optional) if option has key 'PeripheralConstants.VibrationEffect.REPEAT_INT', peripheral makes vibration multiple time as value of this key, otherwise, makes vibration only once. 'PeripheralConstants.VibrationEffect.INTERVAL_INT' is need to config interval time (milliseconds) |
listener | listener to deliver result. |
RESULT_CODE_SUCCESS
if success,
RESULT_CODE_FAIL_SERVICE_UNAVAILABLE
if peripheral service is not available,
RESULT_CODE_FAIL_WRONG_ARGUMENT
if argument is wrong. SecurityException | If caller does not have required permissions |
---|
Bundle option = new Bundle(); // optional option.putInt(PeripheralConstants.VibrationEffect.INTERVAL_INT, 500); // optional option.putInt(PeripheralConstants.VibrationEffect.REPEAT_INT, 3); // optional // option is 'repeat 3 times, interval is 500 milliseconds PeripheralManager.getInstance(context).vibrate(mPeripheralId, milliseconds, option, new PeripheralResultListener() { public void onSuccess(Bundle data) { // invoked when 'vibrate' function succeeds } public void onFail(int errorCode, String description) { // invoked when 'vibrate' function failed } }); |
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_PERIPHERAL_RT" permission. |
API level 35 |
KNOX 3.8 |
Global Scope |