
// pwm_outputDlg.cpp : t@C
//

#include "stdafx.h"
#include "pwm_output.h"
#include "pwm_outputDlg.h"
#include "afxdialogex.h"
#include "CDio.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// Cpwm_outputDlg _CAO

//==========================================
// O[oϐ
//==========================================
short	dev_id;					// foCXID

Cpwm_outputDlg::Cpwm_outputDlg(CWnd* pParent /*=NULL*/)
	: CDialogEx(IDD_PWM_OUTPUT_DIALOG, pParent)
{
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void Cpwm_outputDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_EDIT_DEVICE_NAME, m_DeviceName);
	DDX_Control(pDX, IDC_COMBO_CHANNEL_NUM, m_ChannelNum);
	DDX_Control(pDX, IDC_EDIT_RETURN_CODE, m_ReturnCode);
	DDX_Control(pDX, IDC_EDIT_PULSE_PERIOD0, m_PulsePeriodValue0);
	DDX_Control(pDX, IDC_EDIT_PULSE_PERIOD1, m_PulsePeriodValue1);
	DDX_Control(pDX, IDC_EDIT_PULSE_PERIOD2, m_PulsePeriodValue2);
	DDX_Control(pDX, IDC_EDIT_PULSE_PERIOD3, m_PulsePeriodValue3);
	DDX_Control(pDX, IDC_COMBO_PERIOD_UNIT0, m_PeriodUnit0);
	DDX_Control(pDX, IDC_COMBO_PERIOD_UNIT1, m_PeriodUnit1);
	DDX_Control(pDX, IDC_COMBO_PERIOD_UNIT2, m_PeriodUnit2);
	DDX_Control(pDX, IDC_COMBO_PERIOD_UNIT3, m_PeriodUnit3);
	DDX_Control(pDX, IDC_EDIT_PULSE_DUTY0, m_PulseDutyValue0);
	DDX_Control(pDX, IDC_EDIT_PULSE_DUTY1, m_PulseDutyValue1);
	DDX_Control(pDX, IDC_EDIT_PULSE_DUTY2, m_PulseDutyValue2);
	DDX_Control(pDX, IDC_EDIT_PULSE_DUTY3, m_PulseDutyValue3);
	DDX_Control(pDX, IDC_COMBO_PULSE_PHASE0, m_PulsePhase0);
	DDX_Control(pDX, IDC_COMBO_PULSE_PHASE1, m_PulsePhase1);
	DDX_Control(pDX, IDC_COMBO_PULSE_PHASE2, m_PulsePhase2);
	DDX_Control(pDX, IDC_COMBO_PULSE_PHASE3, m_PulsePhase3);
	DDX_Control(pDX, IDC_EDIT_PWM_STATUS0, m_PwmStatus0);
	DDX_Control(pDX, IDC_EDIT_PWM_STATUS1, m_PwmStatus1);
	DDX_Control(pDX, IDC_EDIT_PWM_STATUS2, m_PwmStatus2);
	DDX_Control(pDX, IDC_EDIT_PWM_STATUS3, m_PwmStatus3);
	DDX_Control(pDX, IDC_EDIT_PWM_ERROR0, m_PwmError0);
	DDX_Control(pDX, IDC_EDIT_PWM_ERROR1, m_PwmError1);
	DDX_Control(pDX, IDC_EDIT_PWM_ERROR2, m_PwmError2);
	DDX_Control(pDX, IDC_EDIT_PWM_ERROR3, m_PwmError3);
}

