public ServerUnit(GlobalDataSet globalDataSet) { this.globalDataSet = globalDataSet; // ENC28J60 dataPackage = new byte[this.globalDataSet.MAX_MOTOR_AMOUNT * 5]; // RASPBERRY PI //dataPackage = new byte[this.globalDataSet.MAX_MOTOR_AMOUNT][]; //// Set event for new available packaged data //dataPackager.newPackageEvent += new DataPackager.DataPackagedEventHandler(dataPackageReceived); // Initialize data array with default values // ENC28J60 for (int j = 0; j < (this.globalDataSet.MAX_MOTOR_AMOUNT * 5); j++) { dataPackage[j] = 0; } // RASPERRY PI //for (int i = 0; i < this.globalDataSet.MAX_MOTOR_AMOUNT; i++) //{ // dataPackage[i] = new byte[8]; // for (int j = 0; j < this.globalDataSet.MAX_DATAPACKAGE_ELEMENTS; j++) dataPackage[i][j] = 0; //} }
public FormRobotControl() { InitializeComponent(); // Definition globalDataSet = new GlobalDataSet(); helperFunctions = new HelperFunctions(globalDataSet); dataPackager = new DataPackager(globalDataSet); tcpServer = new ServerUnit(globalDataSet); // Initialize sampleStep = DEFAULT_SAMPLE_TIME_FACTOR; aliveBit = false; notExecuted = true; // User defines globalDataSet.DebugMode = false; globalDataSet.ShowProgramDuration = false; // Set event that is fired by datapackager named newPackageEvent with method dataPackageReceived (listener: server) // Set event that is fired by server named newServerEvent with method dataPackageServerReceived (listener: dataPackager) dataPackager.newPackageEvent += new DataPackager.DataPackagedEventHandler(tcpServer.dataPackageReceived); // Start server tcpServer.startServer(); // Start thread to package data (the data were packaged before the client is connected dataPackager.startPackaging(); // Check sensor alive in background indicatorLedThread = new Thread(new ThreadStart(indicatorLed)); indicatorLedThread.Start(); ActionSelector actionSelector = new ActionSelector(globalDataSet); }
public TcpIpCommunicationUnit(String pCommunicationName, GlobalDataSet globalDataSet) { this.globalDataSet = globalDataSet; this.communicationName = pCommunicationName; this.configfilename = pCommunicationName + "_NetworkConfig.xml"; this.loadNetworkConfiguration(); this.tunnelingMessage += new MessageTunnelingHandler(tcpDiagnoseServer_tunnelingMessage); }
public MainPage() { this.InitializeComponent(); // Initilize data errorCounterTransfer = 0; mcpExecutorCounter = 0; firstStart = true; stopSequenceIsActive = false; globalDataSet = new GlobalDataSet(); // Get things like mcp2515, logic_Mcp2515_Sender, logic_Mcp2515_Receiver //serverComm = new ServerUnit(globalDataSet); clientUnit = new ClientUnit(globalDataSet); diagnose = new Diagnose(globalDataSet); mcp2515 = globalDataSet.Mcp2515; pulses = new Pulses(); clientUnit.newEvent += new ClientUnit.myEvent(this.dataPackageReceived); // USER CONFIGURATION globalDataSet.DebugMode = false; getProgramDuration = false; // Inititalize raspberry pi and gpio init_raspberry_pi_gpio(); init_raspberry_pi_spi(); // Inititalize mcp2515 Task task_initMcp2515 = new Task(globalDataSet.init_mcp2515_task); task_initMcp2515.Start(); task_initMcp2515.Wait(); // Start executor service task_mcpExecutorService = new Task(mcpExecutorService_task); task_mcpExecutorService.Start(); // Inititalize background tasks stateTimer = new Timer(this.StateTimer, null, 0, DELTA_T_TIMER_CALLBACK); // Create timer to display the state of message transmission errorTimer = new Timer(this.ErrorTimer, null, 0, DELTA_T_ERROR_TIMER); // Create timer to display the state of message transmission // Inititalize server //Task<bool> serverStarted = serverComm.StartServer(); clientUnit.StartClient_loop(); }
/// Constructor of the ActionSelector class public ActionSelector(GlobalDataSet globalDataSet) { this.globalDataSet = globalDataSet; // Inititialize duration = new long[globalDataSet.MAX_MOTOR_AMOUNT]; for (int i = 0; i < globalDataSet.MAX_MOTOR_AMOUNT; i++) { duration[i] = 0; } // Start task to get all data from remote database Task loadDatabaseTask = Task.Factory.StartNew(() => updateLocalDatabase()); loadDatabaseTask.Wait(); // Create datasets from local db dataSetLocal = localDatabaseManager.createDatasetsForDb(localDbDescription); // Start robot control as a timer controlTimer = new Timer(this.controlRobot, null, 0, SAMPLE_TIME); //loadDatabaseThread = new Thread(controlRobot); }
public ServerUnit(GlobalDataSet globalDataSet) { this.globalDataSet = globalDataSet; }
public Diagnose(GlobalDataSet globalDataSet) { this.globalDataSet = globalDataSet; }
public ServerComm(GlobalDataSet globalDataSet) { this.globalDataSet = globalDataSet; }
public ClientUnit(GlobalDataSet globalDataSet) { this.globalDataSet = globalDataSet; }