public async void OnUbiiInitialized() { topicFrequencyCounter = "/" + ubiiNode.GetID() + "/test/pm_frequency_counter"; topicFrequencyCounterTickValue = "/" + ubiiNode.GetID() + "/test/pm_frequency_counter/tick_value"; expectedCounter = 0; tickValue = 2; ubiiNode.PublishImmediately(new TopicDataRecord { Topic = topicFrequencyCounterTickValue, Int32 = tickValue }); //await Task.Delay(2000); testFailure = false; await ubiiNode.SubscribeTopic(topicFrequencyCounter, (TopicDataRecord record) => { expectedCounter += tickValue; testFailure = record.Int32 != expectedCounter; if (testFailure) { Debug.LogError("counter from PM expected to be " + expectedCounter + " but was actually " + record.Int32); } }); ubiiSession = new Ubii.Sessions.Session { Name = "Test Processing Modules Counter" }; ubiiSession.ProcessingModules.Add(new Ubii.Processing.ProcessingModule { Name = TestPMFrequencyCounter.specs.Name }); Ubii.Sessions.IOMapping ioMapping = new Ubii.Sessions.IOMapping(); ioMapping.ProcessingModuleName = TestPMFrequencyCounter.specs.Name; ioMapping.InputMappings.Add(new Ubii.Sessions.TopicInputMapping { InputName = "counterTick", Topic = topicFrequencyCounterTickValue }); ioMapping.OutputMappings.Add(new Ubii.Sessions.TopicOutputMapping { OutputName = "outCounter", Topic = topicFrequencyCounter }); ubiiSession.IoMappings.Add(ioMapping); RunTest(); }
private void CreateSpecs() { this.inputTopic = "/" + ubiiNode.GetID() + "/test-sessions/input/vec3"; this.outputTopic = "/" + ubiiNode.GetID() + "/test-sessions/output/vec3"; this.pmSpecs = new Ubii.Processing.ProcessingModule { Name = "Unity3D-Client-TestSessions-PM-01", OnProcessingStringified = "(inputs, outputs, state) => { outputs.outVec3 = inputs.inVec3; }", ProcessingMode = new Ubii.Processing.ProcessingMode { Frequency = new Ubii.Processing.ProcessingMode.Types.Frequency { Hertz = 10 } } }; this.pmSpecs.Inputs.Add(new Ubii.Processing.ModuleIO { InternalName = "inVec3", MessageFormat = "ubii.dataStructure.Vector3" }); this.pmSpecs.Outputs.Add(new Ubii.Processing.ModuleIO { InternalName = "outVec3", MessageFormat = "ubii.dataStructure.Vector3" }); this.pmSpecs.Authors.Add("Sandro Weber"); this.sessionSpecs = new Ubii.Sessions.Session { Name = "Unity3D-Client-TestSessions-Session-01" }; this.sessionSpecs.Authors.Add("Sandro Weber"); this.sessionSpecs.ProcessingModules.Add(this.pmSpecs); Ubii.Sessions.IOMapping ioMapping = new Ubii.Sessions.IOMapping { ProcessingModuleName = this.pmSpecs.Name }; ioMapping.InputMappings.Add(new Ubii.Sessions.TopicInputMapping { InputName = "inVec3", Topic = this.inputTopic }); ioMapping.OutputMappings.Add(new Ubii.Sessions.TopicOutputMapping { OutputName = "outVec3", Topic = this.outputTopic }); this.sessionSpecs.IoMappings.Add(ioMapping); }