// cctvC3Plug.cpp: implementation of the CPac3Plug class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "cctvC3Plug.h" #include "se_rbac.h" #include "se_dcedef.h" #include "se_rbacdef.h" #include "se_ddbc.h" #include "se_btl.h" #include "se_rdb.h" #include //#include "se_btl.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// ScreenItemNames ScreenItemNameArray[] = { {"F5012_SCR1GROUPCODE", "F5012_SCR1CAMERACODE"}, {"F5012_SCR2GROUPCODE", "F5012_SCR2CAMERACODE"}, {"F5012_SCR3GROUPCODE", "F5012_SCR3CAMERACODE"}, {"F5012_SCR4GROUPCODE", "F5012_SCR4CAMERACODE"}, {"F5012_SCR5GROUPCODE", "F5012_SCR5CAMERACODE"}, {"F5012_SCR6GROUPCODE", "F5012_SCR6CAMERACODE"}, {"F5012_SCR7GROUPCODE", "F5012_SCR7CAMERACODE"}, {"F5012_SCR8GROUPCODE", "F5012_SCR8CAMERACODE"} }; int ScreenItemNameCount = sizeof(ScreenItemNameArray) / sizeof(ScreenItemNames); ////////////////////////////////////////////////////////////////////// extern "C" __declspec(dllexport) void UpdateCamerasByGroup(int group_index, LPCameraDescArray pCamera, void *pPlugin) { if (NULL == pCamera || group_index < 0) return; CPlugCCTVC3 *pPlug = (CPlugCCTVC3 *)pPlugin; if (NULL == pPlug) return; CameraDescArray_Init(pCamera); pPlug->GetCurrentGroupCameras(pPlug->m_group[group_index].code); if (pPlug->m_curCameraNum > 0) { pCamera->cameraNum = pPlug->m_curCameraNum; pCamera->cameras = new CameraDesc[pPlug->m_curCameraNum]; for (int i = 0; im_curCameraNum; i++) { CameraDesc_Copy(pCamera->cameras[i], pPlug->m_curCamera[i].desc); } } return; } extern "C" __declspec(dllexport) int UpdateScreenInfo(LPScreenSet lpScreenSet, void *pPlugin) { CPlugCCTVC3 *pPlug = (CPlugCCTVC3 *)pPlugin; if (NULL == pPlug) return 0; if (NULL == lpScreenSet) return 0; pPlug->m_log->WriteFmtStrWithTime_L3("[UpdateScreenInfo] >>> screenNum: %d, screenIndex: %d groupIndex: %d", lpScreenSet->screenNum, lpScreenSet->screenIndex, lpScreenSet->screen.groupIndex); if ( (lpScreenSet->screenNum != 1 && lpScreenSet->screenNum != MaxNum_Screen && lpScreenSet->screenNum != 4 && lpScreenSet->screenNum != 5 && lpScreenSet->screenNum != 6 && lpScreenSet->screenNum != 7 ) || lpScreenSet->screen.groupIndex < 0 || lpScreenSet->screenIndex < 0 || lpScreenSet->screenIndex > 7) { int a = lpScreenSet->screenNum; int b = lpScreenSet->screen.groupIndex; int c = lpScreenSet->screenIndex ; return 0; } return pPlug->Update_Screen(lpScreenSet); } extern "C" __declspec(dllexport) int AddDisplayMode(LPDisplayModeInfo lpDisplayMode, void *pPlugin) { CPlugCCTVC3 *pPlug = (CPlugCCTVC3 *)pPlugin; if (NULL == pPlug) return 0; return pPlug->InsertDisplayMode(lpDisplayMode); } extern "C" __declspec(dllexport) int ModifyDisplayMode(LPDisplayModeInfo lpDisplayMode, void *pPlugin) { CPlugCCTVC3 *pPlug = (CPlugCCTVC3 *)pPlugin; if (NULL == pPlug) return 0; return pPlug->Update_DisplayMode(lpDisplayMode); } extern "C" __declspec(dllexport) int RemoveDisplayMode(int list_displaymode_index, void *pPlugin) { CPlugCCTVC3 *pPlug = (CPlugCCTVC3 *)pPlugin; if (NULL == pPlug) return 0; return pPlug->DeleteDisplayMode(list_displaymode_index); } extern "C" __declspec(dllexport) int UpdateCurDisplayInfo(LPDisplayCurInfo lpDisplayCurInfo, bool bDisplayMode, bool isCollectedDispMode, bool bNeedUpdateMonitorInfo,void *pPlugin) { CPlugCCTVC3 *pPlug = (CPlugCCTVC3 *)pPlugin; if (NULL == pPlug) return 0; return pPlug->Update_CurDisplayInfo(lpDisplayCurInfo, bDisplayMode, isCollectedDispMode, bNeedUpdateMonitorInfo); } extern "C" __declspec(dllexport) int AddFavorite(LPFavoriteInfo lpFavorite, void *pPlugin) { CPlugCCTVC3 *pPlug = (CPlugCCTVC3 *)pPlugin; if (NULL == pPlug) return 0; return pPlug->InsertFavorite(lpFavorite); } extern "C" __declspec(dllexport) int UpdateFavorite(LPFavoriteInfo lpFavorite, void *pPlugin) { CPlugCCTVC3 *pPlug = (CPlugCCTVC3 *)pPlugin; if (NULL == pPlug) return 0; return pPlug->Update_Favorite(lpFavorite); } extern "C" __declspec(dllexport) int RemoveFavorite(int list_favorite_index, void *pPlugin) { CPlugCCTVC3 *pPlug = (CPlugCCTVC3 *)pPlugin; if (NULL == pPlug) return 0; return pPlug->DeleteFavorite(list_favorite_index); } extern "C" __declspec(dllexport) int OperateOnCamera(LPScreenSet lpScreenSet, OperTypeCamera oper_type, int nMouseState, void * value, void *pPlugin) { CPlugCCTVC3 *pPlug = (CPlugCCTVC3 *)pPlugin; if (NULL == pPlug) return 0; return pPlug->OperateCamera(lpScreenSet, oper_type, nMouseState, value); } extern "C" __declspec(dllexport) int ScanRoundMode(LPScreenSet lpScreenSet, OperTypeCamera oper_type, void * value, void *pPlugin) { CPlugCCTVC3 *pPlug = (CPlugCCTVC3 *)pPlugin; if (NULL == pPlug) return 0; return pPlug->RoundModeScan(lpScreenSet, oper_type, value); } extern "C" __declspec(dllexport) BOOL UpdateScreenInfoByDevNumber(LPScreenInfo lpScreenInfo, void *pPlugin) { CPlugCCTVC3 *pPlug = (CPlugCCTVC3 *)pPlugin; if (NULL == pPlug) return FALSE; return pPlug->UpdateScreenInfoByDevID(lpScreenInfo); } extern "C" __declspec(dllexport) void UpdateUiState(void *pPlugin) { CPlugCCTVC3 *pPlug = (CPlugCCTVC3 *)pPlugin; if (NULL == pPlug) return; pPlug->getOtherDispatherMonitorInfo(); if (NULL != pPlug->m_hDll) { // pPlug->m_log->WriteFmtStrWithTime_L3("TimerProc[]"); UIDLL_AutoRefresh AutoRefresh = (UIDLL_AutoRefresh)GetProcAddress(pPlug->m_hDll, "AutoRefresh"); if (NULL != AutoRefresh) { for (int k = 0; k< MaxNum_Dispatch - 1; k++) { pPlug->m_otherInitParam[k].groupArr = NULL; pPlug->m_otherInitParam[k].plugFuncs = &pPlug->m_plugFuncs; pPlug->m_otherInitParam[k].displayInfo = &pPlug->m_display; // pPlug->m_otherInitParam[k].curDisplay = &pPlug->m_displayInfoArry[k]; //当前登录用户监视的屏幕信息,包括监视的每个摄像头的 deviceNumber、编号、描述(17(漕盈下行1))、监视的屏幕数等 pPlug->m_otherInitParam[k].displayModeNum = NULL; pPlug->m_otherInitParam[k].displaymode = NULL; pPlug->m_otherInitParam[k].favoriteNum = NULL; pPlug->m_otherInitParam[k].favorite = NULL; } AutoRefresh(pPlug->m_otherInitParam, MaxNum_Dispatch - 1, pPlug->m_hWndFather); } } } ////////////////////////////////////////////////////////////////////// // Construction/Destruction CPlugCCTVC3::CPlugCCTVC3(LPVOID lpParam) : m_hDll(NULL), m_bScanActively(FALSE) { m_log = new Logger("CCTVC3", "plugin_cctvC3.log"); m_curCameraNum = 0; m_curCamera = NULL; m_isLevel2 = false; for(int i=0;iWriteFmtStrWithTime_L2("Current ptz level: %d", m_nPLevel); //m_LastSendSec=m_LastSendMsec=0; //获取间隔区域表数据 yansx 2019-04-29 GetCCTVAreaInfo(); readIni(); } CPlugCCTVC3::~CPlugCCTVC3() { if (NULL != m_curCamera) { delete [] m_curCamera; m_curCamera = NULL; } if (NULL != m_hDll) { UIDLL_CloseDialog CloseDialog = (UIDLL_CloseDialog)GetProcAddress(m_hDll, "CloseDialog"); if (NULL != CloseDialog) CloseDialog(m_hWndFather); FreeLibrary(m_hDll); } // if(m_nAutoRefreshTime != 0) // { // ::KillTimer(m_hWndFather,ID_TIMER); // } delete m_log; } /* void CALLBACK AutoRefreshTimerProc(HWND hwnd,UINT uMsg,UINT_PTR idEvent, DWORD dwTime) { g_pCurPlugClass->getOtherDispatherMonitorInfo(); if (NULL != g_pCurPlugClass->m_hDll) { g_pCurPlugClass->m_log->WriteFmtStrWithTime_L3("TimerProc[]"); UIDLL_AutoRefresh AutoRefresh = (UIDLL_AutoRefresh)GetProcAddress(g_pCurPlugClass->m_hDll, "AutoRefresh"); if (NULL != AutoRefresh) { for (int k=0; k< MaxNum_Dispatch - 1; k++) { g_pCurPlugClass->m_otherInitParam[k].groupArr = NULL; g_pCurPlugClass->m_otherInitParam[k].plugFuncs = &g_pCurPlugClass->m_plugFuncs; g_pCurPlugClass->m_otherInitParam[k].displayInfo = &g_pCurPlugClass->m_display; // g_pCurPlugClass->m_otherInitParam[k].curDisplay = &g_pCurPlugClass->m_displayInfoArry[k]; //当前登录用户监视的屏幕信息,包括监视的每个摄像头的 deviceNumber、编号、描述(17(漕盈下行1))、监视的屏幕数等 g_pCurPlugClass->m_otherInitParam[k].displayModeNum = NULL; g_pCurPlugClass->m_otherInitParam[k].displaymode = NULL; g_pCurPlugClass->m_otherInitParam[k].favoriteNum = NULL; g_pCurPlugClass->m_otherInitParam[k].favorite = NULL; } AutoRefresh(g_pCurPlugClass->m_otherInitParam, MaxNum_Dispatch - 1); } } }*/ BOOL CPlugCCTVC3::Create(CWnd * fatherWnd, RECT rect, UINT id, UINT length, LPVOID pExtData) { //CWnd::Create(NULL, NULL, WS_CHILD, CRect(0, 0, 0, 0), fatherWnd, id); m_hWndFather = fatherWnd->m_hWnd; m_nLast4ScreenFocusIndex = 0; m_nLast4ScreenFocusIndex2 = 0; m_bSwitch4to1Screen = true; getExeFuncAddr(); iniDBInfo(); GroupDescArray grpArr; memset(&grpArr, 0, sizeof(GroupDescArray)); if (m_groupNum > 0) { grpArr.groupNum = m_groupNum;//地铁站总数 grpArr.groups = new GroupDesc[m_groupNum]; for (int i=0; i 0) { pCurDispModeInfo = new DisplayModeInfo[nCnt_displaymode]; memset(pCurDispModeInfo, 0, sizeof(DisplayModeInfo)*nCnt_displaymode); transferCurDisplayModes(pCurDispModeInfo, nCnt_displaymode); } FavoriteInfo * pCurFavs = NULL; int nCnt_fav = m_listCurFav.GetCount(); if (nCnt_fav > 0) { pCurFavs = new FavoriteInfo[nCnt_fav]; memset(pCurFavs, 0, sizeof(FavoriteInfo)*nCnt_fav); transferCurFavorites(pCurFavs, nCnt_fav); } if (!m_useSDK) { memset(m_dllName, 0, 32*sizeof(char)); strcpy(m_dllName, "cctvC3ui"); #ifdef _DEBUG strcat(m_dllName, "d.dll"); #else strcat(m_dllName, ".dll"); #endif } m_hDll = LoadLibrary(m_dllName); if (NULL == m_hDll) return FALSE; if (NULL != m_hDll) { UIDLL_ShowDialog ShowDialog = (UIDLL_ShowDialog)GetProcAddress(m_hDll, "ShowDialog"); if (NULL != ShowDialog) { UISet_CCTV uiParam; uiParam.hParent = m_hWndFather; uiParam.freshTime = m_nAutoRefreshTime; uiParam.pos_x = rect.left; uiParam.pos_y = rect.top; uiParam.width = rect.right-rect.left; uiParam.height = rect.bottom-rect.top; RECT rectPlugin; fatherWnd->GetClientRect(&rectPlugin); uiParam.pos_y = (rectPlugin.bottom - rectPlugin.top) - rect.bottom; //COLORREF color1 = RGB(7, 54, 80); /* 取到的颜色不对,可能是debug版本的原因,待查。。。 CWnd * wndSvm = fatherWnd->GetParent(); if (m_bConsistBackground && NULL != wndSvm) { HWND hSvm = wndSvm->m_hWnd; POINT pt1; pt1.x = uiParam.pos_x - 100; pt1.y = uiParam.pos_y - 100; ::ScreenToClient(hSvm, &pt1); HDC dcSvm = ::GetWindowDC(hSvm); color1 = ::GetPixel(dcSvm, pt1.x, pt1.y); } */ uiParam.colorR = GetRValue(m_background); uiParam.colorG = GetGValue(m_background); uiParam.colorB = GetBValue(m_background); InitParam init_param; init_param.groupArr = &grpArr; //站台名 init_param.plugFuncs = &m_plugFuncs; init_param.displayInfo = &m_display; // init_param.curDisplay = &m_curDisplayInfo; //当前登录用户监视的屏幕信息,包括监视的每个摄像头的 deviceNumber、编号、描述(17(漕盈下行1))、监视的屏幕数等 init_param.displayModeNum = nCnt_displaymode; init_param.displaymode = pCurDispModeInfo; init_param.favoriteNum = nCnt_fav; init_param.favorite = pCurFavs; for (int k=0; k< MaxNum_Dispatch - 1; k++) { m_otherInitParam[k].groupArr = &grpArr; m_otherInitParam[k].plugFuncs = &m_plugFuncs; m_otherInitParam[k].displayInfo = &m_display; // m_otherInitParam[k].curDisplay = &m_displayInfoArry[k]; //当前登录用户监视的屏幕信息,包括监视的每个摄像头的 deviceNumber、编号、描述(17(漕盈下行1))、监视的屏幕数等 m_otherInitParam[k].displayModeNum = nCnt_displaymode; m_otherInitParam[k].displaymode = pCurDispModeInfo; m_otherInitParam[k].favoriteNum = nCnt_fav; m_otherInitParam[k].favorite = pCurFavs; } // ShowDialog(&uiParam, &init_param, &m_cctvAreaSet, m_otherInitParam, MaxNum_Dispatch - 1,this); } //第一次界面起来以后,设置一个Timer 每隔一段时间,自动去取一下其它调度员的分屏信息,然后刷新 Yansx 2019-09-05 /* m_log->WriteFmtStrWithTime_L2("Auto refresh time: %d second", m_nAutoRefreshTime); if(m_nAutoRefreshTime != 0) { ::SetTimer(m_hWndFather, ID_TIMER, m_nAutoRefreshTime*1000,(TIMERPROC)AutoRefreshTimerProc); }*/ } if (NULL != pCurFavs) delete [] pCurFavs; if (NULL != pCurDispModeInfo) delete [] pCurDispModeInfo; if (NULL != grpArr.groups) delete [] grpArr.groups; return TRUE; } BOOL CPlugCCTVC3::MovePlugRect(RECT rect) { return TRUE; } void CPlugCCTVC3::Draw(CDC *pDC, RECT rect) { } BOOL CPlugCCTVC3::ShowProperty(void *pData, int *len) { return TRUE; } void * CPlugCCTVC3::GetExData() { return NULL; } UINT CPlugCCTVC3::GetExDataLength() { return 0; } /* void CPlugCCTVC3::SetParam(int paramID, void *pData) { if (0 != paramID) return; if (NULL != m_pDlg) m_pDlg->SetParam(pData); } */ void CPlugCCTVC3::getExeFuncAddr() { m_plugFuncs.updateCamerasByGroup = UpdateCamerasByGroup; m_plugFuncs.updateScreenInfo = UpdateScreenInfo; m_plugFuncs.addDisplayMode = AddDisplayMode; m_plugFuncs.removeDisplayMode = RemoveDisplayMode; m_plugFuncs.updateCurDisplay = UpdateCurDisplayInfo; m_plugFuncs.addFavorite = AddFavorite; m_plugFuncs.updateFavorite = UpdateFavorite; m_plugFuncs.removeFavorite = RemoveFavorite; m_plugFuncs.operateCamera = OperateOnCamera; m_plugFuncs.scanRoundMode = ScanRoundMode; m_plugFuncs.updateScreenInfoByDevID = UpdateScreenInfoByDevNumber; m_plugFuncs.modifyDisplayMode = ModifyDisplayMode; m_plugFuncs.updateUiState = UpdateUiState; } void CPlugCCTVC3::readIni() { m_nPLevel2 = -1; //初始化m_nPLevel2为-1 memset(&m_display, 0, sizeof(DisplayInfo)); m_useSDK = FALSE; memset(m_dllName, 0, 32*sizeof(char)); memset(m_decode, 0, sizeof(m_decode)); char *home = getenv("SEROOT"); if (NULL == home) return; char filename[256] = {0}; sprintf(filename, "%s%s", home, "\\cfg\\C3cctvUi.ini"); CReadConf readconf; int nDispatchNum = readconf.ReadLong("General", "dispatchCount", filename, "0"); if (nDispatchNum <= 0) return; m_Line = (unsigned char)readconf.ReadLong("General", "metro", filename, "0"); m_display.count = nDispatchNum; m_bConsistBackground = readconf.ReadBool("General", "bgConsistent", filename, "0"); int color_r = readconf.ReadLong("General", "background_red", filename, "0"); int color_g = readconf.ReadLong("General", "background_green", filename, "0"); int color_b = readconf.ReadLong("General", "background_blue", filename, "0"); m_background = RGB(color_r, color_g, color_b); m_nAutoRefreshTime = readconf.ReadLong("General", "autoRefreshSecond", filename, "0");//自动刷新其它调度席位的秒数 不设置则默认不会自动刷新 m_nAutoRefreshTime = ((m_nAutoRefreshTime<5) && (m_nAutoRefreshTime>0) || m_nAutoRefreshTime<0 )?5:m_nAutoRefreshTime;//小于5秒,刷新频率太快。 m_nDigAnaCCTVtype = (unsigned char)readconf.ReadLong("General", "DigAnaCCTVtype", filename, "0"); int ifUseSDK = readconf.ReadLong("General", "useSDK", filename, "0"); readconf.ReadString("General", "uiLibrary", m_dllName, filename, ""); if (ifUseSDK == 1 && strlen(m_dllName) > 0) m_useSDK = TRUE; int * disp_index = new int[nDispatchNum]; int * disp_plevel = new int[nDispatchNum]; int i, j=0; char sectionName[16]; for (i=0; i= 0) //如果读取到ptzLevel2的值 { m_nPLevel2 = nPtzlevel2; } int nPtzlevel = readconf.ReadLong(sectionName, "ptzlevel", filename, "-1"); if (nPtzlevel < 0) { m_display.count--; continue; } disp_index[j] = i; disp_plevel[j] = nPtzlevel; j++; } // 第1组永远是当前调度 // for (i=1; i disp_plevel[j]) { int nTemp = disp_index[i]; disp_index[i] = disp_index[j]; disp_index[j] = nTemp; nTemp = disp_plevel[i]; disp_plevel[i] = disp_plevel[j]; disp_plevel[j] = nTemp; } } } if(m_nPLevel2 < 0) //如果没有读取到ptzLevel2的值,将其他席位的ptzLevel赋值给m_nPLevel2 { if(nDispatchNum > 1) m_nPLevel2 = disp_plevel[1]; else m_nPLevel2 = m_nPLevel; } for (i=0; i MaxNum_Group ? MaxNum_Group : m_groupNum; for (i=0; iWriteFmtStrWithTime_L3("[getDispatherFavorites] : failed to find records (ptzlevel = %d) in table TB5015_CCTVFAV", m_nPLevel); return; } FavoriteList tmpFavorList; for (i=0; iWriteFmtStrWithTime_L3("[getDispatherDisplayMode] : failed to find records (ptzlevel = %d) in table TB5014_CCTVDISPLAYMODE", m_nPLevel); return; } for (i=0; iindex; MonitorInfo_Init(pItem); pItem->index = nIndex_Monitor; char tmpV[64] = {0}; sprintf(tmpV, "%d", pItem->index); SEDB_CMDINFO cmdinfo; char cmdbuf[1256] = {0}; sprintf(cmdinfo.table, "%s.dbo.%s", "SEMODEL", "TB5012_CCTVMONITORINFO"); strcpy(cmdbuf, "select "); int i; strcat(cmdbuf, "F5012_SCREENCOUNT"); for (i=0; iindex); return; } pItem->screenNum = (int)dboption.GetIntVal(0, 0); if (pItem->screenNum > MaxNum_Screen ) pItem->screenNum = MaxNum_Screen; // int nScreenNum = pItem->screenNum; int nScreenNum = MaxNum_ScreenColumn; if(m_curDisplayInfo.splitScreenNum == 8 || pItem->screenNum > MaxNum_ScreenColumn) //如果屏幕数大于4,则认为是8屏的席位 { nScreenNum = MaxNum_Screen; } for (i=0; iscreen[i].groupIndex = k; break; } } if (pItem->screen[i].groupIndex == -1) { continue; } strncpy(pItem->screen[i].camera_desc.code, (char *)dboption.GetColVal(0, 2+i*2), MaxLen_CODE-1); } dboption.EndSelectRcdSet(); for (i=0; i< nScreenNum; i++) { getCameraDescByCode(&(pItem->screen[i].camera_desc)); getCCTVDeviceNumber(&(pItem->screen[i].camera_desc)); } } int CPlugCCTVC3::updateDispatherMonitorInfo(LPDisplayCurInfo lpDisplayCufInfo) { if (m_curDisplayInfo.monitor.index <= 0) { if ( insertItem_MonitorInfo( &(lpDisplayCufInfo->monitor) ) <= 0 ) { m_log->WriteFmtStrWithTime_L3("[updateDispatherMonitorInfo] >>> failed to insertItem_MonitorInfo"); return 0; } } else { if ( updateItem_MonitorInfo( &(lpDisplayCufInfo->monitor) ) <= 0 ) { m_log->WriteFmtStrWithTime_L3("[updateDispatherMonitorInfo] >>> failed to updateItem_MonitorInfo"); return 0; } } if (m_curDisplayInfo.index <= 0) { if ( insertItem_CurDisplayInfo(m_nPLevel, lpDisplayCufInfo) <= 0 ) { m_log->WriteFmtStrWithTime_L3("[updateDispatherMonitorInfo] >>> failed to insertItem_CurDisplayInfo"); return 0; } } return 1; } void CPlugCCTVC3::getMonitorNumberForDispatch() { if (m_display.count <= 0) return; int i = 0; for (i=0; iWriteFmtStrWithTime_L2("Dispatch %d: ptz %d, %s, %s, %s", i, m_display.dispatch[i].ptzLevel, m_display.dispatch[i].code, m_display.dispatch[i].desc, m_display.dispatch[i].deviceNumber); } } int CPlugCCTVC3::getGroupCameras(CameraInfo ** camera_array, int * camera_count, const char * group_code) { if (NULL == camera_array || NULL == camera_count) return 0; // 根据组代码获取本组的摄像机代码 SEDB_CMDINFO cmdinfo; char cmdbuf[1256] = {0}; sprintf(cmdinfo.table, "%s.dbo.%s", "SEMODEL", "TB4009_DIGPOINT"); strcpy(cmdbuf, "select "); char * fieldCodes[] = {"F4009_POINTCODE"}; int i; for (i=0; iWriteFmtStrWithTime_L3("[getGroupCameras] : failed to find records (group-code=%s) in table TB4009_DIGPOINT", group_code); return 0; } *camera_count = nCount; *camera_array = new CameraInfo[nCount]; for (i=0; idesc.code, (char *)dboption.GetColVal(i,0), MaxLen_CODE-1); } dboption.EndSelectRcdSet(); for (i=0; icamera_desc.code) <= 0) return; SEDB_CMDINFO cmdinfo; char cmdbuf[1256] = {0}; sprintf(cmdinfo.table, "%s.dbo.%s", "SEMODEL", "TB4009_DIGPOINT"); strcpy(cmdbuf, "select "); char * fieldCodes[] = {"F4009_POINTDESC", "F1001_GROUPCODE"}; int i; for (i=0; icamera_desc.code); strcat(cmdbuf, tmpBuf); // m_log->WriteFmtStrWithTime_L3("%s", cmdbuf); CSE_DBOption dboption; dboption.BeginSelectRcdSet(cmdbuf); int nCount = dboption.GetRcdCount(); if (nCount <= 0) { dboption.EndSelectRcdSet(); m_log->WriteFmtStrWithTime_L3("[getScreenInfo] : failed to find record (code=%s) in table TB4009_DIGPOINT", lpScreen->camera_desc.code); return; } // strcpy(lpScreen->cameraDesc, (char *)dboption.GetColVal(0, 0)); memset(tmpBuf, 0, 128); strcpy(tmpBuf, (char *)dboption.GetColVal(0,1)); dboption.EndSelectRcdSet(); for (i=0; igroupIndex = i; break; } } if (lpScreen->groupIndex >= 0) { getCameraDescByCode(&(lpScreen->camera_desc)); getCCTVDeviceNumber(&(lpScreen->camera_desc)); } } int CPlugCCTVC3::getCameraInfoByCode(LPCameraInfo lpCameraInfo) { if (NULL == lpCameraInfo) return 0; if ( strlen(lpCameraInfo->desc.code) <= 0 ) return 0; SEDB_CMDINFO cmdinfo; char cmdbuf[1256] = {0}; sprintf(cmdinfo.table, "%s.dbo.%s", "SEMODEL", "TB4009_DIGPOINT"); strcpy(cmdbuf, "select "); char * fieldCodes[] = {"F4009_AOJ", "F1010_APPSYSID", "F4004_MEASTYPEID", "F4009_POINTNO1", "F1002_BAYAREANO", "F4009_POINTDESC"}; int i; for (i=0; idesc.code); strcat(cmdbuf, tmpStr); // m_log->WriteFmtStrWithTime_L3("%s", cmdbuf); CSE_DBOption dboption; dboption.BeginSelectRcdSet(cmdbuf); int nCount = dboption.GetRcdCount(); if (nCount <= 0) { dboption.EndSelectRcdSet(); m_log->WriteFmtStrWithTime_L3("[getCameraInfoByCode] : failed to find record in TB4009_DIGPOINT by code %s", lpCameraInfo->desc.code); return 0; } lpCameraInfo->aoj = (uint)dboption.GetIntVal(0,0); lpCameraInfo->appSysID = (BYTE)dboption.GetIntVal(0,1); lpCameraInfo->measTypeID = (uint)dboption.GetIntVal(0,2); lpCameraInfo->pointNo1 = (int)dboption.GetIntVal(0,3); lpCameraInfo->desc.bayAreaNo = (int)dboption.GetIntVal(0,4); strncpy(lpCameraInfo->desc.data, (char *)dboption.GetColVal(0,5), MaxLen_DESC-1); dboption.EndSelectRcdSet(); getCCTVDeviceNumber(&(lpCameraInfo->desc)); return 1; } int CPlugCCTVC3::getCameraDescByCode(LPCameraDesc lpCameraDesc, int * groupIndex) { if (NULL == lpCameraDesc) return 0; if ( strlen(lpCameraDesc->code) <= 0 ) return 0; SEDB_CMDINFO cmdinfo; char cmdbuf[1256] = {0}; sprintf(cmdinfo.table, "%s.dbo.%s", "SEMODEL", "TB4009_DIGPOINT"); strcpy(cmdbuf, "select "); char * fieldCodes[] = {"F1002_BAYAREANO", "F4009_POINTDESC", "F1001_GROUPCODE"}; int i; for (i=0; icode); strcat(cmdbuf, tmpStr); // m_log->WriteFmtStrWithTime_L3("%s", cmdbuf); CSE_DBOption dboption; dboption.BeginSelectRcdSet(cmdbuf); int nCount = dboption.GetRcdCount(); if (nCount <= 0) { dboption.EndSelectRcdSet(); m_log->WriteFmtStrWithTime_L3("[getCameraInfoByCode] : failed to find record in TB4009_DIGPOINT by code %s", lpCameraDesc->code); return 0; } lpCameraDesc->bayAreaNo = (int)dboption.GetIntVal(0, 0); strncpy(lpCameraDesc->data, (char *)dboption.GetColVal(0, 1), MaxLen_DESC-1); if (NULL != groupIndex) { char group_code[MaxLen_CODE] = {0}; strncpy(group_code, (char *)dboption.GetColVal(0, 2), MaxLen_CODE-1); for (i=0; icode) <= 0 ) return; SEDB_CMDINFO cmdinfo; char cmdbuf[1256] = {0}; sprintf(cmdinfo.table, "%s.dbo.%s", "SEMODEL", "TB2023_CCTVDEV"); strcpy(cmdbuf, "select "); char * fieldCodes[] = {"F2023_DEVNO"}; int i; for (i=0; icode); strcat(cmdbuf, tmpStr); CSE_DBOption dboption; dboption.BeginSelectRcdSet(cmdbuf); int nCount = dboption.GetRcdCount(); if (nCount <= 0) { dboption.EndSelectRcdSet(); return; } strncpy(lpCameraDesc->deviceNumber, (char *)dboption.GetColVal(0, 0), MaxLen_DeviceNumber-1); dboption.EndSelectRcdSet(); } void CPlugCCTVC3::GetCurrentGroupCameras(const char * group_code) { m_curCameraNum = 0; if (NULL != m_curCamera) { delete [] m_curCamera; m_curCamera = NULL; } int nRe = getGroupCameras(&m_curCamera, &m_curCameraNum, group_code); } BOOL CPlugCCTVC3::getCameraDescByDeviceID(LPCameraDesc lpCameraDesc, int * groupIndex) { if (NULL == lpCameraDesc) return FALSE; if (strlen(lpCameraDesc->deviceNumber) == 0) return FALSE; SEDB_CMDINFO cmdinfo; char cmdbuf[1256] = {0}; sprintf(cmdinfo.table, "%s.dbo.%s", "SEMODEL", "TB2023_CCTVDEV"); strcpy(cmdbuf, "select "); char * fieldCodes[] = {"F4009_POINTCODE"}; int i; for (i=0; ideviceNumber); strcat(cmdbuf, tmpStr); CSE_DBOption dboption; dboption.BeginSelectRcdSet(cmdbuf); int nCount = dboption.GetRcdCount(); if (nCount <= 0) { dboption.EndSelectRcdSet(); return FALSE; } strncpy(lpCameraDesc->code, (char *)dboption.GetColVal(0, 0), MaxLen_CODE-1); dboption.EndSelectRcdSet(); getCameraDescByCode(lpCameraDesc, groupIndex); return TRUE; } BOOL CPlugCCTVC3::UpdateScreenInfoByDevID(LPScreenInfo lpScreenInfo) { if (NULL == lpScreenInfo) return FALSE; if (strlen(lpScreenInfo->camera_desc.deviceNumber) == 0) return FALSE; BOOL bRet = getCameraDescByDeviceID(&(lpScreenInfo->camera_desc), &(lpScreenInfo->groupIndex)); return bRet; } int CPlugCCTVC3::Update_Screen(LPScreenSet lpScreenSet)//切换摄像头 { DisplayCurInfo tmp_display; DisplayCurInfo_Copy(tmp_display, m_curDisplayInfo); tmp_display.monitor.screenNum = lpScreenSet->screenNum; ScreenInfo_Copy(tmp_display.monitor.screen[lpScreenSet->screenIndex], lpScreenSet->screen); if (updateDispatherMonitorInfo(&tmp_display) <= 0) { m_log->WriteFmtStrWithTime_L3("[Update_Screen] >>> failed to updateDispatherMonitorInfo"); return 0; } DisplayCurInfo_Copy(m_curDisplayInfo, tmp_display); if (!m_useSDK)//协议版 switchCamera(lpScreenSet); return 1; } int CPlugCCTVC3::InsertDisplayMode(LPDisplayModeInfo lpDisplayMode) { if (NULL == lpDisplayMode) return 0; if ( insertItem_MonitorInfo( &(lpDisplayMode->monitor) ) <= 0 ) return 0; if ( insertItem_DisplayMode(m_nPLevel, lpDisplayMode) <= 0 ) return 0; m_listCurDisplaymode.AddTail(*lpDisplayMode); return 1; } //跟新 DisplayModeInfo到数据库 lilei 2019-6-11 int CPlugCCTVC3::updateItem_DisplayMode(UINT ptzLevel, LPDisplayModeInfo pDisplayMode) { char cmdbuf[2048] = {0}; strcpy(cmdbuf, "UPDATE SEMODEL.TB5014_CCTVDISPLAYMODE SET F5014_DESC = "); char * fieldCodes[] = {"F0101_PTZPLEVEL", "F5012_NO", "F5014_DESC"}; char tmpStr[128] = {0}; // sprintf(tmpStr, "%d,%d,'%s'", ptzLevel, pDisplayMode->monitor.index, pDisplayMode->desc); sprintf(tmpStr, "'%s'", pDisplayMode->desc); strcat(cmdbuf, tmpStr); strcat(cmdbuf, " WHERE F5012_NO = "); char tmpStr1[128] = {0}; sprintf(tmpStr1, "%d", pDisplayMode->monitor.index); strcat(cmdbuf, tmpStr1); strcat(cmdbuf, ";"); // m_log->WriteFmtStrWithTime_L3("%s", cmdbuf); CSE_DBOption dboption; // if (dboption.ExecuteCmd(cmdbuf, SERVER_MAIN) != SEDB_SUCCESS) // return 0; int nRet = dboption.ExecuteCmd(cmdbuf);//SERVER_MAIN 改成NULL char cmdbuf2[512] = {0}; strcpy(cmdbuf2, "select max(F5014_NO) FROM SEMODEL.dbo.TB5014_CCTVDISPLAYMODE"); dboption.BeginSelectRcdSet(cmdbuf2); int nRcdCount = dboption.GetRcdCount(); if (nRcdCount <= 0) { dboption.EndSelectRcdSet(); return 0; } pDisplayMode->index = (int)dboption.GetIntVal(0,0); dboption.EndSelectRcdSet(); return 1; } //跟新 DisplayMode到数据库 lilei 2019-6-11 int CPlugCCTVC3::Update_DisplayMode(LPDisplayModeInfo displayMode) { if (NULL == displayMode) return 0; if ( updateItem_DisplayMode(m_nPLevel, displayMode) <= 0 ) return 0; return 1; } int CPlugCCTVC3::DeleteDisplayMode(int list_displaymode_index) { POSITION pos = m_listCurDisplaymode.FindIndex(list_displaymode_index); if (NULL == pos) return 0; DisplayModeInfo dispmode = m_listCurDisplaymode.GetAt(pos); if ( removeItem_DisplayMode(&dispmode) <= 0 ) return 0; m_listCurDisplaymode.RemoveAt(pos); if ( removeItem_MonitorInfo( &(dispmode.monitor) ) <= 0 ) return 0; return 1; } int CPlugCCTVC3::Update_CurDisplayInfo(LPDisplayCurInfo lpDisplayCurInfo, bool bDisplayMode, bool isCollectedDispMode, bool bNeedUpdateMonitorInfo) { if (lpDisplayCurInfo->monitor.screenNum != 1 && lpDisplayCurInfo->monitor.screenNum != MaxNum_Screen && lpDisplayCurInfo->monitor.screenNum != 4 && lpDisplayCurInfo->monitor.screenNum != 5 && lpDisplayCurInfo->monitor.screenNum != 6 && lpDisplayCurInfo->monitor.screenNum != 7) { return 0; } DisplayCurInfo tmp_display; DisplayCurInfo_Init(&tmp_display); tmp_display.monitor.screenNum = lpDisplayCurInfo->monitor.screenNum; tmp_display.lastSelectIndex = lpDisplayCurInfo->lastSelectIndex; tmp_display.lastSelectIndex2 = lpDisplayCurInfo->lastSelectIndex2; tmp_display.curScreenIndex = lpDisplayCurInfo->curScreenIndex; int i = 0; for (i = 0; imonitor.screen[i]); } //Fix bug: 4分屏切成1分屏以后,每次重新进入都自动切成4分. yansx 2019-02-19 tmp_display.monitor.index = lpDisplayCurInfo->monitor.index; if(bNeedUpdateMonitorInfo)//插件启动的时候,不需要做此操作 { if (updateDispatherMonitorInfo(&tmp_display) <= 0) { return 0; } } DisplayCurInfo_Copy(m_curDisplayInfo, tmp_display); lpDisplayCurInfo->index = m_curDisplayInfo.index; lpDisplayCurInfo->monitor.index = m_curDisplayInfo.monitor.index; if((lpDisplayCurInfo->monitor.screenNum == 1 || lpDisplayCurInfo->monitor.screenNum == 5 || lpDisplayCurInfo->monitor.screenNum == 6 || lpDisplayCurInfo->monitor.screenNum == 7) /*&& m_bSwitch4to1Screen*/)//保存4分屏的时候,所选中的摄像头,在切1分屏以后,要使用这个decode.而不是永远都使用第一个. { //吴总需求 2019-04-25 m_nLast4ScreenFocusIndex = lpDisplayCurInfo->lastSelectIndex; m_nLast4ScreenFocusIndex2 = lpDisplayCurInfo->lastSelectIndex2; m_bSwitch4to1Screen = false; } else if(lpDisplayCurInfo->monitor.screenNum == 4 || lpDisplayCurInfo->monitor.screenNum == 8) { m_bSwitch4to1Screen = true; } //m_curDisplayInfo.monitor.screenNum 有可能是1、4、5、6、7、8, // 1、4代表4屏模式 // 5、6、7、8表示是8屏模式 // 5 代表前4分屏为1分屏,后4分屏为4分屏 // 6 代表前4分屏为4分屏,后4分屏为1分屏 // 7 代表前4分屏为1分屏,后4分屏为1分屏 // 6 代表前4分屏为4分屏,后4分屏为4分屏 int screenNum = (m_curDisplayInfo.monitor.screenNum > 4) ? MaxNum_Screen : MaxNum_ScreenColumn/*m_curDisplayInfo.monitor.screenNum*/; int start = 0; int stop = 0; if (isCollectedDispMode) m_curDisplayInfo.lastSelectIndex = 0; if(!isCollectedDispMode && m_curDisplayInfo.curScreenIndex >= 4)// isCollectedDispMode判断是否是初始化或者从场景收藏列表做的摄像头切换 { start = 4; } if(!isCollectedDispMode && m_curDisplayInfo.curScreenIndex < 4 && screenNum >4) { stop = 4; } m_log->WriteFmtStrWithTime_L2("(%d) BEFORE -->>>> switch camera >>> Cur_ScreenNum: %d, screenNum: %d, start: %d, stop: %d", m_curDisplayInfo.monitor.screenNum, m_curDisplayInfo.curScreenIndex, screenNum, start, stop); int tmpNum = m_curDisplayInfo.monitor.screenNum; for (i=start; i= 4)//下面4个分屏的Index是4~7,所以要>=4 { tmp_screenset.screenIndex = m_curDisplayInfo.lastSelectIndex2; } else { continue; } } if(i >= 4) { m_isLevel2 = true; } tmp_screenset.screenNum = m_curDisplayInfo.monitor.screenNum; ScreenInfo_Copy(tmp_screenset.screen, m_curDisplayInfo.monitor.screen[i]); switchCamera(&tmp_screenset); } m_isLevel2 = false; return 1; } int CPlugCCTVC3::InsertFavorite(LPFavoriteInfo lpFavorite) { if (NULL == lpFavorite) return 0; char cmdbuf[1024] = {0}; strcpy(cmdbuf, "INSERT INTO SEMODEL.TB5015_CCTVFAV ("); char * fieldCodes[] = {"F4009_POINTCODE", "F5015_DESC", "F0101_PTZPLEVEL"}; int i; for (i=0; iscreen.camera_desc.code, lpFavorite->desc, m_nPLevel); strcat(cmdbuf, tmpStr); // m_log->WriteFmtStrWithTime_L3("%s", cmdbuf); CSE_DBOption dboption; // if (dboption.ExecuteCmd(cmdbuf, SERVER_MAIN) != SEDB_SUCCESS) // return 0; //int nRet = dboption.ExecuteCmd(cmdbuf, SERVER_MAIN); int nRet = dboption.ExecuteCmd(cmdbuf); char cmdbuf2[512] = {0}; strcpy(cmdbuf2, "select max(F5015_NO) FROM SEMODEL.TB5015_CCTVFAV"); dboption.BeginSelectRcdSet(cmdbuf2); int nRcdCount = dboption.GetRcdCount(); if (nRcdCount <= 0) { dboption.EndSelectRcdSet(); return 0; } lpFavorite->index = (int)dboption.GetIntVal(0,0); dboption.EndSelectRcdSet(); m_listCurFav.AddTail(*lpFavorite); return 1; } int CPlugCCTVC3::Update_Favorite(LPFavoriteInfo lpFavorite) { if (NULL == lpFavorite) return 0; if (strlen(lpFavorite->desc) <= 0) return 0; POSITION pos = m_listCurFav.GetHeadPosition(); while (pos != NULL) { //FavoriteInfo item = m_listCurFav.GetNext(pos); FavoriteInfo item = m_listCurFav.GetAt(pos); if (item.index == lpFavorite->index) { char cmdbuf[1024] = {0}; strcpy(cmdbuf, "UPDATE SEMODEL.TB5015_CCTVFAV SET "); char tmpStr[128] = {0}; sprintf(tmpStr, "F5015_DESC='%s'", lpFavorite->desc); strcat(cmdbuf, tmpStr); strcat(cmdbuf, " WHERE F5015_NO="); memset(tmpStr, 0, 128); sprintf(tmpStr, "%d", lpFavorite->index); strcat(cmdbuf, tmpStr); CSE_DBOption dboption; //int nRet = dboption.ExecuteCmd(cmdbuf, SERVER_MAIN); int nRet = dboption.ExecuteCmd(cmdbuf);//BUG #251 CCTV插件界面调用切换摄像头操作后不能同步写两个冗余的同步参数库 if(nRet != SEDB_SUCCESS) { m_log->WriteFmtStrWithTime_L3("Update_Favorite return Error. %s", cmdbuf); return 0; } strcpy(item.desc, lpFavorite->desc); m_listCurFav.SetAt(pos, item); break; } m_listCurFav.GetNext(pos); } return 1; } int CPlugCCTVC3::DeleteFavorite(int list_favorite_index) { POSITION pos = m_listCurFav.FindIndex(list_favorite_index); if (NULL == pos) return 0; FavoriteInfo favorInfo = m_listCurFav.GetAt(pos); char cmdbuf[1024] = {0}; strcpy(cmdbuf, "DELETE FROM SEMODEL.dbo.TB5015_CCTVFAV WHERE F5015_NO="); char tmpStr[32] = {0}; sprintf(tmpStr, "%d", favorInfo.index); strcat(cmdbuf, tmpStr); // m_log->WriteFmtStrWithTime_L3("%s", cmdbuf); CSE_DBOption dboption; // if (dboption.ExecuteCmd(cmdbuf, SERVER_MAIN) != SEDB_SUCCESS) // return 0; //int nRet = dboption.ExecuteCmd(cmdbuf, SERVER_MAIN); int nRet = dboption.ExecuteCmd(cmdbuf);//BUG #251 CCTV插件界面调用切换摄像头操作后不能同步写两个冗余的同步参数库 m_listCurFav.RemoveAt(pos); return 1; } int CPlugCCTVC3::OperateCamera(LPScreenSet lpScreenSet, OperTypeCamera oper_type, int nMouseState , void * value) { if (NULL == value) return 0; if (oper_type == OperType_None) return 0; PtzCtlInfoEx ptzctlex; memset(&ptzctlex, 0, sizeof(PtzCtlInfoEx)); PtzCtlInfo_Copy(ptzctlex.ptz, *((LPPtzCtlInfo)value)); if (oper_type == OperType_Ptzctl) { switch (ptzctlex.ptz.ctrlValue) { case CCTV_E_PTZ_UP: _tcscpy(ptzctlex.desc, _T("上")); break; case CCTV_E_PTZ_DOWN: _tcscpy(ptzctlex.desc, _T("下")); break; case CCTV_E_PTZ_LEFT: _tcscpy(ptzctlex.desc, _T("左")); break; case CCTV_E_PTZ_RIGHT: _tcscpy(ptzctlex.desc, _T("右")); break; case CCTV_E_PTZ_LUP: _tcscpy(ptzctlex.desc, _T("左上")); break; case CCTV_E_PTZ_LDOWN: _tcscpy(ptzctlex.desc, _T("左下")); break; case CCTV_E_PTZ_RUP: _tcscpy(ptzctlex.desc, _T("右上")); break; case CCTV_E_PTZ_RDOWN: _tcscpy(ptzctlex.desc, _T("右下")); break; case CCTV_E_PTZ_ZOOMIN: _tcscpy(ptzctlex.desc, _T("放大")); break; case CCTV_E_PTZ_ZOOMOUT: _tcscpy(ptzctlex.desc, _T("缩小")); break; case CCTV_E_PTZ_FOCUSNEAR: _tcscpy(ptzctlex.desc, _T("焦距-")); break; case CCTV_E_PTZ_FOCUSFAR: _tcscpy(ptzctlex.desc, _T("焦距+")); break; case CCTV_E_PTZ_IRIS_OPEN: _tcscpy(ptzctlex.desc, _T("光圈+")); break; case CCTV_E_PTZ_IRIS_CLOSE: _tcscpy(ptzctlex.desc, _T("光圈-")); break; case CCTV_E_PRESET_GOTO: _tcscpy(ptzctlex.desc, _T("调用预置位")); break; default: return 0; break; } } else return 0; return cameraAct(lpScreenSet, oper_type, nMouseState, (void *)(&ptzctlex)); } int CPlugCCTVC3::RoundModeScan(LPScreenSet lpScreenSet, OperTypeCamera oper_type, void * value) { if (NULL == value) return 0; if (oper_type == OperType_None) return 0; PtzCtlInfoEx ptzctlex; memset(&ptzctlex, 0, sizeof(PtzCtlInfoEx)); PtzCtlInfo_Copy(ptzctlex.ptz, *((LPPtzCtlInfo)value)); if (oper_type == OperType_RoundTourMode) { switch (ptzctlex.ptz.ctrlValue) { case CCTV_E_SCAN: m_bScanActively = TRUE; _tcscpy(ptzctlex.desc, _T("轮巡启动")); break; case CCTV_E_HALT: m_bScanActively = FALSE; _tcscpy(ptzctlex.desc, _T("轮巡停止")); break; default: return 0; break; } } else return 0; CameraInfo camera_info; CameraInfo_Init(&camera_info); strcpy(camera_info.desc.code, lpScreenSet->screen.camera_desc.code); if ( getCameraInfoByCode(&camera_info) <= 0 ) return -1; ALM_D_BASE_INFO alminfo = {0}; memset(&alminfo, 0, sizeof(ALM_D_BASE_INFO)); strcpy(alminfo.DeviceKey, camera_info.desc.code); strcpy(alminfo.ClassName, "Control"); alminfo.Operator = ALM_K_OPR_ALM; CSeTime kt; TCriterionTime ct; kt.GetNow(&ct, &alminfo.Msec); alminfo.Second = ct; alminfo.Priority = ALM_K_PRI_EVENT; alminfo.DeviceType = 80; alminfo.MessageId = 1; strcpy(alminfo.Graph, ""); alminfo.AttrNum = 5; strcpy(alminfo.UserAttrList[0].UserAttrName, "User"); strcpy(alminfo.UserAttrList[1].UserAttrName, "Console"); get_host_name(alminfo.UserAttrList[1].UserAttrVal); AOJ_GetConsoleDesc(alminfo.UserAttrList[1].UserAttrVal, alminfo.UserAttrList[1].UserAttrValDesc); strcpy(alminfo.UserAttrList[2].UserAttrName, "CtrlType"); sprintf(alminfo.UserAttrList[2].UserAttrVal, "%d", ptzctlex.ptz.ctrlValue); strcpy(alminfo.UserAttrList[2].UserAttrValDesc, ptzctlex.desc); strcpy(alminfo.UserAttrList[3].UserAttrName, "CtrlState"); strcpy(alminfo.UserAttrList[3].UserAttrVal, "0"); strcpy(alminfo.UserAttrList[3].UserAttrValDesc, "成功"); strcpy(alminfo.UserAttrList[4].UserAttrName, "Point"); strcpy(alminfo.UserAttrList[4].UserAttrVal, camera_info.desc.code); AOJ_D_ASSIGNMENT AojMask; AOJ_GetAssignment(NULL,AojMask, DEF_RIGHT_DEVICE_C); char UserName[SE_K_USER_CODE] = {0}; RBAC_GetUserRoleDescription(UserName, alminfo.UserAttrList[0].UserAttrValDesc, NULL, NULL); strcpy(alminfo.UserAttrList[0].UserAttrVal, UserName); alminfo.Aoj = camera_info.aoj; alminfo.AppSysId = camera_info.appSysID; strcpy(alminfo.UserAttrList[4].UserAttrValDesc, camera_info.desc.data); strcpy(alminfo.GroupName, m_group[lpScreenSet->screen.groupIndex].code); m_csi.CCTV_Login(m_nPLevel); // m_Sta = lpScreenSet->screen.groupIndex + 1; m_Sta = m_group[lpScreenSet->screen.groupIndex].groupno;//WYF 20190425 // m_Div = (lpScreenSet->screenNum == MaxNum_Screen || lpScreenSet->screenNum == MaxNum_ScreenColumn) ? 1 : 0; m_Div = getDiv(lpScreenSet); m_Win = lpScreenSet->screenIndex + 1; m_Wall = 2; // 待确定:电视墙编号 m_Task = 3; // 待确定:任务编号 //Yansx 20190130 CameraDesc camera_Desc; CameraDesc_Init(&camera_Desc); strcpy(camera_Desc.code, m_decode[0][m_Win-1]); getCCTVDeviceNumber(&camera_Desc,1); BYTE deviceNum = atoi(camera_Desc.deviceNumber);//这个值小于255 // 获取monitor的code,如果屏幕数大于4,就使用第2个monitor的code lilei 20190710 char* code = m_display.dispatch[0].code; if (m_Win > 4) { code = m_display.dispatch[0].code2; } m_csi.CCTV_SelectCam(camera_info.desc.code, m_Line, m_Sta, m_Div, (m_Win-1)%4+1, m_Wall, m_Task, (char)deviceNum); // LPDispatchInfoEx pDispatchEx = (LPDispatchInfoEx)m_display.dispatch[0].exInfo; // m_csi.CCTV_SelectMon(pDispatchEx->code); // m_csi.CCTV_SelectMon(m_display.dispatch[0].code); m_csi.CCTV_SelectMon(code); m_csi.CCTV_Scan(ptzctlex.ptz.paraValue); if (ptzctlex.ptz.ctrlValue == 2) { m_csi.CCTV_Scan(0); } // m_csi.AlmSignal(UserName,alminfo);//注释此代码,减轻历史表压力. feature #130 Yansx 20190610 return 1; } ////////////////////////////////////////////////////////////////////// void CPlugCCTVC3::transferCurFavorites(LPFavoriteInfo lpFavoriteInfo, int arrayCount) { if (NULL == lpFavoriteInfo) return; int i = 0; POSITION pos = m_listCurFav.GetHeadPosition(); while (pos != NULL) { if (i >= arrayCount) break; FavoriteInfo * pFavorite = lpFavoriteInfo + i++; FavoriteInfo item = m_listCurFav.GetNext(pos); FavoriteInfo_Copy(*pFavorite, item); } } void CPlugCCTVC3::transferCurDisplayModes(LPDisplayModeInfo lpDisplaymode, int arrayCount) { if (NULL == lpDisplaymode) return; int i = 0; POSITION pos = m_listCurDisplaymode.GetHeadPosition(); while (pos != NULL) { if (i >= arrayCount) break; LPDisplayModeInfo pDispMode = lpDisplaymode + i++; DisplayModeInfo item = m_listCurDisplaymode.GetNext(pos); DisplayModeInfo_Copy(*pDispMode, item); } } ////////////////////////////////////////////////////////////////////// int CPlugCCTVC3::insertItem_MonitorInfo(LPMonitorInfo pMonitor) { char cmdbuf[2048] = {0}; strcpy(cmdbuf, "INSERT INTO SEMODEL.dbo.TB5012_CCTVMONITORINFO ("); int i; strcat(cmdbuf, "F5012_SCREENCOUNT"); for (i=0; iscreenNum); strcat(cmdbuf, tmpStr); for (i=0; iscreen[i].camera_desc.code)) sprintf(tmpStr, ",'%s','%s'", m_group[pMonitor->screen[i].groupIndex].code, pMonitor->screen[i].camera_desc.code); else sprintf(tmpStr, ",null,null"); strcat(cmdbuf, tmpStr); } strcat(cmdbuf, ");"); m_log->WriteFmtStrWithTime_L3("[insertItem_MonitorInfo] >>> SQL: %s", cmdbuf); CSE_DBOption dboption; // if (dboption.ExecuteCmd(cmdbuf, SERVER_ALL) != SEDB_SUCCESS) { //int nRet = dboption.ExecuteCmd(cmdbuf, SERVER_MAIN); int nRet = dboption.ExecuteCmd(cmdbuf);//BUG #251 CCTV插件界面调用切换摄像头操作后不能同步写两个冗余的同步参数库 if (nRet != SEDB_SUCCESS) { m_log->WriteFmtStrWithTime_L1("[insertItem_MonitorInfo] >>> failed to dboption.ExecuteCmd, err = %d", nRet); // return 0; } // get index char cmdbuf2[512] = {0}; strcpy(cmdbuf2, "select max(F5012_NO) FROM SEMODEL.dbo.TB5012_CCTVMONITORINFO"); dboption.BeginSelectRcdSet(cmdbuf2); int nRcdCount = dboption.GetRcdCount(); if (nRcdCount <= 0) { dboption.EndSelectRcdSet(); m_log->WriteFmtStrWithTime_L1("[insertItem_MonitorInfo] >>> no recorder is found"); return 0; } pMonitor->index = (int)dboption.GetIntVal(0,0); dboption.EndSelectRcdSet(); return 1; } int CPlugCCTVC3::insertItem_CurDisplayInfo(UINT ptzLevel, LPDisplayCurInfo pCurDisplayInfo) { char cmdbuf[2048] = {0}; int nRet = 0; CSE_DBOption dboption; if(checkCurDisplyItem(ptzLevel)) { strcpy(cmdbuf, "UPDATE SEMODEL.TB5016_CCTVCURINFO SET F5012_NO = "); char tmpStr[128] = {0}; sprintf(tmpStr, "%d",pCurDisplayInfo->monitor.index); strcat(cmdbuf, tmpStr); sprintf(tmpStr, " WHERE F0101_PTZPLEVEL = %d;",ptzLevel); strcat(cmdbuf, tmpStr); m_log->WriteFmtStrWithTime_L3("SQL: %s", cmdbuf); //nRet = dboption.ExecuteCmd(cmdbuf, SERVER_MAIN); nRet = dboption.ExecuteCmd(cmdbuf);//BUG #251 CCTV插件界面调用切换摄像头操作后不能同步写两个冗余的同步参数库 } else { strcpy(cmdbuf, "INSERT INTO SEMODEL.TB5016_CCTVCURINFO ("); char * fieldCodes[] = {"F0101_PTZPLEVEL", "F5012_NO"}; int i; for (i=0; imonitor.index); strcat(cmdbuf, tmpStr); strcat(cmdbuf, ");"); m_log->WriteFmtStrWithTime_L3("SQL: %s", cmdbuf); // if (dboption.ExecuteCmd(cmdbuf, SERVER_MAIN) != SEDB_SUCCESS) // return 0; //nRet = dboption.ExecuteCmd(cmdbuf, SERVER_MAIN); nRet = dboption.ExecuteCmd(cmdbuf);//BUG #251 CCTV插件界面调用切换摄像头操作后不能同步写两个冗余的同步参数库 } // get index char cmdbuf2[512] = {0}; strcpy(cmdbuf2, "select max(F5016_NO) FROM SEMODEL.TB5016_CCTVCURINFO"); dboption.BeginSelectRcdSet(cmdbuf2); int nRcdCount = dboption.GetRcdCount(); if (nRcdCount <= 0) { dboption.EndSelectRcdSet(); m_log->WriteFmtStrWithTime_L1("[updateItem_MonitorInfo] >>> no recorder is found"); return 0; } pCurDisplayInfo->index = (int)dboption.GetIntVal(0,0); dboption.EndSelectRcdSet(); return 1; } bool CPlugCCTVC3::checkCurDisplyItem(UINT nLevel) { return FALSE; //暂时先返回false,为了不改变以前的逻辑 char cmdbuf[1024] = {0}; strcpy(cmdbuf, "SELECT * FROM SEMODEL.dbo.TB5016_CCTVCURINFO WHERE F0101_PTZPLEVEL = "); char tmpStr[128] = {0}; sprintf(tmpStr, "%d",nLevel); strcat(cmdbuf, tmpStr); strcat(cmdbuf, " ORDER BY F5016_NO DESC;"); CSE_DBOption dboption; //int nRet = dboption.ExecuteCmd(cmdbuf, SERVER_MAIN); int nRet = dboption.ExecuteCmd(cmdbuf);//BUG #251 CCTV插件界面调用切换摄像头操作后不能同步写两个冗余的同步参数库 if (nRet == SEDB_SUCCESS) { int nRcdCount = dboption.GetRcdCount(); if (nRcdCount > 0) { dboption.EndSelectRcdSet(); return TRUE; } } dboption.EndSelectRcdSet(); return FALSE; } int CPlugCCTVC3::insertItem_DisplayMode(UINT ptzLevel, LPDisplayModeInfo pDisplayMode) { char cmdbuf[2048] = {0}; strcpy(cmdbuf, "INSERT INTO SEMODEL.dbo.TB5014_CCTVDISPLAYMODE ("); char * fieldCodes[] = {"F0101_PTZPLEVEL", "F5012_NO", "F5014_DESC"}; int i; for (i=0; imonitor.index, pDisplayMode->desc); strcat(cmdbuf, tmpStr); strcat(cmdbuf, ");"); m_log->WriteFmtStrWithTime_L3("insertItem_DisplayMode SQL: %s", cmdbuf); CSE_DBOption dboption; // if (dboption.ExecuteCmd(cmdbuf, SERVER_MAIN) != SEDB_SUCCESS) // return 0; //int nRet = dboption.ExecuteCmd(cmdbuf, SERVER_MAIN); int nRet = dboption.ExecuteCmd(cmdbuf);//BUG #251 CCTV插件界面调用切换摄像头操作后不能同步写两个冗余的同步参数库 char cmdbuf2[512] = {0}; strcpy(cmdbuf2, "select max(F5014_NO) FROM SEMODEL.TB5014_CCTVDISPLAYMODE"); dboption.BeginSelectRcdSet(cmdbuf2); int nRcdCount = dboption.GetRcdCount(); if (nRcdCount <= 0) { dboption.EndSelectRcdSet(); return 0; } pDisplayMode->index = (int)dboption.GetIntVal(0,0); dboption.EndSelectRcdSet(); return 1; } #if 1 int CPlugCCTVC3::updateItem_MonitorInfo(LPMonitorInfo pMonitor) { char cmdbuf[2048] = {0}; strcpy(cmdbuf, "UPDATE SEMODEL.dbo.TB5012_CCTVMONITORINFO SET "); char tmpStr[128] = {0}; sprintf(tmpStr, "F5012_SCREENCOUNT=%d", pMonitor->screenNum); strcat(cmdbuf, tmpStr); int i; for (i=0; iscreen[i].camera_desc.code)) sprintf(tmpStr, ", %s='%s', %s='%s'", ScreenItemNameArray[i].groupCode, m_group[pMonitor->screen[i].groupIndex].code, ScreenItemNameArray[i].camerCode, pMonitor->screen[i].camera_desc.code); else sprintf(tmpStr, ", %s=null, %s=null", ScreenItemNameArray[i].groupCode, ScreenItemNameArray[i].camerCode); strcat(cmdbuf, tmpStr); } strcat(cmdbuf, " WHERE F5012_NO="); memset(tmpStr, 0, 128); sprintf(tmpStr, "%d", pMonitor->index); strcat(cmdbuf, tmpStr); m_log->WriteFmtStrWithTime_L3("SQL: %s", cmdbuf); CSE_DBOption dboption; // if (dboption.ExecuteCmd(cmdbuf, SERVER_MAIN) != SEDB_SUCCESS) { // m_log->WriteFmtStrWithTime_L1("[updateItem_MonitorInfo] >>> no recorder is found"); // return 0; // } //int nRet = dboption.ExecuteCmd(cmdbuf, SERVER_MAIN); int nRet = dboption.ExecuteCmd(cmdbuf);//BUG #251 CCTV插件界面调用切换摄像头操作后不能同步写两个冗余的同步参数库 if (nRet == 0) m_log->WriteFmtStrWithTime_L1("[updateItem_MonitorInfo] >>> no recorder is found"); return 1; } #else int CPlugCCTVC3::updateItem_MonitorInfo(LPMonitorInfo pMonitor) { char cmdbuf[2048] = {0}; strcpy(cmdbuf, "UPDATE SEMODEL.TB5012_CCTVMONITORINFO SET ("); int i; strcat(cmdbuf, "F5012_SCREENCOUNT"); for (i=0; iscreenNum); strcat(cmdbuf, tmpStr); for (i=0; iscreen[i].cameraCode)) sprintf(tmpStr, ",'%s','%s'", m_group[pMonitor->screen[i].groupIndex].code, pMonitor->screen[i].cameraCode); else sprintf(tmpStr, ",null,null"); strcat(cmdbuf, tmpStr); } strcat(cmdbuf, " from dual) WHERE F5012_NO="); memset(tmpStr, 0, 128); sprintf(tmpStr, "%d", pMonitor->index); strcat(cmdbuf, tmpStr); // m_log->WriteFmtStrWithTime_L3("%s", cmdbuf); CSE_DBOption dboption; // if (dboption.ExecuteCmd(cmdbuf, SERVER_MAIN) != SEDB_SUCCESS) // return 0; //int nRet = dboption.ExecuteCmd(cmdbuf, SERVER_MAIN); int nRet = dboption.ExecuteCmd(cmdbuf);//BUG #251 CCTV插件界面调用切换摄像头操作后不能同步写两个冗余的同步参数库 return 1; } #endif int CPlugCCTVC3::removeItem_MonitorInfo(LPMonitorInfo pMonitor) { char cmdbuf[1024] = {0}; strcpy(cmdbuf, "DELETE FROM SEMODEL.TB5012_CCTVMONITORINFO WHERE F5012_NO="); char tmpStr[32] = {0}; sprintf(tmpStr, "%d", pMonitor->index); strcat(cmdbuf, tmpStr); // m_log->WriteFmtStrWithTime_L3("%s", cmdbuf); CSE_DBOption dboption; // if (dboption.ExecuteCmd(cmdbuf, SERVER_MAIN) != SEDB_SUCCESS) // return 0; //int nRet = dboption.ExecuteCmd(cmdbuf, SERVER_MAIN); int nRet = dboption.ExecuteCmd(cmdbuf);//BUG #251 CCTV插件界面调用切换摄像头操作后不能同步写两个冗余的同步参数库 return 1; } int CPlugCCTVC3::removeItem_DisplayMode(LPDisplayModeInfo pDisplayMode) { char cmdbuf[1024] = {0}; strcpy(cmdbuf, "DELETE FROM SEMODEL.TB5014_CCTVDISPLAYMODE WHERE F5014_NO="); char tmpStr[32] = {0}; sprintf(tmpStr, "%d", pDisplayMode->index); strcat(cmdbuf, tmpStr); // m_log->WriteFmtStrWithTime_L3("%s", cmdbuf); CSE_DBOption dboption; // if (dboption.ExecuteCmd(cmdbuf, SERVER_MAIN) != SEDB_SUCCESS) // return 0; //int nRet = dboption.ExecuteCmd(cmdbuf, SERVER_MAIN); int nRet = dboption.ExecuteCmd(cmdbuf);//BUG #251 CCTV插件界面调用切换摄像头操作后不能同步写两个冗余的同步参数库 return 1; } unsigned char CPlugCCTVC3::getDiv(LPScreenSet lpScreenSet) { if(lpScreenSet->screenIndex < 4) { if (lpScreenSet->screenNum == 5 || lpScreenSet->screenNum == 1 || lpScreenSet->screenNum == 7) // lpScreenSet->screenNum == 5\7\1说明前4分屏做了4切1分屏 { return 0; } else { return 1; } } else { if (lpScreenSet->screenNum == 4 || lpScreenSet->screenNum == 5 || lpScreenSet->screenNum == 8) // lpScreenSet->screenNum == 4、5、8,说明后4分屏为4分屏 { return 1; } else { return 0; } } } //////////////////////////////////////////////////////////////////////////////////// int CPlugCCTVC3::switchCamera(LPScreenSet lpScreenSet) { CameraInfo camera_info; CameraInfo_Init(&camera_info); strcpy(camera_info.desc.code, lpScreenSet->screen.camera_desc.code); if ( getCameraInfoByCode(&camera_info) <= 0 ) return -1; ALM_D_BASE_INFO alminfo = {0}; memset(&alminfo, 0, sizeof(ALM_D_BASE_INFO)); strcpy(alminfo.DeviceKey, camera_info.desc.code); strcpy(alminfo.ClassName, "Control"); alminfo.Operator = ALM_K_OPR_ALM; CSeTime kt; TCriterionTime ct; kt.GetNow(&ct, &alminfo.Msec); alminfo.Second = ct; alminfo.Priority = ALM_K_PRI_EVENT; alminfo.DeviceType = 80; alminfo.MessageId = 1; strcpy(alminfo.Graph, ""); alminfo.AttrNum = 5; strcpy(alminfo.UserAttrList[0].UserAttrName, "User"); strcpy(alminfo.UserAttrList[1].UserAttrName, "Console"); get_host_name(alminfo.UserAttrList[1].UserAttrVal); AOJ_GetConsoleDesc(alminfo.UserAttrList[1].UserAttrVal, alminfo.UserAttrList[1].UserAttrValDesc); strcpy(alminfo.UserAttrList[2].UserAttrName, "CtrlType"); sprintf(alminfo.UserAttrList[2].UserAttrVal, "%d", CCTV_E_VIEW); strcpy(alminfo.UserAttrList[2].UserAttrValDesc, "图像显示"); strcpy(alminfo.UserAttrList[3].UserAttrName, "CtrlState"); strcpy(alminfo.UserAttrList[3].UserAttrVal, "0"); strcpy(alminfo.UserAttrList[3].UserAttrValDesc, "成功"); strcpy(alminfo.UserAttrList[4].UserAttrName, "Point"); strcpy(alminfo.UserAttrList[4].UserAttrVal, camera_info.desc.code); AOJ_D_ASSIGNMENT AojMask; AOJ_GetAssignment(NULL, AojMask, DEF_RIGHT_DEVICE_C); char UserName[SE_K_USER_CODE] = {0}; RBAC_GetUserRoleDescription(UserName, alminfo.UserAttrList[0].UserAttrValDesc, NULL, NULL); strcpy(alminfo.UserAttrList[0].UserAttrVal, UserName); alminfo.Aoj = camera_info.aoj; alminfo.AppSysId = camera_info.appSysID; strcpy(alminfo.UserAttrList[4].UserAttrValDesc, camera_info.desc.data); strcpy(alminfo.GroupName, m_group[lpScreenSet->screen.groupIndex].code); /* if(!m_isLevel2) { m_csi.CCTV_Login(m_nPLevel); } else { m_csi.CCTV_Login(m_nPLevel2); } */ // m_Sta = lpScreenSet->screen.groupIndex + 1;//站 m_Sta = m_group[lpScreenSet->screen.groupIndex].groupno;//WYF 20190425 // m_Div = (lpScreenSet->screenNum == MaxNum_Screen || lpScreenSet->screenNum == MaxNum_ScreenColumn) ? 1 : 0;//当前分屏数 m_Div = getDiv(lpScreenSet); m_Win = lpScreenSet->screenIndex + 1;//1分屏:分屏0 4分屏:分屏0 ~ 分屏3 m_Wall = 2; // 待确定:电视墙编号 m_Task = 3; // 待确定:任务编号 if(lpScreenSet->screenIndex<4) // 前4分屏用ptzLevel { m_csi.CCTV_Login(m_nPLevel);m_isLevel2=false; } else // 后4分屏用ptzLevel2 { m_csi.CCTV_Login(m_nPLevel2);m_isLevel2=true; } if(m_nDigAnaCCTVtype == 2 && m_Div == 0)//17号线不需要此功能 17号线的时候配置文件里面DigAnaCCTVtype值要配为1 { if(lpScreenSet->screenIndex < 4) { m_Win = (m_nLast4ScreenFocusIndex==0)?1:m_nLast4ScreenFocusIndex+1; } else { m_Win = m_nLast4ScreenFocusIndex2 +1; } } CameraDesc camera_Desc; CameraDesc_Init(&camera_Desc); strcpy(camera_Desc.code, m_decode[0][m_Win-1]); getCCTVDeviceNumber(&camera_Desc,1); BYTE deviceNum = atoi(camera_Desc.deviceNumber);//这个值小于255 // 获取monitor的code,如果屏幕数大于4,就使用第2个monitor的code lilei 20190710 char* code = m_display.dispatch[0].code; if (m_Win > 4) { code = m_display.dispatch[0].code2; } m_log->WriteFmtStrWithTime_L2("(%d) switch camera >>> camera: %s, line: %d, station: %d, div: %d, win: %d, monitor: %s, decode: %d,角色%d", __LINE__, camera_info.desc.code, m_Line, m_Sta, m_Div, m_Win, code, deviceNum,m_isLevel2*m_nPLevel2); m_csi.CCTV_SelectCam(camera_info.desc.code, m_Line, m_Sta, m_Div, (m_Win-1)%4+1, m_Wall, m_Task, (char)deviceNum); // m_csi.CCTV_SelectMon(m_display.dispatch[0].code); m_csi.CCTV_SelectMon(code); m_csi.CCTV_Switch(); //m_csi.AlmSignal(UserName, alminfo);//注释此代码,减轻历史表压力. feature #130 Yansx 20190610 return 1; } int CPlugCCTVC3::cameraAct(LPScreenSet lpScreenSet, OperTypeCamera oper_type, int nMouseState ,void * value) { if (NULL == lpScreenSet || NULL == value) return 0; unsigned short nowMsec=0; //sint32 nowSec=GetNowSecond(&nowMsec);//WYF 20190127 //if(2>nowSec-m_LastSendSec)return 0; //Remove by Yansx 2019-03-04 因为现在click事件拆分成Down和Up事件,所以放在UI层去做2秒过滤. LPPtzCtlInfoEx lpPtzctlex = (LPPtzCtlInfoEx)value; CameraInfo camera_info; CameraInfo_Init(&camera_info); strcpy(camera_info.desc.code, lpScreenSet->screen.camera_desc.code); if ( getCameraInfoByCode(&camera_info) <= 0 ) return -1; ALM_D_BASE_INFO alminfo = {0}; memset(&alminfo, 0, sizeof(ALM_D_BASE_INFO)); strcpy(alminfo.DeviceKey, camera_info.desc.code); strcpy(alminfo.ClassName, "Control"); alminfo.Operator = ALM_K_OPR_ALM; CSeTime kt; TCriterionTime ct; kt.GetNow(&ct, &alminfo.Msec); alminfo.Second = ct; alminfo.Priority = ALM_K_PRI_EVENT; alminfo.DeviceType = 80; alminfo.MessageId = 1; strcpy(alminfo.Graph, ""); alminfo.AttrNum = 5; strcpy(alminfo.UserAttrList[0].UserAttrName, "User"); strcpy(alminfo.UserAttrList[1].UserAttrName, "Console"); get_host_name(alminfo.UserAttrList[1].UserAttrVal); AOJ_GetConsoleDesc(alminfo.UserAttrList[1].UserAttrVal, alminfo.UserAttrList[1].UserAttrValDesc); strcpy(alminfo.UserAttrList[2].UserAttrName, "CtrlType"); sprintf(alminfo.UserAttrList[2].UserAttrVal, "%d", lpPtzctlex->ptz.ctrlValue); strcpy(alminfo.UserAttrList[2].UserAttrValDesc, lpPtzctlex->desc); strcpy(alminfo.UserAttrList[3].UserAttrName, "CtrlState"); strcpy(alminfo.UserAttrList[3].UserAttrVal, "0"); strcpy(alminfo.UserAttrList[3].UserAttrValDesc, "成功"); strcpy(alminfo.UserAttrList[4].UserAttrName, "Point"); strcpy(alminfo.UserAttrList[4].UserAttrVal, camera_info.desc.code); AOJ_D_ASSIGNMENT AojMask; AOJ_GetAssignment(NULL,AojMask, DEF_RIGHT_DEVICE_C); char UserName[SE_K_USER_CODE] = {0}; RBAC_GetUserRoleDescription(UserName, alminfo.UserAttrList[0].UserAttrValDesc, NULL, NULL); strcpy(alminfo.UserAttrList[0].UserAttrVal, UserName); alminfo.Aoj = camera_info.aoj; alminfo.AppSysId = camera_info.appSysID; strcpy(alminfo.UserAttrList[4].UserAttrValDesc, camera_info.desc.data); strcpy(alminfo.GroupName, m_group[lpScreenSet->screen.groupIndex].code); m_csi.CCTV_Login(m_nPLevel); // m_Sta = lpScreenSet->screen.groupIndex + 1; m_Sta = m_group[lpScreenSet->screen.groupIndex].groupno;//WYF 20190425 //m_Div = (lpScreenSet->screenNum == MaxNum_Screen || lpScreenSet->screenNum == MaxNum_ScreenColumn) ? 1 : 0; m_Div = getDiv(lpScreenSet); m_Win = lpScreenSet->screenIndex + 1; m_Wall = 2; // 待确定:电视墙编号 //m_Task = 3; // 待确定:任务编号 m_Task = nMouseState;//这个值我们暂时用来表示鼠标的状态,1表示Down,0表示Up Yansx 2019-02-27 if(lpScreenSet->screenIndex<4) { m_csi.CCTV_Login(m_nPLevel);m_isLevel2=false; } else { m_csi.CCTV_Login(m_nPLevel2);m_isLevel2=true; } if(m_nDigAnaCCTVtype == 2 && m_Div == 0)//17号线不需要此功能 17号线的时候配置文件里面DigAnaCCTVtype值要配为1 { if(lpScreenSet->screenIndex < 4) { m_Win = (m_nLast4ScreenFocusIndex==0)?1:m_nLast4ScreenFocusIndex+1; } else { m_Win = m_nLast4ScreenFocusIndex2 +1; } } //Yansx 20190130 CameraDesc camera_Desc; CameraDesc_Init(&camera_Desc); strcpy(camera_Desc.code, m_decode[0][m_Win-1]); getCCTVDeviceNumber(&camera_Desc,1); BYTE deviceNum = atoi(camera_Desc.deviceNumber);//这个值小于255 // 获取monitor的code,如果屏幕数大于4,就使用第2个monitor的code lilei 20190710 char* code = m_display.dispatch[0].code; if (m_Win > 4) { code = m_display.dispatch[0].code2; } // m_log->WriteFmtStrWithTime_L2("(%d) control camera >>> camera: %s, line: %d, station: %d, div: %d, win: %d,MouseState: %d, monitor: %s", // __LINE__, camera_info.desc.code, m_Line, m_Sta, m_Div, m_Win,m_Task, code); m_log->WriteFmtStrWithTime_L2("(%d) control camera >>> camera: %s, line: %d, station: %d, div: %d, win: %d,MouseState: %d, monitor: %s, decode: %d,角色%d" , __LINE__, camera_info.desc.code, m_Line, m_Sta, m_Div, (m_Win-1)%4+1, m_Task, code, deviceNum,m_isLevel2*m_nPLevel2); m_csi.CCTV_SelectCam(camera_info.desc.code, m_Line, m_Sta, m_Div, (m_Win-1)%4+1, m_Wall, m_Task, (char)deviceNum); m_csi.CCTV_SelectMon(code); if (lpPtzctlex->ptz.ctrlValue == CCTV_E_PRESET_GOTO) { m_log->WriteFmtStrWithTime_L2("(%d) go to preset place %d", __LINE__, lpPtzctlex->ptz.paraValue); m_csi.CCTV_View(lpPtzctlex->ptz.paraValue); } else { m_log->WriteFmtStrWithTime_L2("(%d) PTZ: type = %d, steplen = %d", __LINE__, lpPtzctlex->ptz.ctrlValue, lpPtzctlex->ptz.paraValue); m_csi.CCTV_PTZ(lpPtzctlex->ptz.ctrlValue, lpPtzctlex->ptz.paraValue); // ptz控制 } //m_csi.AlmSignal(UserName, alminfo);//注释此代码,减轻历史表压力. feature #130 Yansx 20190610 //m_LastSendSec=GetNowSecond(&m_LastSendMsec);//WYF 20190127 return 1; }