168 private USingleProcess,
173 const std::shared_ptr<SharedMemory>& ic =
nullptr,
174 const std::string& prefix =
"opcua");
176 virtual ~OPCUAServer();
178 virtual CORBA::Boolean exist()
override;
181 static std::shared_ptr<OPCUAServer>
init_opcua_server(
int argc,
const char*
const* argv,
183 const std::shared_ptr<SharedMemory>& ic =
nullptr,
184 const std::string& prefix =
"opcua");
189 using DefaultValueType = int32_t;
190 using DefaultValueUType = uint32_t;
191 static const opcua::DataTypeId DefaultVariableType = { opcua::DataTypeId::Int32 };
193 static uint8_t firstBit( DefaultValueUType mask );
195 static DefaultValueUType getBits( DefaultValueUType value, DefaultValueUType mask, uint8_t offset );
197 static DefaultValueUType setBits( DefaultValueUType value, DefaultValueUType set, DefaultValueUType mask, uint8_t offset );
199 static DefaultValueUType forceSetBits( DefaultValueUType value, DefaultValueUType set, DefaultValueUType mask, uint8_t offset );
201 static UA_StatusCode UA_setValueMethod(UA_Server* server,
const UA_NodeId* sessionId,
void* sessionHandle,
202 const UA_NodeId* methodId,
void* methodContext,
const UA_NodeId* objectId,
203 void* objectContext,
size_t inputSize,
const UA_Variant* input,
size_t outputSize, UA_Variant* output);
205#ifndef DISABLE_REST_API
207 virtual Poco::JSON::Object::Ptr httpHelp(
const Poco::URI::QueryParameters& p )
override;
208 virtual Poco::JSON::Object::Ptr httpRequest(
const std::string& req,
const Poco::URI::QueryParameters& p )
override;
214 virtual void callback()
noexcept override;
217 virtual void askSensors(UniversalIO::UIOCommand cmd)
override;
220 void serverLoopTerminate();
225#ifndef DISABLE_REST_API
227 virtual Poco::JSON::Object::Ptr httpGetParam(
const Poco::URI::QueryParameters& p );
228 virtual Poco::JSON::Object::Ptr httpSetParam(
const Poco::URI::QueryParameters& p );
231 Poco::JSON::Object::Ptr httpStatus();
234 bool httpEnabledSetParams {
true };
236 bool initVariable(UniXML::iterator& it);
237 bool readItem(
const std::shared_ptr<UniXML>& xml, UniXML::iterator& it, xmlNode* sec);
238 void readConfiguration();
240 std::shared_ptr<SMInterface> shm;
241 std::unique_ptr<ThreadCreator<OPCUAServer>> serverThread;
242 std::unique_ptr<ThreadCreator<OPCUAServer>> updateThread;
246 IOVariable(
const opcua::Node<opcua::Server>& n) : node(n) {};
247 opcua::Node<opcua::Server> node;
248 IOController::IOStateList::iterator it;
249 UniversalIO::IOType stype = { UniversalIO::AO };
252 DefaultValueType value = { 0 };
253 bool state = {
false };
254 DefaultValueUType mask = { 0 };
255 uint8_t offset = { 0 };
256 opcua::DataTypeId vtype = { DefaultVariableType };
257 uint8_t precision = { 0 };
260 std::unordered_map<ObjectId, IOVariable> variables;
261 size_t writeCount = { 0 };
265 opcua::Node<opcua::Server> node;
266 IONode(
const opcua::Node<opcua::Server>& n ): node(n) {};
273 IOController::IOStateList::iterator it;
275 uint8_t precision = { 0 };
278 std::unordered_map<uint32_t, IOMethod> methods;
279 size_t methodCount = { 0 };
282 std::unique_ptr<opcua::Server> opcServer = {
nullptr };
283 std::unique_ptr<IONode> ioNode = {
nullptr };
285 std::string propPrefix;
287 std::string s_fvalue;
288 std::optional<std::regex> s_fvalue_re;
289 std::string namePrefix;
290 uniset::timeout_t updateTime_msec = { 100 };
291 std::atomic_bool firstUpdate =
false;
293 using folderMap = std::unordered_map<std::string, std::unique_ptr<IONode>>;
295 void initFolderMap( uniset::UniXML::iterator it,
const std::string& parent_name, std::unique_ptr<IONode>& parent );
331 case opcua::LogCategory::Network:
334 case opcua::LogCategory::SecureChannel:
337 case opcua::LogCategory::Session:
340 case opcua::LogCategory::Server:
343 case opcua::LogCategory::Client:
346 case opcua::LogCategory::Userland:
349 case opcua::LogCategory::SecurityPolicy:
350 return "securitypolicy";
static std::shared_ptr< OPCUAServer > init_opcua_server(int argc, const char *const *argv, uniset::ObjectId shmID, const std::shared_ptr< SharedMemory > &ic=nullptr, const std::string &prefix="opcua")
Определения OPCUAServer.cc:630