private bool RGO_LED_ACTION(Devices.RGO_LED rgoled, Command cmd ) { // Need ability for controlled flashing of LED via a format found in cmd.Arguments switch (cmd.Action.ToLower()) { case "red": rgoled.Red(); return true; case "green": rgoled.Green(); return true; case "amber": rgoled.Amber(); return true; case "off": rgoled.Off(); return true; default: rgoled.Off(); return false; } }
/// <summary> /// Device's service therad. Takes commands recieved and determines /// which device is to execute the action included within the command. /// (future) get information about result of execution of command /// when applicable. /// </summary> private void service_Thread() { while (!iCancel) { while (iCmdToService) { Debug.Print("Command being serviced here..."); this.currentDev = getDeviceByID(this.cmdInput.DeviceID); // Determine device this.perfCmdThd.Start(); // Perform action for the device //if (this.perfCmdThd.Join(TimeOut_ms)) // get results after TimeOut_ms //{ //} iCmdToService = false; } Thread.Sleep(10); } }
private bool OUTPUT_RELAY_ACTION(Devices.OutputRelay outputrelay, Command cmd) { switch (cmd.Action.ToLower()) { case "on": outputrelay.On(); return true; case "off": outputrelay.Off(); return true; default: return false; } }