GetPartitionnedPackets() public méthode

Return the Partitionned packets stored in the array list
public GetPartitionnedPackets ( ) : ArrayList
Résultat System.Collections.ArrayList
Exemple #1
0
        public void BitmapAcquiredCBHandler(Bitmap aNewBitmap)
        {
            stopwatch.Restart();

            //Console.WriteLine("BitmapAcquiredCBHandler:");
            //Console.WriteLine("From CameraId " + GetID());
            byte[] newBA = aCodecUtility.CompressBmpToJPEGArray(aNewBitmap);
            //byte[] newBA = (byte[])converter.ConvertTo(aNewBitmap, typeof(byte[]));

            //Total size of the packet to send including header  +  data.
            PacketPartitionner pp = new PacketPartitionner(GetID(), newBA.Length, Packet.GetHeaderSize() + Packet.DEFAULT_PACKET_SIZE, null);

            pp.PartitionFile(newBA, newBA.Length);

            //Console.WriteLine("Bitmap of size:" + newBA.Length + ", Splitted in:" + pp.GetPartitionnedPackets().Count + "Packets of " + (Packet.GetHeaderSize() + Packet.DEFAULT_PACKET_SIZE) + " Bytes");

            //Remove prints to the console
            //This is a critical section, we don't to have more than 1 camera sending data at the same time.
            for (int i = 0; i < pp.GetPartitionnedPackets().Count; i++)
            {
                //Console.WriteLine("Send packet number:" + i + "/" + (pp.GetPartitionnedPackets().Count - 1));

                //((Packet)pp.GetPartitionnedPackets()[i]).PrintInfo();

                Packet p = ((Packet)(pp.GetPartitionnedPackets()[i]));

                byte[] SerializedPacket = p.GetBytes();

                //aUDPSender.SendDataUDP(SerializedPacket, SerializedPacket.Length);
                aUDPSender.SendNow(SerializedPacket, SerializedPacket.Length);

                Thread.Sleep(10);
            }

            //Thread.Sleep(100);

            //clear the array list so you dont send alway the same image.
            //pp.GetPartitionnedPackets().Clear();

            stopwatch.Stop();
            // Write result
            //Console.WriteLine("Time elapsed ms: {0}", stopwatch.ElapsedMilliseconds);
        }
        public void BitmapAcquiredCBHandler(Bitmap aNewBitmap)
        {
            stopwatch.Restart();

            //Console.WriteLine("BitmapAcquiredCBHandler:");
            //Console.WriteLine("From CameraId " + GetID());
            byte[] newBA = aCodecUtility.CompressBmpToJPEGArray(aNewBitmap);
            //byte[] newBA = (byte[])converter.ConvertTo(aNewBitmap, typeof(byte[]));

            //Total size of the packet to send including header  +  data.
            PacketPartitionner pp = new PacketPartitionner(GetID(), newBA.Length, Packet.GetHeaderSize() + Packet.DEFAULT_PACKET_SIZE, null);
            pp.PartitionFile(newBA, newBA.Length);

            //Console.WriteLine("Bitmap of size:" + newBA.Length + ", Splitted in:" + pp.GetPartitionnedPackets().Count + "Packets of " + (Packet.GetHeaderSize() + Packet.DEFAULT_PACKET_SIZE) + " Bytes");

            //Remove prints to the console
            //This is a critical section, we don't to have more than 1 camera sending data at the same time.
            for (int i = 0; i < pp.GetPartitionnedPackets().Count; i++)
            {
                //Console.WriteLine("Send packet number:" + i + "/" + (pp.GetPartitionnedPackets().Count - 1));

                //((Packet)pp.GetPartitionnedPackets()[i]).PrintInfo();

                Packet p = ((Packet)(pp.GetPartitionnedPackets()[i]));

                byte[] SerializedPacket = p.GetBytes();

                //aUDPSender.SendDataUDP(SerializedPacket, SerializedPacket.Length);
                aUDPSender.SendNow(SerializedPacket, SerializedPacket.Length);

                Thread.Sleep(10);
            }

            //Thread.Sleep(100);

            //clear the array list so you dont send alway the same image.
            //pp.GetPartitionnedPackets().Clear();

            stopwatch.Stop();
            // Write result
            //Console.WriteLine("Time elapsed ms: {0}", stopwatch.ElapsedMilliseconds);
        }