Esempio n. 1
0
        private void RoofBehaviorEmulation_Check()
        {
            //if roof is moving
            if (RoofStatus == ShutterStatus.shutterOpening || RoofStatus == ShutterStatus.shutterClosing)
            {
                TimeSpan passed = DateTime.Now - RoofMoving_start;

                //if move time exceeded
                if (passed.TotalSeconds > MOVING_TIME)
                {
                    //set move time to null
                    RoofMoving_start = DateTime.MinValue;

                    //change status
                    if (RoofStatus == ShutterStatus.shutterOpening)
                    {
                        RoofStatus = ShutterStatus.shutterOpen;
                        InputState[CLOSED_PORT] = 1; //inverse logic
                        InputState[OPENED_PORT] = 0; //inverse logic
                    }

                    if (RoofStatus == ShutterStatus.shutterClosing)
                    {
                        RoofStatus = ShutterStatus.shutterClosed;
                        InputState[CLOSED_PORT] = 0; //inverse logic
                        InputState[OPENED_PORT] = 1; //inverse logic
                    }
                }
            }
        }
Esempio n. 2
0
        public Vedrus_dome_emul()
        {
            //init device
            InputState.Add("1", 0);
            InputState.Add("2", 0);
            InputState.Add("3", 0);
            InputState.Add("4", 0);
            InputState.Add("5", 1);
            InputState.Add("6", 1);
            InputState.Add("7", 1);
            InputState.Add("8", 1);

            OutputState.Add("1", 1);
            OutputState.Add("2", 1);
            OutputState.Add("3", 1);
            OutputState.Add("4", 1);
            OutputState.Add("5", 1);
            OutputState.Add("6", 1);
            OutputState.Add("7", 1);
            OutputState.Add("8", 1);


            InputState[OPENED_PORT] = 1; //inverse logic
            InputState[CLOSED_PORT] = 0; //inverse logic
            RoofStatus = ShutterStatus.shutterClosed;

            RoofMoving_start = DateTime.MinValue;
        }
Esempio n. 3
0
        /// <summary>
        ///     Creates an instance of a shutter status from the notification string received from the NexDome
        ///     hardware.
        /// </summary>
        /// <param name="status">The status string received from the controller hardware.</param>
        /// <returns>An object implementing <see cref="IShutterStatus" /> populated with the status values.</returns>
        public IShutterStatus FromShutterStatusPacket(string status)
        {
            var match           = ShutterStatusRegex.Match(status);
            var captures        = match.Groups["Values"].Captures;
            var valueCollection = captures.Cast <Capture>().Select(p => p.Value);

            return(ShutterStatus.FromValueCollection(valueCollection));
        }
Esempio n. 4
0
            /// <summary>Creates and populates a ShutterStatus instance from a collection of string values.</summary>
            /// <param name="valueCollection">
            ///     A collection of strings containing the status values that will need
            ///     to be parsed.
            /// </param>
            /// <returns>
            ///     <see cref="IShutterStatus" />
            /// </returns>
            public static IShutterStatus FromValueCollection(IEnumerable <string> valueCollection)
            {
                var values = valueCollection.ToArray();
                var status = new ShutterStatus
                {
                    Position           = int.Parse(values[0]),
                    LimitOfTravel      = int.Parse(values[1]),
                    OpenSensorActive   = values[2] == "1",
                    ClosedSensorActive = values[3] == "1"
                };

                return(status);
            }
Esempio n. 5
0
        private void RoofBehaviorEmulation_sendsignal()
        {
            if (RoofStatus == ShutterStatus.shutterClosed)
            {
                //roof was closed

                RoofMoving_start        = DateTime.Now;
                RoofStatus              = ShutterStatus.shutterOpening;
                InputState[CLOSED_PORT] = 1;
                InputState[OPENED_PORT] = 1;
            }
            else if (RoofStatus == ShutterStatus.shutterOpen)
            {
                //roof was opened
                RoofMoving_start        = DateTime.Now;
                RoofStatus              = ShutterStatus.shutterClosing;
                InputState[OPENED_PORT] = 1;
                InputState[CLOSED_PORT] = 1;
            }
        }