public AdvFrameInfo(AdvFrameInfoNative copyFrom) { MidFrameTimeStampMillisecondsLo = copyFrom.MidFrameTimeStampMillisecondsLo; MidFrameTimeStampMillisecondsHi = copyFrom.MidFrameTimeStampMillisecondsHi; Exposure10thMs = copyFrom.Exposure10thMs; Gamma = copyFrom.Gamma; Gain = copyFrom.Gain; Temperature = copyFrom.Temperature; Shutter = copyFrom.Shutter; Offset = copyFrom.Offset; SystemTimeLo = copyFrom.SystemTimeLo; SystemTimeHi = copyFrom.SystemTimeHi; GPSTrackedSattelites = copyFrom.GPSTrackedSattelites; GPSAlmanacStatus = copyFrom.GPSAlmanacStatus; GPSFixStatus = copyFrom.GPSFixStatus; GPSAlmanacOffset = copyFrom.GPSAlmanacOffset; VideoCameraFrameIdLo = copyFrom.VideoCameraFrameIdLo; VideoCameraFrameIdHi = copyFrom.VideoCameraFrameIdHi; HardwareTimerFrameIdLo = copyFrom.HardwareTimerFrameIdLo; HardwareTimerFrameIdHi = copyFrom.HardwareTimerFrameIdHi; IntegratedFrames = copyFrom.IntegratedFrames; EndFrameNtpTimeStampMillisecondsLo = copyFrom.EndFrameNtpTimeStampMillisecondsLo; EndFrameNtpTimeStampMillisecondsHi = copyFrom.EndFrameNtpTimeStampMillisecondsHi; EndFrameSecondaryTimeStampMillisecondsLo = copyFrom.EndFrameSecondaryTimeStampMillisecondsLo; EndFrameSecondaryTimeStampMillisecondsHi = copyFrom.EndFrameSecondaryTimeStampMillisecondsHi; NtpTimeStampError = copyFrom.NtpTimeStampError; }
//ADVRESULT ADV2GetFrameStatusChannel(long frameNo, AdvLib::AdvFrameInfo* frameInfo, char* gpsFix, char* userCommand, char* systemError); public static extern int ADV2GetFrameStatusChannel(int frameNo, [In, Out] AdvFrameInfoNative frameInfo, [In, Out] byte[] gpsFix, [In, Out] byte[] userCommand, [In, Out] byte[] systemError);
// DLL_PUBLIC HRESULT ADVGetIntegratedFrame(long startFrameNo, long framesToIntegrate, bool isSlidingIntegration, bool isMedianAveraging, unsigned long* pixels, unsigned long* originalPixels, BYTE* bitmapBytes, BYTE* bitmapDisplayBytes, AdvLib::AdvFrameInfo* frameInfo); public static extern int ADVGetIntegratedFrame(int startFrameNo, int framesToIntegrate, bool isSlidingIntegration, bool isMedianAveraging, [Out] uint[] pixels, [In, Out] uint[] originalPixels, [Out] byte[] bitmapBytes, [Out] byte[] bitmapDisplayBytes, [In, Out] AdvFrameInfoNative frameInfo);
// DLL_PUBLIC HRESULT ADVGetFrame(long frameNo, unsigned long* pixels, unsigned long* originalPixels, BYTE* bitmapPixels, BYTE* bitmapBytes, AdvLib::AdvFrameInfo* frameInfo, char* gpsFix, char* userCommand, char* systemError); public static extern int ADVGetFrame(int frameNo, [In, Out] uint[] pixels, [In, Out] uint[] originalPixels, [In, Out] byte[] bitmapBytes, [In, Out] byte[] bitmapDisplayBytes, [In, Out] AdvFrameInfoNative frameInfo, [In, Out] byte[] gpsFix, [In, Out] byte[] userCommand, [In, Out] byte[] systemError);
public AdvFrameInfo GetStatusChannel(int index) { var frameInfo = new AdvFrameInfoNative(); byte[] gpsFix = new byte[256 * 16]; byte[] userCommand = new byte[256 * 16]; byte[] systemError = new byte[256 * 16]; lock (m_SyncLock) { TangraCore.ADVGetFrameStatusChannel(index, frameInfo, gpsFix, userCommand, systemError); } var rv = new AdvFrameInfo(frameInfo) { UserCommandString = AdvFrameInfo.GetStringFromBytes(userCommand), SystemErrorString = AdvFrameInfo.GetStringFromBytes(systemError), GPSFixString = AdvFrameInfo.GetStringFromBytes(gpsFix) }; return rv; }
public Pixelmap GetPixelmap(int index) { if (index >= m_FirstFrame + m_CountFrames) throw new ApplicationException("Invalid frame position: " + index); uint[] pixels = new uint[m_Width * m_Height]; uint[] unprocessedPixels = new uint[m_Width * m_Height]; byte[] displayBitmapBytes = new byte[m_Width * m_Height]; byte[] rawBitmapBytes = new byte[(m_Width * m_Height * 3) + 40 + 14 + 1]; var frameInfo = new AdvFrameInfoNative(); byte[] gpsFix = new byte[256 * 16]; byte[] userCommand = new byte[256 * 16]; byte[] systemError = new byte[256 * 16]; lock (m_SyncLock) { TangraCore.ADVGetFrame(index, pixels, unprocessedPixels, rawBitmapBytes, displayBitmapBytes, frameInfo, gpsFix, userCommand, systemError); } m_CurrentFrameInfo = new AdvFrameInfo(frameInfo); m_CurrentFrameInfo.UserCommandString = AdvFrameInfo.GetStringFromBytes(userCommand); m_CurrentFrameInfo.SystemErrorString = AdvFrameInfo.GetStringFromBytes(systemError); m_CurrentFrameInfo.GPSFixString = AdvFrameInfo.GetStringFromBytes(gpsFix); if (m_Engine == "AAV" && m_CurrentFrameInfo.IntegratedFrames > 0 && TangraConfig.Settings.AAV.SplitFieldsOSD && m_OsdFirstLine * m_OsdLastLine != 0) { TangraCore.BitmapSplitFieldsOSD(rawBitmapBytes, m_OsdFirstLine, m_OsdLastLine); } if (frameInfo.HasNtpTimeStamp && m_CurrentFrameInfo.Exposure10thMs == 0 && index + 1 < m_FirstFrame + m_CountFrames) { lock (m_SyncLock) { TangraCore.ADVGetFrameStatusChannel(index + 1, frameInfo, gpsFix, userCommand, systemError); } if (frameInfo.HasNtpTimeStamp) m_CurrentFrameInfo.Exposure10thMs = (int)Math.Round(new TimeSpan(frameInfo.EndExposureNtpTimeStamp.Ticks - m_CurrentFrameInfo.EndExposureNtpTimeStamp.Ticks).TotalMilliseconds * 10); } using (MemoryStream memStr = new MemoryStream(rawBitmapBytes)) { Bitmap displayBitmap; if (m_Engine == "AAV" && m_CurrentFrameInfo.IntegratedFrames == 0) { // This is a VTI Split reference frame. Put some mark on it to mark it as such?? displayBitmap = Pixelmap.ConstructBitmapFromBitmapPixels(pixels, m_Width, m_Height); for (int i = 0; i < pixels.Length; i++) displayBitmapBytes[i] = (byte) pixels[i]; } else { try { displayBitmap = (Bitmap)Bitmap.FromStream(memStr); } catch (Exception ex) { Trace.WriteLine(ex.GetFullStackTrace()); displayBitmap = new Bitmap(m_Width, m_Height); } } var rv = new Pixelmap(m_Width, m_Height, m_BitPix, pixels, displayBitmap, displayBitmapBytes); rv.SetMaxSignalValue(m_Aav16NormVal); rv.FrameState = GetCurrentFrameState(index); rv.UnprocessedPixels = unprocessedPixels; return rv; } }
public Pixelmap GetIntegratedFrame(int startFrameNo, int framesToIntegrate, bool isSlidingIntegration, bool isMedianAveraging) { if (startFrameNo < 0 || startFrameNo >= m_FirstFrame + m_CountFrames) throw new ApplicationException("Invalid frame position: " + startFrameNo); int actualFramesToIntegrate = Math.Min(startFrameNo + framesToIntegrate, m_FirstFrame + m_CountFrames - 1) - startFrameNo; uint[] pixels = new uint[m_Width * m_Height]; uint[] unprocessedPixels = new uint[m_Width * m_Height]; byte[] displayBitmapBytes = new byte[m_Width * m_Height]; byte[] rawBitmapBytes = new byte[(m_Width * m_Height * 3) + 40 + 14 + 1]; var frameInfo = new AdvFrameInfoNative(); lock (m_SyncLock) { TangraCore.ADVGetIntegratedFrame(startFrameNo, actualFramesToIntegrate, isSlidingIntegration, isMedianAveraging, pixels, unprocessedPixels, rawBitmapBytes, displayBitmapBytes, frameInfo); } m_CurrentFrameInfo = new AdvFrameInfo(frameInfo); using (MemoryStream memStr = new MemoryStream(rawBitmapBytes)) { Bitmap displayBitmap = (Bitmap)Bitmap.FromStream(memStr); var rv = new Pixelmap(m_Width, m_Height, m_BitPix, pixels, displayBitmap, displayBitmapBytes); rv.SetMaxSignalValue(m_Aav16NormVal); rv.UnprocessedPixels = unprocessedPixels; return rv; } }
public FrameStateData GetFrameStatusChannel(int index) { if (index >= m_FirstFrame + m_CountFrames) throw new ApplicationException("Invalid frame position: " + index); var frameInfo = new AdvFrameInfoNative(); byte[] gpsFix = new byte[256 * 16]; byte[] userCommand = new byte[256 * 16]; byte[] systemError = new byte[256 * 16]; lock (m_SyncLock) { TangraCore.ADVGetFrameStatusChannel(index, frameInfo, gpsFix, userCommand, systemError); } var frameStatusChannel = new AdvFrameInfo(frameInfo); frameStatusChannel.UserCommandString = AdvFrameInfo.GetStringFromBytes(userCommand); frameStatusChannel.SystemErrorString = AdvFrameInfo.GetStringFromBytes(systemError); frameStatusChannel.GPSFixString = AdvFrameInfo.GetStringFromBytes(gpsFix); return AdvFrameInfoToFrameStateData(frameStatusChannel, index); }