7582 lines
345 KiB
JSON
7582 lines
345 KiB
JSON
{
|
|
"type": "translation_unit",
|
|
"children": [
|
|
{
|
|
"type": "preproc_ifdef",
|
|
"children": [
|
|
{
|
|
"type": "#ifndef",
|
|
"text": "#ifndef"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "FEEDBACK_BUZZER_H"
|
|
},
|
|
{
|
|
"type": "preproc_def",
|
|
"children": [
|
|
{
|
|
"type": "#define",
|
|
"text": "#define"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "FEEDBACK_BUZZER_H"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "preproc_include",
|
|
"children": [
|
|
{
|
|
"type": "#include",
|
|
"text": "#include"
|
|
},
|
|
{
|
|
"type": "system_lib_string",
|
|
"text": "<ArduinoLog.h>"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "preproc_include",
|
|
"children": [
|
|
{
|
|
"type": "#include",
|
|
"text": "#include"
|
|
},
|
|
{
|
|
"type": "system_lib_string",
|
|
"text": "<App.h>"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "preproc_include",
|
|
"children": [
|
|
{
|
|
"type": "#include",
|
|
"text": "#include"
|
|
},
|
|
{
|
|
"type": "system_lib_string",
|
|
"text": "<Component.h>"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "preproc_include",
|
|
"children": [
|
|
{
|
|
"type": "#include",
|
|
"text": "#include"
|
|
},
|
|
{
|
|
"type": "system_lib_string",
|
|
"text": "<enums.h>"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "preproc_include",
|
|
"children": [
|
|
{
|
|
"type": "#include",
|
|
"text": "#include"
|
|
},
|
|
{
|
|
"type": "string_literal",
|
|
"children": [
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
},
|
|
{
|
|
"type": "string_content",
|
|
"text": "config.h"
|
|
},
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "preproc_include",
|
|
"children": [
|
|
{
|
|
"type": "#include",
|
|
"text": "#include"
|
|
},
|
|
{
|
|
"type": "system_lib_string",
|
|
"text": "<modbus/Modbus.h>"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "preproc_include",
|
|
"children": [
|
|
{
|
|
"type": "#include",
|
|
"text": "#include"
|
|
},
|
|
{
|
|
"type": "system_lib_string",
|
|
"text": "<modbus/ModbusTCP.h>"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "preproc_include",
|
|
"children": [
|
|
{
|
|
"type": "#include",
|
|
"text": "#include"
|
|
},
|
|
{
|
|
"type": "string_literal",
|
|
"children": [
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
},
|
|
{
|
|
"type": "string_content",
|
|
"text": "config-modbus.h"
|
|
},
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "preproc_include",
|
|
"children": [
|
|
{
|
|
"type": "#include",
|
|
"text": "#include"
|
|
},
|
|
{
|
|
"type": "string_literal",
|
|
"children": [
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
},
|
|
{
|
|
"type": "string_content",
|
|
"text": "ValueWrapper.h"
|
|
},
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "preproc_include",
|
|
"children": [
|
|
{
|
|
"type": "#include",
|
|
"text": "#include"
|
|
},
|
|
{
|
|
"type": "string_literal",
|
|
"children": [
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
},
|
|
{
|
|
"type": "string_content",
|
|
"text": "Feedback3C.h"
|
|
},
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "preproc_def",
|
|
"children": [
|
|
{
|
|
"type": "#define",
|
|
"text": "#define"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "FEEDBACK_BUZZER_MAX_PLAY_TIME_MS"
|
|
},
|
|
{
|
|
"type": "preproc_arg",
|
|
"text": "2500"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "struct_specifier",
|
|
"children": [
|
|
{
|
|
"type": "struct",
|
|
"text": "struct"
|
|
},
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "BuzzerPattern"
|
|
},
|
|
{
|
|
"type": "field_declaration_list",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "field_declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "ushort"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "on_ms"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "ushort"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "off_ms"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
},
|
|
{
|
|
"type": "class_specifier",
|
|
"children": [
|
|
{
|
|
"type": "class",
|
|
"text": "class"
|
|
},
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "FeedbackBuzzer"
|
|
},
|
|
{
|
|
"type": "base_class_clause",
|
|
"children": [
|
|
{
|
|
"type": ":",
|
|
"text": ":"
|
|
},
|
|
{
|
|
"type": "access_specifier",
|
|
"children": [
|
|
{
|
|
"type": "public",
|
|
"text": "public"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "Component"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_declaration_list",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "access_specifier",
|
|
"children": [
|
|
{
|
|
"type": "public",
|
|
"text": "public"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ":",
|
|
"text": ":"
|
|
},
|
|
{
|
|
"type": "field_declaration",
|
|
"children": [
|
|
{
|
|
"type": "enum_specifier",
|
|
"children": [
|
|
{
|
|
"type": "enum",
|
|
"text": "enum"
|
|
},
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "E_BuzzerMode"
|
|
},
|
|
{
|
|
"type": "enumerator_list",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "enumerator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "MODE_OFF"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "enumerator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "MODE_SOLID"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "enumerator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "MODE_SLOW_BLINK"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "comment",
|
|
"text": "// 1s on, 1s off"
|
|
},
|
|
{
|
|
"type": "enumerator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "MODE_FAST_BLINK"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "comment",
|
|
"text": "// 250ms on, 250ms off"
|
|
},
|
|
{
|
|
"type": "enumerator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "MODE_LONG_BEEP_SHORT_PAUSE"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "comment",
|
|
"text": "// 1s on, 250ms off"
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_declaration",
|
|
"children": [
|
|
{
|
|
"type": "enum_specifier",
|
|
"children": [
|
|
{
|
|
"type": "enum",
|
|
"text": "enum"
|
|
},
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "E_MB_Offset"
|
|
},
|
|
{
|
|
"type": "enumerator_list",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "enumerator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_COIL_STATE"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "enumerator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_HR_MODE"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "1"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "enumerator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_COIL_ENABLED"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "2"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "enumerator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_COUNT"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "3"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "access_specifier",
|
|
"children": [
|
|
{
|
|
"type": "private",
|
|
"text": "private"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ":",
|
|
"text": ":"
|
|
},
|
|
{
|
|
"type": "field_declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_qualifier",
|
|
"children": [
|
|
{
|
|
"type": "const",
|
|
"text": "const"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "pin"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_qualifier",
|
|
"children": [
|
|
{
|
|
"type": "const",
|
|
"text": "const"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "modbusAddress"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "MB_Registers"
|
|
},
|
|
{
|
|
"type": "array_declarator",
|
|
"children": [
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "m_modbus_block"
|
|
},
|
|
{
|
|
"type": "[",
|
|
"text": "["
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_COUNT"
|
|
},
|
|
{
|
|
"type": "]",
|
|
"text": "]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_qualifier",
|
|
"children": [
|
|
{
|
|
"type": "mutable",
|
|
"text": "mutable"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "ModbusBlockView"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "m_modbus_view"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_declaration",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "unsigned",
|
|
"text": "unsigned"
|
|
},
|
|
{
|
|
"type": "long",
|
|
"text": "long"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "lastToggleTime"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_declaration",
|
|
"children": [
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "uint8_t"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "pattern_step"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_declaration",
|
|
"children": [
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "uint32_t"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "_start_time_ms"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_declaration",
|
|
"children": [
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "uint32_t"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "_max_play_time_ms"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_declaration",
|
|
"children": [
|
|
{
|
|
"type": "template_type",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "ValueWrapper"
|
|
},
|
|
{
|
|
"type": "template_argument_list",
|
|
"children": [
|
|
{
|
|
"type": "<",
|
|
"text": "<"
|
|
},
|
|
{
|
|
"type": "type_descriptor",
|
|
"children": [
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "bool"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ">",
|
|
"text": ">"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "state"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_declaration",
|
|
"children": [
|
|
{
|
|
"type": "template_type",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "ValueWrapper"
|
|
},
|
|
{
|
|
"type": "template_argument_list",
|
|
"children": [
|
|
{
|
|
"type": "<",
|
|
"text": "<"
|
|
},
|
|
{
|
|
"type": "type_descriptor",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "ushort"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ">",
|
|
"text": ">"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "mode"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "comment",
|
|
"text": "// 0 for solid on, >0 for blinking in seconds"
|
|
},
|
|
{
|
|
"type": "field_declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_qualifier",
|
|
"children": [
|
|
{
|
|
"type": "const",
|
|
"text": "const"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "BuzzerPattern"
|
|
},
|
|
{
|
|
"type": "array_declarator",
|
|
"children": [
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "patterns"
|
|
},
|
|
{
|
|
"type": "[",
|
|
"text": "["
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "3"
|
|
},
|
|
{
|
|
"type": "]",
|
|
"text": "]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "initializer_list",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "initializer_list",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "1000"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "1000"
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "comment",
|
|
"text": "// SLOW_BLINK"
|
|
},
|
|
{
|
|
"type": "initializer_list",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "250"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "250"
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "comment",
|
|
"text": "// FAST_BLINK"
|
|
},
|
|
{
|
|
"type": "initializer_list",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "1000"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "250"
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "comment",
|
|
"text": "// LONG_BEEP_SHORT_PAUSE"
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "access_specifier",
|
|
"children": [
|
|
{
|
|
"type": "public",
|
|
"text": "public"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ":",
|
|
"text": ":"
|
|
},
|
|
{
|
|
"type": "function_definition",
|
|
"children": [
|
|
{
|
|
"type": "function_declarator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "FeedbackBuzzer"
|
|
},
|
|
{
|
|
"type": "parameter_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "Component"
|
|
},
|
|
{
|
|
"type": "pointer_declarator",
|
|
"children": [
|
|
{
|
|
"type": "*",
|
|
"text": "*"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "owner"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "_pin"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "_id"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "_modbusAddress"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "field_initializer_list",
|
|
"children": [
|
|
{
|
|
"type": ":",
|
|
"text": ":"
|
|
},
|
|
{
|
|
"type": "field_initializer",
|
|
"children": [
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "Component"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "string_literal",
|
|
"children": [
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
},
|
|
{
|
|
"type": "string_content",
|
|
"text": "FeedbackBuzzer"
|
|
},
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "_id"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "qualified_identifier",
|
|
"children": [
|
|
{
|
|
"type": "namespace_identifier",
|
|
"text": "Component"
|
|
},
|
|
{
|
|
"type": "::",
|
|
"text": "::"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "COMPONENT_DEFAULT"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "owner"
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "field_initializer",
|
|
"children": [
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "pin"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "_pin"
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "field_initializer",
|
|
"children": [
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "modbusAddress"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "_modbusAddress"
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "setNetCapability"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "qualified_identifier",
|
|
"children": [
|
|
{
|
|
"type": "namespace_identifier",
|
|
"text": "OBJECT_NET_CAPS"
|
|
},
|
|
{
|
|
"type": "::",
|
|
"text": "::"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "E_NCAPS_MODBUS"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "lastToggleTime"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "pattern_step"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "_start_time_ms"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "_max_play_time_ms"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "state"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "template_function",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "ValueWrapper"
|
|
},
|
|
{
|
|
"type": "template_argument_list",
|
|
"children": [
|
|
{
|
|
"type": "<",
|
|
"text": "<"
|
|
},
|
|
{
|
|
"type": "type_descriptor",
|
|
"children": [
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "bool"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ">",
|
|
"text": ">"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "id"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "lambda_expression",
|
|
"children": [
|
|
{
|
|
"type": "lambda_capture_specifier",
|
|
"children": [
|
|
{
|
|
"type": "[",
|
|
"text": "["
|
|
},
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": "]",
|
|
"text": "]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "abstract_function_declarator",
|
|
"children": [
|
|
{
|
|
"type": "parameter_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "trailing_return_type",
|
|
"children": [
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "type_descriptor",
|
|
"children": [
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "uint16_t"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "modbusAddress"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "cast_expression",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "type_descriptor",
|
|
"children": [
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "uint16_t"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
},
|
|
{
|
|
"type": "parenthesized_expression",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_COIL_STATE"
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "qualified_identifier",
|
|
"children": [
|
|
{
|
|
"type": "namespace_identifier",
|
|
"text": "E_FN_CODE"
|
|
},
|
|
{
|
|
"type": "::",
|
|
"text": "::"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "FN_WRITE_COIL"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "slaveId"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "false",
|
|
"text": "false"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "true",
|
|
"text": "true"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "qualified_identifier",
|
|
"children": [
|
|
{
|
|
"type": "template_type",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "ValueWrapper"
|
|
},
|
|
{
|
|
"type": "template_argument_list",
|
|
"children": [
|
|
{
|
|
"type": "<",
|
|
"text": "<"
|
|
},
|
|
{
|
|
"type": "type_descriptor",
|
|
"children": [
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "bool"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ">",
|
|
"text": ">"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "::",
|
|
"text": "::"
|
|
},
|
|
{
|
|
"type": "qualified_identifier",
|
|
"children": [
|
|
{
|
|
"type": "namespace_identifier",
|
|
"text": "ThresholdMode"
|
|
},
|
|
{
|
|
"type": "::",
|
|
"text": "::"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "DIFFERENCE"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "lambda_expression",
|
|
"children": [
|
|
{
|
|
"type": "lambda_capture_specifier",
|
|
"children": [
|
|
{
|
|
"type": "[",
|
|
"text": "["
|
|
},
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": "]",
|
|
"text": "]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "abstract_function_declarator",
|
|
"children": [
|
|
{
|
|
"type": "parameter_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_qualifier",
|
|
"children": [
|
|
{
|
|
"type": "const",
|
|
"text": "const"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "bool"
|
|
},
|
|
{
|
|
"type": "reference_declarator",
|
|
"children": [
|
|
{
|
|
"type": "&",
|
|
"text": "&"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "newValue"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_qualifier",
|
|
"children": [
|
|
{
|
|
"type": "const",
|
|
"text": "const"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "bool"
|
|
},
|
|
{
|
|
"type": "reference_declarator",
|
|
"children": [
|
|
{
|
|
"type": "&",
|
|
"text": "&"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "oldValue"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "digitalWrite"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "pin"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "conditional_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "newValue"
|
|
},
|
|
{
|
|
"type": "?",
|
|
"text": "?"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "HIGH"
|
|
},
|
|
{
|
|
"type": ":",
|
|
"text": ":"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "LOW"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "mode"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "template_function",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "ValueWrapper"
|
|
},
|
|
{
|
|
"type": "template_argument_list",
|
|
"children": [
|
|
{
|
|
"type": "<",
|
|
"text": "<"
|
|
},
|
|
{
|
|
"type": "type_descriptor",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "ushort"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ">",
|
|
"text": ">"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "id"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "lambda_expression",
|
|
"children": [
|
|
{
|
|
"type": "lambda_capture_specifier",
|
|
"children": [
|
|
{
|
|
"type": "[",
|
|
"text": "["
|
|
},
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": "]",
|
|
"text": "]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "abstract_function_declarator",
|
|
"children": [
|
|
{
|
|
"type": "parameter_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "trailing_return_type",
|
|
"children": [
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "type_descriptor",
|
|
"children": [
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "uint16_t"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "modbusAddress"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "cast_expression",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "type_descriptor",
|
|
"children": [
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "uint16_t"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
},
|
|
{
|
|
"type": "parenthesized_expression",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_HR_MODE"
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "qualified_identifier",
|
|
"children": [
|
|
{
|
|
"type": "namespace_identifier",
|
|
"text": "E_FN_CODE"
|
|
},
|
|
{
|
|
"type": "::",
|
|
"text": "::"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "FN_WRITE_HOLD_REGISTER"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "slaveId"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "cast_expression",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "type_descriptor",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "ushort"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MODE_OFF"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "1"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "qualified_identifier",
|
|
"children": [
|
|
{
|
|
"type": "template_type",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "ValueWrapper"
|
|
},
|
|
{
|
|
"type": "template_argument_list",
|
|
"children": [
|
|
{
|
|
"type": "<",
|
|
"text": "<"
|
|
},
|
|
{
|
|
"type": "type_descriptor",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "ushort"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ">",
|
|
"text": ">"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "::",
|
|
"text": "::"
|
|
},
|
|
{
|
|
"type": "qualified_identifier",
|
|
"children": [
|
|
{
|
|
"type": "namespace_identifier",
|
|
"text": "ThresholdMode"
|
|
},
|
|
{
|
|
"type": "::",
|
|
"text": "::"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "DIFFERENCE"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "lambda_expression",
|
|
"children": [
|
|
{
|
|
"type": "lambda_capture_specifier",
|
|
"children": [
|
|
{
|
|
"type": "[",
|
|
"text": "["
|
|
},
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": "]",
|
|
"text": "]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "abstract_function_declarator",
|
|
"children": [
|
|
{
|
|
"type": "parameter_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_qualifier",
|
|
"children": [
|
|
{
|
|
"type": "const",
|
|
"text": "const"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "ushort"
|
|
},
|
|
{
|
|
"type": "reference_declarator",
|
|
"children": [
|
|
{
|
|
"type": "&",
|
|
"text": "&"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "newValue"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_qualifier",
|
|
"children": [
|
|
{
|
|
"type": "const",
|
|
"text": "const"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "ushort"
|
|
},
|
|
{
|
|
"type": "reference_declarator",
|
|
"children": [
|
|
{
|
|
"type": "&",
|
|
"text": "&"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "oldValue"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "setMode"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "cast_expression",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "type_descriptor",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "E_BuzzerMode"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "newValue"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "subscript_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "m_modbus_block"
|
|
},
|
|
{
|
|
"type": "subscript_argument_list",
|
|
"children": [
|
|
{
|
|
"type": "[",
|
|
"text": "["
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_COIL_STATE"
|
|
},
|
|
{
|
|
"type": "]",
|
|
"text": "]"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "INIT_MODBUS_BLOCK_TCP"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "modbusAddress"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_COIL_STATE"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "qualified_identifier",
|
|
"children": [
|
|
{
|
|
"type": "namespace_identifier",
|
|
"text": "E_FN_CODE"
|
|
},
|
|
{
|
|
"type": "::",
|
|
"text": "::"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "FN_WRITE_COIL"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_ACCESS_READ_WRITE"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "string_literal",
|
|
"children": [
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
},
|
|
{
|
|
"type": "string_content",
|
|
"text": "Buzzer State"
|
|
},
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "string_literal",
|
|
"children": [
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
},
|
|
{
|
|
"type": "string_content",
|
|
"text": "FeedbackBuzzer"
|
|
},
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "subscript_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "m_modbus_block"
|
|
},
|
|
{
|
|
"type": "subscript_argument_list",
|
|
"children": [
|
|
{
|
|
"type": "[",
|
|
"text": "["
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_HR_MODE"
|
|
},
|
|
{
|
|
"type": "]",
|
|
"text": "]"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "INIT_MODBUS_BLOCK_TCP"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "modbusAddress"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_HR_MODE"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "qualified_identifier",
|
|
"children": [
|
|
{
|
|
"type": "namespace_identifier",
|
|
"text": "E_FN_CODE"
|
|
},
|
|
{
|
|
"type": "::",
|
|
"text": "::"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "FN_WRITE_HOLD_REGISTER"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_ACCESS_READ_WRITE"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "string_literal",
|
|
"children": [
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
},
|
|
{
|
|
"type": "string_content",
|
|
"text": "Buzzer Mode"
|
|
},
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "string_literal",
|
|
"children": [
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
},
|
|
{
|
|
"type": "string_content",
|
|
"text": "FeedbackBuzzer"
|
|
},
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "subscript_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "m_modbus_block"
|
|
},
|
|
{
|
|
"type": "subscript_argument_list",
|
|
"children": [
|
|
{
|
|
"type": "[",
|
|
"text": "["
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_COIL_ENABLED"
|
|
},
|
|
{
|
|
"type": "]",
|
|
"text": "]"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "INIT_MODBUS_BLOCK_TCP"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "modbusAddress"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_COIL_ENABLED"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "qualified_identifier",
|
|
"children": [
|
|
{
|
|
"type": "namespace_identifier",
|
|
"text": "E_FN_CODE"
|
|
},
|
|
{
|
|
"type": "::",
|
|
"text": "::"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "FN_WRITE_COIL"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_ACCESS_READ_WRITE"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "string_literal",
|
|
"children": [
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
},
|
|
{
|
|
"type": "string_content",
|
|
"text": "Buzzer Enabled"
|
|
},
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "string_literal",
|
|
"children": [
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
},
|
|
{
|
|
"type": "string_content",
|
|
"text": "FeedbackBuzzer"
|
|
},
|
|
{
|
|
"type": "\"",
|
|
"text": "\""
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "m_modbus_view"
|
|
},
|
|
{
|
|
"type": ".",
|
|
"text": "."
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "data"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "m_modbus_block"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "m_modbus_view"
|
|
},
|
|
{
|
|
"type": ".",
|
|
"text": "."
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "count"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_COUNT"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_definition",
|
|
"children": [
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "void"
|
|
},
|
|
{
|
|
"type": "function_declarator",
|
|
"children": [
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "on"
|
|
},
|
|
{
|
|
"type": "parameter_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "setMode"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MODE_SOLID"
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_definition",
|
|
"children": [
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "void"
|
|
},
|
|
{
|
|
"type": "function_declarator",
|
|
"children": [
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "off"
|
|
},
|
|
{
|
|
"type": "parameter_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "setMode"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MODE_OFF"
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_definition",
|
|
"children": [
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "void"
|
|
},
|
|
{
|
|
"type": "function_declarator",
|
|
"children": [
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "setMode"
|
|
},
|
|
{
|
|
"type": "parameter_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "E_BuzzerMode"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "newMode"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "optional_parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "uint32_t"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "max_play_time_ms"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "FEEDBACK_BUZZER_MAX_PLAY_TIME_MS"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "unary_expression",
|
|
"children": [
|
|
{
|
|
"type": "!",
|
|
"text": "!"
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "enabled"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "comment",
|
|
"text": "// If a timed sound is currently playing, do not allow it to be overridden"
|
|
},
|
|
{
|
|
"type": "comment",
|
|
"text": "// by a new sound. The only exception is explicitly turning it OFF."
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "millis"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "-",
|
|
"text": "-"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "_start_time_ms"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "<",
|
|
"text": "<"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "_max_play_time_ms"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "newMode"
|
|
},
|
|
{
|
|
"type": "!=",
|
|
"text": "!="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MODE_OFF"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "mode"
|
|
},
|
|
{
|
|
"type": ".",
|
|
"text": "."
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "update"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "newMode"
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "lastToggleTime"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "millis"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "_start_time_ms"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "millis"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "pattern_step"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "newMode"
|
|
},
|
|
{
|
|
"type": "==",
|
|
"text": "=="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MODE_OFF"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "_max_play_time_ms"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "state"
|
|
},
|
|
{
|
|
"type": ".",
|
|
"text": "."
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "update"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "false",
|
|
"text": "false"
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "else_clause",
|
|
"children": [
|
|
{
|
|
"type": "else",
|
|
"text": "else"
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "max_play_time_ms"
|
|
},
|
|
{
|
|
"type": "==",
|
|
"text": "=="
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "||",
|
|
"text": "||"
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "max_play_time_ms"
|
|
},
|
|
{
|
|
"type": ">",
|
|
"text": ">"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "FEEDBACK_BUZZER_MAX_PLAY_TIME_MS"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "_max_play_time_ms"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "FEEDBACK_BUZZER_MAX_PLAY_TIME_MS"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "else_clause",
|
|
"children": [
|
|
{
|
|
"type": "else",
|
|
"text": "else"
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "_max_play_time_ms"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "max_play_time_ms"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "state"
|
|
},
|
|
{
|
|
"type": ".",
|
|
"text": "."
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "update"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "true",
|
|
"text": "true"
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_definition",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_declarator",
|
|
"children": [
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "setup"
|
|
},
|
|
{
|
|
"type": "parameter_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "virtual_specifier",
|
|
"children": [
|
|
{
|
|
"type": "override",
|
|
"text": "override"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "qualified_identifier",
|
|
"children": [
|
|
{
|
|
"type": "namespace_identifier",
|
|
"text": "Component"
|
|
},
|
|
{
|
|
"type": "::",
|
|
"text": "::"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "setup"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "pinMode"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "pin"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "OUTPUT"
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "digitalWrite"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "pin"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "conditional_expression",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "state"
|
|
},
|
|
{
|
|
"type": ".",
|
|
"text": "."
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "get"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "?",
|
|
"text": "?"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "HIGH"
|
|
},
|
|
{
|
|
"type": ":",
|
|
"text": ":"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "LOW"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "E_OK"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_definition",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_declarator",
|
|
"children": [
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "loop"
|
|
},
|
|
{
|
|
"type": "parameter_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "virtual_specifier",
|
|
"children": [
|
|
{
|
|
"type": "override",
|
|
"text": "override"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "unary_expression",
|
|
"children": [
|
|
{
|
|
"type": "!",
|
|
"text": "!"
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "enabled"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "cast_expression",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "type_descriptor",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "E_BuzzerMode"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "mode"
|
|
},
|
|
{
|
|
"type": ".",
|
|
"text": "."
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "get"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "!=",
|
|
"text": "!="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MODE_OFF"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "off"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "comment",
|
|
"text": "// Ensure it's off if disabled"
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "E_OK"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "qualified_identifier",
|
|
"children": [
|
|
{
|
|
"type": "namespace_identifier",
|
|
"text": "Component"
|
|
},
|
|
{
|
|
"type": "::",
|
|
"text": "::"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "loop"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "E_BuzzerMode"
|
|
},
|
|
{
|
|
"type": "init_declarator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "currentMode"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "cast_expression",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "type_descriptor",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "E_BuzzerMode"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "mode"
|
|
},
|
|
{
|
|
"type": ".",
|
|
"text": "."
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "get"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "comment",
|
|
"text": "// If the timed duration has elapsed, turn the buzzer off."
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "_max_play_time_ms"
|
|
},
|
|
{
|
|
"type": ">",
|
|
"text": ">"
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "&&",
|
|
"text": "&&"
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "millis"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "-",
|
|
"text": "-"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "_start_time_ms"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ">=",
|
|
"text": ">="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "_max_play_time_ms"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "off"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "E_OK"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "currentMode"
|
|
},
|
|
{
|
|
"type": ">",
|
|
"text": ">"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MODE_SOLID"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_qualifier",
|
|
"children": [
|
|
{
|
|
"type": "const",
|
|
"text": "const"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "BuzzerPattern"
|
|
},
|
|
{
|
|
"type": "init_declarator",
|
|
"children": [
|
|
{
|
|
"type": "reference_declarator",
|
|
"children": [
|
|
{
|
|
"type": "&",
|
|
"text": "&"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "pattern"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "subscript_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "patterns"
|
|
},
|
|
{
|
|
"type": "subscript_argument_list",
|
|
"children": [
|
|
{
|
|
"type": "[",
|
|
"text": "["
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "currentMode"
|
|
},
|
|
{
|
|
"type": "-",
|
|
"text": "-"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MODE_SLOW_BLINK"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "]",
|
|
"text": "]"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "declaration",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "unsigned",
|
|
"text": "unsigned"
|
|
},
|
|
{
|
|
"type": "long",
|
|
"text": "long"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "init_declarator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "currentMillis"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "millis"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "declaration",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "unsigned",
|
|
"text": "unsigned"
|
|
},
|
|
{
|
|
"type": "long",
|
|
"text": "long"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "init_declarator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "duration"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "conditional_expression",
|
|
"children": [
|
|
{
|
|
"type": "parenthesized_expression",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "pattern_step"
|
|
},
|
|
{
|
|
"type": "%",
|
|
"text": "%"
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "2"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "==",
|
|
"text": "=="
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "?",
|
|
"text": "?"
|
|
},
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "pattern"
|
|
},
|
|
{
|
|
"type": ".",
|
|
"text": "."
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "on_ms"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ":",
|
|
"text": ":"
|
|
},
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "pattern"
|
|
},
|
|
{
|
|
"type": ".",
|
|
"text": "."
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "off_ms"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "currentMillis"
|
|
},
|
|
{
|
|
"type": "-",
|
|
"text": "-"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "lastToggleTime"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ">=",
|
|
"text": ">="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "duration"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "assignment_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "lastToggleTime"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "currentMillis"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "state"
|
|
},
|
|
{
|
|
"type": ".",
|
|
"text": "."
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "update"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "unary_expression",
|
|
"children": [
|
|
{
|
|
"type": "!",
|
|
"text": "!"
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "state"
|
|
},
|
|
{
|
|
"type": ".",
|
|
"text": "."
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "get"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "update_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "pattern_step"
|
|
},
|
|
{
|
|
"type": "++",
|
|
"text": "++"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "E_OK"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_definition",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_declarator",
|
|
"children": [
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "mb_tcp_write"
|
|
},
|
|
{
|
|
"type": "parameter_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "address"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "networkValue"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "virtual_specifier",
|
|
"children": [
|
|
{
|
|
"type": "override",
|
|
"text": "override"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "declaration",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "init_declarator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "offset"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "address"
|
|
},
|
|
{
|
|
"type": "-",
|
|
"text": "-"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "modbusAddress"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "offset"
|
|
},
|
|
{
|
|
"type": "==",
|
|
"text": "=="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_COIL_STATE"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "comment",
|
|
"text": "// Coil write"
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "setMode"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "conditional_expression",
|
|
"children": [
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "networkValue"
|
|
},
|
|
{
|
|
"type": ">",
|
|
"text": ">"
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "?",
|
|
"text": "?"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MODE_SOLID"
|
|
},
|
|
{
|
|
"type": ":",
|
|
"text": ":"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MODE_OFF"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "E_OK"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "else_clause",
|
|
"children": [
|
|
{
|
|
"type": "else",
|
|
"text": "else"
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "offset"
|
|
},
|
|
{
|
|
"type": "==",
|
|
"text": "=="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_HR_MODE"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "comment",
|
|
"text": "// Mode write"
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "networkValue"
|
|
},
|
|
{
|
|
"type": ">=",
|
|
"text": ">="
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "&&",
|
|
"text": "&&"
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "networkValue"
|
|
},
|
|
{
|
|
"type": "<=",
|
|
"text": "<="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MODE_LONG_BEEP_SHORT_PAUSE"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "setMode"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "cast_expression",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "type_descriptor",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "E_BuzzerMode"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "networkValue"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "E_OK"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "E_INVALID_PARAMETER"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "else_clause",
|
|
"children": [
|
|
{
|
|
"type": "else",
|
|
"text": "else"
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "offset"
|
|
},
|
|
{
|
|
"type": "==",
|
|
"text": "=="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_COIL_ENABLED"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "conditional_expression",
|
|
"children": [
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "networkValue"
|
|
},
|
|
{
|
|
"type": ">",
|
|
"text": ">"
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "?",
|
|
"text": "?"
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "enable"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ":",
|
|
"text": ":"
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "disable"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "E_OK"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "E_INVALID_PARAMETER"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_definition",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_declarator",
|
|
"children": [
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "mb_tcp_read"
|
|
},
|
|
{
|
|
"type": "parameter_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "address"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "virtual_specifier",
|
|
"children": [
|
|
{
|
|
"type": "override",
|
|
"text": "override"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "declaration",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "init_declarator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "offset"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "address"
|
|
},
|
|
{
|
|
"type": "-",
|
|
"text": "-"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "modbusAddress"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "offset"
|
|
},
|
|
{
|
|
"type": "==",
|
|
"text": "=="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_COIL_STATE"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "conditional_expression",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "state"
|
|
},
|
|
{
|
|
"type": ".",
|
|
"text": "."
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "get"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "?",
|
|
"text": "?"
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "1"
|
|
},
|
|
{
|
|
"type": ":",
|
|
"text": ":"
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "else_clause",
|
|
"children": [
|
|
{
|
|
"type": "else",
|
|
"text": "else"
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "offset"
|
|
},
|
|
{
|
|
"type": "==",
|
|
"text": "=="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_HR_MODE"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "mode"
|
|
},
|
|
{
|
|
"type": ".",
|
|
"text": "."
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "get"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "else_clause",
|
|
"children": [
|
|
{
|
|
"type": "else",
|
|
"text": "else"
|
|
},
|
|
{
|
|
"type": "if_statement",
|
|
"children": [
|
|
{
|
|
"type": "if",
|
|
"text": "if"
|
|
},
|
|
{
|
|
"type": "condition_clause",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "offset"
|
|
},
|
|
{
|
|
"type": "==",
|
|
"text": "=="
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "MB_OFS_COIL_ENABLED"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "conditional_expression",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "enabled"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "?",
|
|
"text": "?"
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "1"
|
|
},
|
|
{
|
|
"type": ":",
|
|
"text": ":"
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_definition",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_declarator",
|
|
"children": [
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "mb_tcp_write"
|
|
},
|
|
{
|
|
"type": "parameter_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "MB_Registers"
|
|
},
|
|
{
|
|
"type": "pointer_declarator",
|
|
"children": [
|
|
{
|
|
"type": "*",
|
|
"text": "*"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "reg"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "networkValue"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "virtual_specifier",
|
|
"children": [
|
|
{
|
|
"type": "override",
|
|
"text": "override"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "mb_tcp_write"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "reg"
|
|
},
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "startAddress"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "networkValue"
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_definition",
|
|
"children": [
|
|
{
|
|
"type": "sized_type_specifier",
|
|
"children": [
|
|
{
|
|
"type": "short",
|
|
"text": "short"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_declarator",
|
|
"children": [
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "mb_tcp_read"
|
|
},
|
|
{
|
|
"type": "parameter_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "MB_Registers"
|
|
},
|
|
{
|
|
"type": "pointer_declarator",
|
|
"children": [
|
|
{
|
|
"type": "*",
|
|
"text": "*"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "reg"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "virtual_specifier",
|
|
"children": [
|
|
{
|
|
"type": "override",
|
|
"text": "override"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "mb_tcp_read"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "reg"
|
|
},
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "startAddress"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_definition",
|
|
"children": [
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "void"
|
|
},
|
|
{
|
|
"type": "function_declarator",
|
|
"children": [
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "mb_tcp_register"
|
|
},
|
|
{
|
|
"type": "parameter_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "parameter_declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "ModbusTCP"
|
|
},
|
|
{
|
|
"type": "pointer_declarator",
|
|
"children": [
|
|
{
|
|
"type": "*",
|
|
"text": "*"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "manager"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "virtual_specifier",
|
|
"children": [
|
|
{
|
|
"type": "override",
|
|
"text": "override"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "ModbusBlockView"
|
|
},
|
|
{
|
|
"type": "init_declarator",
|
|
"children": [
|
|
{
|
|
"type": "pointer_declarator",
|
|
"children": [
|
|
{
|
|
"type": "*",
|
|
"text": "*"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "blocksView"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "mb_tcp_blocks"
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "Component"
|
|
},
|
|
{
|
|
"type": "init_declarator",
|
|
"children": [
|
|
{
|
|
"type": "pointer_declarator",
|
|
"children": [
|
|
{
|
|
"type": "*",
|
|
"text": "*"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "thiz"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "template_function",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "const_cast"
|
|
},
|
|
{
|
|
"type": "template_argument_list",
|
|
"children": [
|
|
{
|
|
"type": "<",
|
|
"text": "<"
|
|
},
|
|
{
|
|
"type": "type_descriptor",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "FeedbackBuzzer"
|
|
},
|
|
{
|
|
"type": "abstract_pointer_declarator",
|
|
"children": [
|
|
{
|
|
"type": "*",
|
|
"text": "*"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ">",
|
|
"text": ">"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "this",
|
|
"text": "this"
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "for_statement",
|
|
"children": [
|
|
{
|
|
"type": "for",
|
|
"text": "for"
|
|
},
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "declaration",
|
|
"children": [
|
|
{
|
|
"type": "primitive_type",
|
|
"text": "int"
|
|
},
|
|
{
|
|
"type": "init_declarator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "i"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "number_literal",
|
|
"text": "0"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "binary_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "i"
|
|
},
|
|
{
|
|
"type": "<",
|
|
"text": "<"
|
|
},
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "blocksView"
|
|
},
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "count"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
},
|
|
{
|
|
"type": "update_expression",
|
|
"children": [
|
|
{
|
|
"type": "++",
|
|
"text": "++"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "i"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "declaration",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "MB_Registers"
|
|
},
|
|
{
|
|
"type": "init_declarator",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "info"
|
|
},
|
|
{
|
|
"type": "=",
|
|
"text": "="
|
|
},
|
|
{
|
|
"type": "subscript_expression",
|
|
"children": [
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "blocksView"
|
|
},
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "data"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "subscript_argument_list",
|
|
"children": [
|
|
{
|
|
"type": "[",
|
|
"text": "["
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "i"
|
|
},
|
|
{
|
|
"type": "]",
|
|
"text": "]"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "expression_statement",
|
|
"children": [
|
|
{
|
|
"type": "call_expression",
|
|
"children": [
|
|
{
|
|
"type": "field_expression",
|
|
"children": [
|
|
{
|
|
"type": "identifier",
|
|
"text": "manager"
|
|
},
|
|
{
|
|
"type": "->",
|
|
"text": "->"
|
|
},
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "registerModbus"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "argument_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "thiz"
|
|
},
|
|
{
|
|
"type": ",",
|
|
"text": ","
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "info"
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "function_definition",
|
|
"children": [
|
|
{
|
|
"type": "type_identifier",
|
|
"text": "ModbusBlockView"
|
|
},
|
|
{
|
|
"type": "pointer_declarator",
|
|
"children": [
|
|
{
|
|
"type": "*",
|
|
"text": "*"
|
|
},
|
|
{
|
|
"type": "function_declarator",
|
|
"children": [
|
|
{
|
|
"type": "field_identifier",
|
|
"text": "mb_tcp_blocks"
|
|
},
|
|
{
|
|
"type": "parameter_list",
|
|
"children": [
|
|
{
|
|
"type": "(",
|
|
"text": "("
|
|
},
|
|
{
|
|
"type": ")",
|
|
"text": ")"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "type_qualifier",
|
|
"children": [
|
|
{
|
|
"type": "const",
|
|
"text": "const"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "virtual_specifier",
|
|
"children": [
|
|
{
|
|
"type": "override",
|
|
"text": "override"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "compound_statement",
|
|
"children": [
|
|
{
|
|
"type": "{",
|
|
"text": "{"
|
|
},
|
|
{
|
|
"type": "return_statement",
|
|
"children": [
|
|
{
|
|
"type": "return",
|
|
"text": "return"
|
|
},
|
|
{
|
|
"type": "pointer_expression",
|
|
"children": [
|
|
{
|
|
"type": "&",
|
|
"text": "&"
|
|
},
|
|
{
|
|
"type": "identifier",
|
|
"text": "m_modbus_view"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "}",
|
|
"text": "}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": ";",
|
|
"text": ";"
|
|
},
|
|
{
|
|
"type": "#endif",
|
|
"text": "#endif"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "comment",
|
|
"text": "// FEEDBACK_BUZZER_H "
|
|
}
|
|
]
|
|
} |