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

local Protocol = {};

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

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

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

		ZoomWide 	= "0x00, 0x01, 0x04, 0x07, 0x03, 0xFF,",
		ZoomTele 	= "0x00, 0x01, 0x04, 0x07, 0x02, 0xFF,",
		FocusNear       = "0x00, 0x01, 0x04, 0x08, 0x03, 0xFF,",
		FocusFar 	= "0x00, 0x01, 0x04, 0x08, 0x02, 0xFF,",
		IrisSmall       = "0x00, 0x01, 0x04, 0x0b, 0x03, 0xFF,",
		IrisLarge       = "0x00, 0x01, 0x04, 0x0b, 0x02, 0xFF,",
		--AlarmSearch 		= "0xff, 0x01, 0x00, 0x07, 0x00, 0x21, 0x00",
			
		-- �ƹ�
		LightOn		= "0x00, 0x01, 0x04, 0x33, 0x02, 0xFF,",
		LightOff        = "0x00, 0x01, 0x04, 0x33, 0x03, 0xFF,",
			
		-- Ԥ�õ��������ã�����ת��)
		--[[
		SetPreset 	= "0xff, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00",
		ClearPreset	= "0xff, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00",
		GoToPreset 	= "0xff, 0x01, 0x00, 0x07, 0x00, 0x00, 0x00",			
		--]]	
		-- ˮƽ�ת��
		--[[
		AutoPanOn		= "0xff, 0x01, 0x00, 0x1B, 0x00, 0x00, 0x00",
		AutoPanOff	= "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		--]]
			
		-- �Զ�ɨ�裬��Ԥ�����õı߽��м�ת��
		--[[
		SetLeftLimit 	= "0xff, 0x01, 0x00, 0x11, 0x00, 0x00, 0x00",
		SetRightLimit	= "0xff, 0x01, 0x00, 0x13, 0x00, 0x00, 0x00", 
		AutoScanOn 		= "0xff, 0x01, 0x98, 0x00, 0x00, 0x00, 0x00,",
		-- AutoScanOff	="";
		--]]
			
		-- �Զ�Ѳ����һ��ָ��Ԥ�õ�֮��Ѳ��
                --[[
		AddTour 	= "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		DeleteTour 	= "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		StartTour 	= "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		StopTour 		= "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		ClearTour		= "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
                --]]
			
		-- �켣Ѳ��, һ��ָģʽ(���ÿ�ʼ�����ý�������У�ֹͣ����ģʽ
		--[[
		SetPatternStart = "0xff, 0x01, 0x00, 0x1f, 0x00, 0x00, 0x00",
		SetPatternStop 	= "0xff, 0x01, 0x00, 0x21, 0x00, 0x00, 0x00",
		StartPattern 		= "0xff, 0x01, 0x00, 0x23, 0x00, 0x00, 0x00",
		StopPattern			= "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		ClearPattern 		= "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		--]]
		--[[
		AuxOn 	= "0xff, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00",
		AuxOff 	= "0xff, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00",
		--]]	
		-- �˵���ز��
		--[[
		Menu = "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		MenuExit = "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		MenuEnter = "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		MenuEsc = "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		MenuUp = "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		MenuDown = "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		MenuLeft = "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		MenuRight = "0xff, 0x01, 0x00, 0x1D, 0x00, 0x00, 0x00",
		
		-- ����������������Լ������ض���Ϣ���������ض���Ϣ������
		Position = "0x3a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,0x00, 0xff",	
		--]]
		
		-- ֱ�۸�����ز��
		--[[
		-- ��ͷ��Դ
		CamPowerOn	= "0xff, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00",
		CamPowerOff	= "0xff, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00",
		
		-- ��ˢ
		WiperOn 	= "0xff, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00",
		WiperOff 	= "0xff, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00",
		
		-- �����(��ͨ��)
		NightSeeOn	= "0xff, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00",
		NightSeeOff	= "0xff, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00",
		--]]

	},
	Stop = 
	{
		TileUp 		= "0x00, 0x01, 0x06, 0x01, 0x00, 0x00, 0x03, 0x03, 0xFF,",
		TileDown 	= "0x00, 0x01, 0x06, 0x01, 0x00, 0x00, 0x03, 0x03, 0xFF,",
		PanLeft 	= "0x00, 0x01, 0x06, 0x01, 0x00, 0x00, 0x03, 0x03, 0xFF,",
		PanRight 	= "0x00, 0x01, 0x06, 0x01, 0x00, 0x00, 0x03, 0x03, 0xFF,",
		LeftUp 		= "0x00, 0x01, 0x06, 0x01, 0x00, 0x00, 0x03, 0x03, 0xFF,",
		LeftDown 	= "0x00, 0x01, 0x06, 0x01, 0x00, 0x00, 0x03, 0x03, 0xFF,",
		RightUp		= "0x00, 0x01, 0x06, 0x01, 0x00, 0x00, 0x03, 0x03, 0xFF,",
		RightDown       = "0x00, 0x01, 0x06, 0x01, 0x00, 0x00, 0x03, 0x03, 0xFF,",
		
		ZoomWide 	= "0x00, 0x01, 0x04, 0x07, 0x00, 0xFF,",
		ZoomTele 	= "0x00, 0x01, 0x04, 0x07, 0x00, 0xFF,",
		FocusNear       = "0x00, 0x01, 0x04, 0x08, 0x00, 0xFF,",
		FocusFar 	= "0x00, 0x01, 0x04, 0x08, 0x00, 0xFF,",
                IrisSmall       = "0x00, 0x01, 0x04, 0x0b, 0x00, 0xFF,",
	        IrisLarge       = "0x00, 0x01, 0x04, 0x0b, 0x00, 0xFF,",
	},
}

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


Protocol.CamAddrProcess = function(s, addr)
	local newaddr = math.mod(addr,8);
              s[1] = newaddr + 128;
	return s;
end;

Protocol.SpeedProcess = function(s, arg1, arg2)
                 s[6] = arg1;
                 s[5] = arg2;
                 return s;
end;

--[[Protocol.PositionProcess = function(s, hor, ver, zoom)
	-- ����ֻ������ٶ�λ����
	if s[1] == 0x3a then
		s[4] = bits.band(hor,0xff00)/256;
		s[5] = bits.band(hor, 0xff);
		s[6] = bits.band(ver,0xff00)/256;
		s[7] = bits.band(ver,0xff);
		s[8] = zoom >= 0 and zoom or 0x80 + bits.band(math.abs(zoom), 0xff);
		s[9] = math.mod((s[2] + s[3] + s[4] + s[5] + s[6] + s[7] + s[8]), 256);
		return s;
	end;	
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;