Mini Kabibi Habibi

Current Path : C:/Program Files/Smart Professional Surveillance System/PC-NVR/Common/Lua/ptz/
Upload File :
Current File : C:/Program Files/Smart Professional Surveillance System/PC-NVR/Common/Lua/ptz/DH-CC440.lua

local Protocol = {};

-- ��ʾ�ֵ������16��10����(��Сֵ�����ֵ)
Protocol.Attr = 
{
	-- Э�����ʾ���,���ܳ���16�ַ���Ŀǰ�ݲ�֧������
	Name = "CC440",	
		
	-- ָ�����̨Э�黹�Ǿ���Э�飬ʹ��"PTZ", "MATRIX"��ʾ
	Type = "PTZ",
	
	-- ��msΪ��λ
	Internal = 200,
	
	AlarmLen = 4,
				
	-- û�ж�Ӧ�ĵ�ַ��Χ���붼���0xff
	-- ��̨��ַ��Χ
	CamAddrRange 		= {0x01, 0xFE}, 
	-- ���ӵ�ַ��Χ
	MonAddrRange		= {0x00, 0xFF},	
	-- Ԥ�õ㷶Χ
	PresetRange 		= {0x00, 0xff},
	-- �Զ�Ѳ����·��Χ
	TourRange			= {0x01, 0xff},
	-- �켣��·��Χ
	PatternRange		= {0x01, 0xff},
	-- ��ֱ�ٶȷ�Χ
	TileSpeedRange 		= {0x01, 0xfe},
	-- ˮƽ�ٶȷ�Χ
	PanSpeedRange 		= {0x01, 0xfe},
	
	-- �����Χ
	AuxRange 			= {0x01, 0x01},
}

Protocol.CommandAttr =
{
	-- Э������Ҫ���ĵ�λ�ã���LUA�±��ʾ�����±�ӣ���ʼ,��10���Ʊ�ʾ
	AddrPos 			= 1, 
	PresetPos 		= 4, 
	TileSpeedPos 	= 4,
	PanSpeedPos 	= 4,
	AuxPos 				= 4,
}

Protocol.Command = 
{
	-- д����Э��ʱֻ����16���ƻ��ַ���ʾ,û�еĻ���ע�͵�
	Start= 
	{
		--д��������, ���ϣ����£����ϣ�����
		TileUp 		= "0x00, 0x00, 0x00, 0xfe,",
		TileDown 	= "0x00, 0x00, 0x01, 0xfe,",
		PanLeft 	= "0x00, 0x00, 0x02, 0xfe,", 
		PanRight 	= "0x00, 0x00, 0x03, 0xfe,",
		--LeftUp 		= "0xff, 0x01, 0x88, 0x0c, 0x00, 0x00, 0x00,",
		--LeftDown 	= "0xff, 0x01, 0x88, 0x14, 0x00, 0x00, 0x00,",
		--RightUp		= "0xff, 0x01, 0x88, 0x0a, 0x00, 0x00, 0x00,",
		--RightDown = "0xff, 0x01, 0x88, 0x12, 0x00, 0x00, 0x00,",

		ZoomWide 	= "0x00, 0x02, 0x01, 0x05,",
		ZoomTele 	= "0x00, 0x02, 0x00, 0x05,",
		FocusNear	= "0x00, 0x03, 0x01, 0x00, 0x00, 0x04, 0x01, 0x05, 0x00, 0x03, 0x00, 0x00, ",
		FocusFar 	= "0x00, 0x03, 0x01, 0x00, 0x00, 0x04, 0x00, 0x05, 0x00, 0x03, 0x00, 0x00, ",
		IrisSmall = "0x00, 0x09, 0x01, 0x05,",
		IrisLarge = "0x00, 0x09, 0x00, 0x05,",
		
		AlarmSearch = "0x00, 0x10, 0x00, 0x00",
			
		-- �ƹ�
		LightOn		= "0x00, 0x08, 0x01, 0x00,",
		LightOff  = "0x00, 0x08, 0x00, 0x00,",
			
		-- Ԥ�õ��������ã�����ת��)
		SetPreset 	= "0x00, 0x07, 0x00, 0x00,",
		ClearPreset	= "0x00, 0x07, 0x01, 0x00,",
		GoToPreset 	= "0x00, 0x07, 0x02, 0x00,",			
			
		-- ��ֻ�����ʾ��ˢ����
		AuxOn 	= "0x00, 0x17, 0x00, 0x00,",
		AuxOff 	= "0x00, 0x17, 0x01, 0x00,",
			
		-- �˵���ز��
		Menu = "0x00, 0x05, 0x01, 0x00,",
		MenuExit = "0x00, 0x05, 0x00, 0x00,",
		--MenuEnter = "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		--MenuEsc = "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		MenuUp = "0x00, 0x06, 0x00, 0x00,",
		MenuDown = "0x00, 0x06, 0x01, 0x00,",
		MenuLeft = "0x00, 0x06, 0x02, 0x00,",
		MenuRight = "0x00, 0x06, 0x03, 0x00,",
		
	},
	Stop = 
	{
		TileUp 		= "0x00, 0x00, 0x00, 0x01,",
		TileDown 	= "0x00, 0x00, 0x01, 0x01,",
		PanLeft 	= "0x00, 0x00, 0x02, 0x01,", 
		PanRight 	= "0x00, 0x00, 0x03, 0x01,",
		
		ZoomWide 	= "0x00, 0x02, 0x01, 0x00,",
		ZoomTele 	= "0x00, 0x02, 0x00, 0x00,",
		FocusNear	= "0x00, 0x04, 0x01, 0x00,",
		FocusFar 	= "0x00, 0x04, 0x00, 0x00,",
		IrisSmall = "0x00, 0x09, 0x01, 0x00,",
		IrisLarge = "0x00, 0x09, 0x00, 0x00,",
	},
}

Protocol.Checksum = function (s)
	if table.getn(s) ~= 4 then
		s[5] = s[1];
		s[9] = s[1];
	end;
	return s;
end;

Protocol.SpeedProcess = function(s, hor, ver)
	if hor ~= 0 then
		if s[4] == 0xfe then
			s[4] = hor;
		end;
	end;
	
	if ver ~= 0 then
		if s[4] == 0xfe then
			s[4] = ver;
		end;
	end;	
	return s;
end;

Protocol.MultipleProcess = function(s, speed)
       if table.getn(s) ~= 4 then
                s[8] = speed * 5;
       elseif s[4] == 0x05 then
		s[4] = speed * 5;
       end;
       return s;          

end;
Protocol.AuxProcess = function(s, value)
	return s;
end;

return Protocol;