
// RTXCaptureDemoToolDlg.h : header file
//

#pragma once

#include "mipiCntrlDef.h"

#define WM_MIPI_DEVICEARRIVAL					WM_USER+1
#define WM_MIPI_DEVICEREMOVECOMPLETE			WM_USER+2
#define WM_MIPI_PROGRESS_MONITOR				WM_USER+3

#define __APP_MONITOR_START__					1
#define __APP_MONITOR_STOP__					2

#define __Timer_Dots__							1
#define __Timer_MonitorApp__					2

typedef  int		__HZHANDLE__;

//typedef struct
//{
//	int				nZebraBoardId;			// set in dip-switch or port - id when without dip-switch on carrier board (<0 port and locked)
//	int				nZebraType;				// Zebra4=0, Zebra5=1, ...
//	int				nZebraStatus;			// __Zebra_Open_usable__(2), __Zebra_Open_DrvNoApp__(1), __Zebra_NotYet_Init__(0), __Zebra_InValid__(-1), __Zebra_Removed__(-2)
//} __ZEBRA_BOARD_INFO__, *__PZEBRA_BOARD_INFO__;


#define	__GRAB_IMG_ACT_GOING__				0


#define	__GRAB_IMG_GOT__					0
#define	__GRAB_IMG_NON_PIC__				-1
#define	__GRAB_IMG_START_INDX_TOO_LOW__		-2
#define	__GRAB_IMG_LAST_INDX_OVER__			-3
#define __GRAB_IMG_RUN_STEP_ERR__			-4

#define  __GRAB_IMAGE_BUFFER_COUNT__		16
typedef struct {
	int nGrabStart;
	int nGrabLast;

	int nGrabbeResult;
	int nQueHead, nQueTail;
	DWORD dwImageSize[__GRAB_IMAGE_BUFFER_COUNT__];
	UCHAR *pGrabBuffer[__GRAB_IMAGE_BUFFER_COUNT__];

	DWORD	hThrdId;
	HANDLE	hGrabThrd;
	HANDLE	hGrabThrdCmd;
	HANDLE	hGrabThrdRslt;

	BOOL	bExit;
	int		GrabAct;
} __GRAB_IMAGES__, *__PGRAB_IMAGES;

// CRTXCaptureDemoToolDlg dialog
class CRTXCaptureDemoToolDlg : public CDialogEx
{
// Construction
public:
	CRTXCaptureDemoToolDlg(CWnd* pParent = NULL);	// standard constructor
	HWND	m_hwndProgress;
	__HZHANDLE__ m_Zhandle;

// Dialog Data
	enum { IDD = IDD_RTXCAPTUREDEMOTOOL_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support

	DWORD	m_dwMSVer, m_dwLSVer;
	TCHAR   m_szProgVersion[64];

	int		m_MaxTestStep;
	int     m_FoundZebras;
	int		m_AvailableIndx;


	HANDLE  m_hDialogThrd;
	DWORD   m_ThrdId;

	CButton	m_chkIgnoreAck;
	CButton	m_chkRaw8To10;
	CButton m_chkShowTime;
	CButton	m_scriptchkRaw8To10;
	CButton m_RDO_Read;
	CButton m_RDO_Write;

	CButton m_RDO_App;
	CButton m_RDO_Usb;

	CButton m_RDO_Alais;
	CButton m_RDO_File;

	CComboBox m_Combo_I2CAddrBits;
	CComboBox m_Combo_I2CRdSubAddrBytes;
	CComboBox m_Combo_AliasNames;

public:
	__PGRAB_IMAGES pGrabCtrl;
	// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();

	void displayDownloadedInfo(void);

	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedOk();
	afx_msg void OnBnClickedCancel();
	afx_msg void OnBnClickedBtnDwldOk();
	afx_msg void OnBnClickedBtnGotTeststep();
	afx_msg void OnBnClickedBtnCreateTemplate();
	afx_msg void OnBnClickedBtnI2c();
	afx_msg void OnCbnSelchangeCmbRdSubaddr();
	afx_msg void OnBnClickedChkRead();
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
	afx_msg void OnBnClickedRdoWrite();
	afx_msg void OnBnClickedRdoRead();
	afx_msg void OnBnClickedBtnReset();
	afx_msg void OnBnClickedBtnZebraStatus();
	afx_msg void OnBnClickedRdoApp();
	afx_msg void OnBnClickedRdoUsb();
	afx_msg void OnBnClickedBtnAlias();
	afx_msg void OnBnClickedBtnSelScript();
	afx_msg void OnBnClickedBtnOpenLoadFiles();
	afx_msg void OnBnClickedRdoAlias();
	afx_msg void OnBnClickedRdoFile();
	afx_msg void OnBnClickedBtnGetImg();
	afx_msg void OnBnClickedBtnRunScript();
};
