Exemple #1
0
        public Database(string typeName, string server, string name, string connectionString)
        {
            this.typeName = typeName;
            this.server = server;
            this.name = name;
            this.connectionString = connectionString;
            connection = new OdbcConnection(this.connectionString);

            _tables = new Tables(this);
            _views = new Views(this);
            _sequences = new Sequences(this);
            _storedprocedures = new StoredProcedures(this);
            _functions = new Functions(this);
            _modules = new Modules(this);
            _mqts = new MQTS(this);
        }
	// Update is called once per frame
	void Update () {


		/*if( Input.GetKeyDown(KeyCode.Space))
		{
			Debug.Log (sequences.ToString());
			NextSequence(SequencePhase);
			Debug.Log (sequences.ToString());
			
		}*/

		currentSequence = CurrentSequence;
		sequences = (Sequences)CurrentSequence;

	
	}
    static public bool NextSequence(string tag)
    {
        if (tag == "Slapen" && sequences.ToString() == "Slapen")
        {
            CurrentSequence = 0;
            sequences = Sequences.Opstaan;
            int levelToLoad = Application.loadedLevel + 1;
            Application.LoadLevel(levelToLoad);
        }
        else if(tag == "TvKijken" && sequences.ToString() == "TvKijken")
        {
            directionLight.GetComponent<DayNightTransition>().DayToNight();
        }
        if (tag == sequences.ToString())
        {
            Debug.Log(tag);
            CurrentSequence += 1;
            sequences = (Sequences)CurrentSequence;
            return true;
        }
        return false;

    }
        /// <summary>
        /// Defines a chain of RGB LEDs
        /// </summary>
        /// <param name="Chipset">The chipset used to daisychain the LEDs</param>
        /// <param name="LedCount">The amount of LEDs in the chain</param>
        /// <param name="SPI_Device">The SPI bus the chain is connected to</param>
        /// <param name="ChipSelect_Port">If there's a CS circuitry, specify it's pin</param>
        /// <param name="ChipSelect_ActiveState">If there's a CS circuitry, specify it's active state</param>
        public RgbLedStrip(Chipsets Chipset, int LedCount, SPI.SPI_module SPI_Device, Cpu.Pin ChipSelect_Port, bool ChipSelect_ActiveState)
        {
            // The used chipset
            this._Chipset = Chipset;
            
            // Stores the amount of LEDs
            this.LedCount = LedCount;

            // Extends the arrays for the LED states and brightness
            this._LedState = new byte[LedCount * 3];
            this._Brightness = new byte[LedCount];

            // Settings for the LPD8806 chip
            if (Chipset == Chipsets.LPD8806)
            {
                // Creates a new buffer (final 3 bytes should always be 0 and tells the chain we're done for now)
                this._Buffer = new byte[LedCount * 3 + 3];

                // Default sequence of the Adafruit strips
                this.Sequence = Sequences.GRB;
            }

            // Settings for the WS2801 chip
            if (Chipset == Chipsets.WS2801)
            {
                // Creates a new buffer
                this._Buffer = new byte[LedCount * 3];

                // Default sequence of the Adafruit chains
                this.Sequence = Sequences.RGB;
            }

            // Configures the SPI bus
            this._Conn = new MultiSPI(new SPI.Configuration(
                ChipSelect_Port: ChipSelect_Port,
                ChipSelect_ActiveState: ChipSelect_ActiveState,
                ChipSelect_SetupTime: 0,
                ChipSelect_HoldTime: 0,
                Clock_IdleState: false,
                Clock_Edge: true,
                Clock_RateKHz: 1000,
                SPI_mod: SPI_Device
            ));

            // Set brightness only half way, most LED strips are just way too bright imho
            this.SetBrightnessAll(128);
            // Turns off all LEDs
            this.SetColorAll(0);
            // Writes for the first time
            this.Write();
        }
