{ "type": "translation_unit", "children": [ { "type": "preproc_ifdef", "children": [ { "type": "#ifndef", "text": "#ifndef" }, { "type": "identifier", "text": "RELAY_H" }, { "type": "preproc_def", "children": [ { "type": "#define", "text": "#define" }, { "type": "identifier", "text": "RELAY_H" } ] }, { "type": "preproc_include", "children": [ { "type": "#include", "text": "#include" }, { "type": "system_lib_string", "text": "" } ] }, { "type": "preproc_include", "children": [ { "type": "#include", "text": "#include" }, { "type": "system_lib_string", "text": "" } ] }, { "type": "preproc_include", "children": [ { "type": "#include", "text": "#include" }, { "type": "system_lib_string", "text": "" } ] }, { "type": "preproc_include", "children": [ { "type": "#include", "text": "#include" }, { "type": "system_lib_string", "text": "" } ] }, { "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": "" } ] }, { "type": "preproc_include", "children": [ { "type": "#include", "text": "#include" }, { "type": "system_lib_string", "text": "" } ] }, { "type": "preproc_include", "children": [ { "type": "#include", "text": "#include" }, { "type": "string_literal", "children": [ { "type": "\"", "text": "\"" }, { "type": "string_content", "text": "config-modbus.h" }, { "type": "\"", "text": "\"" } ] }, { "type": "comment", "text": "// application-specific modbus configuration\r" } ] }, { "type": "class_specifier", "children": [ { "type": "class", "text": "class" }, { "type": "type_identifier", "text": "Bridge" } ] }, { "type": ";", "text": ";" }, { "type": "class_specifier", "children": [ { "type": "class", "text": "class" }, { "type": "type_identifier", "text": "Relay" }, { "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": "private", "text": "private" } ] }, { "type": ":", "text": ":" }, { "type": "comment", "text": "// Keep address private, provide via getModbusInfo\r" }, { "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": "comment", "text": "// Store Modbus address internally\r" }, { "type": "field_declaration", "children": [ { "type": "type_identifier", "text": "MB_Registers" }, { "type": "array_declarator", "children": [ { "type": "field_identifier", "text": "m_modbus_block" }, { "type": "[", "text": "[" }, { "type": "number_literal", "text": "2" }, { "type": "]", "text": "]" } ] }, { "type": ";", "text": ";" } ] }, { "type": "comment", "text": "// m_modbus_view needs to be mutable to be returned as ModbusBlockView* from a const method.\r" }, { "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": "comment", "text": "// for blinking\r" }, { "type": "field_declaration", "children": [ { "type": "sized_type_specifier", "children": [ { "type": "unsigned", "text": "unsigned" }, { "type": "long", "text": "long" } ] }, { "type": "field_identifier", "text": "onOffFrequency" }, { "type": ";", "text": ";" } ] }, { "type": "comment", "text": "// in seconds\r" }, { "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": "access_specifier", "children": [ { "type": "public", "text": "public" } ] }, { "type": ":", "text": ":" }, { "type": "function_definition", "children": [ { "type": "function_declarator", "children": [ { "type": "identifier", "text": "Relay" }, { "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": "Relay" }, { "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": ",", "text": "," }, { "type": "field_initializer", "children": [ { "type": "field_identifier", "text": "value" }, { "type": "argument_list", "children": [ { "type": "(", "text": "(" }, { "type": "false", "text": "false" }, { "type": ")", "text": ")" } ] } ] }, { "type": ",", "text": "," }, { "type": "field_initializer", "children": [ { "type": "field_identifier", "text": "onOffFrequency" }, { "type": "argument_list", "children": [ { "type": "(", "text": "(" }, { "type": "number_literal", "text": "0" }, { "type": ")", "text": ")" } ] } ] }, { "type": ",", "text": "," }, { "type": "field_initializer", "children": [ { "type": "field_identifier", "text": "lastToggleTime" }, { "type": "argument_list", "children": [ { "type": "(", "text": "(" }, { "type": "number_literal", "text": "0" }, { "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": "comment", "text": "// Initialize instance-specific Modbus block.\r" }, { "type": "comment", "text": "// The modbusAddress is the actual start address for the Relay's single coil.\r" }, { "type": "comment", "text": "// So, the offset passed to the macro is 0.\r" }, { "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": "number_literal", "text": "0" }, { "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": "comment", "text": "// Base address for this component's block\r" }, { "type": "number_literal", "text": "0" }, { "type": ",", "text": "," }, { "type": "comment", "text": "// Offset for this specific register\r" }, { "type": "qualified_identifier", "children": [ { "type": "namespace_identifier", "text": "E_FN_CODE" }, { "type": "::", "text": "::" }, { "type": "identifier", "text": "FN_WRITE_COIL" } ] }, { "type": ",", "text": "," }, { "type": "comment", "text": "// Function code\r" }, { "type": "identifier", "text": "MB_ACCESS_READ_WRITE" }, { "type": ",", "text": "," }, { "type": "comment", "text": "// Access type\r" }, { "type": "string_literal", "children": [ { "type": "\"", "text": "\"" }, { "type": "string_content", "text": "Relay" }, { "type": "\"", "text": "\"" } ] }, { "type": ",", "text": "," }, { "type": "comment", "text": "// Name\r" }, { "type": "null", "children": [ { "type": "nullptr", "text": "nullptr" } ] }, { "type": "comment", "text": "// Group (nullptr if not applicable)\r" }, { "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": "number_literal", "text": "1" }, { "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": "comment", "text": "// Base address for this component's block\r" }, { "type": "number_literal", "text": "1" }, { "type": ",", "text": "," }, { "type": "comment", "text": "// Offset for the frequency register\r" }, { "type": "qualified_identifier", "children": [ { "type": "namespace_identifier", "text": "E_FN_CODE" }, { "type": "::", "text": "::" }, { "type": "identifier", "text": "FN_WRITE_HOLD_REGISTER" } ] }, { "type": ",", "text": "," }, { "type": "comment", "text": "// Function code\r" }, { "type": "identifier", "text": "MB_ACCESS_READ_WRITE" }, { "type": ",", "text": "," }, { "type": "comment", "text": "// Access type\r" }, { "type": "string_literal", "children": [ { "type": "\"", "text": "\"" }, { "type": "string_content", "text": "Relay On/Off Freq (secs)" }, { "type": "\"", "text": "\"" } ] }, { "type": ",", "text": "," }, { "type": "comment", "text": "// Name\r" }, { "type": "null", "children": [ { "type": "nullptr", "text": "nullptr" } ] }, { "type": "comment", "text": "// Group (nullptr if not applicable)\r" }, { "type": ")", "text": ")" } ] } ] } ] }, { "type": ";", "text": ";" } ] }, { "type": "comment", "text": "// Initialize the view to point to this instance-specific block\r" }, { "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": "comment", "text": "// Point to the array of blocks\r" }, { "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": "number_literal", "text": "2" } ] }, { "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": "info" }, { "type": "parameter_list", "children": [ { "type": "(", "text": "(" }, { "type": "optional_parameter_declaration", "children": [ { "type": "sized_type_specifier", "children": [ { "type": "short", "text": "short" } ] }, { "type": "identifier", "text": "flags" }, { "type": "=", "text": "=" }, { "type": "number_literal", "text": "0" } ] }, { "type": ",", "text": "," }, { "type": "optional_parameter_declaration", "children": [ { "type": "sized_type_specifier", "children": [ { "type": "short", "text": "short" } ] }, { "type": "identifier", "text": "val" }, { "type": "=", "text": "=" }, { "type": "number_literal", "text": "0" } ] }, { "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": "field_expression", "children": [ { "type": "identifier", "text": "Log" }, { "type": ".", "text": "." }, { "type": "field_identifier", "text": "verboseln" } ] }, { "type": "argument_list", "children": [ { "type": "(", "text": "(" }, { "type": "string_literal", "children": [ { "type": "\"", "text": "\"" }, { "type": "string_content", "text": "Relay::info - ID: %d, Pin: %d, Modbus Addr: %d, Value: %d, Freq: %lu, NetCaps: %d" }, { "type": "\"", "text": "\"" } ] }, { "type": ",", "text": "," }, { "type": "identifier", "text": "id" }, { "type": ",", "text": "," }, { "type": "identifier", "text": "pin" }, { "type": ",", "text": "," }, { "type": "identifier", "text": "modbusAddress" }, { "type": ",", "text": "," }, { "type": "identifier", "text": "value" }, { "type": ",", "text": "," }, { "type": "identifier", "text": "onOffFrequency" }, { "type": ",", "text": "," }, { "type": "identifier", "text": "nFlags" }, { "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": "debug" }, { "type": "parameter_list", "children": [ { "type": "(", "text": "(" }, { "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": "info" }, { "type": "argument_list", "children": [ { "type": "(", "text": "(" }, { "type": "number_literal", "text": "0" }, { "type": ",", "text": "," }, { "type": "number_literal", "text": "0" }, { "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": "comment", "text": "// Call base class setup (important if it does network registration)\r" }, { "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": "identifier", "text": "value" }, { "type": ")", "text": ")" } ] } ] }, { "type": ";", "text": ";" } ] }, { "type": "comment", "text": "// Ensure pin state matches initial value\r" }, { "type": "expression_statement", "children": [ { "type": "call_expression", "children": [ { "type": "field_expression", "children": [ { "type": "identifier", "text": "Log" }, { "type": ".", "text": "." }, { "type": "field_identifier", "text": "verboseln" } ] }, { "type": "argument_list", "children": [ { "type": "(", "text": "(" }, { "type": "string_literal", "children": [ { "type": "\"", "text": "\"" }, { "type": "string_content", "text": "Relay::setup - ID %d, Pin %d, Initial Value: %d, Modbus Addr: %d" }, { "type": "\"", "text": "\"" } ] }, { "type": ",", "text": "," }, { "type": "identifier", "text": "id" }, { "type": ",", "text": "," }, { "type": "identifier", "text": "pin" }, { "type": ",", "text": "," }, { "type": "identifier", "text": "value" }, { "type": ",", "text": "," }, { "type": "identifier", "text": "modbusAddress" }, { "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": "setValue" }, { "type": "parameter_list", "children": [ { "type": "(", "text": "(" }, { "type": "parameter_declaration", "children": [ { "type": "primitive_type", "text": "bool" }, { "type": "identifier", "text": "newValue" } ] }, { "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": "value" }, { "type": "!=", "text": "!=" }, { "type": "identifier", "text": "newValue" } ] }, { "type": ")", "text": ")" } ] }, { "type": "compound_statement", "children": [ { "type": "{", "text": "{" }, { "type": "expression_statement", "children": [ { "type": "assignment_expression", "children": [ { "type": "identifier", "text": "value" }, { "type": "=", "text": "=" }, { "type": "identifier", "text": "newValue" } ] }, { "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": "identifier", "text": "newValue" }, { "type": "?", "text": "?" }, { "type": "identifier", "text": "HIGH" }, { "type": ":", "text": ":" }, { "type": "identifier", "text": "LOW" } ] }, { "type": ")", "text": ")" } ] } ] }, { "type": ";", "text": ";" } ] }, { "type": "expression_statement", "children": [ { "type": "call_expression", "children": [ { "type": "identifier", "text": "notifyStateChange" }, { "type": "argument_list", "children": [ { "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": "setValueCmd" }, { "type": "parameter_list", "children": [ { "type": "(", "text": "(" }, { "type": "parameter_declaration", "children": [ { "type": "sized_type_specifier", "children": [ { "type": "short", "text": "short" } ] }, { "type": "identifier", "text": "arg1" } ] }, { "type": ",", "text": "," }, { "type": "parameter_declaration", "children": [ { "type": "sized_type_specifier", "children": [ { "type": "short", "text": "short" } ] }, { "type": "identifier", "text": "arg2" } ] }, { "type": ")", "text": ")" } ] } ] }, { "type": "compound_statement", "children": [ { "type": "{", "text": "{" }, { "type": "expression_statement", "children": [ { "type": "assignment_expression", "children": [ { "type": "identifier", "text": "onOffFrequency" }, { "type": "=", "text": "=" }, { "type": "number_literal", "text": "0" } ] }, { "type": ";", "text": ";" } ] }, { "type": "comment", "text": "// manual override\r" }, { "type": "return_statement", "children": [ { "type": "return", "text": "return" }, { "type": "call_expression", "children": [ { "type": "identifier", "text": "setValue" }, { "type": "argument_list", "children": [ { "type": "(", "text": "(" }, { "type": "binary_expression", "children": [ { "type": "identifier", "text": "arg1" }, { "type": ">", "text": ">" }, { "type": "number_literal", "text": "0" } ] }, { "type": ")", "text": ")" } ] } ] }, { "type": ";", "text": ";" } ] }, { "type": "}", "text": "}" } ] } ] }, { "type": "function_definition", "children": [ { "type": "primitive_type", "text": "bool" }, { "type": "function_declarator", "children": [ { "type": "field_identifier", "text": "getValue" }, { "type": "parameter_list", "children": [ { "type": "(", "text": "(" }, { "type": ")", "text": ")" } ] }, { "type": "type_qualifier", "children": [ { "type": "const", "text": "const" } ] } ] }, { "type": "compound_statement", "children": [ { "type": "{", "text": "{" }, { "type": "return_statement", "children": [ { "type": "return", "text": "return" }, { "type": "identifier", "text": "value" }, { "type": ";", "text": ";" } ] }, { "type": "}", "text": "}" } ] } ] }, { "type": "comment", "text": "/**\r\n * @brief Handles writes coming from the network (e.g., Modbus write coil/register).\r\n * @param reg The Modbus register being written to.\r\n * @param networkValue The value received from the network.\r\n * @return E_OK if the address matches and the value is set, E_INVALID_PARAMETER otherwise.\r\n */" }, { "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": "comment", "text": "/**\r\n * @brief Handles writes coming from the network (e.g., Modbus write coil/register).\r\n * @param address The Modbus address being written to (should match component's address).\r\n * @param networkValue The value received from the network.\r\n * @return E_OK if the address matches and the value is set, E_INVALID_PARAMETER otherwise.\r\n */" }, { "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": "if_statement", "children": [ { "type": "if", "text": "if" }, { "type": "condition_clause", "children": [ { "type": "(", "text": "(" }, { "type": "binary_expression", "children": [ { "type": "identifier", "text": "address" }, { "type": "==", "text": "==" }, { "type": "identifier", "text": "modbusAddress" } ] }, { "type": ")", "text": ")" } ] }, { "type": "comment", "text": "// Use internal member\r" }, { "type": "compound_statement", "children": [ { "type": "{", "text": "{" }, { "type": "expression_statement", "children": [ { "type": "assignment_expression", "children": [ { "type": "identifier", "text": "onOffFrequency" }, { "type": "=", "text": "=" }, { "type": "number_literal", "text": "0" } ] }, { "type": ";", "text": ";" } ] }, { "type": "comment", "text": "// Manual control stops blinking\r" }, { "type": "return_statement", "children": [ { "type": "return", "text": "return" }, { "type": "call_expression", "children": [ { "type": "identifier", "text": "setValue" }, { "type": "argument_list", "children": [ { "type": "(", "text": "(" }, { "type": "binary_expression", "children": [ { "type": "identifier", "text": "networkValue" }, { "type": ">", "text": ">" }, { "type": "number_literal", "text": "0" } ] }, { "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": "address" }, { "type": "==", "text": "==" }, { "type": "binary_expression", "children": [ { "type": "identifier", "text": "modbusAddress" }, { "type": "+", "text": "+" }, { "type": "number_literal", "text": "1" } ] } ] }, { "type": ")", "text": ")" } ] }, { "type": "compound_statement", "children": [ { "type": "{", "text": "{" }, { "type": "expression_statement", "children": [ { "type": "assignment_expression", "children": [ { "type": "identifier", "text": "onOffFrequency" }, { "type": "=", "text": "=" }, { "type": "identifier", "text": "networkValue" } ] }, { "type": ";", "text": ";" } ] }, { "type": "if_statement", "children": [ { "type": "if", "text": "if" }, { "type": "condition_clause", "children": [ { "type": "(", "text": "(" }, { "type": "binary_expression", "children": [ { "type": "identifier", "text": "onOffFrequency" }, { "type": ">", "text": ">" }, { "type": "number_literal", "text": "0" } ] }, { "type": ")", "text": ")" } ] }, { "type": "compound_statement", "children": [ { "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": "}", "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": "comment", "text": "/**\r\n * @brief Handles reads requests from the network (e.g., Modbus read coil/register).\r\n * @param address The Modbus address being read (should match component's address).\r\n * @return The current state (1 for ON, 0 for OFF) if the address matches, 0 otherwise.\r\n */" }, { "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": "if_statement", "children": [ { "type": "if", "text": "if" }, { "type": "condition_clause", "children": [ { "type": "(", "text": "(" }, { "type": "binary_expression", "children": [ { "type": "identifier", "text": "address" }, { "type": "==", "text": "==" }, { "type": "identifier", "text": "modbusAddress" } ] }, { "type": ")", "text": ")" } ] }, { "type": "comment", "text": "// Use internal member\r" }, { "type": "compound_statement", "children": [ { "type": "{", "text": "{" }, { "type": "return_statement", "children": [ { "type": "return", "text": "return" }, { "type": "conditional_expression", "children": [ { "type": "identifier", "text": "value" }, { "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": "address" }, { "type": "==", "text": "==" }, { "type": "binary_expression", "children": [ { "type": "identifier", "text": "modbusAddress" }, { "type": "+", "text": "+" }, { "type": "number_literal", "text": "1" } ] } ] }, { "type": ")", "text": ")" } ] }, { "type": "compound_statement", "children": [ { "type": "{", "text": "{" }, { "type": "return_statement", "children": [ { "type": "return", "text": "return" }, { "type": "identifier", "text": "onOffFrequency" }, { "type": ";", "text": ";" } ] }, { "type": "}", "text": "}" } ] } ] } ] } ] }, { "type": "return_statement", "children": [ { "type": "return", "text": "return" }, { "type": "number_literal", "text": "0" }, { "type": ";", "text": ";" } ] }, { "type": "comment", "text": "// Default for mismatched addresses\r" }, { "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": "comment", "text": "// Log.traceln(F(\"Relay::mb_tcp_read (Reg Context) - TCP Addr: %d, Type: %d\"), reg->startAddress, reg->type);\r" }, { "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": "Relay" }, { "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": "comment", "text": "// Return the instance-specific Modbus block view\r" }, { "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": "function_definition", "children": [ { "type": "sized_type_specifier", "children": [ { "type": "short", "text": "short" } ] }, { "type": "function_declarator", "children": [ { "type": "field_identifier", "text": "serial_register" }, { "type": "parameter_list", "children": [ { "type": "(", "text": "(" }, { "type": "parameter_declaration", "children": [ { "type": "type_identifier", "text": "Bridge" }, { "type": "pointer_declarator", "children": [ { "type": "*", "text": "*" }, { "type": "identifier", "text": "bridge" } ] } ] }, { "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": "serial_register" } ] }, { "type": "argument_list", "children": [ { "type": "(", "text": "(" }, { "type": "identifier", "text": "bridge" }, { "type": ")", "text": ")" } ] } ] }, { "type": ";", "text": ";" } ] }, { "type": "expression_statement", "children": [ { "type": "call_expression", "children": [ { "type": "field_expression", "children": [ { "type": "identifier", "text": "bridge" }, { "type": "->", "text": "->" }, { "type": "field_identifier", "text": "registerMemberFunction" } ] }, { "type": "argument_list", "children": [ { "type": "(", "text": "(" }, { "type": "identifier", "text": "id" }, { "type": ",", "text": "," }, { "type": "this", "text": "this" }, { "type": ",", "text": "," }, { "type": "call_expression", "children": [ { "type": "identifier", "text": "C_STR" }, { "type": "argument_list", "children": [ { "type": "(", "text": "(" }, { "type": "string_literal", "children": [ { "type": "\"", "text": "\"" }, { "type": "string_content", "text": "setValue" }, { "type": "\"", "text": "\"" } ] }, { "type": ")", "text": ")" } ] } ] }, { "type": ",", "text": "," }, { "type": "binary_expression", "children": [ { "type": "parenthesized_expression", "children": [ { "type": "(", "text": "(" }, { "type": "identifier", "text": "ComponentFnPtr" }, { "type": ")", "text": ")" } ] }, { "type": "&", "text": "&" }, { "type": "qualified_identifier", "children": [ { "type": "namespace_identifier", "text": "Relay" }, { "type": "::", "text": "::" }, { "type": "identifier", "text": "setValueCmd" } ] } ] }, { "type": ")", "text": ")" } ] } ] }, { "type": ";", "text": ";" } ] }, { "type": "expression_statement", "children": [ { "type": "call_expression", "children": [ { "type": "field_expression", "children": [ { "type": "identifier", "text": "bridge" }, { "type": "->", "text": "->" }, { "type": "field_identifier", "text": "registerMemberFunction" } ] }, { "type": "argument_list", "children": [ { "type": "(", "text": "(" }, { "type": "identifier", "text": "id" }, { "type": ",", "text": "," }, { "type": "this", "text": "this" }, { "type": ",", "text": "," }, { "type": "call_expression", "children": [ { "type": "identifier", "text": "C_STR" }, { "type": "argument_list", "children": [ { "type": "(", "text": "(" }, { "type": "string_literal", "children": [ { "type": "\"", "text": "\"" }, { "type": "string_content", "text": "info" }, { "type": "\"", "text": "\"" } ] }, { "type": ")", "text": ")" } ] } ] }, { "type": ",", "text": "," }, { "type": "binary_expression", "children": [ { "type": "parenthesized_expression", "children": [ { "type": "(", "text": "(" }, { "type": "identifier", "text": "ComponentFnPtr" }, { "type": ")", "text": ")" } ] }, { "type": "&", "text": "&" }, { "type": "qualified_identifier", "children": [ { "type": "namespace_identifier", "text": "Relay" }, { "type": "::", "text": "::" }, { "type": "identifier", "text": "info" } ] } ] }, { "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": "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": "if_statement", "children": [ { "type": "if", "text": "if" }, { "type": "condition_clause", "children": [ { "type": "(", "text": "(" }, { "type": "binary_expression", "children": [ { "type": "identifier", "text": "onOffFrequency" }, { "type": ">", "text": ">" }, { "type": "number_literal", "text": "0" } ] }, { "type": ")", "text": ")" } ] }, { "type": "compound_statement", "children": [ { "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": "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": "binary_expression", "children": [ { "type": "identifier", "text": "onOffFrequency" }, { "type": "*", "text": "*" }, { "type": "number_literal", "text": "1000" } ] } ] }, { "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": "identifier", "text": "setValue" }, { "type": "argument_list", "children": [ { "type": "(", "text": "(" }, { "type": "unary_expression", "children": [ { "type": "!", "text": "!" }, { "type": "identifier", "text": "value" } ] }, { "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": "comment", "text": "// --- Member Variables ---\r" }, { "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": "primitive_type", "text": "bool" }, { "type": "field_identifier", "text": "value" }, { "type": ";", "text": ";" } ] }, { "type": "}", "text": "}" } ] } ] }, { "type": ";", "text": ";" }, { "type": "#endif", "text": "#endif" } ] } ] }