/// <summary> /// Applies next single action pending in the buffer. /// </summary> /// <returns></returns> public bool ApplyNextAction() { lock (actionBufferLock) { lastAction = actionBuffer.GetNext(); if (lastAction == null) { return(false); } bool success = Apply(lastAction); if (success && child != null) { child.Issue(lastAction); } return(success); } }
///// <summary> ///// Buffers current state settings (speed, zone, motion type...), and opens up for ///// temporary settings changes to be reverted by PopSettings(). ///// </summary> //public void PushCurrentSettings() //{ // //Console.WriteLine("Pushing {0}", currentSettings); // settingsBuffer.Push(currentSettings); // currentSettings = currentSettings.Clone(); // sets currentS to a new object //} ///// <summary> ///// Reverts the state settings (speed, zone, motion type...) to the previously buffered ///// state by PushSettings(). ///// </summary> //public void PopCurrentSettings() //{ // currentSettings = settingsBuffer.Pop(); // //Console.WriteLine("Reverted to {0}", currentSettings); //} //// TODO: take another look at this, it was quick and dirty... //public bool SetIOName(string ioName, int pinNumber, bool isDigital) //{ // if (isDigital) // { // if (pinNumber < 0 || pinNumber >= virtualCursor.digitalOutputs.Length) // { // Console.WriteLine("ERROR: pin # out of range"); // return false; // } // else // { // virtualCursor.digitalOutputNames[pinNumber] = ioName; // writeCursor.digitalOutputNames[pinNumber] = ioName; // } // return true; // } // else // { // if (pinNumber < 0 || pinNumber >= virtualCursor.analogOutputs.Length) // { // Console.WriteLine("ERROR: pin # out of range"); // return false; // } // else // { // virtualCursor.analogOutputNames[pinNumber] = ioName; // writeCursor.analogOutputNames[pinNumber] = ioName; // } // return true; // } //} // █████╗ ██████╗████████╗██╗ ██████╗ ███╗ ██╗███████╗ // ██╔══██╗██╔════╝╚══██╔══╝██║██╔═══██╗████╗ ██║██╔════╝ // ███████║██║ ██║ ██║██║ ██║██╔██╗ ██║███████╗ // ██╔══██║██║ ██║ ██║██║ ██║██║╚██╗██║╚════██║ // ██║ ██║╚██████╗ ██║ ██║╚██████╔╝██║ ╚████║███████║ // ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝ // /// <summary> /// Issue an Action of whatever kind... /// </summary> /// <param name="action"></param> /// <returns></returns> public bool IssueApplyActionRequest(Action action) { if (!_areCursorsInitialized) { Console.WriteLine("ERROR: cursors not initialized. Did you .Connect()?"); return(false); } bool success = virtualCursor.Issue(action); //if (_controlMode == ControlType.Stream) _comm.TickStreamQueue(true); return(success); }