Exemple #5
0
        /// <summary>
        /// 測定状態の変更イベント
        /// </summary>
        /// <param name="status"></param>
        void testSquence_StatusChanged(Sequences.TestSequence.TestStatusType status)
        {
            if (this.InvokeRequired)
            {
                this.Invoke((MethodInvoker) delegate{ testSquence_StatusChanged(status); });
                return;
            }

            switch (status)
            {
                case Sequences.TestSequence.TestStatusType.Run:

                    controllerForm.SetMeasureStatus(frmMeasureController.MeasureStatus.Start);

                    bAllReadyStart = true;

                    this.measureTask.Start();

                    this.swMeasure.Reset();
                    this.swMeasure.Start();
                    ShowStatusMessage(AppResource.GetString("TXT_MEASURE_START"));

                    break;
                case Sequences.TestSequence.TestStatusType.Pause:
                    controllerForm.SetMeasureStatus(frmMeasureController.MeasureStatus.Stop);

                    //for (int i = 0; i < this.graph2DList.Length; i++)
                    //{
                    //    if (this.graph2DList[i] != null)
                    //    {
                    //        this.graph2DList[i].IsRealTime = false;
                    //    }
                    //}

                    this.swMeasure.Stop();

                    ShowStatusMessage(AppResource.GetString("MSG_MEAS_STOP_TEST"));

                    this.measureTask.Pause();

                    break;
                case Sequences.TestSequence.TestStatusType.Stop:
                    controllerForm.SetMeasureStatus(frmMeasureController.MeasureStatus.Exit);

                    ShowStatusMessage(AppResource.GetString("MSG_MEAS_END"));
                    try
                    {
                        this.controllerForm.Enabled = false;
                        this.graphControllerForm.Enabled = false;
                        this.Enabled = false;

                        RealTimeData.EndData();
                        this.measureTask.Pause();

                        bool bret = true;

                        //データが一つでも受信されていればデータ保存する。
                        if (RealTimeData.receiveCount != 0)
                        {
                            ShowStatusMessage(AppResource.GetString("MSG_MEAS_SAVE_FILES"));
                            // 測定設定ファイル群及びデータファイルを保存する
                            bret = SaveMeasureFiles();
                        }

                        if (bret)
                            testSquence.ExitTest();
                        else
                        {
                            //画面終了しない。再開があるため。
                            return;
                        }

                        //測定完了フラグオン
                        bMeasureClosed = true;
                    }
                    finally
                    {
                        this.controllerForm.Enabled = true;
                        this.graphControllerForm.Enabled = true;
                        this.Enabled = true;

                    }

                    //画面終了
                    if (this.InvokeRequired)
                        this.Invoke((MethodInvoker)delegate() { this.Close(); });
                    else
                        this.Close();

                    break;

                //緊急停止
                case Sequences.TestSequence.TestStatusType.EmergencyStop:

                    System.Threading.Tasks.Task task =
                        new System.Threading.Tasks.Task(
                            delegate
                            {
                                this.measureTask.Stop();
                                //測定を停止する。
                                testSquence.EndTest();
                            });

                    task.Start();

                    MessageBox.Show(AppResource.GetString("MSG_MEAS_EMERGENCY_STOP"), AppResource.GetString("TXT_MEASUREMENT"), MessageBoxButtons.OK, MessageBoxIcon.Stop);

                    break;
            }
        }
Exemple #6
0
 public void reset()
 {
     _tables = new Tables(this);
     _views = new Views(this);
     _sequences = new Sequences(this);
     _storedprocedures = new StoredProcedures(this);
     _functions = new Functions(this);
     _modules = new Modules(this);
     _mqts = new MQTS(this);
 }
Exemple #7
0
 public void TrySquence(Sequences seq, int lenMS, int timoutMS)
 {
     if (Seq == null)
     {
         Seq = new Sequence(seq, lenMS, timoutMS);
         return;
     }
     if (!Seq.Running)
     {
         Seq = new Sequence(seq, lenMS, timoutMS);
     }
 }