BEGIN_MESSAGE_MAP(Cpwm_outputDlg, CDialogEx)
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_BUTTON_DIO_INIT,&Cpwm_outputDlg::OnBnClickedButtonDioInit)
	ON_BN_CLICKED(IDC_BUTTON_DIO_EXIT,&Cpwm_outputDlg::OnBnClickedButtonDioExit)
	ON_BN_CLICKED(IDC_BUTTON_EXIT,&Cpwm_outputDlg::OnBnClickedButtonExit)
	ON_BN_CLICKED(IDC_BUTTON_DIO_SET_PWM_PULSE_PERIOD,&Cpwm_outputDlg::OnBnClickedButtonDioSetPwmPulsePeriod)
	ON_BN_CLICKED(IDC_BUTTON_DIO_SET_PWM_PULSE_DUTY,&Cpwm_outputDlg::OnBnClickedButtonDioSetPwmPulseDuty)
	ON_BN_CLICKED(IDC_BUTTON_DIO_SET_PWM_PULSE_PHASE,&Cpwm_outputDlg::OnBnClickedButtonDioSetPwmPulsePhase)
	ON_BN_CLICKED(IDC_BUTTON_DIO_START_PWM,&Cpwm_outputDlg::OnBnClickedButtonDioStartPwm)
	ON_BN_CLICKED(IDC_BUTTON_DIO_STOP_PWM,&Cpwm_outputDlg::OnBnClickedButtonDioStopPwm)
	ON_BN_CLICKED(IDC_BUTTON_DIO_GET_PWM_STATUS,&Cpwm_outputDlg::OnBnClickedButtonDioGetPwmStatus)
END_MESSAGE_MAP()


// Cpwm_outputDlg bZ[W nh[
//=========================================================
// _CAO
//=========================================================
BOOL Cpwm_outputDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// ̃_CAÕACRݒ肵܂BAvP[ṼC EBhE_CAOłȂꍇA
	//  Framework ́A̐ݒIɍs܂B
	SetIcon(m_hIcon, TRUE);			// 傫ACR̐ݒ
	SetIcon(m_hIcon, FALSE);		// ACR̐ݒ

	short	ch_no;
	TCHAR	cstr[256];
	//----------------------------------------
	// Rg[zݒ
	//----------------------------------------
	//--------------------
	// pXRg[
	//--------------------
	m_PulsePeriodValue[0]	= &m_PulsePeriodValue0;
	m_PulsePeriodValue[1]	= &m_PulsePeriodValue1;
	m_PulsePeriodValue[2]	= &m_PulsePeriodValue2;
	m_PulsePeriodValue[3]	= &m_PulsePeriodValue3;
	//--------------------
	// pXPʃRg[
	//--------------------
	m_PeriodUnit[0]			= &m_PeriodUnit0;
	m_PeriodUnit[1]			= &m_PeriodUnit1;
	m_PeriodUnit[2]			= &m_PeriodUnit2;
	m_PeriodUnit[3]			= &m_PeriodUnit3;
	//--------------------
	// pXf[eBRg[
	//--------------------
	m_PulseDutyValue[0]		= &m_PulseDutyValue0;
	m_PulseDutyValue[1]		= &m_PulseDutyValue1;
	m_PulseDutyValue[2]		= &m_PulseDutyValue2;
	m_PulseDutyValue[3]		= &m_PulseDutyValue3;
	//--------------------
	// pXʑVtgRg[
	//--------------------
	m_PulsePhase[0]			= &m_PulsePhase0;
	m_PulsePhase[1]			= &m_PulsePhase1;
	m_PulsePhase[2]			= &m_PulsePhase2;
	m_PulsePhase[3]			= &m_PulsePhase3;
	//--------------------
	// PWMXe[^XRg[
	//--------------------
	m_PwmStatus[0]			= &m_PwmStatus0;
	m_PwmStatus[1]			= &m_PwmStatus1;
	m_PwmStatus[2]			= &m_PwmStatus2;
	m_PwmStatus[3]			= &m_PwmStatus3;
	//--------------------
	// PWMG[Rg[
	//--------------------
	m_PwmError[0]			= &m_PwmError0;
	m_PwmError[1]			= &m_PwmError1;
	m_PwmError[2]			= &m_PwmError2;
	m_PwmError[3]			= &m_PwmError3;
	//----------------------------------------
	// ʕ\̏
	//----------------------------------------
	//--------------------
	// foCX
	//--------------------
	m_DeviceName.SetWindowText(_T("DIO000"));
	//--------------------
	// `l
	//--------------------
	m_ChannelNum.AddString(_T("1"));
	m_ChannelNum.AddString(_T("2"));
	m_ChannelNum.AddString(_T("3"));
	m_ChannelNum.AddString(_T("4"));
	m_ChannelNum.SelectString(-1, _T("4"));
	//--------------------
	// e`lƂ
	//--------------------
	for(ch_no = 0; ch_no < MAX_PWM_CH; ch_no++){
		//--------------------
		// pXRg[
		//--------------------
		wsprintf(cstr, _T("%u"), (ch_no + 1) * 100);
		m_PulsePeriodValue[ch_no]->SetWindowText(cstr);
		//--------------------
		// pXPʃRg[
		//--------------------
		m_PeriodUnit[ch_no]->AddString(_T("sec"));
		m_PeriodUnit[ch_no]->AddString(_T("msec"));
		m_PeriodUnit[ch_no]->AddString(_T("usec"));
		m_PeriodUnit[ch_no]->AddString(_T("nsec"));
		m_PeriodUnit[ch_no]->SelectString(-1, _T("msec"));
		//--------------------
		// pXf[eBRg[
		//--------------------
		wsprintf(cstr, _T("%u"), 32767);
		m_PulseDutyValue[ch_no]->SetWindowText(cstr);
		//--------------------
		// pXʑVtgRg[
		//--------------------
		m_PulsePhase[ch_no]->AddString(_T("0"));
		m_PulsePhase[ch_no]->AddString(_T("90"));
		m_PulsePhase[ch_no]->AddString(_T("180"));
		m_PulsePhase[ch_no]->SelectString(-1, _T("0"));
		//--------------------
		// PWMXe[^XRg[
		//--------------------
		m_PwmStatus[ch_no]->SetWindowText(_T(""));
		//--------------------
		// PWMG[Rg[
		//--------------------
		m_PwmError[ch_no]->SetWindowText(_T(""));
	}
	
	return TRUE;  // tH[JXRg[ɐݒ肵ꍇATRUE Ԃ܂B
}

