⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p_01.cpp

📁 pelco D protocol 的一个简单实现
💻 CPP
字号:
// p_01.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "D.h"
#include "ComPort.h"


int _tmain(int argc, _TCHAR* argv[])
{
	CComPort* com_port = new CComPort("COM1:;9600;0;0;8;0");
    BYTE buff[7];
	LPBYTE tmp_buffer;
	int n = 0;
	D_Pelco camera;
	while(1)
	{
	    
		char* str = "HELLO WORLD!";
		int pos = 0;
//		while(str[pos])
//		{
		  tmp_buffer = camera.WriteToScreen(1, 'G', (BYTE)(pos/7) );
		 // com_port->Write(buff,7);
		  memcpy(buff  , tmp_buffer, 7);
		  com_port ->Write(buff,7);
		//  pos++;
		//  Sleep(100);
		//}
		//	camera.WriteToScreen(0,"Hello world!!!");
		tmp_buffer = camera.CameraTilt(0,Up,0x3F);
		memcpy(buff  , tmp_buffer, 7);
		com_port ->Write(buff,7);
		Sleep(5000);
		tmp_buffer = camera.CameraPan(0,Left,0x3F);
		memcpy(buff  , tmp_buffer, 7);
		com_port ->Write(buff,7);
		Sleep(10000);
		tmp_buffer = camera.CameraPan(0,Right,0x3F);
		memcpy(buff  , tmp_buffer, 7);
		com_port ->Write(buff,7);
		Sleep(10000);
		tmp_buffer = camera.CameraTilt(0,Down,0x3F);
		memcpy(buff  , tmp_buffer, 7);
		com_port ->Write(buff,7);
		Sleep(5000);
		tmp_buffer = camera.CameraTilt(0,Up,0x3F);
		memcpy(buff  , tmp_buffer, 7);
		com_port ->Write(buff,7);
		Sleep(5000);
		tmp_buffer = camera.CameraFocus(0,Near);
		memcpy(buff  , tmp_buffer, 7);
		com_port ->Write(buff,7);
		Sleep(1000);
		tmp_buffer = camera.CameraFocus(0,Far);
		memcpy(buff  , tmp_buffer, 7);
		com_port ->Write(buff,7);
		Sleep(1000);
		tmp_buffer = camera.CameraZoom(0,Tele);
		memcpy(buff  , tmp_buffer, 7);
		com_port ->Write(buff,7);
		Sleep(3000);
		tmp_buffer = camera.CameraZoom(0,Wide);
		memcpy(buff  , tmp_buffer, 7);
		com_port ->Write(buff,7);
		Sleep(3000);

	}
	return 0;
}

⌨️ 快捷键说明

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