(function(exports) {
	const response_lenght = 10
	const queryTimeout = 1000
	exports.boards_count = 8
	exports.interface_count = 3
	exports.index_multiply = 0x100
	exports.can_nodes_count = 8
	//{ethernet: 0, master: 1, rs: 2, can: 3, rs_short: 4, rs_without_tcp: 5}
	exports.network_interface_list = {
        0: [0, 2, 3],
        1: [0],
        2: [0, 2, 3],
        3: [0, 2, 3],
        4: [0, 2, 2],
        5: [],
        6: [5, 5],
		7: [5, 3],
	}
	exports.network_interface_list_EM_12T = {
		0: [0],
        1: [0],
        2: [0],
        3: [0, 2, 2],
        4: [0, 2, 3],
        5: [],
        6: [2, 2],
		7: [2, 3],
	}

	exports.data_type_template = function() { return data_type_template }
	exports.add_template = function(template)
	{
		data_type_template.templates.push(template)
	}
	let data_type_template = {"templates": [
		{"index": "1027_1","template": "combobox", "commands":  templates_commands.head_types()},
		{"index": "1027_2","template": "module_types", "commands":  templates_commands.module_types()},
		{"index": "1027_3","template": "module_types", "commands":  templates_commands.module_types()},
		{"index": "1027_4","template": "module_types", "commands":  templates_commands.module_types()},
		{"index": "1027_5","template": "module_types", "commands":  templates_commands.module_types()},
		{"index": "1027_6","template": "module_types", "commands":  templates_commands.module_types()},
		{"index": "1027_7","template": "module_types", "commands":  templates_commands.module_types()},
		{"index": "1027_8","template": "module_types", "commands":  templates_commands.module_types()},
		{"index": "1027_9","template": "module_types", "commands":  templates_commands.module_types()},
		{"index": "2081_1","template": "datetime"},
		{"index": "2002_1","template": "combobox", "commands":  templates_commands.access_commands()},
		{"index": "2001_9","template": "change_value", "commands":  templates_commands.access_values()},
		{"index": "2002_2","template": "password"},
		{"index": "1018_3","template": "ip_addr"},
		{"index": "2000_3","template": "ip_addr"},
		{"index": "2000_6","template": "ip_addr"},
		{"index": "2001_5","template": "battery"},
		{"index": "2001_12","template": "bit_value", "commands": templates_commands.hw_error_flags()},
		{"index": "2001_13","template": "bit_value", "commands": templates_commands.sw_error_flags()},
		{"index": "2213_1","template": "combobox", "commands":  templates_commands.on_off_values()},
		{"index": "2213_2","template": "ip_addr"},
		{"index": "2213_3","template": "ip_addr"},
		{"index": "2213_4","template": "ip_addr"},
		{"index": "2213_5","template": "ip_addr"},
		{"index": "2213_6","template": "ip_addr"},
		{"index": "221B_2","template": "ip_addr"},
		{"index": "221B_3","template": "ip_addr"},
		{"index": "221B_4","template": "ip_addr"},
		{"index": "221B_5","template": "ip_addr"},
		{"index": "221B_6","template": "ip_addr"},
		{"index": "221B_2","class": "need_restart"},
		{"index": "221B_3","class": "need_restart"},
		{"index": "221B_4","class": "need_restart"},
		{"index": "221B_5","class": "need_restart"},
		{"index": "221B_6","class": "need_restart"},
		{"index": "1011_1","template": "restore_params"},
		{"index": "5001_1","template": "change_value", "commands":  templates_commands.user_app_status()},
		{"index": "5000_2","template": "datetime_simple"},
		{"index": "5000_3","template": "ip_addr"},
	]}

	exports.get_multiply_templates = function() { return multiply_templates }
	exports.add_multiply_templates = function(template)
	{
		multiply_templates.push(template)
	}
	let multiply_templates = [{
		"type": "index multiply", 
		"count": exports.boards_count, 
		"multiply_coefficient": exports.index_multiply,
		"templates":[
		{"index": "4060_1","template": "combobox", "commands": templates_commands.connection_scheme()},
		{"index": "4060_2","template": "combobox", "commands": templates_commands.current_range()},
		{"index": "4060_3","template": "combobox", "commands": templates_commands.current_diff_range()},
		{"index": "4044_1","template": "combobox", "commands": templates_commands.on_off_values()},
		{"index": "4044_2","template": "combobox", "commands": templates_commands.on_off_values()},
		{"index": "4044_3","template": "combobox", "commands": templates_commands.on_off_values()},
		{"index": "4044_4","template": "combobox", "commands": templates_commands.on_off_values()},
		]},{
		"type": "index multiply", 
		"count": exports.interface_count, 
		"multiply_coefficient": 4,
		"templates":[
			{"index": "2143_1", "template": "boolean_type"},
			{"index": "2143_2", "template": "combobox", "commands": templates_commands.baudrate()},
			{"index": "2143_4", "template": "combobox", "commands": templates_commands.parity()},
			{"index": "2143_5", "template": "combobox", "commands": templates_commands.stopbits()},
			{"index": "2103_1", "template": "boolean_type"},
			{"index": "2103_2", "template": "combobox", "commands": templates_commands.CAN_speed()},
			{"index": "2333_1", "template": "boolean_type"},
			{"index": "2383_1", "template": "boolean_type"},
			{"index": "2323_1", "template": "boolean_type"},
			{"index": "2343_1","template": "boolean_type"},
	]}]

	exports.hide_fields_indexes = [
		{type: "one_field", index: 0x2000, sub: 2},
		{type: "one_field", index: 0x2000, sub: 3},
		{type: "one_field", index: 0x5000, sub: 3},
		//{type: "multy_sub", index: 0x3F26, count: 5},
		//{type: "multy_index", index: 0x3F27, count: 10, index_multiply: 0x100},
	]
	
	//exports.module_types = function() { return module_types;}
	exports.response_lenght = function() { return response_lenght }
	exports.queryTimeout = function() { return queryTimeout }
	
})(this.configuration = {})
