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/HY.lua

local Protocol = {};

-- ��ʾ�ֵ������16��10����(��Сֵ�����ֵ)
Protocol.Attr = 
{
	-- Э�����ʾ���,���ܳ���16�ַ���Ŀǰ�ݲ�֧������
	Name = "HY",	
		
	-- ָ�����̨Э�黹�Ǿ���Э�飬ʹ��"PTZ", "MATRIX"��ʾ
	Type = "PTZ",
	
	-- ��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, 0x01},
}

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

Protocol.Command = 
{
	-- д����Э��ʱֻ����16���ƻ��ַ���ʾ,û�еĻ���ע�͵�
	Start= 
	{
		--д��������, ���ϣ����£����ϣ�����
		TileUp 		= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x02, 0x00, 0x00, 0x00",
		TileDown 	= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x03, 0x00, 0x00, 0x00",
		PanLeft 	= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x04, 0x00, 0x00, 0x00",
		PanRight 	= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x05, 0x00, 0x00, 0x00",
		
		ZoomWide 	= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x06, 0x00, 0x00, 0x00",
		ZoomTele 	= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x07, 0x00, 0x00, 0x00",
		FocusNear	= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x08, 0x00, 0x00, 0x00",
		FocusFar 	= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x09, 0x00, 0x00, 0x00",
		IrisSmall = "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x0b, 0x00, 0x00, 0x00",
		IrisLarge = "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x0a, 0x00, 0x00, 0x00",
			
		
		LightOn 	= "0x05, 0x08, 0x3a, 0x00, 0xa5, 0x00, 0x0e, 0x00, 0x00, 0x00",
		LightOff 	= "0x05, 0x08, 0x3a, 0x00, 0xa5, 0x00, 0x2e, 0x00, 0x00, 0x00",
		
		AuxOn 	= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x0d, 0x00, 0x00, 0x00",
		AuxOff 	= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x2d, 0x00, 0x00, 0x00",
			
	},
	Stop = 
	{
		TileUp 		= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x22, 0x00, 0x00, 0x00",
		TileDown 	= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x23, 0x00, 0x00, 0x00",
		PanLeft 	= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x24, 0x00, 0x00, 0x00",
		PanRight 	= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x25, 0x00, 0x00, 0x00",
		
		ZoomWide 	= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x26, 0x00, 0x00, 0x00",
		ZoomTele 	= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x27, 0x00, 0x00, 0x00",
		FocusNear = "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x28, 0x00, 0x00, 0x00",
		FocusFar 	= "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x29, 0x00, 0x00, 0x00",
		IrisSmall = "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x2b, 0x00, 0x00, 0x00",
		IrisLarge = "0x05, 0x08, 0x3a, 0x89, 0xa5, 0x00, 0x2a, 0x00, 0x00, 0x00",
	},
}

Protocol.Checksum = function (s)
	local value = s[5];
	for i = 6, 8 do
		value = bits.bxor(value,s[i]);
	end;
	s[9] = math.mod(value, 256);
	return s;
end;


Protocol.CamAddrProcess = function(s, addr)
	s[6] = addr - 1;
	return s;
end;

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

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

return Protocol;