123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- #pragma once
- #include <stdio.h>
- #include <locale.h>
- #include <stdlib.h>
- //#include <time.h> //或者 #include <ctime>
- #include <ctime>
- #include <io.h>
- #pragma comment(lib,"version.lib")
- #include <vector>
- #include <string>
- // GDI+
- #include <gdiplus.h>
- using namespace Gdiplus;
- #pragma comment(lib, "gdiplus.lib")
- #ifndef _UNICODE
- typedef string TString;
- #else
- typedef wstring TString;
- #endif
- // usb;
- static GUID UsbClassGuid = { 0xA5DCBF10L, 0x6530, 0x11D2, {0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED} };
- // mac;
- static GUID MacClassGuid = { 0xAD498944, 0x762F, 0x11D0, {0x8D, 0xCB, 0x00, 0xC0, 0x4F, 0xC3, 0x35, 0x8C} };
- // hdd;
- static GUID HDDClassGuid = { 0x53F56307, 0xB6BF, 0x11D0, {0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B} };
- namespace Global
- {
- typedef struct __ST_CONFIG__
- {
- int nLanguage; // 0:Chinese, 1:english
- // 是否启用测试精灵;
- bool enableTW;
- bool useTW;
- bool useUB530;
- std::string strMIInitBat;
- std::string strSCBCInitBat;
- // script、tester、resource保存目录;
- std::string svnScriptSavePath;
- std::string svnTesterSavePath;
- std::string svnResourceSavePath;
- std::string svnUpdateUrl;
- // test wizard
- int twPort;
- std::string twSignaldir;
- std::string twUseSignal;
- // usb change;
- int usbPort;
- bool enableUSB;
- // ir-device;
- std::string redratpath;
- bool bGenerics;
- std::string signaldir;
- std::string use_signal;
- // SATService;
- bool bAutoLogin;
- std::string strSATUserName;
- std::string strSATPassword;
- std::string strActuator;
- std::string strServiceIP;
- std::string strServicePort;
- // UB530
- bool bAutoReconnect; // 是否启用自动重连;
- int nReconnectCycle; // 重连周期;
- // 电源控制Lan;
- int nPowerLanIndex;
- // 是否启动TV串口;
- bool enableTVPort;
- int tvPort;
- // 是否记住ftp信息;
- bool bRememberFTPInfo;
- std::string strFtpUser;
- std::string strFtpPassword;
- // 是否要实时更新svn信息;
- bool bSVNRealTimeUpdate;
- // 测试精灵端口控制类型:开关、切换;
- // 0 = 开关; 1 = 切换;
- int nTWPortControltype;
- }STConfig, * pSTConfig;
- // 读取baidu.cfg配置文件内容;
- typedef struct __COUNT_INFO__
- {
- std::string app_id;
- std::string api_key;
- std::string secret_key;
- std::string ret_count;
- }CountInfo, * pCountInfo;
-
- typedef struct __BAIDU_CFG__
- {
- std::string cur_count;
- std::string reset_time;
- std::map<std::string, __COUNT_INFO__> list_count;
- }BaiduCfg, * pBaiduCfg;
- // 读取resource_run.cfg配置文件内容;
- typedef struct __RS_RUN_CFG__
- {
- std::string sound_list; // 声音级别;
- std::string sound1;
- std::string sound2;
- std::string full_cut; // 是否全步骤截图;('True/False')
- //....
- std::string tg39_port;
- std::string tv_port;
- std::string sat_home;
- std::string sat_result_dir;
- std::string chroma22293;
- //...
- std::string menutree_chip;
- std::string menutree_style;
- std::string menutree_channel;
- //...
- std::string chroma1;
- std::string chroma2;
- // 是否监听电视;
- bool bWatchTV;
- }RsRunCfg, * pRsRunCfg;
- //////////////////////////////////////////////////////////////////////////
- // 全局变量;
- extern HINSTANCE g_hLanguageDLL;
- extern TCHAR g_szCurModuleDir[MAX_PATH];
- extern TCHAR g_szCurModulePath[MAX_PATH];
- extern TCHAR g_szFna[MAX_PATH];
- extern TCHAR g_szConfig[MAX_PATH];
- extern TCHAR g_szResuorceCfg[MAX_PATH];
- extern STConfig g_Config;
- extern TCHAR g_szPython27Dir[MAX_PATH];
- extern ULONGLONG g_ulWaitTime;
- extern int g_nSysZoomRatio;
- extern TCHAR g_szVersion[MAX_PATH];
- extern BaiduCfg g_bdcfg;
- extern RsRunCfg g_rscfg;
- //////////////////////////////////////////////////////////////////////////
- // 全局函数;
- void GetConfig();
- int ReadReg(char* path, char* key, char* value);
- BOOL Python27Dir();
- BOOL GetSysSerialPort(std::vector<std::string>& vtports);
- void WriteTextLog(const TCHAR* format, ...);
- void WriteTextLogEx(int nType, const TCHAR* format, ...);
- BOOL LoadImgFromFile(IN Image** pImg, LPCTSTR lpPath);
- BOOL LoadImgFromBuffer(IN Image** pImg, IN BYTE* pBuffer, IN CONST INT& nBufLen);
- BOOL LoadImgFromBuffer(IN Image** pImg, LPCTSTR lpPath);
- int GetEncoderClsid(IN CONST WCHAR* format, OUT CLSID* pClsid);
- Image* LoadImgFromResource(IN HMODULE hModule, IN LPCTSTR lpName, IN LPCTSTR lpType);
- BOOL SaveImgByRotate(LPCTSTR lpszFileName, BYTE* pBuffer, CONST INT& nBufLen, BOOL bHoriontal, BOOL bVertically);
- void MKDIR(LPCTSTR dir);
- bool GetVersion(OUT WORD* pdwFileVersion, OUT WORD* pdwProductVerion);
- void GetSysZoomRatio();
- BOOL EnumUSBDevice(OUT char acDevPath[MAX_PATH][MAX_PATH], OUT int& nDevNum);
- INT EnumUSBDevice(CONST GUID* pClassGuid);
- };
|