Ejemplo n.º 1
0
void CEpgDataCap_BonDlg::OnBnClickedButtonSet()
{
	// TODO: ここにコントロール通知ハンドラー コードを追加します。
	CSettingDlg setDlg(m_hWnd);
	disableKeyboardHook = TRUE;
	INT_PTR result = setDlg.DoModal();
	disableKeyboardHook = FALSE;
	if( result == IDOK ){

		this->main.ReloadSetting();

		ReloadNWSet();

		WORD ONID;
		WORD TSID;
		WORD SID;
		this->main.GetCh(&ONID, &TSID, &SID);
		this->initONID = ONID;
		this->initTSID = TSID;
		this->initSID = SID;
		ReloadServiceList();
		
		this->minTask = GetPrivateProfileInt( L"Set", L"MinTask", 0, this->moduleIniPath.c_str() );
	}
}
Ejemplo n.º 2
0
DWORD CEpgDataCap_BonDlg::SelectBonDriver(LPCWSTR fileName, BOOL ini)
{
	this->main.CloseBonDriver();
	DWORD err = this->main.OpenBonDriver(fileName);
	if( err != NO_ERR ){
		this->log.Format(L"BonDriverのオープンができませんでした\r\n%s\r\n", fileName);
		SetDlgItemText(IDC_EDIT_LOG, this->log);
		BtnUpdate(GUI_OPEN_FAIL);
	}else{
		this->log = L"";
		SetDlgItemText(IDC_EDIT_LOG, this->log);
		BtnUpdate(GUI_NORMAL);
	}
	ReloadServiceList(ini);
	return err;
}
Ejemplo n.º 3
0
void CEpgDataCap_BonDlg::OnBnClickedButtonSet()
{
	// TODO: ここにコントロール通知ハンドラー コードを追加します。
	CSettingDlg setDlg;
	if( setDlg.DoModal() == IDOK ){

		this->main.ReloadSetting();

		ReloadNWSet();

		WORD ONID;
		WORD TSID;
		WORD SID;
		this->main.GetCh(&ONID, &TSID, &SID);
		this->initONID = ONID;
		this->initTSID = TSID;
		this->initSID = SID;
		ReloadServiceList();
		
		this->minTask = GetPrivateProfileInt( L"Set", L"MinTask", 0, this->moduleIniPath );
	}
}
Ejemplo n.º 4
0
LRESULT CEpgDataCap_BonDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	// TODO: ここに特定なコードを追加するか、もしくは基本クラスを呼び出してください。
	switch(message){
	case WM_RESERVE_REC_START:
		{
			BtnUpdate(GUI_OTHER_CTRL);
			if( this->log.Find(L"予約録画中") < 0 ){
				this->log = L"予約録画中\r\n";
				SetDlgItemText(IDC_EDIT_LOG, this->log);
			}
			ChgIconStatus();
		}
		break;
	case WM_RESERVE_REC_STOP:
		{
			BtnUpdate(GUI_NORMAL);
			this->log = L"予約録画終了しました\r\n";
			SetDlgItemText(IDC_EDIT_LOG, this->log);
			ChgIconStatus();
		}
		break;
	case WM_RESERVE_EPGCAP_START:
		{
			SetTimer(TIMER_EPGCAP_STATSU, 1000, NULL);
			BtnUpdate(GUI_CANCEL_ONLY);
			ChgIconStatus();
		}
		break;
	case WM_RESERVE_EPGCAP_STOP:
		{
			ChgIconStatus();
		}
		break;
	case WM_CHG_TUNER:
		{
			wstring bonDriver = L"";
			this->main.GetOpenBonDriver(&bonDriver);
			this->iniBonDriver = bonDriver.c_str();
			ReloadBonDriver();
			ChgIconStatus();
		}
		break;
	case WM_CHG_CH:
		{
			WORD ONID;
			WORD TSID;
			WORD SID;
			this->main.GetCh(&ONID, &TSID, &SID);
			this->initONID = ONID;
			this->initTSID = TSID;
			this->initSID = SID;
			ReloadServiceList();
			ChgIconStatus();
		}
		break;
	case WM_RESERVE_REC_STANDBY:
		{
			if( wParam == 1 ){
				BtnUpdate(GUI_REC_STANDBY);
				this->log = L"予約録画待機中\r\n";
				SetDlgItemText(IDC_EDIT_LOG, this->log);
			}else if( wParam == 2 ){
				BtnUpdate(GUI_NORMAL);
				this->log = L"視聴モード\r\n";
				SetDlgItemText(IDC_EDIT_LOG, this->log);
			}else{
				BtnUpdate(GUI_NORMAL);
				this->log = L"";
				SetDlgItemText(IDC_EDIT_LOG, this->log);
			}
		}
		break;
	case WM_TRAY_PUSHICON:
		{
			//タスクトレイ関係
			switch(LOWORD(lParam)){
				case WM_LBUTTONDOWN:
					{
						this->iniMin = FALSE;
						ShowWindow(SW_RESTORE);
						SetForegroundWindow();
						KillTimer(RETRY_ADD_TRAY);
						DeleteTaskBar(GetSafeHwnd(), TRAYICON_ID);
					}
					break ;
				default :
					break ;
				}
		}
		break;
	default:
		break;
	}

	return CDialogEx::WindowProc(message, wParam, lParam);
}
Ejemplo n.º 5
0
void CEpgDataCap_BonDlg::OnTimer(UINT_PTR nIDEvent)
{
	// TODO: ここにメッセージ ハンドラー コードを追加するか、既定の処理を呼び出します。
	switch(nIDEvent){
		case TIMER_INIT_DLG:
			{
				KillTimer( TIMER_INIT_DLG );
				if( this->iniMin == TRUE && this->minTask == TRUE){
				    ShowWindow(SW_HIDE);
				}
			}
			break;
		case TIMER_STATUS_UPDATE:
			{
				KillTimer( TIMER_STATUS_UPDATE );
				SetThreadExecutionState(ES_SYSTEM_REQUIRED);

				int iLine = this->editStatus.GetFirstVisibleLine();
				float signal = 0;
				DWORD space = 0;
				DWORD ch = 0;
				ULONGLONG drop = 0;
				ULONGLONG scramble = 0;
				vector<NW_SEND_INFO> udpSendList;
				vector<NW_SEND_INFO> tcpSendList;

				BOOL ret = this->main.GetViewStatusInfo(&signal, &space, &ch, &drop, &scramble, &udpSendList, &tcpSendList);

				if(ret==TRUE){
					this->statusLog.Format(L"Signal: %.02f Drop: %I64d Scramble: %I64d  space: %d ch: %d",signal, drop, scramble, space, ch);
				}else{
					this->statusLog.Format(L"Signal: %.02f Drop: %I64d Scramble: %I64d",signal, drop, scramble);
				}
				this->statusLog += L"\r\n";

				CString udp = L"";
				if( udpSendList.size() > 0 ){
					udp = "UDP送信:";
					for( size_t i=0; i<udpSendList.size(); i++ ){
						CString buff;
						if( udpSendList[i].broadcastFlag == FALSE ){
							buff.Format(L"%s:%d ",udpSendList[i].ipString.c_str(), udpSendList[i].port);
						}else{
							buff.Format(L"%s:%d(Broadcast) ",udpSendList[i].ipString.c_str(), udpSendList[i].port);
						}
						udp += buff;
					}
					udp += L"\r\n";
				}
				this->statusLog += udp;

				CString tcp = L"";
				if( tcpSendList.size() > 0 ){
					tcp = "TCP送信:";
					for( size_t i=0; i<tcpSendList.size(); i++ ){
						CString buff;
						buff.Format(L"%s:%d ",tcpSendList[i].ipString.c_str(), tcpSendList[i].port);
						tcp += buff;
					}
					tcp += L"\r\n";
				}
				this->statusLog += tcp;

				SetDlgItemText(IDC_EDIT_STATUS, this->statusLog);
				editStatus.LineScroll(iLine);

				CString info = L"";
				this->main.GetEpgInfo(this->btnPgNext.GetCheck(), &info);
				if( this->pgInfo.Compare(info) != 0 ){
					this->pgInfo = info;
					SetDlgItemText(IDC_EDIT_PG_INFO, this->pgInfo);
				}
				SetTimer(TIMER_STATUS_UPDATE, 1000, NULL);
			}
			break;
		case TIMER_CHSCAN_STATSU:
			{
				KillTimer( TIMER_CHSCAN_STATSU );
				DWORD space = 0;
				DWORD ch = 0;
				wstring chName = L"";
				DWORD chkNum = 0;
				DWORD totalNum = 0;
				DWORD status = this->main.GetChScanStatus(&space, &ch, &chName, &chkNum, &totalNum);
				if( status == ST_WORKING ){
					this->log.Format(L"%s (%d/%d 残り約 %d 秒)\r\n", chName.c_str(), chkNum, totalNum, (totalNum - chkNum)*10);
					SetDlgItemText(IDC_EDIT_LOG, this->log);
					SetTimer(TIMER_CHSCAN_STATSU, 1000, NULL);
				}else if( status == ST_CANCEL ){
					KillTimer(TIMER_CHSCAN_STATSU);
					this->log = L"キャンセルされました\r\n";
					SetDlgItemText(IDC_EDIT_LOG, this->log);
				}else if( status == ST_COMPLETE ){
					KillTimer(TIMER_CHSCAN_STATSU);
					this->log = L"終了しました\r\n";
					SetDlgItemText(IDC_EDIT_LOG, this->log);
					ReloadServiceList();
					int sel = this->combService.GetCurSel();
					if( sel != CB_ERR ){
						DWORD index = (DWORD)this->combService.GetItemData(sel);
						SelectService(this->serviceList[index].originalNetworkID, this->serviceList[index].transportStreamID, this->serviceList[index].serviceID, this->serviceList[index].space, this->serviceList[index].ch );
					}
					BtnUpdate(GUI_NORMAL);
					ChgIconStatus();

					//同じサービスが別の物理チャンネルにあるかチェック
					wstring msg = L"";
					for( size_t i=0; i<this->serviceList.size(); i++ ){
						for( size_t j=i+1; j<this->serviceList.size(); j++ ){
							if( this->serviceList[i].originalNetworkID == this->serviceList[j].originalNetworkID &&
								this->serviceList[i].transportStreamID == this->serviceList[j].transportStreamID &&
								this->serviceList[i].serviceID == this->serviceList[j].serviceID ){
									wstring log = L"";
									Format(log, L"%s space:%d ch:%d <=> %s space:%d ch:%d\r\n",
										this->serviceList[i].serviceName.c_str(),
										this->serviceList[i].space,
										this->serviceList[i].ch,
										this->serviceList[j].serviceName.c_str(),
										this->serviceList[j].space,
										this->serviceList[j].ch);
									msg += log;
									break;
							}
						}
					}
					if( msg.size() > 0){
						wstring log = L"同一サービスが複数の物理チャンネルで検出されました。\r\n受信環境のよい物理チャンネルのサービスのみ残すように設定を行ってください。\r\n正常に録画できない可能性が出てきます。\r\n\r\n";
						log += msg;
						MessageBox(log.c_str());
					}
				}
			}
			break;
		case TIMER_EPGCAP_STATSU:
			{
				KillTimer( TIMER_EPGCAP_STATSU );
				EPGCAP_SERVICE_INFO info;
				DWORD status = this->main.GetEpgCapStatus(&info);
				if( status == ST_WORKING ){
					int sel = this->combService.GetCurSel();
					if( sel != CB_ERR ){
						DWORD index = (DWORD)this->combService.GetItemData(sel);
						if( info.ONID != this->serviceList[index].originalNetworkID ||
							info.TSID != this->serviceList[index].transportStreamID ||
							info.SID != this->serviceList[index].serviceID ){
						}
						this->initONID = info.ONID;
						this->initTSID = info.TSID;
						this->initSID = info.SID;
						ReloadServiceList();
						this->main.SetSID(info.SID);
					}

					this->log = L"EPG取得中\r\n";
					SetDlgItemText(IDC_EDIT_LOG, this->log);
					SetTimer(TIMER_EPGCAP_STATSU, 1000, NULL);
				}else if( status == ST_CANCEL ){
					KillTimer(TIMER_EPGCAP_STATSU);
					this->log = L"キャンセルされました\r\n";
					SetDlgItemText(IDC_EDIT_LOG, this->log);
				}else if( status == ST_COMPLETE ){
					KillTimer(TIMER_EPGCAP_STATSU);
					this->log = L"終了しました\r\n";
					SetDlgItemText(IDC_EDIT_LOG, this->log);
					BtnUpdate(GUI_NORMAL);
					ChgIconStatus();
				}
			}
			break;
		case TIMER_REC_END:
			{
				this->main.StopRec();
				KillTimer(TIMER_REC_END);
				this->log = L"録画停止しました\r\n";
				SetDlgItemText(IDC_EDIT_LOG, this->log);
				BtnUpdate(GUI_NORMAL);
				chkRecSet.SetCheck(FALSE);
				ChgIconStatus();
			}
			break;
		case RETRY_ADD_TRAY:
			{
				KillTimer(RETRY_ADD_TRAY);
				CString buff=L"";
				wstring bonFile = L"";
				this->main.GetOpenBonDriver(&bonFile);
				CString strBuff2=L"";
				this->combService.GetWindowText(strBuff2);
				buff.Format(L"%s : %s", bonFile.c_str(), strBuff2.GetBuffer(0));

				HICON setIcon = this->iconBlue;
				if( this->main.IsRec() == TRUE ){
					setIcon = this->iconRed;
				}else if( this->main.GetEpgCapStatus(NULL) == ST_WORKING ){
					setIcon = this->iconGreen;
				}else if( this->main.GetOpenBonDriver(NULL) == FALSE ){
					setIcon = this->iconGray;
				}
		
				if( AddTaskBar( GetSafeHwnd(),
						WM_TRAY_PUSHICON,
						TRAYICON_ID,
						setIcon,
						buff ) == FALSE ){
							SetTimer(RETRY_ADD_TRAY, 5000, NULL);
				}
			}
			break;
		default:
			break;
	}
	CDialogEx::OnTimer(nIDEvent);
}