/// <summary> /// Initializes a new instance of the ModuleBlackboard class /// </summary> /// <param name="name">Module name</param> public ModuleBlackboard(string name) : base(name) { sharedVariables = new SharedVariableCollection(); sharedVariables.Add(svAliveModules = new AliveModulesSharedVariable(this)); sharedVariables.Add(svBusyModules = new BusyModulesSharedVariable(this)); sharedVariables.Add(svConnectedModules = new ConnectedModulesSharedVariable(this)); sharedVariables.Add(svModules = new ModulesSharedVariable(this)); sharedVariables.Add(svReadyModules = new ReadyModulesSharedVariable(this)); sharedVariables.Add(svVariableList = new VariableListSharedVariable(this)); pendingSubscriptions = new Dictionary <string, List <SharedVariableSubscription> >(); // Add default blackboard commands //this.Prototypes.Add(pttAlive); //this.Prototypes.Add(pttBin); //this.Prototypes.Add(pttBusy); //this.Prototypes.Add(pttConnected); //this.Prototypes.Add(pttReady); this.Prototypes.Add(new Prototype("alive", true, true, 300, true)); this.Prototypes.Add(new Prototype("bin", true, true, 300, true)); this.Prototypes.Add(new Prototype("busy", true, true, 300, true)); this.Prototypes.Add(new Prototype("connected", true, true, 300, true)); this.Prototypes.Add(new Prototype("ready", true, true, 300, true)); this.Prototypes.Add(new Prototype("modules", false, true, 300, true)); this.Prototypes.Add(new Prototype("idletime", true, true, 300, true)); this.Prototypes.Add(new Prototype("setupmodule", true, true, 500, true)); this.Prototypes.Add(new Prototype("querymodule", true, true, 300, true)); this.Prototypes.Add(new Prototype("reset", true, false, 300, true)); this.Prototypes.Add(new Prototype("restart_test", true, false, 300, true)); this.Prototypes.Add(new Prototype("bbstatus", true, true, 300, true)); this.Prototypes.Add(new Prototype("mstatus", true, true, 300, true)); this.Prototypes.Add(new Prototype("mystat", true, false, 300, true)); // Remote module start and stop commands this.Prototypes.Add(new Prototype("start_module_app", true, true, 3000, true)); this.Prototypes.Add(new Prototype("stop_module_app", true, false, 3000, true)); // Shared Variable related this.Prototypes.Add(new Prototype("suscribe_var", true, true, 500, true)); this.Prototypes.Add(new Prototype("subscribe_var", true, true, 500, true)); this.Prototypes.Add(new Prototype("unsubscribe_var", true, true, 500, true)); // Moved to parent class //this.Prototypes.Add(new Prototype("create_var", true, true, 300, true)); //this.Prototypes.Add(new Prototype("list_vars", true, true, 300, true)); //this.Prototypes.Add(new Prototype("read_var", true, true, 300, true)); //this.Prototypes.Add(new Prototype("read_vars", true, true, 300, true)); //this.Prototypes.Add(new Prototype("write_var", true, true, 300, true)); commandsReceived = new ProducerConsumer <ITextCommand>(50); processManager = new ProcessManager(); msc = new MachineStatusCollection(this); }
private void SharedVariables_SharedVariableAdded(SharedVariableCollection collection, SharedVariable variable) { if (variable == null) return; if (this.InvokeRequired) { if (!this.IsHandleCreated || this.Disposing || this.IsDisposed) return; this.BeginInvoke(dlgShvSharedVariableAdded, collection, variable); return; } if(lvSharedVariables.Items.Count < (collection.Count -1)) { UpdateSharedVariables(); return; } ListViewItem lvi = lvSharedVariables.Items.Add(variable.Name); lvi.Tag = variable; lvSharedVariables.Refresh(); }