using MMCE_Test; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using static MMCE_Test.NMCSDKLib; namespace SHARP_CLAS_UI { public class Slave { #region Property public ushort Board_Id { get; private set; } public ushort Device_Id { get; private set; } public EcState Slave_State { get; private set; } #endregion #region Construct public Slave(ushort Board_Id, ushort Device_Id) { this.Board_Id = Board_Id; this.Device_Id = Device_Id; } #endregion #region Function public bool Get_State(out EcState State) { try { byte data = 0; MC_STATUS mc; mc = SlaveGetCurState(Board_Id, Device_Id, ref data); if (mc == MC_STATUS.MC_OK) { Slave_State = (EcState)data; State = (EcState)data; return true; } else { throw new Exception($"Error : {mc}"); } } catch (Exception ex) { State = EcState.eST_UNKNOWN; return false; } } #endregion } }