FileDirectoryType
Moderator: uamodeler
-
- Sr. Member
- Posts: 12
- Joined: 20 Oct 2015, 10:07
FileDirectoryType
Hi,
I would like to have a view of a file directory on the server, from an OPC UA client.
I found that the UaModeler offers the type FileDirectoryType (subtype of FolderType), which would probably be what I want.
However, compiling the output of UaModeler fails because the include file "opcua_filedirectorytype.h" is missing in the C++ SDK 1.4.3.291.
If I leave out the FileDirectoryType object in my information model, creating the model with UaModeler and compiling the C++ code works fine.
Is this a mistake, or do I need a newer SDK? I read something about C++ SDK 1.5 but It's not on the download page.
Thanks for any help
I would like to have a view of a file directory on the server, from an OPC UA client.
I found that the UaModeler offers the type FileDirectoryType (subtype of FolderType), which would probably be what I want.
However, compiling the output of UaModeler fails because the include file "opcua_filedirectorytype.h" is missing in the C++ SDK 1.4.3.291.
If I leave out the FileDirectoryType object in my information model, creating the model with UaModeler and compiling the C++ code works fine.
Is this a mistake, or do I need a newer SDK? I read something about C++ SDK 1.5 but It's not on the download page.
Thanks for any help
- Support Team
- Hero Member
- Posts: 3072
- Joined: 18 Mar 2011, 15:09
Re: FileDirectoryType
Hello,
FileDirectoryType is not supported by C++ SDK 1.4.
The nodes and toolkit classes will be part of C++ SDK 1.5 which will be released soon.
Note: C++ SDK 1.5 will only add the OPC UA Type. If you want to reflect a file directory on disc, you need to implement functionality like discovering the file directory to get the already existing files and directories yourself.
Best regards
Support Team
FileDirectoryType is not supported by C++ SDK 1.4.
The nodes and toolkit classes will be part of C++ SDK 1.5 which will be released soon.
Note: C++ SDK 1.5 will only add the OPC UA Type. If you want to reflect a file directory on disc, you need to implement functionality like discovering the file directory to get the already existing files and directories yourself.
Best regards
Support Team
-
- Sr. Member
- Posts: 12
- Joined: 20 Oct 2015, 10:07
Re: FileDirectoryType
Hi,
I now switched to the C++ SDK 1.5.
I can see that now there are the include files include/uaserver/opcua_filedirectorytype.h and include/uaserver/opcua_filedirectorytypebase.h, which were not present before.
However, UaExpert does not yet show the derived type FileDirectoryType below FolderType, in the ObjectTypes tree. Is this a bug, or would I have to create the type definition in that place by myself?
Anyway, since FileDirectoryType was not available in SDK 1.4, I meanwhile created a subtype of FolderType with quite the same functionality as FileDirectoryType should provide.
Best regards,
D. Rothe
I now switched to the C++ SDK 1.5.
I can see that now there are the include files include/uaserver/opcua_filedirectorytype.h and include/uaserver/opcua_filedirectorytypebase.h, which were not present before.
However, UaExpert does not yet show the derived type FileDirectoryType below FolderType, in the ObjectTypes tree. Is this a bug, or would I have to create the type definition in that place by myself?
Anyway, since FileDirectoryType was not available in SDK 1.4, I meanwhile created a subtype of FolderType with quite the same functionality as FileDirectoryType should provide.
Best regards,
D. Rothe
- Support Team
- Hero Member
- Posts: 3072
- Joined: 18 Mar 2011, 15:09
Re: FileDirectoryType
Hello,
In C++ SDK some types nodes are added on demand, i.e. the type nodes are created when the first instance of the type is created.
Best regards
Support Team
In C++ SDK some types nodes are added on demand, i.e. the type nodes are created when the first instance of the type is created.
Best regards
Support Team
-
- Sr. Member
- Posts: 12
- Joined: 20 Oct 2015, 10:07
Re: FileDirectoryType
Hi,
seemingly there is a problem in the FileDirecotryType (or FileDirectoryTypeBase) implementation. If I use the type, the program stops with an exception:
Assertion failed: m_pCreateDirectoryMethod, file D:\work\uasdkcpp\src\uaserver\uaservercpp\coremodule\opcua_filedirectorytypebase.cpp, line 147
This can be triggered by
OpcUa::FileDirectoryTypeBase::createTypes(); // fails
but also by
OpcUa::FileDirectoryType* pdir2 = new OpcUa::FileDirectoryType(UaNodeId(sName, nsIndex), sName, nsIndex, this);
I am now using the UA C++ SDK version 1.5.1. Is this a known bug?
Best,
D. Rothe
seemingly there is a problem in the FileDirecotryType (or FileDirectoryTypeBase) implementation. If I use the type, the program stops with an exception:
Assertion failed: m_pCreateDirectoryMethod, file D:\work\uasdkcpp\src\uaserver\uaservercpp\coremodule\opcua_filedirectorytypebase.cpp, line 147
This can be triggered by
OpcUa::FileDirectoryTypeBase::createTypes(); // fails
but also by
OpcUa::FileDirectoryType* pdir2 = new OpcUa::FileDirectoryType(UaNodeId(sName, nsIndex), sName, nsIndex, this);
I am now using the UA C++ SDK version 1.5.1. Is this a known bug?
Best,
D. Rothe
-
- Sr. Member
- Posts: 13
- Joined: 28 Jun 2016, 02:06
Re: FileDirectoryType
The same thing is happening here.drothe82 wrote:Hi,
seemingly there is a problem in the FileDirecotryType (or FileDirectoryTypeBase) implementation. If I use the type, the program stops with an exception:
Assertion failed: m_pCreateDirectoryMethod, file D:\work\uasdkcpp\src\uaserver\uaservercpp\coremodule\opcua_filedirectorytypebase.cpp, line 147
This can be triggered by
OpcUa::FileDirectoryTypeBase::createTypes(); // fails
but also by
OpcUa::FileDirectoryType* pdir2 = new OpcUa::FileDirectoryType(UaNodeId(sName, nsIndex), sName, nsIndex, this);
I am now using the UA C++ SDK version 1.5.1. Is this a known bug?
Best,
D. Rothe
- Support Team
- Hero Member
- Posts: 3072
- Joined: 18 Mar 2011, 15:09
Re: FileDirectoryType
This is a bug in C++ SDK. We are working on a solution.
If you are using the source version of the C++ SDK, you can fix the file opcua_filedirectorytype.cpp. Please cut the block that adds the OPC UA Methods in method createType (at the end of the method) and paste the block after
If you are using the source version of the C++ SDK, you can fix the file opcua_filedirectorytype.cpp. Please cut the block that adds the OPC UA Methods in method createType (at the end of the method) and paste the block after
Code: Select all
pTypeNodeConfig->addNodeAndReference(UaNodeId(OpcUaId_FolderType, nsSuperTypeIdx), pObjectType, OpcUaId_HasSubtype);
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Full Member
- Posts: 8
- Joined: 01 Jun 2016, 08:22
Re: FileDirectoryType
Hello,
I have the same problem with SDK 1.4.3:
Assertion failed: addStatus.isGood(), file ...\opcua_server\k_attributetypebase.cpp, line 144
The code looks like this:
Where do I have to modify the code, I could not reproduce your solution. The createTypes method looks like this:
Thank you very much!!
I have the same problem with SDK 1.4.3:
Assertion failed: addStatus.isGood(), file ...\opcua_server\k_attributetypebase.cpp, line 144
The code looks like this:
Code: Select all
else if (pChild->browseName() == UaQualifiedName("DeliveryMode", k::NodeManagerkopplung::getTypeNamespace()))
{
if (!m_pDeliveryMode)
{
m_pDeliveryMode = (OpcUa::BaseDataVariableType*) pFactory->createVariable((UaBase::Variable*)pChild, pNodeConfig, pSharedMutex);
addStatus = pNodeConfig->addNodeAndReference(this, m_pDeliveryMode, OpcUaId_HasComponent);
UA_ASSERT(addStatus.isGood());
if (!((UaBase::Variable*)pChild)->modellingRuleId().isNull())
{
m_pDeliveryMode->setModellingRuleId(((UaBase::Variable*)pChild)->modellingRuleId());
}
}
}
Code: Select all
void AttributeTypeBase::createTypes()
{
if ( s_typeNodesCreated == false )
{
s_typeNodesCreated = true;
UaStatus addStatus;
UaVariant defaultValue;
NodeManagerRoot* pNodeManagerRoot = NodeManagerRoot::CreateRootNodeManager();
OpcUa_Int16 nsTypeIdx = NodeManagerkopplung::getTypeNamespace();
OpcUa_Int16 nsSuperTypeIdx = NodeManagerRoot::getTypeNamespace();
NodeManagerConfig* pTypeNodeConfig = pNodeManagerRoot->getNodeManagerByNamespace(nsTypeIdx)->getNodeManagerConfig();
OpcUa::GenericObjectType* pObjectType;
pObjectType = new OpcUa::GenericObjectType(
UaNodeId(kId_AttributeType, nsTypeIdx),
UaQualifiedName("AttributeType", nsTypeIdx),
UaLocalizedText("", "AttributeType"),
UaLocalizedText("", ""),
OpcUa_False,
&AttributeType::clearStaticMembers);
pTypeNodeConfig->addNodeAndReference(UaNodeId(OpcUaId_BaseObjectType, nsSuperTypeIdx), pObjectType, OpcUaId_HasSubtype);
// Mandatory variable ContentEncoding
defaultValue.setString("");
s_pContentEncoding = new OpcUa::BaseDataVariableType(UaNodeId(kId_AttributeType_ContentEncoding, nsTypeIdx), "ContentEncoding", k::NodeManagerkopplung::getTypeNamespace(), defaultValue, 3, pTypeNodeConfig);
s_pContentEncoding->setModellingRuleId(OpcUaId_ModellingRule_Mandatory);
addStatus = pTypeNodeConfig->addNodeAndReference(pObjectType, s_pContentEncoding, OpcUaId_HasComponent);
UA_ASSERT(addStatus.isGood());
// Mandatory variable ContentType
defaultValue.setString("");
s_pContentType = new OpcUa::BaseDataVariableType(UaNodeId(kId_AttributeType_ContentType, nsTypeIdx), "ContentType", k::NodeManagerkopplung::getTypeNamespace(), defaultValue, 3, pTypeNodeConfig);
s_pContentType->setModellingRuleId(OpcUaId_ModellingRule_Mandatory);
addStatus = pTypeNodeConfig->addNodeAndReference(pObjectType, s_pContentType, OpcUaId_HasComponent);
UA_ASSERT(addStatus.isGood());
// Optional variable DeliveryMode
defaultValue.setString("");
s_pDeliveryMode = new OpcUa::BaseDataVariableType(UaNodeId(kId_AttributeType_DeliveryMode, nsTypeIdx), "DeliveryMode", k::NodeManagerkopplung::getTypeNamespace(), defaultValue, 3, pTypeNodeConfig);
s_pDeliveryMode->setModellingRuleId(OpcUaId_ModellingRule_Optional);
addStatus = pTypeNodeConfig->addNodeAndReference(pObjectType, s_pDeliveryMode, OpcUaId_HasComponent);
UA_ASSERT(addStatus.isGood());
// Mandatory variable Exchange
defaultValue.setInt32((OpcUa_Int32) k::ExchangeType_Direct);
s_pExchange = new OpcUa::BaseDataVariableType(UaNodeId(kId_AttributeType_Exchange, nsTypeIdx), "Exchange", k::NodeManagerkopplung::getTypeNamespace(), defaultValue, 3, pTypeNodeConfig);
s_pExchange->setDataType(UaNodeId(kId_ExchangeType, k::NodeManagerkopplung::getTypeNamespace()));
s_pExchange->setModellingRuleId(OpcUaId_ModellingRule_Mandatory);
addStatus = pTypeNodeConfig->addNodeAndReference(pObjectType, s_pExchange, OpcUaId_HasComponent);
UA_ASSERT(addStatus.isGood());
// Optional variable ExpirationPeriod
defaultValue.setString("");
s_pExpirationPeriod = new OpcUa::BaseDataVariableType(UaNodeId(kId_AttributeType_ExpirationPeriod, nsTypeIdx), "ExpirationPeriod", k::NodeManagerkopplung::getTypeNamespace(), defaultValue, 3, pTypeNodeConfig);
s_pExpirationPeriod->setModellingRuleId(OpcUaId_ModellingRule_Optional);
addStatus = pTypeNodeConfig->addNodeAndReference(pObjectType, s_pExpirationPeriod, OpcUaId_HasComponent);
UA_ASSERT(addStatus.isGood());
// Optional variable MessagePriority
defaultValue.setString("");
s_pMessagePriority = new OpcUa::BaseDataVariableType(UaNodeId(kId_AttributeType_MessagePriority, nsTypeIdx), "MessagePriority", k::NodeManagerkopplung::getTypeNamespace(), defaultValue, 3, pTypeNodeConfig);
s_pMessagePriority->setModellingRuleId(OpcUaId_ModellingRule_Optional);
addStatus = pTypeNodeConfig->addNodeAndReference(pObjectType, s_pMessagePriority, OpcUaId_HasComponent);
UA_ASSERT(addStatus.isGood());
// Optional variable MessagePublishTimestamp
defaultValue.setString("");
s_pMessagePublishTimestamp = new OpcUa::BaseDataVariableType(UaNodeId(kId_AttributeType_MessagePublishTimestamp, nsTypeIdx), "MessagePublishTimestamp", k::NodeManagerkopplung::getTypeNamespace(), defaultValue, 3, pTypeNodeConfig);
s_pMessagePublishTimestamp->setModellingRuleId(OpcUaId_ModellingRule_Optional);
addStatus = pTypeNodeConfig->addNodeAndReference(pObjectType, s_pMessagePublishTimestamp, OpcUaId_HasComponent);
UA_ASSERT(addStatus.isGood());
// Mandatory variable PublisherApplicationID
defaultValue.setString("");
s_pPublisherApplicationID = new OpcUa::BaseDataVariableType(UaNodeId(kId_AttributeType_PublisherApplicationID, nsTypeIdx), "PublisherApplicationID", k::NodeManagerkopplung::getTypeNamespace(), defaultValue, 3, pTypeNodeConfig);
s_pPublisherApplicationID->setModellingRuleId(OpcUaId_ModellingRule_Mandatory);
addStatus = pTypeNodeConfig->addNodeAndReference(pObjectType, s_pPublisherApplicationID, OpcUaId_HasComponent);
UA_ASSERT(addStatus.isGood());
// Optional variable RoutingKey
defaultValue.setString("");
s_pRoutingKey = new OpcUa::BaseDataVariableType(UaNodeId(kId_AttributeType_RoutingKey, nsTypeIdx), "RoutingKey", k::NodeManagerkopplung::getTypeNamespace(), defaultValue, 3, pTypeNodeConfig);
s_pRoutingKey->setModellingRuleId(OpcUaId_ModellingRule_Optional);
addStatus = pTypeNodeConfig->addNodeAndReference(pObjectType, s_pRoutingKey, OpcUaId_HasComponent);
UA_ASSERT(addStatus.isGood());
}
}
- Support Team
- Hero Member
- Posts: 3072
- Joined: 18 Mar 2011, 15:09
Re: FileDirectoryType
You get the same error, but the reason is not the same.
There have been additional unexpected references to other instance declaration nodes in the model you sent to us last week. Did you remove these references? The generated NodeManager that we created with your model can be loaded without an error.
There have been additional unexpected references to other instance declaration nodes in the model you sent to us last week. Did you remove these references? The generated NodeManager that we created with your model can be loaded without an error.
Best regards
Unified Automation Support Team
Unified Automation Support Team