// _CAOɍŏ{^ǉꍇAACR`悷邽߂
//  ̃R[hKvłBhLg/r[ fg MFC AvP[V̏ꍇA
//  ́AFramework ɂĎIɐݒ肳܂B

void Cpwm_outputDlg::OnPaint()
{
	if (IsIconic())
	{
		CPaintDC dc(this); // `̃foCX ReLXg

		SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);

		// NCAg̎lp`̈̒
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// ACR̕`
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialogEx::OnPaint();
	}
}

// [U[ŏEBhEhbOĂƂɕ\J[\擾邽߂ɁA
//  VXe̊֐Ăяo܂B
HCURSOR Cpwm_outputDlg::OnQueryDragIcon()
{
	return static_cast<HCURSOR>(m_hIcon);
}

//=========================================================
// DioInit{^NbNۂ̏ɂȂ܂
// foCX̏s܂
//=========================================================
void Cpwm_outputDlg::OnBnClickedButtonDioInit()
{
	TCHAR	sz_device_name[256];
	TCHAR	return_string[256];
	char	device_name[256];
	char	error_string[256];
	long	ret;

	//----------------------------------------
	// foCX擾
	//----------------------------------------
	m_DeviceName.GetWindowText(sz_device_name, _countof(sz_device_name));
	sprintf_s(device_name, "%S", sz_device_name);
	//----------------------------------------
	// AfoCXID擾
	//----------------------------------------
	ret	= DioInit(device_name, &dev_id);
	//----------------------------------------
	// G[
	//----------------------------------------
	DioGetErrorString(ret, error_string);
	wsprintf(return_string, _T("DioInit = %d : %S"), ret, error_string);
	m_ReturnCode.SetWindowText(return_string);
}

