public void TestBeginEndAccess() { // OpenDDS Issue: Coherent sets for PRESENTATION QoS not Currently implemented on RTPS. // Just prepare the unit test for the moment. // Initialize entities TestStructTypeSupport support = new TestStructTypeSupport(); string typeName = support.GetTypeName(); ReturnCode result = support.RegisterType(_participant, typeName); Assert.AreEqual(ReturnCode.Ok, result); Topic topic = _participant.CreateTopic(nameof(TestNotifyDataReaders), typeName); Assert.IsNotNull(topic); Assert.IsNull(topic.GetListener()); Assert.AreEqual(nameof(TestNotifyDataReaders), topic.Name); Assert.AreEqual(typeName, topic.TypeName); Topic otherTopic = _participant.CreateTopic("Other" + nameof(TestNotifyDataReaders), typeName); Assert.IsNotNull(otherTopic); Assert.IsNull(otherTopic.GetListener()); Assert.AreEqual("Other" + nameof(TestNotifyDataReaders), otherTopic.Name); Assert.AreEqual(typeName, otherTopic.TypeName); PublisherQos pubQos = new PublisherQos(); pubQos.Presentation.AccessScope = PresentationQosPolicyAccessScopeKind.GroupPresentationQos; pubQos.Presentation.CoherentAccess = true; pubQos.Presentation.OrderedAccess = true; Publisher publisher = _participant.CreatePublisher(pubQos); Assert.IsNotNull(publisher); DataWriter writer = publisher.CreateDataWriter(topic); Assert.IsNotNull(writer); TestStructDataWriter dataWriter = new TestStructDataWriter(writer); DataWriter otherWriter = publisher.CreateDataWriter(otherTopic); Assert.IsNotNull(otherWriter); TestStructDataWriter otherDataWriter = new TestStructDataWriter(otherWriter); SubscriberQos subQos = new SubscriberQos(); subQos.Presentation.AccessScope = PresentationQosPolicyAccessScopeKind.GroupPresentationQos; subQos.Presentation.CoherentAccess = true; subQos.Presentation.OrderedAccess = true; MySubscriberListener listener = new MySubscriberListener(); listener.DataOnReaders += (sub) => { result = sub.BeginAccess(); Assert.AreEqual(ReturnCode.Ok, result); List <DataReader> list = new List <DataReader>(); result = sub.GetDataReaders(list); // Here we should check that we received two DataReader // read the data of each one and confirm tha the group coherent access // is working as expected. result = sub.EndAccess(); Assert.AreEqual(ReturnCode.Ok, result); }; Subscriber subscriber = _participant.CreateSubscriber(subQos, listener); Assert.IsNotNull(subscriber); DataReader reader = subscriber.CreateDataReader(topic); Assert.IsNotNull(reader); TestStructDataReader dataReader = new TestStructDataReader(reader); DataReader otherReader = subscriber.CreateDataReader(otherTopic); Assert.IsNotNull(otherReader); TestStructDataReader otherDataReader = new TestStructDataReader(otherReader); // Call EndAccess without calling first BeginAccess result = subscriber.EndAccess(); Assert.AreEqual(ReturnCode.PreconditionNotMet, result); // Publish a samples in both topics result = publisher.BeginCoherentChanges(); Assert.AreEqual(ReturnCode.Ok, result); result = dataWriter.Write(new TestStruct { Id = 1 }); Assert.AreEqual(ReturnCode.Ok, result); result = otherDataWriter.Write(new TestStruct { Id = 1 }); Assert.AreEqual(ReturnCode.Ok, result); result = publisher.EndCoherentChanges(); Assert.AreEqual(ReturnCode.Ok, result); // Give some time to the subscriber to process the messages System.Threading.Thread.Sleep(500); }
public static void DataAvailable(DataReader reader) { try { TestStructDataReader dr = new TestStructDataReader(reader); List <TestStruct> samples = new List <TestStruct>(); List <SampleInfo> infos = new List <SampleInfo>(); ReturnCode error = dr.Read(samples, infos); if ((error == ReturnCode.Ok)) { for (int i = 0; i < samples.Count; i++) { SampleInfo info = infos[i]; TestStruct sample = samples[i]; if (info.ValidData) { Console.WriteLine(); Console.WriteLine("RawData:"); Console.WriteLine(sample.RawData); Console.WriteLine(); Console.WriteLine("LongDoubleType:"); Console.WriteLine(sample.LongDoubleType); Console.WriteLine(); Console.WriteLine("LongSequence:"); foreach (int l in sample.LongSequence) { Console.WriteLine(l); } Console.WriteLine(); Console.WriteLine("StringSequence:"); foreach (string s in sample.StringSequence) { Console.WriteLine(s); } Console.WriteLine(); Console.WriteLine("StructSequence:"); foreach (BasicTestStruct s in sample.StructSequence) { Console.WriteLine(s.Id); } Console.WriteLine(); Console.WriteLine("LongDoubleSequence:"); foreach (double ld in sample.LongDoubleSequence) { Console.WriteLine(ld); } Console.WriteLine(); Console.WriteLine("LongArray:"); foreach (int l in sample.LongArray) { Console.WriteLine(l); } Console.WriteLine(); Console.WriteLine("StringArray:"); foreach (string s in sample.StringArray) { Console.WriteLine(s); } Console.WriteLine(); Console.WriteLine("StructArray:"); foreach (BasicTestStruct s in sample.StructArray) { Console.WriteLine(s.Id); } Console.WriteLine(); Console.WriteLine("LongDoubleArray:"); foreach (double d in sample.LongDoubleArray) { Console.WriteLine(d); } Console.WriteLine(); } } } } catch (System.Exception ex) { System.Console.Write(ex); } }
public void TestGetDataReaders() { // Initialize entities TestStructTypeSupport support = new TestStructTypeSupport(); string typeName = support.GetTypeName(); ReturnCode result = support.RegisterType(_participant, typeName); Assert.AreEqual(ReturnCode.Ok, result); Topic topic = _participant.CreateTopic(nameof(TestNotifyDataReaders), typeName); Assert.IsNotNull(topic); Assert.IsNull(topic.GetListener()); Assert.AreEqual(nameof(TestNotifyDataReaders), topic.Name); Assert.AreEqual(typeName, topic.TypeName); Topic otherTopic = _participant.CreateTopic("Other" + nameof(TestNotifyDataReaders), typeName); Assert.IsNotNull(otherTopic); Assert.IsNull(otherTopic.GetListener()); Assert.AreEqual("Other" + nameof(TestNotifyDataReaders), otherTopic.Name); Assert.AreEqual(typeName, otherTopic.TypeName); Publisher publisher = _participant.CreatePublisher(); Assert.IsNotNull(publisher); DataWriter writer = publisher.CreateDataWriter(topic); Assert.IsNotNull(writer); TestStructDataWriter dataWriter = new TestStructDataWriter(writer); DataWriter otherWriter = publisher.CreateDataWriter(otherTopic); Assert.IsNotNull(otherWriter); TestStructDataWriter otherDataWriter = new TestStructDataWriter(otherWriter); Subscriber subscriber = _participant.CreateSubscriber(); Assert.IsNotNull(subscriber); DataReader reader = subscriber.CreateDataReader(topic); Assert.IsNotNull(reader); TestStructDataReader dataReader = new TestStructDataReader(reader); DataReader otherReader = subscriber.CreateDataReader(otherTopic); Assert.IsNotNull(otherReader); TestStructDataReader otherDataReader = new TestStructDataReader(otherReader); // Check that the GetDataReaders without sending any sample List <DataReader> list = new List <DataReader>(); result = subscriber.GetDataReaders(list); Assert.AreEqual(ReturnCode.Ok, result); Assert.AreEqual(0, list.Count); // Publish in the topic and check again result = dataWriter.Write(new TestStruct { Id = 1 }); Assert.AreEqual(ReturnCode.Ok, result); System.Threading.Thread.Sleep(100); result = subscriber.GetDataReaders(list); Assert.AreEqual(ReturnCode.Ok, result); Assert.AreEqual(1, list.Count); // Publish in the otherTopic and check again result = otherDataWriter.Write(new TestStruct { Id = 1 }); Assert.AreEqual(ReturnCode.Ok, result); System.Threading.Thread.Sleep(100); result = subscriber.GetDataReaders(list, SampleStateKind.NotReadSampleState | SampleStateKind.ReadSampleState, ViewStateMask.AnyViewState, InstanceStateMask.AnyInstanceState); Assert.AreEqual(ReturnCode.Ok, result); Assert.AreEqual(2, list.Count); // Take from both DataReaders and check again List <TestStruct> received = new List <TestStruct>(); List <SampleInfo> sampleInfos = new List <SampleInfo>(); result = dataReader.Take(received, sampleInfos); Assert.AreEqual(ReturnCode.Ok, result); result = otherDataReader.Take(received, sampleInfos); Assert.AreEqual(ReturnCode.Ok, result); result = subscriber.GetDataReaders(list); Assert.AreEqual(ReturnCode.Ok, result); Assert.AreEqual(0, list.Count); // Test GetDataReaders with null parameter result = subscriber.GetDataReaders(null); Assert.AreEqual(ReturnCode.BadParameter, result); }
private static void TestSubscriber(DomainParticipant participant) { Console.WriteLine("Starting applicattion as Subscriber..."); Subscriber subscriber = participant.CreateSubscriber(); if (subscriber == null) { throw new ApplicationException("Subscriber could not be created."); } Console.WriteLine("Creating Topic..."); Topic topic = CreateTestTopic(participant); Console.WriteLine("Creating DataReader..."); DataReaderQos qos = new DataReaderQos(); qos.Reliability.Kind = ReliabilityQosPolicyKind.ReliableReliabilityQos; DataReader dr = subscriber.CreateDataReader(topic, qos); if (dr == null) { Console.WriteLine("DataReader could not be created."); throw new ApplicationException("DataReader could not be created."); } Console.WriteLine("DataReader created..."); TestStructDataReader dataReader = new TestStructDataReader(dr); Console.WriteLine("Waiting for sample with default values..."); List <TestStruct> received = new List <TestStruct>(); List <SampleInfo> sampleInfo = new List <SampleInfo>(); ReturnCode ret = dataReader.Take(received, sampleInfo); while (ret != ReturnCode.Ok) { Thread.Sleep(100); ret = dataReader.Take(received, sampleInfo); } if (received.Count > 0) { PrintReceivedSample(received[0]); } Console.WriteLine("Waiting for sample with custom values..."); if (received.Count < 2) { received = new List <TestStruct>(); sampleInfo = new List <SampleInfo>(); ret = dataReader.Take(received, sampleInfo); while (ret != ReturnCode.Ok) { Thread.Sleep(100); ret = dataReader.Take(received, sampleInfo); } if (received.Count > 0) { PrintReceivedSample(received[0]); } } else { PrintReceivedSample(received[1]); } }
public void TestDispose() { // Initialize entities Duration duration = new Duration { Seconds = 5 }; DataWriterQos qos = new DataWriterQos(); qos.WriterDataLifecycle.AutodisposeUnregisteredInstances = false; DataWriter writer = _publisher.CreateDataWriter(_topic, qos); Assert.IsNotNull(writer); TestStructDataWriter dataWriter = new TestStructDataWriter(writer); Subscriber subscriber = _participant.CreateSubscriber(); Assert.IsNotNull(subscriber); DataReaderQos drQos = new DataReaderQos(); qos.Reliability.Kind = ReliabilityQosPolicyKind.ReliableReliabilityQos; MyDataReaderListener listener = new MyDataReaderListener(); DataReader dataReader = subscriber.CreateDataReader(_topic, drQos, listener); Assert.IsNotNull(dataReader); int count = 0; Timestamp timestamp = default; listener.DataAvailable += (reader) => { List <TestStruct> samples = new List <TestStruct>(); List <SampleInfo> infos = new List <SampleInfo>(); TestStructDataReader dr = new TestStructDataReader(reader); ReturnCode ret = dr.Take(samples, infos); if (ret == ReturnCode.Ok) { foreach (var info in infos) { if (info.InstanceState == InstanceStateKind.NotAliveDisposedInstanceState) { count++; if (count == 3) { timestamp = infos.First().SourceTimestamp; } } } } }; // Wait for discovery writer.WaitForSubscriptions(1, 1000); dataReader.WaitForPublications(1, 1000); // Dispose an instance that does not exist ReturnCode result = dataWriter.Dispose(new TestStruct { Id = 1 }, InstanceHandle.HandleNil); Assert.AreEqual(ReturnCode.Error, result); // Call dispose with the simplest overload TestStruct instance1 = new TestStruct { Id = 1 }; result = dataWriter.Write(instance1); Assert.AreEqual(ReturnCode.Ok, result); result = dataWriter.WaitForAcknowledgments(duration); Assert.AreEqual(ReturnCode.Ok, result); System.Threading.Thread.Sleep(100); Assert.AreEqual(0, count); result = dataWriter.Dispose(instance1); Assert.AreEqual(ReturnCode.Ok, result); result = dataWriter.WaitForAcknowledgments(duration); Assert.AreEqual(ReturnCode.Ok, result); System.Threading.Thread.Sleep(100); Assert.AreEqual(1, count); // Call dispose with the handle parameter TestStruct instance2 = new TestStruct { Id = 2 }; InstanceHandle handle2 = dataWriter.RegisterInstance(instance2); Assert.AreNotEqual(InstanceHandle.HandleNil, handle2); result = dataWriter.Write(instance2, handle2); Assert.AreEqual(ReturnCode.Ok, result); result = dataWriter.WaitForAcknowledgments(duration); Assert.AreEqual(ReturnCode.Ok, result); System.Threading.Thread.Sleep(100); Assert.AreEqual(1, count); result = dataWriter.Dispose(instance2, handle2); Assert.AreEqual(ReturnCode.Ok, result); result = dataWriter.WaitForAcknowledgments(duration); Assert.AreEqual(ReturnCode.Ok, result); System.Threading.Thread.Sleep(100); Assert.AreEqual(2, count); // Call dispose with the handle parameter and specific timestamp Timestamp now = DateTime.Now.ToTimestamp(); TestStruct instance3 = new TestStruct { Id = 3 }; InstanceHandle handle3 = dataWriter.RegisterInstance(instance3); Assert.AreNotEqual(InstanceHandle.HandleNil, handle3); result = dataWriter.Write(instance3, handle3); Assert.AreEqual(ReturnCode.Ok, result); result = dataWriter.WaitForAcknowledgments(duration); Assert.AreEqual(ReturnCode.Ok, result); System.Threading.Thread.Sleep(100); Assert.AreEqual(2, count); result = dataWriter.Dispose(instance3, handle3, now); Assert.AreEqual(ReturnCode.Ok, result); result = dataWriter.WaitForAcknowledgments(duration); Assert.AreEqual(ReturnCode.Ok, result); System.Threading.Thread.Sleep(100); Assert.AreEqual(3, count); Assert.AreEqual(now.Seconds, timestamp.Seconds); Assert.AreEqual(now.NanoSeconds, timestamp.NanoSeconds); }
public void TestWrite() { // Initialize entities Duration duration = new Duration { Seconds = 5 }; DataWriter writer = _publisher.CreateDataWriter(_topic); Assert.IsNotNull(writer); TestStructDataWriter dataWriter = new TestStructDataWriter(writer); Subscriber subscriber = _participant.CreateSubscriber(); Assert.IsNotNull(subscriber); DataReaderQos qos = new DataReaderQos(); qos.Reliability.Kind = ReliabilityQosPolicyKind.ReliableReliabilityQos; MyDataReaderListener listener = new MyDataReaderListener(); DataReader dataReader = subscriber.CreateDataReader(_topic, qos, listener); Assert.IsNotNull(dataReader); int count = 0; Timestamp timestamp = default; ReturnCode retReadInstance = ReturnCode.Error; InstanceHandle lookupHandle = InstanceHandle.HandleNil; List <TestStruct> samples = new List <TestStruct>(); List <SampleInfo> infos = new List <SampleInfo>(); listener.DataAvailable += (reader) => { count++; if (count == 4) { TestStructDataReader dr = new TestStructDataReader(reader); lookupHandle = dr.LookupInstance(new TestStruct { Id = count }); retReadInstance = dr.ReadInstance(samples, infos, lookupHandle); if (retReadInstance == ReturnCode.Ok && infos != null && infos.Count == 1) { timestamp = infos.First().SourceTimestamp; } } }; // Wait for discovery writer.WaitForSubscriptions(1, 1000); // Write an instance with the simplest overload ReturnCode result = dataWriter.Write(new TestStruct { Id = 1 }); Assert.AreEqual(ReturnCode.Ok, result); result = dataWriter.WaitForAcknowledgments(duration); Assert.AreEqual(ReturnCode.Ok, result); System.Threading.Thread.Sleep(10); Assert.AreEqual(1, count); // Write an instance with the handle parameter as HandleNil result = dataWriter.Write(new TestStruct { Id = 2 }, InstanceHandle.HandleNil); Assert.AreEqual(ReturnCode.Ok, result); result = dataWriter.WaitForAcknowledgments(duration); Assert.AreEqual(ReturnCode.Ok, result); System.Threading.Thread.Sleep(10); Assert.AreEqual(2, count); // Write an instance with the handle parameter with a previously registered instance TestStruct instance = new TestStruct { Id = 3 }; InstanceHandle handle = dataWriter.RegisterInstance(instance); Assert.AreNotEqual(InstanceHandle.HandleNil, handle); result = dataWriter.Write(instance, handle); Assert.AreEqual(ReturnCode.Ok, result); result = dataWriter.WaitForAcknowledgments(duration); Assert.AreEqual(ReturnCode.Ok, result); System.Threading.Thread.Sleep(10); Assert.AreEqual(3, count); // Write an instance with the handle parameter and the timestamp Timestamp now = DateTime.Now.ToTimestamp(); TestStruct instance1 = new TestStruct { Id = 4 }; InstanceHandle handle1 = dataWriter.RegisterInstance(instance1); Assert.AreNotEqual(InstanceHandle.HandleNil, handle1); result = dataWriter.Write(instance1, handle1, now); Assert.AreEqual(ReturnCode.Ok, result); result = dataWriter.WaitForAcknowledgments(duration); Assert.AreEqual(ReturnCode.Ok, result); System.Threading.Thread.Sleep(10); Assert.AreEqual(4, count); Assert.AreNotEqual(InstanceHandle.HandleNil, lookupHandle); Assert.AreEqual(ReturnCode.Ok, retReadInstance); Assert.IsNotNull(infos); Assert.AreEqual(1, infos.Count); Assert.AreEqual(now.Seconds, timestamp.Seconds); Assert.AreEqual(now.NanoSeconds, timestamp.NanoSeconds); }
public void TestBeginEndCoherentChanges() { // Initialize entities TestStructTypeSupport support = new TestStructTypeSupport(); string typeName = support.GetTypeName(); ReturnCode result = support.RegisterType(_participant, typeName); Assert.AreEqual(ReturnCode.Ok, result); Topic topic = _participant.CreateTopic(nameof(TestBeginEndCoherentChanges), typeName); Assert.IsNotNull(topic); Assert.IsNull(topic.GetListener()); Assert.AreEqual(nameof(TestBeginEndCoherentChanges), topic.Name); Assert.AreEqual(typeName, topic.TypeName); PublisherQos pQos = new PublisherQos(); pQos.Presentation.CoherentAccess = true; pQos.Presentation.OrderedAccess = true; pQos.Presentation.AccessScope = PresentationQosPolicyAccessScopeKind.TopicPresentationQos; Publisher publisher = _participant.CreatePublisher(pQos); Assert.IsNotNull(publisher); SubscriberQos sQos = new SubscriberQos(); sQos.Presentation.CoherentAccess = true; sQos.Presentation.OrderedAccess = true; sQos.Presentation.AccessScope = PresentationQosPolicyAccessScopeKind.TopicPresentationQos; Subscriber subscriber = _participant.CreateSubscriber(sQos); Assert.IsNotNull(subscriber); DataWriter writer = publisher.CreateDataWriter(topic); Assert.IsNotNull(writer); TestStructDataWriter dataWriter = new TestStructDataWriter(writer); DataReaderQos drQos = new DataReaderQos(); drQos.Reliability.Kind = ReliabilityQosPolicyKind.ReliableReliabilityQos; drQos.History.Kind = HistoryQosPolicyKind.KeepAllHistoryQos; DataReader reader = subscriber.CreateDataReader(topic, drQos); Assert.IsNotNull(reader); TestStructDataReader dataReader = new TestStructDataReader(reader); // Call EndCoherentChanges without calling first SuspendPublications result = publisher.EndCoherentChanges(); Assert.AreEqual(ReturnCode.PreconditionNotMet, result); // Begin coherent access and write samples result = publisher.BeginCoherentChanges(); Assert.AreEqual(ReturnCode.Ok, result); for (int i = 1; i <= 5; i++) { TestStruct sample = new TestStruct { Id = i, ShortType = (short)i }; InstanceHandle handle = dataWriter.RegisterInstance(sample); Assert.AreNotEqual(InstanceHandle.HandleNil, handle); result = dataWriter.Write(sample, handle); Assert.AreEqual(ReturnCode.Ok, result); } System.Threading.Thread.Sleep(500); // Check that not samples arrived List <TestStruct> data = new List <TestStruct>(); List <SampleInfo> sampleInfos = new List <SampleInfo>(); #region OpenDDS Issue // Coherent sets for PRESENTATION QoS not Currently implemented on RTPS //result = dataReader.Read(data, sampleInfos); //Assert.AreEqual(ReturnCode.NoData, result); #endregion // End coherent access and check the samples result = publisher.EndCoherentChanges(); Assert.AreEqual(ReturnCode.Ok, result); System.Threading.Thread.Sleep(500); data = new List <TestStruct>(); sampleInfos = new List <SampleInfo>(); result = dataReader.Read(data, sampleInfos); Assert.AreEqual(ReturnCode.Ok, result); for (int i = 0; i < data.Count; i++) { Assert.IsTrue(sampleInfos[i].ValidData); Assert.AreEqual(i + 1, data[i].Id); Assert.AreEqual(i + 1, data[i].ShortType); } }
public void TestSuspendResumePublications() { // Initialize entities TestStructTypeSupport support = new TestStructTypeSupport(); string typeName = support.GetTypeName(); ReturnCode result = support.RegisterType(_participant, typeName); Assert.AreEqual(ReturnCode.Ok, result); Topic topic = _participant.CreateTopic(nameof(TestSuspendResumePublications), typeName); Assert.IsNotNull(topic); Assert.IsNull(topic.GetListener()); Assert.AreEqual(nameof(TestSuspendResumePublications), topic.Name); Assert.AreEqual(typeName, topic.TypeName); Publisher publisher = _participant.CreatePublisher(); Assert.IsNotNull(publisher); Subscriber subscriber = _participant.CreateSubscriber(); Assert.IsNotNull(subscriber); DataWriter writer = publisher.CreateDataWriter(topic); Assert.IsNotNull(writer); TestStructDataWriter dataWriter = new TestStructDataWriter(writer); DataReaderQos drQos = new DataReaderQos(); drQos.Reliability.Kind = ReliabilityQosPolicyKind.ReliableReliabilityQos; drQos.History.Kind = HistoryQosPolicyKind.KeepAllHistoryQos; DataReader reader = subscriber.CreateDataReader(topic, drQos); Assert.IsNotNull(reader); TestStructDataReader dataReader = new TestStructDataReader(reader); // Call ResumePublications without calling first SuspendPublications result = publisher.ResumePublications(); Assert.AreEqual(ReturnCode.PreconditionNotMet, result); // Suspend publications and write samples result = publisher.SuspendPublications(); Assert.AreEqual(ReturnCode.Ok, result); for (int i = 1; i <= 5; i++) { // OpenDDS issue: cannot register more than one instance during SuspendPublications. // Looks like that the control messages are never delivered and the controlTracker never get free during delete_datawriter TestStruct sample = new TestStruct { Id = 1, ShortType = (short)i }; InstanceHandle handle = dataWriter.RegisterInstance(sample); Assert.AreNotEqual(InstanceHandle.HandleNil, handle); result = dataWriter.Write(sample, handle); Assert.AreEqual(ReturnCode.Ok, result); } System.Threading.Thread.Sleep(500); // Check that not samples arrived List <TestStruct> data = new List <TestStruct>(); List <SampleInfo> sampleInfos = new List <SampleInfo>(); result = dataReader.Read(data, sampleInfos); Assert.AreEqual(ReturnCode.NoData, result); // Resume publication and check the samples result = publisher.ResumePublications(); Assert.AreEqual(ReturnCode.Ok, result); System.Threading.Thread.Sleep(500); data = new List <TestStruct>(); sampleInfos = new List <SampleInfo>(); result = dataReader.Read(data, sampleInfos); Assert.AreEqual(ReturnCode.Ok, result); for (int i = 0; i < data.Count; i++) { Assert.IsTrue(sampleInfos[i].ValidData); Assert.AreEqual(i + 1, data[i].ShortType); } }