Files
diplomarbeit/Tester/SW/designtest_control/QUA_2475_designtest/initialisation.cs
T
Matthias 7921d3bb2a added new class files
git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@102 9fe90eed-be63-e94b-8204-d34ff4c2ff93
2009-01-09 16:15:13 +00:00

165 lines
6.9 KiB
C#

/* ---------------------------------------------------------------------------
* Initialisation.cs (c) 2009 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description: This file handles all Inits, variable definitions and start
* Values of arrays.
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 08, 2009, MMi
* Creation.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* System use files
* ---------------------------------------------------------------------------
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.IO.Ports;
using System.Threading;
/* ---------------------------------------------------------------------------
* Local function definitions
* ---------------------------------------------------------------------------
*/
namespace QUA_2475_designtest
{
public partial class mainWindow
{
/* PORT DEFINITION */
private SerialPort com1 = new SerialPort(); /* Define type COM1 */
/* THREAD DEFINITION */
Thread com1GetMessage; /* COM1 Read Thread */
//Thread com6GetMessage; /* COM2 Read Thread */
Thread TestTimeoutThread; /* Test Timeout Thread */
/* INTEGER DEFINITION */
const int NrOfTests = 15; /* Indicates number of single Test */
uint actualTest = 0; /* Indicates number of actual Test */
uint TotalTestNumber = 1; /* Number of total Tests */
uint TotalPassedNumber = 1; /* Number of passed Tests */
uint TotalFailedNumber = 1; /* Number of failed Tests */
uint testcnt = 0;
/* BOOLEAN DEFINITION */
private bool Master_receiveMessages = true; /* Allow COM2 to read */
private bool activeTest = false; /* Indicates an active Test */
private bool activeAutomatictest = false; /* autoTest is active */
/* ARRAY DEFINITION */
/* Array of all available Textboxes for Tests */
public TextBox[] TestTextBoxes = new TextBox[NrOfTests];
/* Array for all single Test call commands */
public string[] TestCallCommands = new string[NrOfTests];
/* Array for absolut path and file names of Tests */
public string[] Testfiles = new string[NrOfTests];
/* Array to contain each Test Result */
public bool[] TestResult = new bool[NrOfTests];
private string MasterInputString; /* bound to T_MasterInput */
/* ENUM TYPE DEFINITION */
/* Enumeration for single Tests. With these numbers, all information
* for each test is callable. Usable e.g. as ArrayIndex for Arrays
* listed above.
*/
public enum TestType
{
MB_LED = 0,
MB_EEPROM = 1,
ETH1 = 2,
ETH0 = 3,
CF = 4,
USB = 5,
MB_DIO = 6,
MB_AIO = 7,
MB_RLY = 8,
CAN = 9,
EB_LED = 10,
EB_EEPROM = 11,
EB_DIO = 12,
EB_AIO = 13,
EB_RLY = 14
};
public void initialise()
{
com1.PortName = "COM1"; /* Bind com1 to COM1 */
com1.Open(); /* Open com1 */
com1.BaudRate = 115200; /* Set com1 Baudrate */
/* Capture corresponding Textboxes to TextBox Array */
TestTextBoxes[(int)TestType.MB_LED] = T_test_MB_LED;
TestTextBoxes[(int)TestType.MB_EEPROM] = T_test_MB_EEPROM;
TestTextBoxes[(int)TestType.ETH1] = T_test_eth1;
TestTextBoxes[(int)TestType.ETH0] = T_test_eth0;
TestTextBoxes[(int)TestType.CF] = T_test_CF;
TestTextBoxes[(int)TestType.USB] = T_test_USB;
TestTextBoxes[(int)TestType.MB_DIO] = T_test_MB_DIO;
TestTextBoxes[(int)TestType.MB_AIO] = T_test_MB_AIO;
TestTextBoxes[(int)TestType.MB_RLY] = T_test_MB_RLY;
TestTextBoxes[(int)TestType.CAN] = T_test_CAN;
TestTextBoxes[(int)TestType.EB_LED] = T_test_EB_LED;
TestTextBoxes[(int)TestType.EB_EEPROM] = T_test_EB_EEPROM;
TestTextBoxes[(int)TestType.EB_DIO] = T_test_EB_DIO;
TestTextBoxes[(int)TestType.EB_AIO] = T_test_EB_AIO;
TestTextBoxes[(int)TestType.EB_RLY] = T_test_EB_RLY;
/* Reset all Test Results */
TestResult[0] = false;
TestResult[1] = false;
TestResult[2] = false;
TestResult[3] = false;
TestResult[4] = false;
TestResult[5] = false;
TestResult[6] = false;
TestResult[7] = false;
TestResult[8] = false;
TestResult[9] = false;
TestResult[10] = false;
TestResult[11] = false;
TestResult[12] = false;
TestResult[13] = false;
TestResult[14] = false;
/* Define Commands (path and filename) for test-script calls */
TestCallCommands[0] = "ledtest 2\r";
TestCallCommands[1] = "eeprom 2\r";
TestCallCommands[2] = "\r";
TestCallCommands[3] = "\r";
TestCallCommands[4] = "\r";
TestCallCommands[5] = "\r";
TestCallCommands[6] = "dio 2\r";
TestCallCommands[7] = "\r";
TestCallCommands[8] = "\r";
TestCallCommands[9] = "\r";
TestCallCommands[10] = "\r";
TestCallCommands[11] = "\r";
TestCallCommands[12] = "\r";
TestCallCommands[13] = "\r";
TestCallCommands[14] = "\r";
/* Define and start com1 reading Thread */
com1GetMessage = new Thread(new ThreadStart(com1_DataReceived));
com1GetMessage.Start();
}
}
}