//=========================================================
// DioSetPwmPulsePeriod{^NbNۂ̏ɂȂ܂
// foCXPWMpXݒs܂
//=========================================================
void Cpwm_outputDlg::OnBnClickedButtonDioSetPwmPulsePeriod()
{
	TCHAR				cstr[256];
	TCHAR				return_string[256];
	char				error_string[256];
	unsigned long long	pulse_period_value[MAX_PWM_CH];
	unsigned short		pulse_period_unit[MAX_PWM_CH];
	short				ch_no_array[MAX_PWM_CH];
	long				ret;
	short				ch_no;
	short				pwm_ch_num;
	
	//----------------------------------------
	// `l̎擾
	//----------------------------------------
	m_ChannelNum.GetLBText(m_ChannelNum.GetCurSel(), cstr);
	pwm_ch_num	= (short)wcstoul(cstr, NULL, 10);
	//----------------------------------------
	// e`lƂ
	//----------------------------------------
	for(ch_no = 0; ch_no < pwm_ch_num; ch_no++){
		//----------------------------------------
		// `lԍi[
		//----------------------------------------
		ch_no_array[ch_no]	= ch_no;
		//----------------------------------------
		// PWMpXwl擾
		//----------------------------------------
		m_PulsePeriodValue[ch_no]->GetWindowText(cstr, _countof(cstr));
		pulse_period_value[ch_no]	= wcstoull(cstr, NULL, 10);
		//----------------------------------------
		// pXPʎwl擾
		//----------------------------------------
		m_PeriodUnit[ch_no]->GetLBText(m_PeriodUnit[ch_no]->GetCurSel(), cstr);
		if(wcscmp(cstr, _T("sec")) == 0){
			pulse_period_unit[ch_no]	= DIO_PWM_PULSE_UNIT_S;
		}else if(wcscmp(cstr, _T("msec")) == 0){
			pulse_period_unit[ch_no]	= DIO_PWM_PULSE_UNIT_MS;
		}else if(wcscmp(cstr, _T("usec")) == 0){
			pulse_period_unit[ch_no]	= DIO_PWM_PULSE_UNIT_US;
		}else{
			pulse_period_unit[ch_no]	= DIO_PWM_PULSE_UNIT_NS;
		}
	}
	//----------------------------------------
	// PWMpXݒ菈
	//----------------------------------------
	ret	= DioSetPwmPulsePeriod(dev_id, ch_no_array, pwm_ch_num, pulse_period_value, pulse_period_unit);
	//----------------------------------------
	// G[
	//----------------------------------------
	DioGetErrorString(ret, error_string);
	wsprintf(return_string, _T("DioSetPwmPulsePeriod = %d : %S"), ret, error_string);
	m_ReturnCode.SetWindowText(return_string);
}

//=========================================================
// DioSetPwmPulseDuty{^NbNۂ̏ɂȂ܂
// foCXPWMpXf[eBݒs܂
//=========================================================
void Cpwm_outputDlg::OnBnClickedButtonDioSetPwmPulseDuty()
{
	TCHAR			cstr[256];
	TCHAR			return_string[256];
	char			error_string[256];
	unsigned short	pulse_duty[MAX_PWM_CH];
	short			ch_no_array[MAX_PWM_CH];
	long			ret;
	short			ch_no;
	short			pwm_ch_num;
	
	//----------------------------------------
	// `l̎擾
	//----------------------------------------
	m_ChannelNum.GetLBText(m_ChannelNum.GetCurSel(), cstr);
	pwm_ch_num	= (short)wcstoul(cstr, NULL, 10);
	//----------------------------------------
	// e`lƂ
	//----------------------------------------
	for(ch_no = 0; ch_no < pwm_ch_num; ch_no++){
		//----------------------------------------
		// `lԍi[
		//----------------------------------------
		ch_no_array[ch_no]	= ch_no;
		//----------------------------------------
		// PWMpXf[eBl擾
		//----------------------------------------
		m_PulseDutyValue[ch_no]->GetWindowText(cstr, _countof(cstr));
		pulse_duty[ch_no]	= (unsigned short)wcstoul(cstr, NULL, 10);
	}
	//----------------------------------------
	// PWMpXf[eBݒ菈
	//----------------------------------------
	ret	= DioSetPwmPulseDuty(dev_id, ch_no_array, pwm_ch_num, pulse_duty);
	//----------------------------------------
	// G[
	//----------------------------------------
	DioGetErrorString(ret, error_string);
	wsprintf(return_string, _T("DioSetPwmPulseDuty = %d : %S"), ret, error_string);
	m_ReturnCode.SetWindowText(return_string);
}

