Example #1
0
// CSetDlgBasic メッセージ ハンドラー
BOOL CSetDlgBasic::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  ここに初期化を追加してください
	wstring path;
	GetSettingPath(path);
	settingFolderPath = path.c_str();

	int iNum = GetPrivateProfileInt( L"SET", L"RecFolderNum", 0, commonIniPath );
	if( iNum == 0 ){
		GetDefSettingPath(path);
		recFolderList.AddString( path.c_str() );
	}else{
		for( int i = 0; i < iNum; i++ ){
			CString key = L"";
			key.Format(L"RecFolderPath%d", i );
			WCHAR buff[512]=L"";
			GetPrivateProfileString( L"SET", key, L"", buff, 512, commonIniPath );
			recFolderList.AddString( buff );
		}
	}

	UpdateData(FALSE);

	return TRUE;  // return TRUE unless you set the focus to a control
	// 例外 : OCX プロパティ ページは必ず FALSE を返します。
}
Example #2
0
//BonDriverをロードしてチャンネル情報などを取得(ファイル名で指定)
//戻り値:
// エラーコード
//引数:
// bonDriverFile	[IN]EnumBonDriverで取得されたBonDriverのファイル名
DWORD CBonCtrl::OpenBonDriver(
	LPCWSTR bonDriverFile,
	int openWait
)
{
	if( Lock(L"OpenBonDriver-2") == FALSE ) return ERR_FALSE;
	_CloseBonDriver();
	DWORD ret = this->bonUtil.OpenBonDriver(bonDriverFile, openWait);
	wstring bonFile = this->bonUtil.GetOpenBonDriverFileName();
	if( ret == NO_ERR ){
		ret = _OpenBonDriver();
		this->tsOut.ResetChChange();

		this->tsOut.SetBonDriver(bonFile);
	}
	if( bonFile.empty() == false ){
		wstring settingPath;
		GetSettingPath(settingPath);
		wstring bonFileTitle;
		GetFileTitle(bonFile, bonFileTitle);
		wstring tunerName = this->bonUtil.GetTunerName();
		CheckFileName(tunerName);
		this->chUtil.LoadChSet( settingPath + L"\\" + bonFileTitle + L"(" + tunerName + L").ChSet4.txt", settingPath + L"\\ChSet5.txt" );
	}

	UnLock();
	return ret;
}
Example #3
0
void CBonCtrl::GetEpgDataFilePath(WORD ONID, WORD TSID, wstring& epgDataFilePath)
{
	wstring epgDataFolderPath = L"";
	GetSettingPath(epgDataFolderPath);
	epgDataFolderPath += EPG_SAVE_FOLDER;

	if( ONID == 4 && this->BSBasic == TRUE ){
		Format(epgDataFilePath, L"%s\\%04XFFFF_epg.dat", epgDataFolderPath.c_str(), ONID);
	}else if( ONID == 6 && this->CS1Basic == TRUE ){
		Format(epgDataFilePath, L"%s\\%04XFFFF_epg.dat", epgDataFolderPath.c_str(), ONID);
	}else if( ONID == 7 && this->CS2Basic == TRUE ){
		Format(epgDataFilePath, L"%s\\%04XFFFF_epg.dat", epgDataFolderPath.c_str(), ONID);
	}else{
		Format(epgDataFilePath, L"%s\\%04X%04X_epg.dat", epgDataFolderPath.c_str(), ONID, TSID);
	}
}
void GetRecFolderPath(wstring& strPath)
{
	wstring strIni = L"";
	GetCommonIniPath(strIni);
	
	WCHAR wPath[MAX_PATH + 8];
	GetPrivateProfileString( L"Set", L"RecFolderPath0", L"", wPath, MAX_PATH + 8, strIni.c_str() );
	strPath = wPath;
	ChkFolderPath(strPath);
	if( strPath.size() >= MAX_PATH ){
		throw std::runtime_error("");
	}
	if( strPath.empty() || GetPrivateProfileInt(L"SET", L"RecFolderNum", 0, strIni.c_str()) <= 0 ){
		GetSettingPath(strPath);
	}
}
Example #5
0
BOOL CSetDlgEpg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  ここに初期化を追加してください
	btnBS.SetCheck( GetPrivateProfileInt( L"SET", L"BSBasicOnly", 1, commonIniPath ) );
	btnCS1.SetCheck( GetPrivateProfileInt( L"SET", L"CS1BasicOnly", 1, commonIniPath ) );
	btnCS2.SetCheck( GetPrivateProfileInt( L"SET", L"CS2BasicOnly", 1, commonIniPath ) );

	wstring path;
	GetSettingPath(path);
	path += L"\\ChSet5.txt";
	this->chSet.ParseText(path.c_str());

	map<LONGLONG, CH_DATA5>::iterator itr;
	for( itr = this->chSet.chList.begin(); itr != this->chSet.chList.end(); itr++ ){
		int index = this->serviceList.AddString(itr->second.serviceName.c_str());
		this->serviceList.SetCheck(index, itr->second.epgCapFlag);
	}

	return TRUE;  // return TRUE unless you set the focus to a control
	// 例外 : OCX プロパティ ページは必ず FALSE を返します。
}
Example #6
0
//設定を行う
void CMediaPortal_BonMain::ReloadSetting()
{
	wstring commonIniPath = L"";
	GetCommonIniPath(commonIniPath);

	wstring appIniPath = L"";
	GetModuleIniPath(appIniPath);

	wstring settingPath = L"";
	GetSettingPath(settingPath);

	wstring bonDriverPath = L"";
	GetModuleFolderPath(bonDriverPath);
	bonDriverPath += BON_DLL_FOLDER;

	this->bonCtrl.SetSettingFolder( settingPath.c_str(), bonDriverPath.c_str() );

	this->recFolderList.clear();
	int iNum = GetPrivateProfileInt( L"SET", L"RecFolderNum", 0, commonIniPath.c_str() );
	if( iNum == 0 ){
		this->recFolderList.push_back( settingPath );
	}else{
		for( int i = 0; i < iNum; i++ ){
			CString key = L"";
			key.Format(L"RecFolderPath%d", i );
			WCHAR wBuff[512]=L"";
			GetPrivateProfileString( L"SET", key, L"", wBuff, 512, commonIniPath.c_str() );

			this->recFolderList.push_back(wBuff);
		}
	}

	this->enableScrambleFlag = GetPrivateProfileInt( L"SET", L"Scramble", 1, appIniPath.c_str() );
	this->enableEMMFlag = GetPrivateProfileInt( L"SET", L"EMM", 0, appIniPath.c_str() );
	this->allService = GetPrivateProfileInt( L"SET", L"AllService", 0, appIniPath.c_str() );
	this->needCaption = GetPrivateProfileInt( L"SET", L"Caption", 1, appIniPath.c_str() );
	this->needData = GetPrivateProfileInt( L"SET", L"Data", 0, appIniPath.c_str() );

	this->startMargine = GetPrivateProfileInt( L"SET", L"StartMargine", 5, appIniPath.c_str() );
	this->endMargine = GetPrivateProfileInt( L"SET", L"EndMargine", 5, appIniPath.c_str() );

	this->overWriteFlag = GetPrivateProfileInt( L"SET", L"OverWrite", 0, appIniPath.c_str() );

	this->BSBasic = GetPrivateProfileInt( L"SET", L"BSBasicOnly", 1, commonIniPath.c_str() );
	this->CS1Basic = GetPrivateProfileInt( L"SET", L"CS1BasicOnly", 1, commonIniPath.c_str() );
	this->CS2Basic = GetPrivateProfileInt( L"SET", L"CS2BasicOnly", 1, commonIniPath.c_str() );

	WCHAR buff[512]=L"";
	GetPrivateProfileString( L"SET", L"ViewPath", L"", buff, 512, appIniPath.c_str() );
	this->viewPath = buff;
	GetPrivateProfileString( L"SET", L"ViewOption", L"", buff, 512, appIniPath.c_str() );
	this->viewOpt = buff;

	this->udpCount = (DWORD)GetPrivateProfileInt( L"SET_UDP", L"Count", 0, appIniPath.c_str() );
	this->tcpCount = (DWORD)GetPrivateProfileInt( L"SET_TCP", L"Count", 0, appIniPath.c_str() );

	if( this->nwCtrlID != 0 ){
		if( this->allService == TRUE ){
			this->bonCtrl.SetServiceID(this->nwCtrlID, 0xFFFF);
		}else{
			this->bonCtrl.SetServiceID(this->nwCtrlID, this->lastSID);
		}
	}

	BOOL epgCapLive = (BOOL)GetPrivateProfileInt( L"SET", L"EpgCapLive", 1, appIniPath.c_str() );
	BOOL epgCapRec = (BOOL)GetPrivateProfileInt( L"SET", L"EpgCapRec", 1, appIniPath.c_str() );
	DWORD epgCapBackStartWaitSec = (DWORD)GetPrivateProfileInt( L"SET", L"EpgCapBackStartWaitSec", 30, appIniPath.c_str() );

	this->bonCtrl.SetBackGroundEpgCap(epgCapLive, epgCapRec, this->BSBasic, this->CS1Basic, this->CS2Basic, epgCapBackStartWaitSec);
	if( this->sendTcpFlag == FALSE && this->sendUdpFlag == FALSE ){
		this->bonCtrl.SetScramble(this->nwCtrlID, this->enableScrambleFlag);
	}
	this->bonCtrl.SetEMMMode(this->enableEMMFlag);

	DWORD tsBuffMaxCount = (DWORD)GetPrivateProfileInt( L"SET", L"TsBuffMaxCount", 5000, appIniPath.c_str() );
	int writeBuffMaxCount = GetPrivateProfileInt( L"SET", L"WriteBuffMaxCount", -1, appIniPath.c_str() );
	this->bonCtrl.SetTsBuffMaxCount(tsBuffMaxCount, writeBuffMaxCount);

	this->openWait = (DWORD)GetPrivateProfileInt( L"SET", L"OpenWait", 200, appIniPath.c_str() );
}
Example #7
0
void GetLogoSavePath(wstring& strPath)
{
	strPath = L"";
	GetSettingPath(strPath);
	strPath += LOGO_SAVE_FOLDER;
}
Example #8
0
void GetEpgSavePath(wstring& strPath)
{
	strPath = L"";
	GetSettingPath(strPath);
	strPath += EPG_SAVE_FOLDER;
}
Example #9
0
//チューナー一覧の読み込みを行う
//戻り値:
// TRUE(成功)、FALSE(失敗)
BOOL CTunerManager::ReloadTuner()
{
	map<DWORD, TUNER_INFO*>::iterator itr;
	for( itr = this->tunerMap.begin(); itr != this->tunerMap.end(); itr++ ){
		SAFE_DELETE(itr->second);
	}
	this->tunerMap.clear();

	wstring path = L"";
	GetSettingPath(path);

	wstring srvIniPath = L"";
	GetEpgTimerSrvIniPath(srvIniPath);

	wstring searchKey = path;
	searchKey += L"\\*.ChSet4.txt";

	WIN32_FIND_DATA findData;
	HANDLE find;

	//指定フォルダのファイル一覧取得
	find = FindFirstFile( searchKey.c_str(), &findData);
	if ( find == INVALID_HANDLE_VALUE ) {
		return FALSE;
	}
	do{
		if( (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 ){
			//本当に拡張子DLL?
			if( IsExt(findData.cFileName, L".txt") == TRUE ){
				wstring chSetPath = L"";
				Format(chSetPath, L"%s\\%s", path.c_str(), findData.cFileName);

				wstring bonFileName = L"";
				wstring buff = findData.cFileName;

				FindBonFileName(buff, bonFileName);

				bonFileName += L".dll";

				WORD count = (WORD)GetPrivateProfileInt(bonFileName.c_str(), L"Count", 0, srvIniPath.c_str());
				if( count != 0 ){
					//カウント0以上のものだけ利用
					WORD priority = (WORD)GetPrivateProfileInt(bonFileName.c_str(), L"Priority", 0, srvIniPath.c_str());
					BOOL epgCapFlag = (BOOL)GetPrivateProfileInt(bonFileName.c_str(), L"GetEpg", 1, srvIniPath.c_str());
					WORD EPGcount = (WORD)GetPrivateProfileInt(bonFileName.c_str(), L"EPGCount", -1, srvIniPath.c_str());
					if(EPGcount<0) EPGcount = count;

					for( WORD i=1; i<=count; i++ ){
						TUNER_INFO* item = new TUNER_INFO;
						item->bonID = priority;
						item->tunerID = i;
						if(EPGcount<i){		//	EPGCountを超えていたらEPG取得に使用しない
							item->epgCapFlag = 0;
						} else {
							item->epgCapFlag = epgCapFlag;
						}
						item->bonFileName = bonFileName;
						item->chUtil.ParseText(chSetPath.c_str());
						item->chSet4FilePath = chSetPath;
						DWORD key = ((DWORD)item->bonID)<<16 | item->tunerID;
						this->tunerMap.insert(pair<DWORD, TUNER_INFO*>(key, item));
					}
				}
			}
		}
	}while(FindNextFile(find, &findData));

	FindClose(find);

	return TRUE;
}
Example #10
0
//チューナー一覧の読み込みを行う
//戻り値:
// TRUE(成功)、FALSE(失敗)
BOOL CTunerManager::ReloadTuner()
{
	this->tunerMap.clear();

	wstring path = L"";
	GetSettingPath(path);

	wstring srvIniPath = L"";
	GetModuleIniPath(srvIniPath);

	wstring searchKey = path;
	searchKey += L"\\*.ChSet4.txt";

	WIN32_FIND_DATA findData;
	HANDLE find;

	//指定フォルダのファイル一覧取得
	find = FindFirstFile( searchKey.c_str(), &findData);
	if ( find == INVALID_HANDLE_VALUE ) {
		return FALSE;
	}
	do{
		if( (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 ){
			wstring bonFileName;
			if( FindBonFileName(findData.cFileName, bonFileName) != FALSE ){
				wstring chSetPath = L"";
				Format(chSetPath, L"%s\\%s", path.c_str(), findData.cFileName);

				bonFileName += L".dll";

				WORD count = (WORD)GetPrivateProfileInt(bonFileName.c_str(), L"Count", 0, srvIniPath.c_str());
				if( count != 0 ){
					//カウント0以上のものだけ利用
					WORD priority = (WORD)GetPrivateProfileInt(bonFileName.c_str(), L"Priority", 0, srvIniPath.c_str());
					BOOL epgCapFlag = (BOOL)GetPrivateProfileInt(bonFileName.c_str(), L"GetEpg", 1, srvIniPath.c_str());
					WORD EPGcount = (WORD)GetPrivateProfileInt(bonFileName.c_str(), L"EPGCount", count, srvIniPath.c_str());
					if(EPGcount==0)	EPGcount = count;

					if( this->tunerMap.find((DWORD)priority<<16 | 1) != this->tunerMap.end() ){
						OutputDebugString(L"CTunerManager::ReloadTuner(): Duplicate bonID\r\n");
						count = 0;
					}
					for( WORD i=1; i<=count; i++ ){
						TUNER_INFO item;
						item.epgCapMaxOfThisBon = min(epgCapFlag == FALSE ? 0 : EPGcount, count);
						item.bonFileName = bonFileName;
						item.chSet4FilePath = chSetPath;
						CParseChText4 chUtil;
						chUtil.ParseText(chSetPath.c_str());
						map<DWORD, CH_DATA4>::const_iterator itr;
						for( itr = chUtil.GetMap().begin(); itr != chUtil.GetMap().end(); itr++ ){
							item.chList.push_back(itr->second);
						}
						this->tunerMap.insert(pair<DWORD, TUNER_INFO>((DWORD)priority<<16 | i, item));
					}
				}
			}
		}
	}while(FindNextFile(find, &findData));

	FindClose(find);

	return TRUE;
}
Example #11
0
UINT WINAPI CEpgDBManager::LoadThread(LPVOID param)
{
	CEpgDBManager* sys = (CEpgDBManager*)param;

	OutputDebugString(L"Start Load EpgData\r\n");
	DWORD time = GetTickCount();

	CEpgDataCap3Util epgUtil;
	if( epgUtil.Initialize(FALSE) == FALSE ){
		OutputDebugString(L"★EpgDataCap3.dllの初期化に失敗しました。\r\n");
		return 0;
	}

	//EPGファイルの検索
	vector<wstring> epgFileList;
	wstring epgDataPath = L"";
	GetSettingPath(epgDataPath);
	epgDataPath += EPG_SAVE_FOLDER;

	wstring searchKey = epgDataPath;
	searchKey += L"\\*_epg.dat";

	WIN32_FIND_DATA findData;
	HANDLE find;

	//指定フォルダのファイル一覧取得
	find = FindFirstFile( searchKey.c_str(), &findData);
	if ( find == INVALID_HANDLE_VALUE ) {
		//1つも存在しない
		epgUtil.UnInitialize();
		return 0;
	}
	do{
		if( (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 ){
			//本当に拡張子DLL?
			if( IsExt(findData.cFileName, L".dat" ) == TRUE ){
				//見つかったファイルを一覧に追加
				wstring epgFilePath = L"";
				Format(epgFilePath, L"%s\\%s", epgDataPath.c_str(), findData.cFileName);

				epgFileList.push_back(epgFilePath);
			}
		}
	}while(FindNextFile(find, &findData));

	FindClose(find);

	//EPGファイルの解析
	for( size_t i=0; i<epgFileList.size(); i++ ){
		HANDLE file = _CreateFile( epgFileList[i].c_str(), GENERIC_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
		if( file != INVALID_HANDLE_VALUE ){
			FILETIME CreationTime;
			FILETIME LastAccessTime;
			FILETIME LastWriteTime;
			GetFileTime(file, &CreationTime, &LastAccessTime, &LastWriteTime);

			LONGLONG fileTime = ((LONGLONG)LastWriteTime.dwHighDateTime)<<32 | (LONGLONG)LastWriteTime.dwLowDateTime;
			if( fileTime + 7*24*60*60*I64_1SEC < GetNowI64Time() ){
				//1週間以上前のファイルなので削除
				CloseHandle(file);
				DeleteFile( epgFileList[i].c_str() );
				_OutputDebugString(L"★delete %s", epgFileList[i].c_str());
			}else{

				DWORD fileSize = GetFileSize( file, NULL );
				BYTE readBuff[188*1024];
				DWORD readSize = 0;
				while( readSize < fileSize ){
					if( ::WaitForSingleObject(sys->loadStopEvent, 0) != WAIT_TIMEOUT ){
						//キャンセルされた
						CloseHandle(file);
						epgUtil.UnInitialize();
						return 0;
					}
					DWORD read=0;
					ReadFile( file, &readBuff, 188*1024, &read, NULL );
					for( DWORD i=0; i<read; i+=188 ){
						epgUtil.AddTSPacket(readBuff+i, 188);
					}
					readSize+=read;
					Sleep(0);
				}
				CloseHandle(file);
			}
		}
		Sleep(0);
	}

	//EPGデータを取得
	DWORD serviceListSize = 0;
	SERVICE_INFO* serviceList = NULL;
	if( epgUtil.GetServiceListEpgDB(&serviceListSize, &serviceList) == FALSE ){
		epgUtil.UnInitialize();
		return 0;
	}

	for( DWORD i=0; i<serviceListSize; i++ ){
		LONGLONG key = _Create64Key(serviceList[i].original_network_id, serviceList[i].transport_stream_id, serviceList[i].service_id);
		EPGDB_SERVICE_DATA* item = new EPGDB_SERVICE_DATA;
		item->serviceInfo.ONID = serviceList[i].original_network_id;
		item->serviceInfo.TSID = serviceList[i].transport_stream_id;
		item->serviceInfo.SID = serviceList[i].service_id;
		if( serviceList[i].extInfo != NULL ){
			item->serviceInfo.service_type = serviceList[i].extInfo->service_type;
			item->serviceInfo.partialReceptionFlag = serviceList[i].extInfo->partialReceptionFlag;
			if( serviceList[i].extInfo->service_provider_name != NULL ){
				item->serviceInfo.service_provider_name = serviceList[i].extInfo->service_provider_name;
			}
			if( serviceList[i].extInfo->service_name != NULL ){
				item->serviceInfo.service_name = serviceList[i].extInfo->service_name;
			}
			if( serviceList[i].extInfo->network_name != NULL ){
				item->serviceInfo.network_name = serviceList[i].extInfo->network_name;
			}
			if( serviceList[i].extInfo->ts_name != NULL ){
				item->serviceInfo.ts_name = serviceList[i].extInfo->ts_name;
			}
			item->serviceInfo.remote_control_key_id = serviceList[i].extInfo->remote_control_key_id;
		}
		sys->epgMap.insert(pair<LONGLONG, EPGDB_SERVICE_DATA*>(key, item));

		DWORD epgInfoListSize = 0;
		EPG_EVENT_INFO* epgInfoList = NULL;
		if( epgUtil.GetEpgInfoList(item->serviceInfo.ONID, item->serviceInfo.TSID, item->serviceInfo.SID, &epgInfoListSize, &epgInfoList) == TRUE ){
			for( DWORD j=0; j<epgInfoListSize; j++ ){
				EPGDB_EVENT_INFO* itemEvent = new EPGDB_EVENT_INFO;
				sys->ConvertEpgInfo(item->serviceInfo.ONID, item->serviceInfo.TSID, item->serviceInfo.SID, epgInfoList+j, itemEvent);
				item->eventMap.insert(pair<WORD, EPGDB_EVENT_INFO*>(itemEvent->event_id, itemEvent));
			}
		}
		Sleep(0);
	}

	_OutputDebugString(L"End Load EpgData %dmsec\r\n", GetTickCount()-time);
	epgUtil.UnInitialize();

	return 0;
}
Example #12
0
UINT WINAPI CBonCtrl::ChScanThread(LPVOID param)
{
	CBonCtrl* sys = (CBonCtrl*)param;

	sys->chUtil.Clear();

	wstring settingPath;
	GetSettingPath(settingPath);
	wstring bonFileTitle;
	GetFileTitle(sys->bonUtil.GetOpenBonDriverFileName(), bonFileTitle);
	wstring tunerName = sys->bonUtil.GetTunerName();
	CheckFileName(tunerName);

	wstring chSet4 = settingPath + L"\\" + bonFileTitle + L"(" + tunerName + L").ChSet4.txt";
	wstring chSet5 = settingPath + L"\\ChSet5.txt";

	vector<CHK_CH_INFO> chkList;
	map<DWORD, BON_SPACE_INFO> spaceMap;
	if( sys->bonUtil.GetOriginalChList(&spaceMap) != NO_ERR ){
		sys->chSt_err = ST_COMPLETE;
		sys->chUtil.SaveChSet(chSet4, chSet5);
		return 0;
	}
	map<DWORD, BON_SPACE_INFO>::iterator itrSpace;
	for( itrSpace = spaceMap.begin(); itrSpace != spaceMap.end(); itrSpace++ ){
		sys->chSt_totalNum += (DWORD)itrSpace->second.chMap.size();
		map<DWORD, wstring>::iterator itrCh;
		for( itrCh = itrSpace->second.chMap.begin(); itrCh != itrSpace->second.chMap.end(); itrCh++ ){
			CHK_CH_INFO item;
			item.space = itrSpace->first;
			item.spaceName = itrSpace->second.spaceName;
			item.ch = itrCh->first;
			item.chName = itrCh->second;
			chkList.push_back(item);
		}
	}

	if( sys->chSt_totalNum == 0 ){
		sys->chSt_err = ST_COMPLETE;
		sys->chUtil.SaveChSet(chSet4, chSet5);
		return 0;
	}

	wstring folderPath;
	GetModuleFolderPath( folderPath );
	wstring iniPath = folderPath;
	iniPath += L"\\BonCtrl.ini";

	DWORD chChgTimeOut = GetPrivateProfileInt(L"CHSCAN", L"ChChgTimeOut", 9, iniPath.c_str());
	DWORD serviceChkTimeOut = GetPrivateProfileInt(L"CHSCAN", L"ServiceChkTimeOut", 8, iniPath.c_str());


	DWORD wait = 0;
	BOOL chkNext = TRUE;
	DWORD startTime = 0;
	DWORD chkWait = 0;
	DWORD chkCount = 0;
	BOOL firstChg = FALSE;

	while(1){
		if( ::WaitForSingleObject(sys->chScanStopEvent, wait) != WAIT_TIMEOUT ){
			//キャンセルされた
			sys->chSt_err = ST_CANCEL;
			break;
		}
		if( chkNext == TRUE ){
			sys->chSt_space = chkList[chkCount].space;
			sys->chSt_ch = chkList[chkCount].ch;
			sys->chSt_chName = chkList[chkCount].chName;
			sys->_SetCh(chkList[chkCount].space, chkList[chkCount].ch, TRUE);
			if( firstChg == FALSE ){
				firstChg = TRUE;
				sys->tsOut.ResetChChange();
			}
			startTime = GetTickCount();
			chkNext = FALSE;
			wait = 1000;
			chkWait = chChgTimeOut;
		}else{
			BOOL chChgErr = FALSE;
			if( sys->tsOut.IsChChanging(&chChgErr) == TRUE ){
				if( GetTickCount() - startTime > chkWait * 1000 ){
					//チャンネル切り替えに8秒以上かかってるので無信号と判断
					OutputDebugString(L"★AutoScan Ch Change timeout\r\n");
					chkNext = TRUE;
				}
			}else{
				if( GetTickCount() - startTime > (chkWait + serviceChkTimeOut) * 1000 || chChgErr == TRUE){
					//チャンネル切り替え成功したけどサービス一覧とれないので無信号と判断
					OutputDebugString(L"★AutoScan GetService timeout\r\n");
					chkNext = TRUE;
				}else{
					//サービス一覧の取得を行う
					DWORD serviceListSize;
					SERVICE_INFO* serviceList;
					if( sys->tsOut.GetServiceListActual(&serviceListSize, &serviceList) == NO_ERR ){
						if( serviceListSize > 0 ){
							//一覧の取得ができた
							for( DWORD i=0 ;i<serviceListSize; i++ ){
								if( serviceList[i].extInfo != NULL ){
									if( serviceList[i].extInfo->service_name != NULL ){
										if( wcslen(serviceList[i].extInfo->service_name) > 0 ){
											sys->chUtil.AddServiceInfo(chkList[chkCount].space, chkList[chkCount].ch, chkList[chkCount].chName, &(serviceList[i]));
										}
									}
								}
							}
							chkNext = TRUE;
						}
					}
				}
			}
			if( chkNext == TRUE ){
				//次のチャンネルへ
				chkCount++;
				sys->chSt_chkNum++;
				if( sys->chSt_totalNum <= chkCount ){
					//全部チェック終わったので終了
					sys->chSt_err = ST_COMPLETE;
					sys->chUtil.SaveChSet(chSet4, chSet5);
					break;
				}
			}
		}
	}

	sys->chUtil.LoadChSet(chSet4, chSet5);

	return 0;
}