Esempio n. 1
0
        private void TransmitPacketType101(IMeasurement[] measurements, int startIndex, int endIndex)
        {
            PacketType101 packet = new PacketType101();

            for (int i = startIndex; i <= endIndex; i++)
            {
                packet.Data.Add(new PacketType101DataPoint(measurements[i]));
            }

            m_historianPublisher.SendAsync(packet.BinaryImage());
        }
Esempio n. 2
0
        /// <summary>
        /// Transmits export data in <see cref="PacketType101"/>
        /// </summary>
        private void TransmitPacketType101(ExportContext context, IList <IDataPoint> dataToTransmit)
        {
            PacketType101 packet;

            if (dataToTransmit.Count <= context.DataPerPacket)
            {
                // Transmit all the data.
                packet = new PacketType101(dataToTransmit);
                context.Socket.MulticastAsync(packet.BinaryImage(), 0, packet.BinaryLength);
            }
            else
            {
                // Transmit data at the maximum allowed rate.
                for (int i = 0; i < dataToTransmit.Count; i += context.DataPerPacket)
                {
                    packet = new PacketType101(dataToTransmit.GetRange(i, dataToTransmit.Count - i < context.DataPerPacket ? dataToTransmit.Count - i : context.DataPerPacket));
                    context.Socket.MulticastAsync(packet.BinaryImage(), 0, packet.BinaryLength);
                }
            }
        }