//=========================================================
// DioSetPwmPulsePhase{^NbNۂ̏ɂȂ܂
// foCXPWMpXʑVtgݒs܂
//=========================================================
void Cpwm_outputDlg::OnBnClickedButtonDioSetPwmPulsePhase()
{
	TCHAR	cstr[256];
	TCHAR	return_string[256];
	char	error_string[256];
	short	pulse_phase[MAX_PWM_CH];
	short	ch_no_array[MAX_PWM_CH];
	long	ret;
	short	ch_no;
	short	pwm_ch_num;
	
	//----------------------------------------
	// `l̎擾
	//----------------------------------------
	m_ChannelNum.GetLBText(m_ChannelNum.GetCurSel(), cstr);
	pwm_ch_num	= (short)wcstoul(cstr, NULL, 10);
	//----------------------------------------
	// e`lƂ
	//----------------------------------------
	for(ch_no = 0; ch_no < pwm_ch_num; ch_no++){
		//----------------------------------------
		// `lԍi[
		//----------------------------------------
		ch_no_array[ch_no]	= ch_no;
		//----------------------------------------
		// PWMpXʑVtgwl擾
		//----------------------------------------
		m_PulsePhase[ch_no]->GetLBText(m_PulsePhase[ch_no]->GetCurSel(), cstr);
		if(wcscmp(cstr, _T("0")) == 0){
			pulse_phase[ch_no]	= DIO_PWM_PULSE_PHASE_0_DEGREES;
		}else if(wcscmp(cstr, _T("90")) == 0){
			pulse_phase[ch_no]	= DIO_PWM_PULSE_PHASE_90_DEGREES;
		}else{
			pulse_phase[ch_no]	= DIO_PWM_PULSE_PHASE_180_DEGREES;
		}
	}
	//----------------------------------------
	// PWMpXʑVtgݒ菈
	//----------------------------------------
	ret	= DioSetPwmPulsePhase(dev_id, ch_no_array, pwm_ch_num, pulse_phase);
	//----------------------------------------
	// G[
	//----------------------------------------
	DioGetErrorString(ret, error_string);
	wsprintf(return_string, _T("DioSetPwmPulsePhase = %d : %S"), ret, error_string);
	m_ReturnCode.SetWindowText(return_string);
}

//=========================================================
// DioStartPwm{^NbNۂ̏ɂȂ܂
// PWMpXo͂Jn܂
//=========================================================
void Cpwm_outputDlg::OnBnClickedButtonDioStartPwm()
{
	TCHAR	cstr[256];
	TCHAR	return_string[256];
	char	error_string[256];
	short	ch_no_array[MAX_PWM_CH];
	long	ret;
	short	ch_no;
	short	pwm_ch_num;
	
	//----------------------------------------
	// `l̎擾
	//----------------------------------------
	m_ChannelNum.GetLBText(m_ChannelNum.GetCurSel(), cstr);
	pwm_ch_num	= (short)wcstoul(cstr, NULL, 10);
	//----------------------------------------
	// e`lƂ
	//----------------------------------------
	for(ch_no = 0; ch_no < pwm_ch_num; ch_no++){
		//----------------------------------------
		// `lԍi[
		//----------------------------------------
		ch_no_array[ch_no]	= ch_no;
	}
	//----------------------------------------
	// PWMpXo͊Jn
	//----------------------------------------
	ret	= DioStartPwm(dev_id, ch_no_array, pwm_ch_num);
	//----------------------------------------
	// G[
	//----------------------------------------
	DioGetErrorString(ret, error_string);
	wsprintf(return_string, _T("DioStartPwm = %d : %S"), ret, error_string);
	m_ReturnCode.SetWindowText(return_string);
}

