Пример #1
0
        private void OnRequestCompleted(ActionCompletedUnit tu)
        {
            OnOperationCompletedBefore(tu);
            RequestDataExOperation op = new RequestDataExOperation(0, NodeId, Data, TxOptions, TxSecOptions, SecurityScheme, TxOptions2, CmdClass, Cmd, TimeoutMs);

            OnOperationCompletedAfter(tu, requestCompleted, op);
        }
Пример #2
0
        protected override void CreateInstance()
        {
            sendFirst = new SendDataExOperation(NodeId, Data, TxOptions, TxSecOptions, SecurityScheme, TxOptions2);
            sendFirst.SubstituteSettings = SubstituteSettings;
            sendCompleted = new ActionCompletedUnit(sendFirst, OnSendCompleted);

            requestFirst = new RequestDataExOperation(0, NodeId, Data, TxOptions, TxSecOptions, SecurityScheme, TxOptions2, CmdClass, Cmd, TimeoutMs);
            requestFirst.SubstituteSettings = SubstituteSettings;
            requestCompleted = new ActionCompletedUnit(requestFirst, OnRequestCompleted);
        }
Пример #3
0
        public RequestNodeInfoSecureTask(SecurityManagerInfo securityManagerInfo, RequestNodeInfoOperation action, bool isInclusionTask)
        {
            _allowFailed         = true;
            _securityManagerInfo = securityManagerInfo;
            _nodeInfo            = action;
            _isInclusionTask     = isInclusionTask;

            var tm = CMD_SUPPORTED;

            if (securityManagerInfo.Network.IsFlirs(_nodeInfo.NodeId)) //skip only for ENTRY
            {
                tm = CMD_SUPPORTED_FLIRS;
            }

            _delayBeforeStart = new DelayOperation(START_DELAY);

            _supportedS0 = new RequestDataExOperation(0, 0,
                                                      new COMMAND_CLASS_SECURITY.SECURITY_COMMANDS_SUPPORTED_GET(), _txOptions,
                                                      TransmitSecurityOptions.S2_TXOPTION_VERIFY_DELIVERY, SecuritySchemes.S0, TransmitOptions2.NONE,
                                                      COMMAND_CLASS_SECURITY.ID, COMMAND_CLASS_SECURITY.SECURITY_COMMANDS_SUPPORTED_REPORT.ID, tm);

            _supportedS2_ACCESS = new RequestDataExOperation(0, 0,
                                                             new COMMAND_CLASS_SECURITY_2.SECURITY_2_COMMANDS_SUPPORTED_GET(), _txOptions,
                                                             TransmitSecurityOptions.S2_TXOPTION_VERIFY_DELIVERY, SecuritySchemes.S2_ACCESS, TransmitOptions2.NONE,
                                                             COMMAND_CLASS_SECURITY_2.ID, COMMAND_CLASS_SECURITY_2.SECURITY_2_COMMANDS_SUPPORTED_REPORT.ID, tm);

            _supportedS2_AUTHENTICATED = new RequestDataExOperation(0, 0,
                                                                    new COMMAND_CLASS_SECURITY_2.SECURITY_2_COMMANDS_SUPPORTED_GET(), _txOptions,
                                                                    TransmitSecurityOptions.S2_TXOPTION_VERIFY_DELIVERY, SecuritySchemes.S2_AUTHENTICATED, TransmitOptions2.NONE,
                                                                    COMMAND_CLASS_SECURITY_2.ID, COMMAND_CLASS_SECURITY_2.SECURITY_2_COMMANDS_SUPPORTED_REPORT.ID, tm);

            _supportedS2_UNAUTHENTICATED = new RequestDataExOperation(0, 0,
                                                                      new COMMAND_CLASS_SECURITY_2.SECURITY_2_COMMANDS_SUPPORTED_GET(), _txOptions,
                                                                      TransmitSecurityOptions.S2_TXOPTION_VERIFY_DELIVERY, SecuritySchemes.S2_UNAUTHENTICATED, TransmitOptions2.NONE,
                                                                      COMMAND_CLASS_SECURITY_2.ID, COMMAND_CLASS_SECURITY_2.SECURITY_2_COMMANDS_SUPPORTED_REPORT.ID, tm);

            List <ActionBase> list = new List <ActionBase>();

            list.Add(_delayBeforeStart);
            list.Add(_nodeInfo);
            if (_securityManagerInfo.Network.HasSecurityScheme(SecuritySchemeSet.ALLS2))
            {
                if (_securityManagerInfo.Network.IsSecuritySchemesSpecified(_nodeInfo.NodeId))
                {
                    if (_securityManagerInfo.Network.HasSecurityScheme(SecuritySchemes.S2_ACCESS))
                    {
                        if (!_isInclusionTask || _securityManagerInfo.Network.HasSecurityScheme(_nodeInfo.NodeId, SecuritySchemes.S2_ACCESS))
                        {
                            list.Add(_supportedS2_ACCESS);
                        }
                    }
                    if (_securityManagerInfo.Network.HasSecurityScheme(SecuritySchemes.S2_AUTHENTICATED))
                    {
                        if (!_isInclusionTask || _securityManagerInfo.Network.HasSecurityScheme(_nodeInfo.NodeId, SecuritySchemes.S2_AUTHENTICATED))
                        {
                            list.Add(_supportedS2_AUTHENTICATED);
                        }
                    }
                    if (_securityManagerInfo.Network.HasSecurityScheme(SecuritySchemes.S2_UNAUTHENTICATED))
                    {
                        if (!_isInclusionTask || _securityManagerInfo.Network.HasSecurityScheme(_nodeInfo.NodeId, SecuritySchemes.S2_UNAUTHENTICATED))
                        {
                            list.Add(_supportedS2_UNAUTHENTICATED);
                        }
                    }
                    if (_securityManagerInfo.Network.HasSecurityScheme(SecuritySchemes.S0))
                    {
                        if (!_isInclusionTask || _securityManagerInfo.Network.HasSecurityScheme(_nodeInfo.NodeId, SecuritySchemes.S0))
                        {
                            if (!list.Contains(_supportedS0))
                            {
                                list.Add(_supportedS0);
                            }
                        }
                    }
                }
                else
                {
                    if (_securityManagerInfo.Network.HasSecurityScheme(SecuritySchemes.S2_ACCESS))
                    {
                        list.Add(_supportedS2_ACCESS);
                    }
                    if (_securityManagerInfo.Network.HasSecurityScheme(SecuritySchemes.S2_AUTHENTICATED))
                    {
                        list.Add(_supportedS2_AUTHENTICATED);
                    }
                    if (_securityManagerInfo.Network.HasSecurityScheme(SecuritySchemes.S2_UNAUTHENTICATED))
                    {
                        list.Add(_supportedS2_UNAUTHENTICATED);
                    }
                }
            }
            if (_securityManagerInfo.Network.HasSecurityScheme(SecuritySchemes.S0))
            {
                if (_securityManagerInfo.Network.IsSecuritySchemesSpecified(_nodeInfo.NodeId))
                {
                    if (_securityManagerInfo.Network.HasSecurityScheme(_nodeInfo.NodeId, SecuritySchemes.S0) &&
                        !_securityManagerInfo.Network.HasSecurityScheme(_nodeInfo.NodeId, SecuritySchemeSet.ALLS2))
                    {
                        if (!list.Contains(_supportedS0))
                        {
                            list.Add(_supportedS0);
                        }
                    }
                }
                else
                {
                    if (!list.Contains(_supportedS0))
                    {
                        list.Add(_supportedS0);
                    }
                }
            }

            Actions = list.ToArray();
        }