예제 #1
0
        /// <summary>
        /// Execute the Command WritePin
        /// </summary>
        /// <param name="parameters">Represents the GpioPin:Uint16 which shall be written on</param>
        /// <returns>The current status of the requested pin.</returns>
        public string WritePin(UInt16 id)
        {
            GPIOinterface.activatePin(id);
            string retValue = GPIOinterface.readPin(id);

            return(retValue);
        }
예제 #2
0
        /// <summary>
        /// Execute presssing one rockerswitch
        /// </summary>
        /// <param name="rsw">expected "up" ord "down"</param>
        /// <param name="durationCategorie">expected string defined in <see cref="DurationConfig"/></param>
        /// <returns>content of rsw+(duration) </returns>
        public string PressRockerSwitch(string rsw, string durationCategorie)
        {
            if (rsw == null || durationCategorie == null)
            {
                throw new Exception("Received invalid paremeterlist");
            }

            int duration = DurationConfig.getDuration(durationCategorie);

            Debug.WriteLine("\n Execute {0} with Parameter {3} duration {1}({2}) \n", this.GetType().Name, durationCategorie, duration, rsw);

            UInt16 pushButton_Pin;

            if (rsw == "down")
            {
                pushButton_Pin = GpioMap.rockerSwitchDownPin;
            }
            else if (rsw == "up")
            {
                pushButton_Pin = GpioMap.rockerSwitchUpPin;
            }
            else
            {
                throw new Exception("Invalid Rockerswitch submitted");
            }

            GPIOinterface.activatePin(pushButton_Pin);
            Task.Delay(duration).Wait();
            GPIOinterface.deactivatePin(pushButton_Pin);

            return(rsw + "(" + duration + ")");
        }
 private void pressRockerSwitch(UInt16 pin, int ticks)
 {
     for (int i = 0; i < ticks; ++i)
     {
         GPIOinterface.activatePin(pin);
         Task.Delay(1000).Wait();
         GPIOinterface.deactivatePin(pin);
         Task.Delay(1000).Wait();
     }
 }
예제 #4
0
 /// <summary>
 /// Can be used to change the state of the (hardware) LED to a new state.
 /// Note: this method uses the instance constant "PIN_ID" to change the state
 /// => new call then e.g.LED.switchToState(ON);
 /// </summary>
 /// <param name="targetState">the state wished to change to</param>
 /// <returns>The GpioPinValue of the concerned Gpio-Pin</returns>
 private string switch_LED_ToState(uint targetState)
 {
     if (targetState == 0)
     {
         GPIOinterface.deactivatePin(GPIO_PIN_ID);
     }
     else
     {
         GPIOinterface.activatePin(GPIO_PIN_ID);
     }
     return(GPIOinterface.readPin(GPIO_PIN_ID));
 }
        /// <summary>
        ///  Executes the Command PressPushButton. For this the respective Pushbutton is activated and deactivated after
        /// a user-provided duration using the raspberry-class methods.
        /// </summary>
        /// <param name="durationCategorie">expected string defined in <see cref="DurationConfig"/> </param>
        /// <returns>The provided duration as string</returns>
        public string PressPushButton(string durationCategorie)
        {
            int duration = DurationConfig.getDuration(durationCategorie);

            Debug.WriteLine("\n Execute {0} with Parameters duration {1}({2}) \n", this.GetType().Name, durationCategorie, duration);

            GPIOinterface.activatePin(pushButton_Pin);
            Task.Delay(duration).Wait();
            GPIOinterface.deactivatePin(pushButton_Pin);

            return(duration.ToString());
        }
예제 #6
0
        /// <summary>
        /// Executes the Command EnableAudioShoe. Send signal that an audio-shoe is connected /disconnected
        /// by pulling up /down the respective pin as defined by documentation.
        /// Compare the circuit diagram for more details.
        /// </summary>
        /// <param name="value">Integer: For 1 activate audioshoe, for 0 deactivate it.</param>
        /// <returns>Current status of AudioShoe-Pin.</returns>
        public string EnableAudioShoe(int value)
        {
            if (value == 1)
            {
                GPIOinterface.activatePin(audioShoe_Pin);
            }
            else if (value == 0)
            {
                GPIOinterface.deactivatePin(audioShoe_Pin);
            }

            return(GPIOinterface.readPin(audioShoe_Pin));
        }
예제 #7
0
        /// <summary>
        /// Send signal that a tele-coil is detected or undetected by pulling up the respective pin as defined by documentation. Compare the
        /// circuit diagram for more details.
        /// </summary>
        /// <param name="value">Integer: For 1 activate the telecoil. For 0 deactivate it.</param>
        /// <returns>The current status of the teleCoil-pin.</returns>
        public string EnableTeleCoil(int value)
        {
            if (value == 1)
            {
                GPIOinterface.activatePin(teleCoil_Pin);
            }
            else if (value == 0)
            {
                GPIOinterface.deactivatePin(teleCoil_Pin);
            }

            return(GPIOinterface.readPin(teleCoil_Pin));
        }
        /// <summary>
        /// Method can be used to trigger combinations as wished. For now it activats multiple pins at the same time.
        /// Currently we use 3 buttons: rockerswitch_down, rockerswitch_up and pushbutton.
        /// </summary>
        /// <param name="pb">"PB" to activate Pushbutton otherwise NULL</param>
        /// <param name="rsu">"RSU" to activate RockerSwitchUP otherwise NULL</param>
        /// <param name="rsd">"RSD" to activate RockerSwitchDown otherwise NULL</param>
        /// <param name="durationCategorie">expected string defined in <see cref="DurationConfig"/> </param>
        /// <returns>provided duration</returns>
        public string PressCombination(string pb, string rsu, string rsd, string durationCategorie)
        {
            int duration = DurationConfig.getDuration(durationCategorie);

            Debug.WriteLine("\n Execute {0} with Parameters PB={1}, RSD={2}, RSU={3} and duration {4}({5}) \n", this.GetType().Name, pb, rsd, rsu, durationCategorie, duration);

            if (pb == null && rsd == null && rsu == null && durationCategorie == null)
            {
                throw new Exception("Invalid parameterlist received");
            }

            if (rsd == "RSD" & rsu == "RSU")
            {
                throw new Exception("Tester tried to press both rockerswitches in combination");
            }

            if (pb == "PB")
            {
                GPIOinterface.activatePin(GpioMap.pushButton_Pin);
            }

            if (rsu == "RSU" & rsd == null)
            {
                GPIOinterface.activatePin(GpioMap.rockerSwitchUpPin);
            }

            if (rsd == "RSD" & rsu == null)
            {
                GPIOinterface.activatePin(GpioMap.rockerSwitchDownPin);
            }

            Task.Delay(duration).Wait();
            GPIOinterface.deactivatePin(GpioMap.pushButton_Pin);
            GPIOinterface.deactivatePin(GpioMap.rockerSwitchDownPin);
            GPIOinterface.deactivatePin(GpioMap.rockerSwitchUpPin);

            return(duration.ToString());
        }