//=========================================================
// DioStopPwm{^NbNۂ̏ɂȂ܂
// PWMpXo͂~܂
//=========================================================
void Cpwm_outputDlg::OnBnClickedButtonDioStopPwm()
{
	TCHAR	cstr[256];
	TCHAR	return_string[256];
	char	error_string[256];
	short	ch_no_array[MAX_PWM_CH];
	long	ret;
	short	ch_no;
	short	pwm_ch_num;
	
	//----------------------------------------
	// `l̎擾
	//----------------------------------------
	m_ChannelNum.GetLBText(m_ChannelNum.GetCurSel(), cstr);
	pwm_ch_num	= (short)wcstoul(cstr, NULL, 10);
	//----------------------------------------
	// e`lƂ
	//----------------------------------------
	for(ch_no = 0; ch_no < pwm_ch_num; ch_no++){
		//----------------------------------------
		// `lԍi[
		//----------------------------------------
		ch_no_array[ch_no]	= ch_no;
	}
	//----------------------------------------
	// PWMpXo͒~
	//----------------------------------------
	ret	= DioStopPwm(dev_id, ch_no_array, pwm_ch_num);
	//----------------------------------------
	// G[
	//----------------------------------------
	DioGetErrorString(ret, error_string);
	wsprintf(return_string, _T("DioStopPwm = %d : %S"), ret, error_string);
	m_ReturnCode.SetWindowText(return_string);
}

//=========================================================
// DioGetPwmStatus{^NbNۂ̏ɂȂ܂
// PWMXe[^X擾܂
//=========================================================
void Cpwm_outputDlg::OnBnClickedButtonDioGetPwmStatus()
{
	TCHAR			cstr[256];
	TCHAR			return_string[256];
	char			error_string[256];
	unsigned short	pwm_status[MAX_PWM_CH];
	unsigned short	pwm_error[MAX_PWM_CH];
	short			ch_no_array[MAX_PWM_CH];
	long			ret;
	short			ch_no;
	short			pwm_ch_num;
	
	//----------------------------------------
	// `l̎擾
	//----------------------------------------
	m_ChannelNum.GetLBText(m_ChannelNum.GetCurSel(), cstr);
	pwm_ch_num	= (short)wcstoul(cstr, NULL, 10);
	//----------------------------------------
	// e`lƂ
	//----------------------------------------
	for(ch_no = 0; ch_no < pwm_ch_num; ch_no++){
		//----------------------------------------
		// `lԍi[
		//----------------------------------------
		ch_no_array[ch_no]	= ch_no;
	}
	//----------------------------------------
	// PWMXe[^X擾
	//----------------------------------------
	ret	= DioGetPwmStatus(dev_id, ch_no_array, pwm_ch_num, pwm_status, pwm_error);
	//----------------------------------------
	// G[
	//----------------------------------------
	DioGetErrorString(ret, error_string);
	wsprintf(return_string, _T("DioGetPwmStatus = %d : %S"), ret, error_string);
	m_ReturnCode.SetWindowText(return_string);
	//----------------------------------------
	// G[̏ꍇI
	//----------------------------------------
	if(ret != DIO_ERR_SUCCESS){
		return;
	}
	//----------------------------------------
	// e`lƂ
	//----------------------------------------
	for(ch_no = 0; ch_no < pwm_ch_num; ch_no++){
		//----------------------------------------
		// PWMXe[^X\XV
		//----------------------------------------
		_itow_s(pwm_status[ch_no], cstr, 16);
		m_PwmStatus[ch_no]->SetWindowText(cstr);
		//----------------------------------------
		// PWMG[\XV
		//----------------------------------------
		_itow_s(pwm_error[ch_no], cstr, 16);
		m_PwmError[ch_no]->SetWindowText(cstr);
	}
}

//=========================================================
// DioExit{^NbNۂ̏ɂȂ܂
// foCX̏Is܂
//=========================================================
void Cpwm_outputDlg::OnBnClickedButtonDioExit()
{
	TCHAR	return_string[256];
	char	error_string[256];
	long	ret;

	//----------------------------------------
	// I
	//----------------------------------------
	ret	= DioExit(dev_id);
	//----------------------------------------
	// G[
	//----------------------------------------
	DioGetErrorString(ret, error_string);
	wsprintf(return_string, _T("DioExit = %d : %S"), ret, error_string);
	m_ReturnCode.SetWindowText(return_string);
}

//=========================================================
// NbNۂ̏ɂȂ܂
// foCX̏IsAAvP[VI܂
//=========================================================
void Cpwm_outputDlg::OnBnClickedButtonExit()
{
	//----------------------------------------
	// I
	//----------------------------------------
	DioExit(dev_id);
	//----------------------------------------
	// _CAOI
	//----------------------------------------
	CDialog::OnOK();
}
