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-MATRIX.lua

local Protocol = {};

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

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

Protocol.Command = 
{
	-- д����Э��ʱֻ����16���ƻ��ַ���ʾ,û�еĻ���ע�͵�
	Start= 
	{
		--д��������, ���ϣ����£����ϣ�����
		TileUp 		= "0x44, 0x48, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00",
		TileDown 	= "0x44, 0x48, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00",
		PanLeft 	= "0x44, 0x48, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00",
		PanRight 	= "0x44, 0x48, 0x00, 0x03, 0x01, 0x00, 0x00, 0x00",

		ZoomWide 	= "0x44, 0x48, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00",
		ZoomTele 	= "0x44, 0x48, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00",
		FocusNear	= "0x44, 0x48, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00",
		FocusFar 	= "0x44, 0x48, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00",
		IrisSmall   = "0x44, 0x48, 0x09, 0x01, 0x01, 0x00, 0x00, 0x00",
		IrisLarge   = "0x44, 0x48, 0x09, 0x00, 0x01, 0x00, 0x00, 0x00",
			
		AlarmSearch 	= "0x44, 0x48, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00",
			
		-- �ƹ�
		LightOn		= "0x44, 0x48, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00",
		LightOff    = "0x44, 0x48, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00",
			
		-- Ԥ�õ��������ã�����ת��)
		SetPreset 	= "0x44, 0x48, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00",
		ClearPreset	= "0x44, 0x48, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00",
		GoToPreset 	= "0x44, 0x48, 0x07, 0x02, 0x00, 0x00, 0x00, 0x00",			        
        
        MatrixSwitch    = "0x44, 0x48, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00",
				

		AuxOn 	    = "0x44, 0x48, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00",
		AuxOff   	= "0x44, 0x48, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00",
			
		-- �˵���ز��

		Menu            = "0x44, 0x48, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00",
		MenuExit        = "0x44, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00",
		
		MenuUp          = "0x44, 0x48, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00",
		MenuDown        = "0x44, 0x48, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00",
		MenuLeft        = "0x44, 0x48, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00",
		MenuRight       = "0x44, 0x48, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00",

	},
	Stop = 
	{
		TileUp 		= "0x44, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00",
		TileDown 	= "0x44, 0x48, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00",
		PanLeft 	= "0x44, 0x48, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00",
		PanRight 	= "0x44, 0x48, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00",

		ZoomWide 	= "0x44, 0x48, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00",
		ZoomTele 	= "0x44, 0x48, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00",
		FocusNear	= "0x44, 0x48, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00",
		FocusFar 	= "0x44, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00",
		IrisSmall       = "0x44, 0x48, 0x09, 0x01, 0x00, 0x00, 0x00, 0x00",
		IrisLarge       = "0x44, 0x48, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00",
	},
}

Protocol.Checksum = function (s)
	return s;
end;

Protocol.MonAddrProcess = function(s, addr)
         s[6] = addr;
	 return s;
end;

Protocol.CamAddrProcess = function(s, addr)
        local highaddr = math.floor(addr/256);
	local lowaddr = math.mod(addr,256);
        s[8] = lowaddr;
        s[7] = highaddr;
	return s;
end;

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

Protocol.SpeedProcess = function(s, arg1, arg2)
	if s[5] == 0x01 then
		if s[4] == 0x00 or s[4] == 0x01 then
			s[5] = arg1;
		elseif s[4] == 0x02 or s[4] == 0x03 then
			s[5] = arg2;
		end;
	end;
	return s;
end;

return Protocol;