/// <summary> /// Receive data callback method /// </summary> /// <param name="clientNumber"></param> /// <param name="message"></param> /// <param name="messageSize"></param> void OnDataReceived(int clientNumber, byte[] message, int messageSize) { try { string strMessage = Encoding.Default.GetString(message).Trim('\0'); logger.Debug(strMessage); if (strMessage.IndexOf(':') > -1) { string[] command = strMessage.Split(new char[] { ':' }); int robotIndex = -1; if (command[1] != null && !string.IsNullOrEmpty(command[1])) { if (int.TryParse(command[1], out robotIndex)) { robotIndex = int.Parse(command[1]); } } logger.DebugFormat("Receive command : {0}", command[0]); switch (command[0]) { case "/motoron": MotorOn(robotIndex); break; case "/restart": Restart(robotIndex); break; case "/robotstop": Pause(robotIndex); break; case "/alarmreset": AlaramReset(robotIndex); break; case "/orderstart": robotManager.OrderStart(); break; case "/orderstop": robotManager.OrderStop(); break; case "/loopcount": LoopCount = int.Parse(command[1]); UpdateLogList(string.Format("Loop 카운트가 변경 되었습니다 = {0}", LoopCount)); SetLoopCount(LoopCount); break; } } } catch (Exception ex) { logger.Error(ex.Message); } autoEvent.Set(); }