public void Initialize(ISourceController sourceController, ITrackController trackController, ITagController tagController)
        {
            this.sourceController = sourceController;
            this.trackController  = trackController;
            this.tagController    = tagController;

            treeView.ItemsSource = boundSources;

            boundSources.Add(new DeviceCatalogSource {
                Name = "Devices"
            });

            var sources = sourceController.Search(new Dictionary <string, object> {
                { "Parent", null }
            });

            if (sources != null && sources.Count() > 0)
            {
                foreach (var source in sources)
                {
                    boundSources.Add(source);
                    LoadSourceChildren(source);
                }
            }
        }
        public TrackController(IOldRepository<IOldTrack> repository, ITagController tagController)
        {
            this.repository = repository;
            this.tagController = tagController;

            //var tracks = repository.All();
            //foreach (var track in tracks)
            //{
            //    tagController.LoadPicture(track);
            //    boundTracks.Add(track);
            //}

            imageLoader.WorkerSupportsCancellation = true;
            imageLoader.DoWork += LoadTrackImages;
            imageLoader.RunWorkerCompleted += LoadTrackImagesCompleted;

            if (!System.IO.Directory.Exists(cachePath))
            {
                System.IO.Directory.CreateDirectory(cachePath);
            }
            else
            {
                LoadCachedFiles();
            }
        }
        public void Initialize(ILogger logger, ISecurityContext securityContext, IMediaFactory mediaFactory, IMetadataController mediaItemController, ITaskController taskController, ITagController tagController, IVideoPlayer videoPlayer)
        {
            if (logger == null)
                throw new ArgumentNullException("logger");
            if (securityContext == null)
                throw new ArgumentNullException("securityContext");
            if (mediaFactory == null)
                throw new ArgumentNullException("mediaFactory");
            if (mediaItemController == null)
                throw new ArgumentNullException("mediaItemController");
            if (taskController == null)
                throw new ArgumentNullException("taskController");
            if (tagController == null)
                throw new ArgumentNullException("tagController");
            if (videoPlayer == null)
                throw new ArgumentNullException("videoPlayer");

            this.logger = logger;
            this.securityContext = securityContext;
            this.mediaFactory = mediaFactory;
            this.taskController = taskController;
            this.mediaItemController = mediaItemController;
            this.tagController = tagController;
            this.videoPlayer = videoPlayer;
        }
Exemple #4
0
        public TrackController(IOldRepository <IOldTrack> repository, ITagController tagController)
        {
            this.repository    = repository;
            this.tagController = tagController;

            //var tracks = repository.All();
            //foreach (var track in tracks)
            //{
            //    tagController.LoadPicture(track);
            //    boundTracks.Add(track);
            //}

            imageLoader.WorkerSupportsCancellation = true;
            imageLoader.DoWork             += LoadTrackImages;
            imageLoader.RunWorkerCompleted += LoadTrackImagesCompleted;

            if (!System.IO.Directory.Exists(cachePath))
            {
                System.IO.Directory.CreateDirectory(cachePath);
            }
            else
            {
                LoadCachedFiles();
            }
        }
        /// <summary>
        /// Creates a new <see cref="Controller"/> instance.
        /// </summary>
        /// <param name="tagController">The tag controller used by the created controller.</param>
        /// <param name="controllerTag">The tag, the new controller is dependend on.</param>
        /// <param name="userDefinedInterfaces">User defined interfaces</param>
        /// <param name="tagListener">A tag listener instance</param>
        /// <returns>A new <see cref="Controller"/> instance.</returns>
        public Controller Create(
            ITagController tagController,
            IControllerTag controllerTag,
            IList <string> userDefinedInterfaces,
            ITagListener tagListener)
        {
            var controller = Create(tagController, controllerTag, tagListener);

            if (userDefinedInterfaces != null)
            {
                tagListener.AddUdtHandler <Command>(CmdList.PlcArrayDataType());

                foreach (var userDefinedInterface in userDefinedInterfaces.Where(value => !string.IsNullOrWhiteSpace(value)))
                {
                    var path = TagName.SpecificInterface(parent: null).AppendTagName(userDefinedInterface);

                    var userDefinedInterfaceTags = ChildTagsFromPath(controllerTag, path);
                    controller.AddUserDefinedInterface(path, userDefinedInterfaceTags);

                    // create the commands
                    foreach (var userDefinedInterfaceTag in userDefinedInterfaceTags)
                    {
                        var commands = CreateCommands(controllerTag, controller, userDefinedInterfaceTag, tagListener);
                        controller.UpdateUserDefinedCommands(userDefinedInterfaceTag.NestedName, commands.ToList());
                    }
                }
            }

            return(controller);
        }
 public RootController(
     ITagController tagController,
     IControllerTag controllerTag)
     : base(tagController, controllerTag)
 {
     _autoModeCommand = new SetAll2AutoModeCommand(this);
 }
 private Controller CreateControllerInstance(ITagController tagController, IControllerTag controllerTag)
 {
     if (controllerTag.GetParentControllerId() == NoControllerId)
     {
         return(new RootController(tagController, controllerTag));
     }
     return(new Controller(tagController, controllerTag));
 }
        public DataChannelWriter(ITagListener tagListener, ITagController tagController)
        {
            _tagListener   = tagListener;
            _tagController = tagController;

            PollingRate = DefaultPollingRate;
            Timeout     = DefaultTimeout;
        }
