Package com.zebra.barcode.sdk.sms
Class ConfigHelper
java.lang.Object
com.zebra.barcode.sdk.sms.ConfigHelper
ConfigHelper handles the validations for the SMS configuration file
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecuteStoreAttribute
(int scannerId, String scannerModel, String attributes) execute asynctask with prepared xmlfileReadWithHandler
(android.content.Context context, String model) Method to parse the config file from the work directory, read the data and to generate duplicate file for comparison purposesgenerateAttribute
(String attrId, String attrDataType, String attrValue) Method to generate an attribute xml tag with given datavoid
generateConfigurationEvent
(DCSSDKDefs.DCSSDK_UC_EVENT_TYPE event, DCSSDKDefs.DCSSDK_RESULT result, int currentConfigRecord, int totalConfigurationsCount) Generates session-start, progress, session-end events for configuration push procedure.getExceptionList
(ScannerConfig scannerConfig) Method to get the integer list of exceptions from the exceptions stringstatic ConfigHelper
singletonloadConfiguration
(android.content.Context context) Method to push configuration settings to the scannerstatic Document
loadXMLFromString
(String xml) Method to get the DOM object tree by parsing the xml stringprepareAttributeStoreInXML
(int scannerId, String attributes) prepare inxml with give scanner_id and attribute listboolean
validateConfigurationSelfHash
(String filePath) This method will generate the MD5 hash value for the config file content and validate it with the configuration file's self-hashboolean
validateScannerModel
(List<ScannerConfigModel> scannerModels, String currentScannerModel) This method will validate the connected scanner model with the compatible model list in the config file
-
Field Details
-
scannerConfig
-
SCANNER_MODEL_CS4070
- See Also:
-
-
Constructor Details
-
ConfigHelper
public ConfigHelper() -
ConfigHelper
-
-
Method Details
-
getInstance
singleton- Returns:
- ConfigHelper
-
validateConfigurationSelfHash
This method will generate the MD5 hash value for the config file content and validate it with the configuration file's self-hash- Parameters:
filePath
- to configuration file- Returns:
- true if generated MD5 hash value is identical to the config files original self hash value
-
validateScannerModel
public boolean validateScannerModel(List<ScannerConfigModel> scannerModels, String currentScannerModel) This method will validate the connected scanner model with the compatible model list in the config file- Parameters:
scannerModels
- - Retrieved scanner models from config filecurrentScannerModel
- - current connected scanner model- Returns:
- true if the current scanner model is included in the config file's scanner model list
-
getExceptionList
Method to get the integer list of exceptions from the exceptions string- Parameters:
scannerConfig
- configuration data received from the configuration file- Returns:
- Throws:
NumberFormatException
-
loadConfiguration
Method to push configuration settings to the scanner- Parameters:
context
-- Returns:
- DCSSDKDefs.DCSSDK_RESULT
-
generateConfigurationEvent
public void generateConfigurationEvent(DCSSDKDefs.DCSSDK_UC_EVENT_TYPE event, DCSSDKDefs.DCSSDK_RESULT result, int currentConfigRecord, int totalConfigurationsCount) Generates session-start, progress, session-end events for configuration push procedure.- Parameters:
event
- : event type (SCANNER_UC_SESS_START/SCANNER_UC_PROGRESS/SCANNER_UC_SESS_END)currentConfigRecord
- : how many records pushed so fartotalConfigurationsCount
- : Total number of configurations to push
-
generateAttribute
Method to generate an attribute xml tag with given data- Parameters:
attrId
- - Id of the attributeattrDataType
- - Datatype of the attributeattrValue
- - Value of the attribute- Returns:
- String value of attribute xml tag
-
loadXMLFromString
public static Document loadXMLFromString(String xml) throws ParserConfigurationException, IOException, SAXException Method to get the DOM object tree by parsing the xml string- Parameters:
xml
- - configuration file xml content string- Returns:
- DOM object tree created with the input xml content
- Throws:
Exception
ParserConfigurationException
IOException
SAXException
-
fileReadWithHandler
Method to parse the config file from the work directory, read the data and to generate duplicate file for comparison purposes- Parameters:
context
-model
- - scanner model number- Returns:
- ScannerConfig model containing the content from the config file
-
prepareAttributeStoreInXML
prepare inxml with give scanner_id and attribute list- Parameters:
scannerId
-attributes
-- Returns:
- inXml - String
-
executeStoreAttribute
public DCSSDKDefs.DCSSDK_RESULT executeStoreAttribute(int scannerId, String scannerModel, String attributes) execute asynctask with prepared xml- Parameters:
scannerId
-scannerModel
-attributes
- eg:" "140 B 2 - Returns:
- DCSSDKDefs.DCSSDK_RESULT
-