Class ConfigHelper

java.lang.Object
com.zebra.barcode.sdk.sms.ConfigHelper

public class ConfigHelper extends Object
ConfigHelper handles the validations for the SMS configuration file
  • Field Details

  • Constructor Details

    • ConfigHelper

      public ConfigHelper()
    • ConfigHelper

      public ConfigHelper(CommandPacket commandPacket)
  • Method Details

    • getInstance

      public static ConfigHelper getInstance()
      singleton
      Returns:
      ConfigHelper
    • validateConfigurationSelfHash

      public boolean 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-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 file
      currentScannerModel - - current connected scanner model
      Returns:
      true if the current scanner model is included in the config file's scanner model list
    • getExceptionList

      public List<Integer> getExceptionList(ScannerConfig scannerConfig) throws NumberFormatException
      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

      public DCSSDKDefs.DCSSDK_RESULT loadConfiguration(android.content.Context context)
      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 far
      totalConfigurationsCount - : Total number of configurations to push
    • generateAttribute

      public String generateAttribute(String attrId, String attrDataType, String attrValue)
      Method to generate an attribute xml tag with given data
      Parameters:
      attrId - - Id of the attribute
      attrDataType - - Datatype of the attribute
      attrValue - - 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

      public ScannerConfig fileReadWithHandler(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 purposes
      Parameters:
      context -
      model - - scanner model number
      Returns:
      ScannerConfig model containing the content from the config file
    • prepareAttributeStoreInXML

      public String prepareAttributeStoreInXML(int scannerId, String attributes)
      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:"140B2"
      Returns:
      DCSSDKDefs.DCSSDK_RESULT