Exemple #9
0
 public void AddTagController(ITagController tagController)
 {
     if (tagController != null)
     {
         ((SimulatedTagController)tagController).TagWrittenEvent += OnTagControllerTagWritten;
         _tagControllers.Add(tagController);
     }
 }
Exemple #10
0
        public void Initialize(ITrackController trackController, ITagController tagController, PlaybackView playbackView, MediaPropertyView mediaPropertyView)
        {
            this.trackController   = trackController;
            this.tagController     = tagController;
            this.playbackView      = playbackView;
            this.mediaPropertyView = mediaPropertyView;

            mediaList.ItemsSource = trackController.Tracks;
        }
Exemple #11
0
        public void SetUp()
        {
            var logger = new Log4NetLogger();

            _tagController = new BeckhoffTagController(Global.AdsAddress, Global.AdsPort, logger);
            _tagListener   = new BeckhoffPollingTagListener(Global.AdsAddress, Global.AdsPort, new GlobalLock(), logger);

            _tagController.StartConnection();
            _tagListener.StartListening();
        }
Exemple #12
0
 public BeckhoffOnlineControllerTreeImporter(ITagImporter tagImporter)
 {
     _twinCatClient      = new TwinCatClientWrapper();
     _tagController      = new BeckhoffTagController();
     _tagListener        = new BeckhoffPollingTagListener();
     _alarmsImporter     = new BeckhoffOnlineAlarmsImporter();
     _findControllerTags = new ControllerTagFinder(tagImporter, new Log4NetLogger());
     _createController   = new ControllerFactory();
     _logger             = new Log4NetLogger();
     _controllerTree     = new ControllerTree();
 }
        public void SetUp()
        {
            _logger        = new Log4NetLogger();
            _tagController = new BeckhoffTagController(Global.AdsAddress, Global.AdsPort, _logger);
            _tagListener   = new BeckhoffPollingTagListener(Global.AdsAddress, Global.AdsPort, new GlobalLock(), _logger);

            _tagController.StartConnection();
            _tagListener.StartListening();

            _tagImporter = new BeckhoffOnlineTagImporter(_logger);
            _tagImporter.Initialize(Global.AdsAddress, Global.AdsPort);
        }
        public void SetUp()
        {
            _tagController  = new BeckhoffTagController(Global.AdsAddress, Global.AdsPort);
            _tagListener    = new BeckhoffPollingTagListener(Global.AdsAddress, Global.AdsPort, new GlobalLock());
            _alarmsImporter = new BeckhoffOnlineAlarmsImporter(Global.AdsAddress, Global.AdsPort, new GlobalLock());
            _alarmsImporter.Initialize(_tagListener);

            _tagController.StartConnection();
            _tagListener.StartListening();

            // prepare test by clear out all alarms
            _tagController.WriteTag(WriteTags.GlobalAlarmsCommandTag, WriteTags.ClearAllAlarmsCommand).Wait();
            Thread.Sleep(500);
        }
        /// <summary>
        /// Creates a new <see cref="Controller"/> instance.
        /// </summary>
        /// <param name="tagController">The tag controller used by the created controller.</param>
        /// <param name="controllerTag">The tag, the new controller is dependend on.</param>
        /// <param name="tagListener">A tag listener instance.</param>
        /// <returns>A new <see cref="Controller"/> instance.</returns>
        public Controller Create(ITagController tagController, IControllerTag controllerTag, ITagListener tagListener)
        {
            Controller controller = CreateControllerInstance(tagController, controllerTag);
            IEnumerable <Impl.Command> commands = CreateCommands(controllerTag, controller);

            controller.UpdateCommands(commands);
            controller.AddCommonInterfaceTags(CommonInterfaceTagsFrom(controllerTag));
            controller.AddParameters(ChildTagsFromPath(controllerTag, TagName.SpecificInterface(parent: null).Parameters()));
            controller.AddActualValues(ChildTagsFromPath(controllerTag, TagName.SpecificInterface(parent: null).ActualValues()));
            controller.AddConfigurations(ChildTagsFromPath(controllerTag, TagName.SpecificInterface(parent: null).Configurations()));
            controller.AddOutputs(ChildTagsFromPath(controllerTag, TagName.SpecificInterface(parent: null).Outputs()));
            controller.AddInputs(ChildTagsFromPath(controllerTag, TagName.SpecificInterface(parent: null).Inputs()));
            controller.AddPossibleAlarms(ReadPossibleAlarms(controllerTag, tagListener));

            return(controller);
        }
