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

-- ���Ǵ�Э�飬�Ѿ����ã����ø���
local Protocol = {};

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

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

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

		ZoomWide 	= "0xf6, 0x4b, 0x00, 0x00, 0x09, 0x01, 0x00",
		ZoomTele 	= "0xf6, 0x4c, 0x00, 0x00, 0x09, 0x01, 0x00",
		FocusNear	= "0xf6, 0x4e, 0x00, 0x00, 0x09, 0x01, 0x00",
		FocusFar 	= "0xf6, 0x4d, 0x00, 0x80, 0x09, 0x01, 0x00",
		IrisSmall       = "0xf6, 0x49, 0x00, 0x00, 0x09, 0x01, 0x00",
		IrisLarge       = "0xf6, 0x4a, 0x00, 0x00, 0x09, 0x01, 0x00",
			

			
		-- Ԥ�õ��������ã�����ת��)
		SetPreset 	= "0xf6, 0x52, 0x00, 0x00, 0x00, 0x0f, 0x00",
		ClearPreset	= "0xf6, 0x01, 0x00, 0x05, 0x00, 0x0f, 0x00",
		GoToPreset 	= "0xf6, 0x54, 0x00, 0x00, 0x00, 0x0f, 0x00",			
		
		SetLeftLimit 	= "0xf6, 0x5c, 0x00, 0x00, 0x01, 0x0f, 0x00",
		SetRightLimit	= "0xf6, 0x5c, 0x00, 0x00, 0x00, 0x0f, 0x00", 
		AutoScanOn 	= "0xf6, 0x5d, 0x00, 0x00, 0x01, 0x0f, 0x00,",
		AutoScanOff	= "0xf6, 0x5d, 0x00, 0x00, 0x00, 0x0f, 0x00,",	
			
		-- �Զ�Ѳ����һ��ָ��Ԥ�õ�֮��Ѳ��

		AddTour 	= "0xf6, 0x55, 0x00, 0x00, 0x00, 0x0f, 0x00",
		DeleteTour 	= "0xf6, 0x56, 0x00, 0x00, 0x00, 0x0f, 0x00",
		StartTour 	= "0xf6, 0x59, 0x00, 0x00, 0x01, 0x0f, 0x00",
		StopTour 	= "0xf6, 0x59, 0x00, 0x00, 0x00, 0x0f, 0x00",
		
		--�������
		AuxOn  = "0xf6, 0x5e, 0x00, 0x00, 0x00, 0x01, 0x00",
		AuxOff = "0xf6, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00",

	},
	Stop = 
	{
		TileUp 		= "0xf6, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00,",
		TileDown 	= "0xf6, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00,",
		PanLeft 	= "0xf6, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00,", 
		PanRight 	= "0xf6, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00,",

		ZoomWide 	= "0xf6, 0x4a, 0x00, 0x00, 0xff, 0x01, 0x00",
		ZoomTele 	= "0xf6, 0x4a, 0x00, 0x00, 0xff, 0x01, 0x00",
		FocusNear	= "0xf6, 0x4a, 0x00, 0x00, 0xff, 0x01, 0x00",
		FocusFar 	= "0xf6, 0x4a, 0x00, 0x00, 0xff, 0x01, 0x00",
		IrisSmall       = "0xf6, 0x4a, 0x00, 0x00, 0xff, 0x01, 0x00",
		IrisLarge       = "0xf6, 0x4a, 0x00, 0x00, 0xff, 0x01, 0x00",
	},
}

Protocol.Checksum = function (s)
         local sum = math.mod((s[2] + s[3] + s[4] + s[5] + s[6]), 256);
         s[7] = math.mod(sum,128);
	 return s;
end;


Protocol.CamAddrProcess = function(s, addr)
       s[4] = math.mod(addr,128);
       s[3] = math.floor(addr/128) * 128;
       return s ;
end;

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

Protocol.MultipleProcess = function(s,arg1)
      if s[5] == 0xff then
         s[5] = 0x00;
         return s;
      end;
      return s;
end;

Protocol.SetTourProcess = function(s, tour, preset)
        s[5] = preset;
	return s;
end;

Protocol.TourProcess = function(s, tour)
	return s;	
end;



--[[
����ĺ���ǿ�ѡ�ģ����������⴦���̲Ŵ򿪣�û�еĻ���ǧ��Ҫ�򿪣��������ɽ������
Protocol.MonAddrProcess = function(s, addr)
	return s;
end;

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

Protocol.PresetProcess = function(s, arg)
	return s;
end;
--]]


return Protocol;