camera.cpp

来自「用vc编写的视频采集端口编成」· C++ 代码 · 共 2,257 行 · 第 1/4 页

CPP
2,257 行
字号
		szCommandLine[3] = 0x10;
		szCommandLine[4] = 0x0;
		szCommandLine[5] = pnSpeedTable[dwTiltSpeed];
		szCommandLine[6] = CheckSum();
		nStrLen = 7;
	}
	else{
		szCommandLine[0] = 0xa0;
		szCommandLine[1] = 0x0;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x8;
		szCommandLine[4] = 0x0;//pnSpeedTable[iSpd];
		szCommandLine[5] = 0x20;
		szCommandLine[6] = 0xaf;
		szCommandLine[7] = 0x27;
		nStrLen = 8;
	}
	if(pCameraList[m_iCurrentCamera].iAVPort == 1){// Channel 1
		if(M7_WriteAuxCom(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}
	else{
		if(M7_WriteAuxCom2(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}

	return 1;
}

bool CCamera::JIMU_StopTiltDown()
{
	int nStrLen;
	if(pCameraList[m_iCurrentCamera].iProtocol == PELCO_D){
		szCommandLine[0] = 0xff;
		szCommandLine[1] = 0x1;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0x0;
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0x1;
		nStrLen = 7;
	}
	else{
		szCommandLine[0] = 0xa0;
		szCommandLine[1] = 0x0;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0;//pnSpeedTable[iSpd];
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0xaf;
		szCommandLine[7] = 0x0f;
		nStrLen = 8;
	}
	if(pCameraList[m_iCurrentCamera].iAVPort == 1){// Channel 1
		if(M7_WriteAuxCom(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}
	else{
		if(M7_WriteAuxCom2(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}

	return 1;
}

bool CCamera::JIMU_ZoomTelephoto()
{
	int nStrLen;
	if(pCameraList[m_iCurrentCamera].iProtocol == PELCO_D){
		szCommandLine[0] = 0xff;
		szCommandLine[1] = 0x1;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x20;
		szCommandLine[4] = 0x0;
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0x21;
		nStrLen = 7;
	}
	else{
		szCommandLine[0] = 0xa0;
		szCommandLine[1] = 0x0;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x20;
		szCommandLine[4] = 0;//pnSpeedTable[iSpd];
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0xaf;
		szCommandLine[7] = 0x2f;
		nStrLen = 8;
	}

	if(pCameraList[m_iCurrentCamera].iAVPort == 1){// Channel 1
		if(M7_WriteAuxCom(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}
	else{
		if(M7_WriteAuxCom2(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}

	return 1;
}
bool CCamera::JIMU_StopZoomTelephoto()
{
	int nStrLen;
		if(pCameraList[m_iCurrentCamera].iProtocol == PELCO_D){
		szCommandLine[0] = 0xff;
		szCommandLine[1] = 0x1;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0x0;
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0x1;
		nStrLen = 7;
	}
	else{
		szCommandLine[0] = 0xa0;
		szCommandLine[1] = 0x0;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0;//pnSpeedTable[iSpd];
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0xaf;
		szCommandLine[7] = 0x0f;
		nStrLen = 8;
	}
	if(pCameraList[m_iCurrentCamera].iAVPort == 1){// Channel 1
		if(M7_WriteAuxCom(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}
	else{
		if(M7_WriteAuxCom2(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}

	return 1;
}
bool CCamera::JIMU_ZoomWide()
{
	int nStrLen;
		if(pCameraList[m_iCurrentCamera].iProtocol == PELCO_D){
		szCommandLine[0] = 0xff;
		szCommandLine[1] = 0x1;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x40;
		szCommandLine[4] = 0x0;
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0x41;
		nStrLen = 7;
	}
	else{
		szCommandLine[0] = 0xa0;
		szCommandLine[1] = 0x0;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x40;
		szCommandLine[4] = 0;//pnSpeedTable[iSpd];
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0xaf;
		szCommandLine[7] = 0x4f;
		nStrLen = 8;
	}
	if(pCameraList[m_iCurrentCamera].iAVPort == 1){// Channel 1
		if(M7_WriteAuxCom(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}
	else{
		if(M7_WriteAuxCom2(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}

	return 1;
}
bool CCamera::JIMU_StopZoomWide()
{
	int nStrLen;
		if(pCameraList[m_iCurrentCamera].iProtocol == PELCO_D){
		szCommandLine[0] = 0xff;
		szCommandLine[1] = 0x1;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0x0;
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0x1;
		nStrLen = 7;
	}
	else{
		szCommandLine[0] = 0xa0;
		szCommandLine[1] = 0x0;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0;//pnSpeedTable[iSpd];
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0xaf;
		szCommandLine[7] = 0x0f;
		nStrLen = 8;
	}
	if(pCameraList[m_iCurrentCamera].iAVPort == 1){// Channel 1
		if(M7_WriteAuxCom(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}
	else{
		if(M7_WriteAuxCom2(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}

	return 1;
}

bool CCamera::JIMU_FocusNear()
{
	int nStrLen;
		if(pCameraList[m_iCurrentCamera].iProtocol == PELCO_D){
		szCommandLine[0] = 0xff;
		szCommandLine[1] = 0x1;
		szCommandLine[2] = 0x1;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0x0;
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0x2;
		nStrLen = 7;
	}
	else{
		szCommandLine[0] = 0xa0;
		szCommandLine[1] = 0x0;
		szCommandLine[2] = 0x2;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0;//pnSpeedTable[iSpd];
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0xaf;
		szCommandLine[7] = 0x0d;
		nStrLen = 8;
	}
	if(pCameraList[m_iCurrentCamera].iAVPort == 1){// Channel 1
		if(M7_WriteAuxCom(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}
	else{
		if(M7_WriteAuxCom2(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}

	return 1;
}
bool CCamera::JIMU_StopFocusNear()
{
	int nStrLen;
		if(pCameraList[m_iCurrentCamera].iProtocol == PELCO_D){
		szCommandLine[0] = 0xff;
		szCommandLine[1] = 0x1;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0x0;
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0x1;
		nStrLen = 7;
	}
	else{
		szCommandLine[0] = 0xa0;
		szCommandLine[1] = 0x0;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0;//piSpdTable[iSpd];
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0xaf;
		szCommandLine[7] = 0x0f;
		nStrLen = 8;
	}
	if(pCameraList[m_iCurrentCamera].iAVPort == 1){// Channel 1
		if(M7_WriteAuxCom(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}
	else{
		if(M7_WriteAuxCom2(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}

	return 1;
}
bool CCamera::JIMU_FocusFar()
{
	int nStrLen;
	if(1){
			if(pCameraList[m_iCurrentCamera].iProtocol == PELCO_D){
				szCommandLine[0] = 0xff;
				szCommandLine[1] = 0x1;
				szCommandLine[2] = 0x0;
				szCommandLine[3] = 0x80;
				szCommandLine[4] = 0x0;
				szCommandLine[5] = 0x0;
				szCommandLine[6] = 0x81;
				nStrLen = 7;
			}
			else{
				szCommandLine[0] = 0xa0;
				szCommandLine[1] = 0x0;
				szCommandLine[2] = 0x1;
				szCommandLine[3] = 0x0;
				szCommandLine[4] = 0;//pnSpeedTable[iSpd];
				szCommandLine[5] = 0x0;
				szCommandLine[6] = 0xaf;
				szCommandLine[7] = 0x0e;
				nStrLen = 8;
			}
			if(pCameraList[m_iCurrentCamera].iAVPort == 1){// Channel 1
				if(M7_WriteAuxCom(m_hM7, nStrLen, szCommandLine)){
					MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
					return 0;
				}
			}
			else{
				if(M7_WriteAuxCom2(m_hM7, nStrLen, szCommandLine)){
					MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
					return 0;
				}
			}
			return 1;	
	}

	return 1;
}
bool CCamera::JIMU_StopFocusFar()
{
	int nStrLen;
		if(pCameraList[m_iCurrentCamera].iProtocol == PELCO_D){
		szCommandLine[0] = 0xff;
		szCommandLine[1] = 0x1;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0x0;
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0x1;
		nStrLen = 7;
	}
	else{
		szCommandLine[0] = 0xa0;
		szCommandLine[1] = 0x0;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0;//pnSpeedTable[iSpd];
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0xaf;
		szCommandLine[7] = 0x0f;
		nStrLen = 8;
	}
	if(pCameraList[m_iCurrentCamera].iAVPort == 1){// Channel 1
		if(M7_WriteAuxCom(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}
	else{
		if(M7_WriteAuxCom2(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}

	return 1;
}

bool CCamera::JIMU_IrisOpen()
{
	int nStrLen;
		if(pCameraList[m_iCurrentCamera].iProtocol == PELCO_D){
		szCommandLine[0] = 0xff;
		szCommandLine[1] = 0x1;
		szCommandLine[2] = 0x2;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0x0;
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0x3;
		nStrLen = 7;
	}
	else{
		szCommandLine[0] = 0xa0;
		szCommandLine[1] = 0x0;
		szCommandLine[2] = 0x4;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0;//pnSpeedTable[iSpd];
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0xaf;
		szCommandLine[7] = 0xb;
		nStrLen = 8;
	}
	if(pCameraList[m_iCurrentCamera].iAVPort == 1){// Channel 1
		if(M7_WriteAuxCom(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}
	else{
		if(M7_WriteAuxCom2(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}

	return 1;
}
bool CCamera::JIMU_StopIrisOpen()
{
	int nStrLen;
		if(pCameraList[m_iCurrentCamera].iProtocol == PELCO_D){
		szCommandLine[0] = 0xff;
		szCommandLine[1] = 0x1;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0x0;
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0x1;
		nStrLen = 7;
	}
	else{
		szCommandLine[0] = 0xa0;
		szCommandLine[1] = 0x0;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0;//piSpdTable[iSpd];
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0xaf;
		szCommandLine[7] = 0x0f;
		nStrLen = 8;
	}
	if(pCameraList[m_iCurrentCamera].iAVPort == 1){// Channel 1
		if(M7_WriteAuxCom(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}
	else{
		if(M7_WriteAuxCom2(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}

	return 1;
}
bool CCamera::JIMU_IrisClose()
{
	int nStrLen;
		if(pCameraList[m_iCurrentCamera].iProtocol == PELCO_D){
		szCommandLine[0] = 0xff;
		szCommandLine[1] = 0x1;
		szCommandLine[2] = 0x4;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0x0;
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0x5;
		nStrLen = 7;
	}
	else{
		szCommandLine[0] = 0xa0;
		szCommandLine[1] = 0x0;
		szCommandLine[2] = 0x8;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0;//pnSpeedTable[iSpd];
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0xaf;
		szCommandLine[7] = 0x7;
		nStrLen = 8;
	}
	if(pCameraList[m_iCurrentCamera].iAVPort == 1){// Channel 1
		if(M7_WriteAuxCom(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}
	else{
		if(M7_WriteAuxCom2(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}

	return 1;
}

bool CCamera::JIMU_StopIrisClose()
{
	int nStrLen;
		if(pCameraList[m_iCurrentCamera].iProtocol == PELCO_D){
		szCommandLine[0] = 0xff;
		szCommandLine[1] = 0x1;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0x0;
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0x1;
		nStrLen = 7;
	}
	else{
		szCommandLine[0] = 0xa0;
		szCommandLine[1] = 0x0;
		szCommandLine[2] = 0x0;
		szCommandLine[3] = 0x0;
		szCommandLine[4] = 0;//pnSpeedTable[iSpd];
		szCommandLine[5] = 0x0;
		szCommandLine[6] = 0xaf;
		szCommandLine[7] = 0x0f;
		nStrLen = 8;
	}
	if(pCameraList[m_iCurrentCamera].iAVPort == 1){// Channel 1
		if(M7_WriteAuxCom(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}
	else{
		if(M7_WriteAuxCom2(m_hM7, nStrLen, szCommandLine)){
			MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
			return 0;
		}
	}

	return 1;
}

bool CCamera::JIMU_SetPreset(int nNum)
{
	szCommandLine[0] = 0xff;
	szCommandLine[1] = 0x1;
	szCommandLine[2] = 0x0;
	szCommandLine[3] = 0x0;
	szCommandLine[4] = 0x0;
	szCommandLine[5] = 0x0;
	szCommandLine[6] = 0x1;
	int nStrLen = 7;
	if(pCameraList[m_iCurrentCamera].iAVPort == 1){// Channel 1

		for (int i = 1; i <= 3; i++)
			if(M7_WriteAuxCom(m_hM7, nStrLen, szCommandLine)){
				MessageBox(NULL, "WriteComm error", "error", MB_OK | MB_ICONERROR);
				return 0;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?