Exemple #16
0
        public void SetUp()
        {
            _tag           = new Tag("fbAGS_1.udiAlarmId", "MiddlePRG_1", "UDINT", Global.AdsPort);
            _tagController = new BeckhoffTagController(Global.AdsAddress, Global.AdsPort);
            _tagController.StartConnection();
            _tagListener = new BeckhoffPollingTagListener(Global.AdsAddress, Global.AdsPort, new GlobalLock());
            _tagListener.StartListening();

            try
            {
                _tagController.WriteTag(_tag, 0).Wait(1000);
            }
            catch (Exception e)
            {
                Assert.Fail("Cannot setup test because writing initial values to PLC failed. " + e.Message);
            }
        }
Exemple #17
0
 public BeckhoffOnlineControllerTreeImporter(
     ITwinCatClient twinCatClient,
     ITagController tagController,
     ITagListener tagListener,
     IFindControllerTags findControllerTags,
     ICreateController createController,
     IAlarmsImporter alarmsImporter,
     ILogger logger)
 {
     _twinCatClient      = twinCatClient;
     _tagController      = tagController;
     _tagListener        = tagListener;
     _alarmsImporter     = alarmsImporter;
     _findControllerTags = findControllerTags;
     _createController   = createController;
     _logger             = logger;
     _controllerTree     = new ControllerTree();
 }
Exemple #18
0
        public void GivenTagControllerCreatedOnDifferentThread_WhenDispose_ShouldNotThrow()
        {
            ITagController tagController = null;

            var thread = new Thread(() =>
            {
                tagController = new BeckhoffTagController(Global.AdsAddress, Global.AdsPort);
                tagController.StartConnection();
            });

            thread.Start();
            thread.Join();

            var action = new Action(() => tagController.Dispose());

            action.ShouldNotThrow();

            thread.Abort();
        }
