GetPartitionnedPackets() public method

Return the Partitionned packets stored in the array list
public GetPartitionnedPackets ( ) : ArrayList
return System.Collections.ArrayList
        public void BitmapAcquiredCBHandler(Bitmap aNewBitmap)
        {
            byte[] newBA = aCodecUtility.CompressBmpToJPEGArray(aImageQuality, aNewBitmap);
            int FileID = aRandomGenerator.Next();

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

            //Console.WriteLine("Partition File ID " + FileID + " In " + pp.GetPartitionnedPackets().Count + " Packets");

            //Remove prints to the console
            for (int i = 0; i < pp.GetPartitionnedPackets().Count; i++)
            {
                Packet p = ((Packet)(pp.GetPartitionnedPackets()[i]));

                //Console.WriteLine("Send Packet:"+i);

                byte[] SerializedPacket = p.GetBytes();

                //Sending the data to a blocking queue that gets process by a thread generate additionnal delay
                //The best solution to reduce the lag for now is to send the data directly with SendNow method.
                //aUDPSender.SendDataUDP(SerializedPacket, SerializedPacket.Length);

                aUDPSender.SendBytesNow(SerializedPacket, SerializedPacket.Length);

            }

            pp.GetPartitionnedPackets().Clear();
        }
Beispiel #2
0
        public void BitmapAcquiredCBHandler(Bitmap aNewBitmap)
        {
            byte[] newBA  = aCodecUtility.CompressBmpToJPEGArray(aImageQuality, aNewBitmap);
            int    FileID = aRandomGenerator.Next();

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

            pp.PartitionFile(newBA, newBA.Length);

            //Console.WriteLine("Partition File ID " + FileID + " In " + pp.GetPartitionnedPackets().Count + " Packets");

            //Remove prints to the console
            for (int i = 0; i < pp.GetPartitionnedPackets().Count; i++)
            {
                Packet p = ((Packet)(pp.GetPartitionnedPackets()[i]));

                //Console.WriteLine("Send Packet:"+i);

                byte[] SerializedPacket = p.GetBytes();

                //Sending the data to a blocking queue that gets process by a thread generate additionnal delay
                //The best solution to reduce the lag for now is to send the data directly with SendNow method.
                //aUDPSender.SendDataUDP(SerializedPacket, SerializedPacket.Length);

                aUDPSender.SendBytesNow(SerializedPacket, SerializedPacket.Length);
            }

            pp.GetPartitionnedPackets().Clear();
        }