/// <summary> /// Gets the Stim Therapy Status from the API /// </summary> /// <param name="theSummit">SummitSystem for making the call to the API to the INS</param> /// <returns>String showing Therapy Active or Therapy Inactive</returns> public string GetTherapyStatus(ref SummitSystem theSummit) { if (theSummit == null || theSummit.IsDisposed) { return(""); } GeneralInterrogateData insGeneralInfo = null; try { //Add a sleep in there to allow status of therapy to get pass Therapy Transitioning state //Allows it to either be Active or InActive and not inbetween Thread.Sleep(200); //Get data from api bufferInfo = theSummit.ReadGeneralInfo(out insGeneralInfo); //parse insGeneralInfo to get stim therapy status if (insGeneralInfo != null) { stimState = insGeneralInfo.TherapyStatusData.TherapyStatus.ToString(); } } catch (Exception e) { _log.Error(e); } return(stimState); }
/// <summary> /// Resets the POR bit if it was set /// </summary> /// <param name="localSummit">SummitSystem for the api call</param> private void ResetPOR(SummitSystem localSummit) { if (localSummit == null || localSummit.IsDisposed) { _log.Warn("Summit Disposed"); return; } _log.Info("POR was set, resetting..."); APIReturnInfo bufferReturnInfo; try { // reset POR bufferReturnInfo = localSummit.ResetErrorFlags(Medtronic.NeuroStim.Olympus.DataTypes.Core.StatusBits.Por); if (bufferReturnInfo.RejectCode != 0) { return; } // check battery BatteryStatusResult theStatus; localSummit.ReadBatteryLevel(out theStatus); if (bufferReturnInfo.RejectCode != 0) { return; } // perform interrogate command and check if therapy is enabled.s GeneralInterrogateData interrogateBuffer; localSummit.ReadGeneralInfo(out interrogateBuffer); if (interrogateBuffer.IsTherapyUnavailable) { _log.Warn("Therapy still unavailable after POR reset"); return; } } catch (Exception e) { _log.Error(e); } }
/// <summary> /// Gets the Active group from the api /// </summary> /// <param name="theSummit">SummitSystem to make api calls to INS</param> /// <returns>The active group in the format Group A instead of the format returned from medtonic such as Group0</returns> public string GetActiveGroup(ref SummitSystem theSummit) { if (theSummit == null || theSummit.IsDisposed) { return(""); } GeneralInterrogateData insGeneralInfo = null; try { //Get the group from the api call bufferInfo = theSummit.ReadGeneralInfo(out insGeneralInfo); if (insGeneralInfo != null) { activeGroup = insGeneralInfo.TherapyStatusData.ActiveGroup.ToString(); } } catch (Exception e) { _log.Error(e); } //This returns the converted group from something like Group0 to Group A return(ConvertActiveGroupToReadableForm(activeGroup)); }