Exemple #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Controller"/> class.
 /// </summary>
 public Controller(
     ITagController tagController,
     IControllerTag controllerTag)
 {
     _tagController                        = tagController;
     _controllerTag                        = controllerTag;
     _children                             = new ConcurrentBag <Controller>();
     _alarms                               = new ConcurrentDictionary <uint, Alarm>();
     _possibleAlarms                       = new ConcurrentBag <PossibleAlarm>();
     _parameters                           = new ConcurrentBag <Tag>();
     _configurations                       = new ConcurrentBag <Tag>();
     _actualValues                         = new ConcurrentBag <Tag>();
     _inputs                               = new ConcurrentBag <Tag>();
     _outputs                              = new ConcurrentBag <Tag>();
     _commonInterfaceTags                  = new ConcurrentBag <Tag>();
     _commands                             = new ConcurrentBag <Command>();
     AlarmAdded                           += () => { };
     AlarmRemoved                         += () => { };
     AlarmReplaced                        += () => { };
     CommonInformationChanged             += () => { };
     GetCommonInterfaceTag().ValueChanged += (s, e) => CommonInformationChanged();
 }
Exemple #20
0
        public void Initialize(ILogger logger, ISecurityContext securityContext, IMediaFactory mediaFactory, IMetadataController mediaItemController, ITaskController taskController, ITagController tagController, TaskResultView taskResultView)
        {
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            if (securityContext == null)
            {
                throw new ArgumentNullException("securityContext");
            }
            if (mediaFactory == null)
            {
                throw new ArgumentNullException("mediaFactory");
            }
            if (mediaItemController == null)
            {
                throw new ArgumentNullException("mediaItemController");
            }
            if (taskController == null)
            {
                throw new ArgumentNullException("taskController");
            }
            if (tagController == null)
            {
                throw new ArgumentNullException("tagController");
            }
            if (taskResultView == null)
            {
                throw new ArgumentNullException("taskResultView");
            }

            this.logger              = logger;
            this.securityContext     = securityContext;
            this.mediaFactory        = mediaFactory;
            this.mediaItemController = mediaItemController;
            this.taskController      = taskController;
            this.tagController       = tagController;
            this.taskResultView      = taskResultView;
        }
Exemple #21
0
 public DeleteChargeController(IChargeService chargeService, INoteService noteService, ITagController tagController)
 {
     _chargeService = chargeService;
     _noteService   = noteService;
     _tagController = tagController;
 }
 public void Initialize(ITrackController trackController, ITagController tagController)
 {
     this.trackController = trackController;
     this.tagController = tagController;
 }
 public SimulatedControllerTreeImporter(ITagController tagController)
 {
     _tagController  = tagController;
     _controllerTree = new ControllerTree();
 }
        public void Initialize(ISourceController sourceController, ITrackController trackController, ITagController tagController)
        {
            this.sourceController = sourceController;
            this.trackController = trackController;
            this.tagController = tagController;

            treeView.ItemsSource = boundSources;

            boundSources.Add(new DeviceCatalogSource { Name = "Devices" });

            var sources = sourceController.Search(new Dictionary<string, object> { { "Parent", null } });
            if (sources != null && sources.Count() > 0)
            {
                foreach (var source in sources)
                {
                    boundSources.Add(source);
                    LoadSourceChildren(source);
                }
            }
        }
 public DataChannelListener(ITagListener tagListener, ITagController tagController)
 {
     _tagListener   = tagListener;
     _tagController = tagController;
 }
Exemple #26
0
 public void Initialize(ITrackController trackController, ITagController tagController)
 {
     this.trackController = trackController;
     this.tagController   = tagController;
 }
Exemple #27
0
 public TagValidator(ITagController tagController)
 {
     _tagController = tagController;
 }
 public void Initialize(ITrackController trackController, ITagController tagController, PlaybackView playbackView, MediaPropertyView mediaPropertyView)
 {
     this.trackController = trackController;
     this.tagController = tagController;
     this.playbackView = playbackView;
     this.mediaPropertyView = mediaPropertyView;
     
     mediaList.ItemsSource = trackController.Tracks;
 }