def data_from_hex(hex_string)
      raise ArgumentError, "Hex string is missing" if !hex_string
      hex_string = hex_string.strip
      data = [hex_string].pack(HEX_PACK_CODE)
      if hex_from_data(data) != hex_string.downcase # invalid hex string was detected
        raise FormatError, "Hex string is invalid: #{hex_string.inspect}"
      end
      return data
    end
def data_from_hex(hex_string)
      raise ArgumentError, "Hex string is missing" if !hex_string
      hex_string = hex_string.strip
      data = [hex_string].pack(HEX_PACK_CODE)
      if hex_from_data(data) != hex_string.downcase # invalid hex string was detected
        raise FormatError, "Hex string is invalid: #{hex_string.inspect}"
      end
      return data
    end
Converts hexadecimal string to a binary data string.