Open luyulei-lyl opened 1 year ago
the UA_server task code ` void opcuaTask(void *argument) { UA_UInt32 sendBufferSize =16000; UA_UInt32 recvBufferSize =16000; UA_UInt16 portNumber = 4840;
UA_Server *server =UA_Server_new();
UA_ServerConfig *config=UA_Server_getConfig(server);
UA_ServerConfig_setMinimalCustomBuffer(config,portNumber,0,sendBufferSize,recvBufferSize);
UA_ServerConfig_setCustomHostname(config,UA_STRING("192.168.1.106"));
UA_Boolean running =true;
UA_VariableAttributes attr=UA_VariableAttributes_default;
// UA_VariableTypeAttributes attr1= UA_VariableTypeAttributes_default;
UA_Int32 myInteger=42;
UA_Variant_setScalarCopy(&attr.value,&myInteger,&UA_TYPES[UA_TYPES_INT32]);
attr.description=UA_LOCALIZEDTEXT_ALLOC("en_us","the answer");
attr.displayName=UA_LOCALIZEDTEXT_ALLOC("en_us","the answer");
UA_NodeId myIntegerNodeId=UA_NODEID_STRING_ALLOC(1,"the answer");
UA_QualifiedName myIntegerName=UA_QUALIFIEDNAME_ALLOC(1,"the answer");
UA_NodeId parentNodeId =UA_NODEID_NUMERIC(0,UA_NS0ID_OBJECTSFOLDER);
UA_NodeId parentReferenceNodeId=UA_NODEID_NUMERIC(0,UA_NS0ID_ORGANIZES);
UA_Server_addVariableNode(server,
myIntegerNodeId,
parentNodeId,
parentReferenceNodeId,
myIntegerName,
UA_NODEID_NULL,
attr,
NULL,
NULL
);
UA_VariableAttributes_clear(&attr);
UA_NodeId_clear(&myIntegerNodeId);
UA_QualifiedName_clear(&myIntegerName);
UA_StatusCode retval = UA_Server_run(server, &running);
UA_Server_delete(server);
} `
mcu start running uart printf this(twice) :
1970-01-01
00:00:00.003 (UTC+0000)] warn/server AccessControl: Unconfigured AccessControl. Users have all permissions.[1970-01-01 00:00:00.013 (UTC+0000)] info/server AccessControl: Anonymous login is enabled[1970-01-01 00:00:00.021 (UTC+0000)] warn/server Username/Password configured, but no encrypting SecurityPolicy. This can leak credentials on the network.[1970-01-01 00:00:00.035 (UTC+0000)] warn/userland AcceptAll Certificate Verification. Any remote certificate will be accepted.[1970-01-01 00:00:00.046 (UTC+0000)] info/session SecureChannel 0 | Session g=00000001-0000-0000-0000-000000000000 | AddNode (ns=1;s=the answer): No TypeDefinition. Use the default TypeDefinition for the Variable/Object[1970-01-01 00:00:00.066 (UTC+0000)] info/network TCP network layer listening on opc.tcp://192.168.1.106:4840/TCP network layer listening on :opc.tcp://192.168.1.106:4840/nswer`
I used H743VIT6+LWIP+FreeRTOS ,and create a UA_server task and a led blink task It seems to be running,but i used UaExpert client to connect this server ,the print this
[1970-01-01 00:01:08.231 (UTC+0000)] info/network Connection 1 | New connection over TCP[1970-01-01 00:01:08.239 (UTC+0000)] info/channel assertion "Balloc succeeded" failed: file "/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-260_20210727_1627371386/src/newlib/newlib/libc/stdlib/mprec.c", line 778
i can't fonud what wrong with this problem,so help me .