/// <summary> /// 設置蜂鳴器狀態 /// </summary> /// <param name="lightStatus">燈狀態值</param> /// <returns>是否設置成功</returns> public abstract bool SetBuzzerStatus(EnmBuzzerStatus buzzerStatus);
public override bool SetBuzzerStatus(EnmBuzzerStatus buzzerStatus) { if (!CheckPLCStatus()) { return false; } Thread.Sleep(500); lock (m_objSyncRoot) { try { return this.m_ZWorldPLC.PLC_Set_Y((uint)GetBuzzerStatusIntVal(buzzerStatus), (uint)EnmZWorldLightType.Caution); } catch (Exception ex) { base.OnException(mc_strClassName, "SetBuzzerStatus", ex); return false; } } }
/// <summary> /// 獲取蜂鳴器的狀態枚舉整型值 /// </summary> /// <param name="status"></param> /// <returns></returns> public abstract int GetBuzzerStatusIntVal(EnmBuzzerStatus status);
public override int GetBuzzerStatusIntVal(EnmBuzzerStatus status) { switch (status) { case EnmBuzzerStatus.OFF: return 0; case EnmBuzzerStatus.ON: return 1; case EnmBuzzerStatus.Blink: return 10; case EnmBuzzerStatus.Error: return 255; default: return 255; } }