public static UpdateInfo GetChannelConfig(Constants.Channels channelNumber) { if (!currentConfig.ContainsKey((int)channelNumber)) { return(null); } return(currentConfig[(int)channelNumber]); }
public IEnumerator stimulateBurst(StimulationInfo[] infos, int duration) { System.DateTime stopTime = System.DateTime.Now.AddMilliseconds(duration); while (stopTime > System.DateTime.Now) { Stop(); foreach (var info in infos) { Constants.Channels channel = GetChannel(info.part, info.side); SinglePulse.sendSinglePulse(channel, info.width, info.current); } yield return(null); } }
public void stimulateSinglePulse(Part part, Side side, int width, int current) { Stop(); //update bodypart Constants.Channels channel = GetChannel(part, side); if (channel == Constants.Channels.ChannelNone) { return; } for (int i = 0; i < pulseCount; i++) { SinglePulse.sendSinglePulse(channel, width, current); } }
public static bool UpdateChannel(Constants.Channels channelNumber, UpdateInfo info, bool sendMessage = true) { if (!currentConfig.ContainsKey((int)channelNumber)) { return(false); } currentConfig.Remove((int)channelNumber); currentConfig.Add((int)channelNumber, info); if (sendMessage) { List <UpdateInfo> infos = new List <UpdateInfo>(currentConfig.Values); byte[] cmd = ChannelList.GetUpdateCommand(infos); RehaStimInterface.sendMessage(cmd); } return(true); }
public bool setChannel(Constants.Channels channelNumber, bool active = true) { if (channelNumber == Constants.Channels.ChannelNone) { return(false); } if (active) { activeChannels.Add((int)channelNumber); } else { activeChannels.Remove((int)channelNumber); } return(true); }
public void stimulate(Part part, Side side, int width, int current) { //init channel mode if needed initStimulation(); //update bodypart Constants.Channels channel = GetChannel(part, side); if (channel == Constants.Channels.ChannelNone) { return; } UpdateInfo info = new UpdateInfo(); info.pulseCurrent = Mathf.Max(0, current); info.pulseWidth = Mathf.Max(0, width); //update EMS ChannelList.UpdateChannel(channel, info); }