示例#1
0
        private static string CreatePropertyType(string value, AdminShellV20.Reference valueId)
        {
            UAObject prop = new UAObject();

            prop.NodeId     = "ns=1;i=" + masterID.ToString();
            prop.BrowseName = "1:Property";
            masterID++;
            List <Reference> refs = new List <Reference>();

            refs.Add(CreateHasTypeDefinition("1:AASPropertyType"));
            refs.Add(
                CreateReference(
                    "HasProperty",
                    CreateProperty(value, "1:AASPropertyType", "Value", "String"))); //DataType: Man weiss es nicht
            if (valueId != null)
            {
                refs.Add(
                    CreateReference(
                        "HasProperty",
                        CreateProperty(valueId.ToString(), "1:AASReferenceType", "ValueId", "String")));
            }
            prop.References = refs.ToArray();
            root.Add((UANode)prop);
            return(prop.NodeId);
        }
示例#2
0
        private static string CreateAASQualifier(string type, string value, AdminShellV20.Reference valueId)
        {
            UAObject qual = new UAObject();

            qual.NodeId     = "ns=1;i=" + masterID.ToString();
            qual.BrowseName = "1:Qualifier";
            masterID++;
            List <Reference> refs = new List <Reference>();

            //map Qualifier Data
            refs.Add(CreateHasTypeDefinition("1:AASQualifierType"));
            refs.Add(
                CreateReference("HasProperty", CreateProperty(type, "1:AASPropertyType", "QualifierType", "String")));
            refs.Add(
                CreateReference(
                    "HasProperty", CreateProperty(value, "1:AASPropertyType", "QualifierValue", "String")));
            if (valueId != null)
            {
                foreach (AdminShellV20.Key key in valueId.Keys)
                {
                    refs.Add(
                        CreateReference(
                            "HasComponent", CreateKey(key.idType, key.local.ToString(), key.type, key.value)));
                }
            }

            qual.References = refs.ToArray();
            root.Add((UANode)qual);
            return(qual.NodeId);
        }
示例#3
0
        private static string CreateReference(AdminShellV20.Reference _ref)
        {
            UAObject obj = new UAObject();

            obj.NodeId     = "ns=1;i=" + masterID.ToString();
            obj.BrowseName = "1:Reference";
            masterID++;
            List <Reference> refs = new List <Reference>();

            refs.Add(CreateHasTypeDefinition("1:AASReferenceType"));

            if (_ref != null)
            {
                foreach (AdminShellV20.Key key in _ref.Keys)
                {
                    refs.Add(
                        CreateReference(
                            "HasComponent", CreateKey(key.idType, key.local.ToString(), key.type, key.value)));
                }
            }

            obj.References = refs.ToArray();
            root.Add((UANode)obj);
            return(obj.NodeId);
        }
        private static AdminShellV20.Reference createReference(UANode node)
        {
            //Reference (node)
            //  -> Key (multiple)

            List <Key> keys = new List <Key>();

            keys = addSemanticID(node);
            AdminShellV20.Reference refe = AdminShellV20.Reference.CreateNew(keys);
            return(refe);
        }
        private static AdminShellV20.Reference createReference(string val)
        {
            //Refereces are saved as Strings: [type,local,idtype,value]


            AdminShellV20.Reference reference = new AdminShellV20.Reference();
            //convert String to an actual Reference
            var mep = val.Split(',');

            if (mep.Length == 4)
            {
                string type   = mep[0].Trim().TrimStart('[');
                bool   local  = (mep[1].Trim() == "not Local") ? false : true;
                string idType = mep[2].Trim();
                string value  = mep[3].Trim().TrimEnd(']');
                reference = AdminShellV20.Reference.CreateNew(type, local, idType, value);
            }
            return(reference);
        }