Esempio n. 1
0
        public NXTProtocol(object s, NXTStreamType stype)
        {
            stream     = s;
            streamType = stype;

            cmdThread = new Thread(CommandWorker);

            lsGetStatusDelegate  = null;
            lsReadDelegate       = null;
            ultrasonicDelegate   = null;
            batteryLevelDelegate = null;
            getVersionDelegate   = null;
            getOutputDelegate    = null;
            getInputDelegate     = null;
            messageReadDelegate  = null;
            keepAliveDelegate    = null;
        }
Esempio n. 2
0
 public static V ReturnValue <I, V>(this I inValue, GetInputDelegate <I, V> getValue)
 => TeronisTools.ReturnValue(inValue, getValue);
Esempio n. 3
0
        public NXTProtocol(object s, NXTStreamType stype)
        {
            stream = s;
            streamType = stype;

            cmdThread = new Thread(CommandWorker);

            lsGetStatusDelegate = null;
            lsReadDelegate = null;
            ultrasonicDelegate = null;
            batteryLevelDelegate = null;
            getVersionDelegate = null;
            getOutputDelegate = null;
            getInputDelegate = null;
            messageReadDelegate = null;
            keepAliveDelegate = null;
        }
Esempio n. 4
0
 public static V ReturnValue <I, V>(this I inValue, [MaybeNull] out I outInValue, GetInputDelegate <I, V> getValue)
 => TeronisTools.ReturnValue(inValue, out outInValue, getValue);
Esempio n. 5
0
        public override IEnumerable <AssociativeNode> BuildOutputAst(List <AssociativeNode> inputAstNodes)
        {
            getInput = GetNodeInputs;

            //setup list to hold elements
            List <object> cnstList = new List <object>();
            List <string> instList = new List <string>();
            List <string> toolList = new List <string>();
            List <string> wobjList = new List <string>();


            //get the inputs
            if (NodeModel != null && NodeView != null)
            {
                try
                {
                    cnstList = getInput.Invoke(0).OfType <object>().ToList();
                    instList = getInput.Invoke(1).OfType <string>().ToList();
                    toolList = getInput.Invoke(2).OfType <string>().ToList();
                    wobjList = getInput.Invoke(3).OfType <string>().ToList();
                }catch
                {
                    Warning("All inputs need valid connections");
                }



                Func <string, List <object>, List <string>, List <string>, List <string>, string> func =
                    ToroUIfunctions.processUIdata;

                string progData = string.Empty;

                _fileExists = false;
                if (CustomUi != null && _ModFileLoc != null)
                {
                    _fileExists = File.Exists(_ModFileLoc);
                    //if (_fileExists && HasConnectedInput(0) && HasConnectedInput(1) && HasConnectedInput(2) && HasConnectedInput(3))
                    if (_fileExists)
                    {
                        RunProcessRapidCode =
                            new TaskFactory().StartNew(
                                () =>
                                progData =
                                    ToroUIfunctions.processUIdata(_ModFileLoc, cnstList, instList, toolList, wobjList));
                        RunProcessRapidCode.Wait();
                        _programData = AstFactory.BuildStringNode(progData);
                        GetFileDataAndPopulatePanel(false);
                    }
                }
            }
            else
            {
                _programData = AstFactory.BuildStringNode("No program data created");
            }

            List <AssociativeNode> _controler = new List <AssociativeNode>(6);

            if (CustomUi != null && CustomUi.SetupPanel.hasController)
            {
                foreach (var s in CustomUi.SetupPanel.selectedControler)
                {
                    _controler.Add(AstFactory.BuildStringNode(s));
                }
            }

            else
            {
                _controler = new List <AssociativeNode>(1)
                {
                    AstFactory.BuildNullNode()
                };
            }

            return(new[]
            {
                AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), _programData),
                AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(1), AstFactory.BuildExprList(_controler))
            });
        }