@@ -24,13 +24,15 @@ namespace opcua
2424 * FUNCTION DEFINITION
2525 **************************************************************************************/
2626
27- static void analog_input_on_read_request (UA_Server *server,
28- const UA_NodeId *sessionId,
29- void *sessionContext,
30- const UA_NodeId *nodeid,
31- void *nodeContext,
32- const UA_NumericRange *range,
33- const UA_DataValue *data)
27+ static void
28+ analog_input_on_read_request (
29+ UA_Server *server,
30+ const UA_NodeId *sessionId,
31+ void *sessionContext,
32+ const UA_NodeId *nodeid,
33+ void *nodeContext,
34+ const UA_NumericRange *range,
35+ const UA_DataValue *data)
3436{
3537 AnalogInput * this_ptr = reinterpret_cast <AnalogInput *>(nodeContext);
3638 this_ptr->onReadRequest (server, nodeid);
@@ -40,7 +42,9 @@ static void analog_input_on_read_request(UA_Server *server,
4042 * CTOR/DTOR
4143 **************************************************************************************/
4244
43- AnalogInput::AnalogInput (UA_NodeId const & node_id, OnReadRequestFunc const on_read_request)
45+ AnalogInput::AnalogInput (
46+ UA_NodeId const & node_id,
47+ OnReadRequestFunc const on_read_request)
4448: _node_id{node_id}
4549, _on_read_request{on_read_request}
4650{
@@ -51,10 +55,12 @@ AnalogInput::AnalogInput(UA_NodeId const & node_id, OnReadRequestFunc const on_r
5155 * PUBLIC MEMBER FUNCTIONS
5256 **************************************************************************************/
5357
54- AnalogInput::SharedPtr AnalogInput::create (UA_Server * server,
55- UA_NodeId const & parent_node_id,
56- const char * display_name,
57- OnReadRequestFunc const on_read_request)
58+ AnalogInput::SharedPtr
59+ AnalogInput::create (
60+ UA_Server * server,
61+ UA_NodeId const & parent_node_id,
62+ const char * display_name,
63+ OnReadRequestFunc const on_read_request)
5864{
5965 UA_VariableAttributes analog_input_value_attr = UA_VariableAttributes_default;
6066
@@ -81,8 +87,7 @@ AnalogInput::SharedPtr AnalogInput::create(UA_Server * server,
8187 if (UA_StatusCode_isBad (rc))
8288 {
8389 UA_LOG_ERROR (UA_Log_Stdout, UA_LOGCATEGORY_SERVER,
84- " AnalogInput::create: UA_Server_addVariableNode(...) failed with %s" ,
85- UA_StatusCode_name (rc));
90+ " %s: UA_Server_addVariableNode(...) failed with %s" , __PRETTY_FUNCTION__, UA_StatusCode_name (rc));
8691 return nullptr ;
8792 }
8893
@@ -93,8 +98,7 @@ AnalogInput::SharedPtr AnalogInput::create(UA_Server * server,
9398 if (UA_StatusCode_isBad (rc))
9499 {
95100 UA_LOG_ERROR (UA_Log_Stdout, UA_LOGCATEGORY_SERVER,
96- " AnalogInput::create: UA_Server_setNodeContext(...) failed with %s" ,
97- UA_StatusCode_name (rc));
101+ " %s: UA_Server_setNodeContext(...) failed with %s" , __PRETTY_FUNCTION__, UA_StatusCode_name (rc));
98102 return nullptr ;
99103 }
100104
@@ -105,15 +109,17 @@ AnalogInput::SharedPtr AnalogInput::create(UA_Server * server,
105109 if (UA_StatusCode_isBad (rc))
106110 {
107111 UA_LOG_ERROR (UA_Log_Stdout, UA_LOGCATEGORY_SERVER,
108- " AnalogInput::create: UA_Server_setVariableNode_valueCallback(...) failed with %s" ,
109- UA_StatusCode_name (rc));
112+ " %s: UA_Server_setVariableNode_valueCallback(...) failed with %s" , __PRETTY_FUNCTION__, UA_StatusCode_name (rc));
110113 return nullptr ;
111114 }
112115
113116 return instance_ptr;
114117}
115118
116- void AnalogInput::onReadRequest (UA_Server * server, UA_NodeId const * node_id)
119+ void
120+ AnalogInput::onReadRequest (
121+ UA_Server * server,
122+ UA_NodeId const * node_id)
117123{
118124 /* Obtain the value of the analog input pin. */
119125 float const in_x_val = _on_read_request ();
@@ -124,7 +130,7 @@ void AnalogInput::onReadRequest(UA_Server * server, UA_NodeId const * node_id)
124130 UA_Variant_setScalar (&in_x_val_opcua_variant, &in_x_val_opcua_value, &UA_TYPES[UA_TYPES_FLOAT]);
125131 UA_Server_writeValue (server, *node_id, in_x_val_opcua_variant);
126132 /* Some debug output. */
127- UA_LOG_INFO (UA_Log_Stdout, UA_LOGCATEGORY_SERVER, " AnalogInput::onReadRequest: value = %f" , in_x_val);
133+ UA_LOG_INFO (UA_Log_Stdout, UA_LOGCATEGORY_SERVER, " %s: value = %f" , __PRETTY_FUNCTION__ , in_x_val);
128134}
129135
130136/* *************************************************************************************
0 commit comments