/// <summary>获取通道使能状态</summary> public int GetTrigChannelEnable(int channel, out bool isEnabled) { if (channel < 0 || channel >= TrigChannelCount) { throw new ArgumentOutOfRangeException("GetTrigChannelBandInputs(int channel...) failed by channel = " + channel + " is out of range 0~" + (TrigChannelCount - 1)); } isEnabled = false; lock (asyncLocker) { if (!IsDeviceOpen) { return((int)ErrorDef.NotOpen); } JFLightWithTrigWorkMode workMode = 0; if ((int)ErrorDef.Success != GetWorkMode(out workMode)) { return((int)ErrorDef.InvokeFailed); } if (workMode != JFLightWithTrigWorkMode.Trigger) //0:开关模式 1:触发模式 { return((int)ErrorDef.ModeError); } isEnabled = chnEnables[channel]; return((int)ErrorDef.Success); } }
public int GetWorkMode(out JFLightWithTrigWorkMode workMode) { workMode = JFLightWithTrigWorkMode.TurnOnOff; lock (asyncLocker) { if (!IsDeviceOpen) { return((int)ErrorDef.NotOpen); } //if (workMode == 1) //opt光源控制器: 0-〉开关模式 1-〉常规亮度的触发模式 2-〉高亮度触发模式 int modeInner = 0; int errCode = opt.ReadWorkMode(ref modeInner); if (errCode != OPTControllerAPI.OPT_SUCCEED) { return((int)ErrorDef.InvokeFailed); } if (modeInner == 0) { workMode = (int)JFLightWithTrigWorkMode.TurnOnOff; } else// if(modeInner == 2) { workMode = JFLightWithTrigWorkMode.Trigger; } return((int)ErrorDef.Success); } }
public int SetWorkMode(JFLightWithTrigWorkMode mode) { lock (asyncLocker) { if (!IsDeviceOpen) { return((int)ErrorDef.NotOpen); } int modeParam = 0; if (mode == JFLightWithTrigWorkMode.Trigger) //opt光源控制器: 0-〉开关模式 1-〉常规亮度的触发模式 2-〉高亮度触发模式 { modeParam = 2; } int modeInner = 0; int errCode = opt.ReadWorkMode(ref modeInner); errCode = opt.SetWorkMode(modeParam); if (errCode != OPTControllerAPI.OPT_SUCCEED) { return((int)ErrorDef.InvokeFailed); } return((int)ErrorDef.Success); } }
/// <summary>设置通道使能状态</summary> public int SetTrigChannelEnable(int channel, bool isEnable) { if (channel < 0 || channel >= TrigChannelCount) { throw new ArgumentOutOfRangeException("SetTrigChannelBandInputs(int channel = " + channel + " is out of range 0~" + (TrigChannelCount - 1)); } lock (asyncLocker) { if (!IsDeviceOpen) { return((int)ErrorDef.NotOpen); } JFLightWithTrigWorkMode workMode = 0; if ((int)ErrorDef.Success != GetWorkMode(out workMode)) { return((int)ErrorDef.InvokeFailed); } if (workMode != JFLightWithTrigWorkMode.Trigger) //0:开关模式 1:触发模式 { return((int)ErrorDef.ModeError); } int errCode = 0; if (isEnable) { errCode = opt.TurnOnChannel(channel + 1); } else { errCode = opt.TurnOffChannel(channel + 1); } if (errCode != OPTControllerAPI.OPT_SUCCEED) { return((int)ErrorDef.InvokeFailed); } chnEnables[channel] = isEnable; return((int)ErrorDef.Success); } }
bool[] chnEnables = null; // = new bool[16]; /// <summary>获取通道开关状态</summary> public int GetLightChannelEnable(int channel, out bool isTurnOn) { isTurnOn = false; lock (asyncLocker) { if (!IsDeviceOpen) { return((int)ErrorDef.NotOpen); } JFLightWithTrigWorkMode workMode = 0; if ((int)ErrorDef.Success != GetWorkMode(out workMode)) { return((int)ErrorDef.InvokeFailed); } if (workMode != JFLightWithTrigWorkMode.TurnOnOff) //0:开关模式 { return((int)ErrorDef.ModeError); } isTurnOn = chnEnables[channel]; return((int)ErrorDef.Success); } }
public int GetTrigChannelEnables(out bool[] isEnables) { isEnables = null; lock (asyncLocker) { if (!IsDeviceOpen) { return((int)ErrorDef.NotOpen); } JFLightWithTrigWorkMode workMode = 0; if ((int)ErrorDef.Success != GetWorkMode(out workMode)) { return((int)ErrorDef.InvokeFailed); } if (workMode != JFLightWithTrigWorkMode.Trigger) //0:开关模式 1:触发模式 { return((int)ErrorDef.ModeError); } isEnables = new bool[TrigChannelCount]; Array.Copy(chnEnables, 0, isEnables, 0, TrigChannelCount); return((int)ErrorDef.Success); } }
public int GetWorkMode(out JFLightWithTrigWorkMode workMode) { workMode = _workMode;//JFLightWithTrigWorkMode.TurnOnOff; return((int)ErrorDef.Success); }
public int SetWorkMode(JFLightWithTrigWorkMode mode) { _workMode = mode; return((int)ErrorDef.Success);//return (int)ErrorDef.Unsupported; }
public int SetTrigChannelEnables(int[] channels, bool[] isEnables) { if (null == channels || isEnables == null) { throw new ArgumentNullException("SetTrigChannelEnables(channels,isEnables) failed By: null == channels || isEnables == null"); } if (channels.Length == 0 || channels.Length != isEnables.Length) { throw new ArgumentException("SetTrigChannelEnables(channels,isEnables) failed By:channels.Length == 0 || channels.Length != isEnables.Length"); } lock (asyncLocker) { if (!IsDeviceOpen) { return((int)ErrorDef.NotOpen); } JFLightWithTrigWorkMode workMode = 0; if ((int)ErrorDef.Success != GetWorkMode(out workMode)) { return((int)ErrorDef.InvokeFailed); } if (workMode != JFLightWithTrigWorkMode.Trigger) //0:开关模式 1:触发模式 { return((int)ErrorDef.ModeError); } List <int> needEnableChannels = new List <int>(); List <int> needDisableChannels = new List <int>(); int i = 0; for (i = 0; i < channels.Count(); i++) { if (isEnables[i] != chnEnables[channels[i]]) { if (isEnables[i]) { needEnableChannels.Add(channels[i] + 1); //OPT的通道号从1开始 } else { needDisableChannels.Add(channels[i] + 1); } } } int errRet = 0; if (needEnableChannels.Count > 0) { errRet = opt.TurnOnMultiChannel(needEnableChannels.ToArray(), needEnableChannels.Count); if (errRet != OPTControllerAPI.OPT_SUCCEED) { return((int)ErrorDef.InvokeFailed); } for (i = 0; i < needEnableChannels.Count; i++) { chnEnables[needEnableChannels[i] - 1] = true; } } if (needDisableChannels.Count > 0) { errRet = opt.TurnOffMultiChannel(needDisableChannels.ToArray(), needDisableChannels.Count); if (errRet != OPTControllerAPI.OPT_SUCCEED) { return((int)ErrorDef.InvokeFailed); } for (i = 0; i < needDisableChannels.Count; i++) { chnEnables[needDisableChannels[i] - 1] = false; } } return((int)ErrorDef.Success); } }