MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / nodeFoundCallBack

Method nodeFoundCallBack

extensions/opc/src/fetchopc.cpp:188–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186 }
187
188 bool FetchOPCProcessor::nodeFoundCallBack(opc::Client& client, const UA_ReferenceDescription *ref, const std::string& path,
189 const std::shared_ptr<core::ProcessContext> &context, const std::shared_ptr<core::ProcessSession> &session) {
190 nodesFound_++;
191 if(ref->nodeClass == UA_NODECLASS_VARIABLE) {
192 try {
193 opc::NodeData nodedata = connection_->getNodeData(ref, path);
194 bool write = true;
195 if (lazy_mode_) {
196 write = false;
197 std::string nodeid = nodedata.attributes["Full path"];
198 std::string cur_timestamp = node_timestamp_[nodeid];
199 std::string new_timestamp = nodedata.attributes["Sourcetimestamp"];
200 if (cur_timestamp != new_timestamp) {
201 node_timestamp_[nodeid] = new_timestamp;
202 logger_->log_debug("Node %s has new source timestamp %s", nodeid, new_timestamp);
203 write = true;
204 }
205 }
206 if (write) {
207 OPCData2FlowFile(nodedata, context, session);
208 variablesFound_++;
209 }
210 } catch (const std::exception& exception) {
211 std::string browsename((char*)ref->browseName.name.data, ref->browseName.name.length);
212 logger_->log_warn("Caught Exception while trying to get data from node %s: %s", path + "/" + browsename, exception.what());
213 }
214 }
215 return true;
216 }
217
218 void FetchOPCProcessor::OPCData2FlowFile(const opc::NodeData& opcnode, const std::shared_ptr<core::ProcessContext> &context, const std::shared_ptr<core::ProcessSession> &session) {
219 auto flowFile = session->create();

Callers

nothing calls this directly

Calls 4

getNodeDataMethod · 0.80
log_debugMethod · 0.80
log_warnMethod · 0.80
whatMethod · 0.45

Tested by

no test coverage detected