public UDPSenderCameraDevice(string IpAddress, int Port, string aCameraName, string aMonikerString, int aCameraID) : base(aCameraName, aMonikerString, aCameraID) { //register callback on BitmapAcquired RegisterBitmapAcquiredCB(BitmapAcquiredCBHandler); //Create a socket connection for data to go out. aUDPSender = new UDPSender(IpAddress, Port); stopwatch = new Stopwatch(); converter = new ImageConverter(); aUDPStatistics = new LocalUDPStatistics(aUDPSender, 1000); aCodecUtility = new CodecUtility(); }
public void PacketReconstructedCBHandler(int FileID, byte[] filebyte, int bytesRead) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); CodecUtility aCodec = new CodecUtility(); LatestFrame = aCodec.DecompressJPEGArrayToBpm(filebyte); //Call the callback if (aNewBitmapReceivedEvent != null) { aNewBitmapReceivedEvent(LatestFrame); } PacketReconstructors.GetReconstructedPackets().Clear(); stopwatch.Stop(); // Write result //Console.WriteLine("Time elapsed ms: {0}", stopwatch.ElapsedMilliseconds); }