ConfigurationManager
Summary
Inner class of the CodiscanSDK class. Used to set/get configuration values of a connected CODiScan device.
Functions
Function | Description |
---|---|
set | Set given integer and/or string properties of the connected CODiScan device. |
get | Get values for the given PropertyIDs from the connected CODiScan device. |
registerGetListener | Register a given GetConfigListener to receive onGetConfig callbacks when property values are received from the connected CODiScan device. Triggered by get. |
removeGetListener | Remove a given GetConfigListener to stop receiving onGetConfig callbacks. |
registerSetListener | Register a given SetConfigListener to receive onSetConfig callbacks when status has been received from applying property values of the connected CODiScan device. Triggered by set. |
removeSetListener | Remove a given SetConfigListener to stop receiving onSetConfig callbacks. |
Functions
set
fun set(ints: HashMap<Int, Int>, strings: HashMap<Int, String>): Int
Set given integer and/or string properties of the connected CODiScan device.
Parameters
- ints - map of the given PropertyID's key and values.
- strings - map of the given string PropertyID's key and values.
Returns
- 0 -> Success.
- 1 -> Fail, CODiScan device disconnected.
- 4 -> Fail, no configuration values to set.
- 6 -> Fail, CODiScan service unbound.
- 8 -> Fail, bad configuration values given.
Example
if (codiscanSDK.configurationManager.set(hashMapOf(PropertyID.AZTEC_ENABLE to 1), hashMapOf(PropertyID.LABEL_ID_AZTEC to "ABC")) != 0) {
Log.i("MY_APP", "Something went wrong with setting values to the CODiScan!")
}
get
fun get(ids: IntArray): Int
Get values for the given PropertyIDs from the connected CODiScan device.
Parameters
- ids - the given PropertyIDs to retrieve the values of.
Returns
- 0 -> Success.
- 1 -> Fail, CODiScan device disconnected.
- 4 -> Fail, no configuration values to get.
- 6 -> Fail, CODiScan service unbound.
- 8 -> Fail, bad configuration values given.
Example
if (codiscanSDK.configurationManager.get(intArrayOf(PropertyID.AZTEC_ENABLE, PropertyID.LABEL_ID_AZTEC)) != 0) {
Log.i("MY_APP", "Something went wrong with getting values from the CODiScan!")
}
registerGetListener
fun registerGetListener(listener: GetConfigListener): Int
Register a given GetConfigListener to receive onGetConfig callbacks when property values are received from the connected CODiScan device. Triggered by get.
Parameters
- listener - the given GetConfigListener.
Returns
- 0 -> Success.
- 2 -> Fail, unable to register listener.
- 6 -> Fail, CODiScan service unbound.
Example
if (codiscanSDK.configurationManager.registerGetListener(this) != 0) {
Log.i("MY_APP", "Something went wrong with registering the get listener!")
}
removeGetListener
fun removeGetListener(listener: GetConfigListener): Int
Remove a given GetConfigListener to stop receiving onGetConfig callbacks.
Parameters
- listener - the given GetConfigListener.
Returns
- 0 -> Success.
- 3 -> Fail, unable to remove listener.
- 6 -> Fail, CODiScan service unbound.
Example
if (codiscanSDK.configurationManager.removeGetListener(this) != 0) {
Log.i("MY_APP", "Something went wrong with de-registering the get listener!")
}
registerSetListener
fun registerGetListener(listener: GetConfigListener): Int
Register a given SetConfigListener to receive onSetConfig callbacks when status has been received from applying property values of the connected CODiScan device. Triggered by set.
Parameters
- listener - the given SetConfigListener.
Returns
- 0 -> Success.
- 2 -> Fail, unable to register listener.
- 6 -> Fail, CODiScan service unbound.
Example
if (codiscanSDK.configurationManager.registerSetListener(this) != 0) {
Log.i("MY_APP", "Something went wrong with registering the set listener!")
}
removeSetListener
fun removeSetListener(listener: GetConfigListener): Int
Remove a given SetConfigListener to stop receiving onSetConfig callbacks.
Parameters
- listener - the given SetConfigListener.
Returns
- 0 -> Success.
- 3 -> Fail, unable to remove listener.
- 6 -> Fail, CODiScan service unbound.
Example
if (codiscanSDK.configurationManager.removeSetListener(this) != 0) {
Log.i("MY_APP", "Something went wrong with de-registering the set listener!")
}