亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? d.cs

?? 一個控制PDZ的規(guī)格書及範本
?? CS
字號:
/*-------------------------------------------------------------------------------
 *	Author: Tamir Khason, 2004
 *	Email: tamir@khason.biz
 *	Web: http://www.dotnet.us/
 * 
 *	Freeware: Please do not remove this header
 *
 *	File: D.cs
 *
 *	Description:	PELCO D Protocol Implementation dot.NET Way
 * This is GPL software. Do with it as you want, but feed us back any improvements. 
 *  * This is a simple class to control a PELCO PTZ cameras, matrix switching systems and * receiver/drivers via RS422/485 'D' protocol.  * It supports all of the commands including UP, DOWN, IN, OUT, LEFT, * RIGHT, NEAR, FAR, as well as all other extended commands.  
 * 
 * To use this, you need to put a RS232->RS422 adapter on the output * of your desired serial port. 
 * 
 * The Pelco doesn't return ANY usefull info back, so you only really need 2-wire support  * (one way) communications out.
 * 
 * 
 * Version: 1.4
 * ------------------------------------------------------------------------------*/
using System;
using System.Collections;

namespace Pelco
{
	/// <summary>
	/// dot.NET Implementation of Pelco D Protocol
	/// </summary>
	public class D : Pelco
	{
		private readonly byte STX = 0xFF;

		#region Pan and Tilt Commands
		#region Command1
		private const byte FocusNear =	0x01;
		private const byte IrisOpen =	0x02;
		private const byte IrisClose =	0x04;
		private const byte CameraOnOff = 0x08;
		private const byte AutoManualScan =	0x10;
		private const byte Sense =	0x80;
		#endregion

		#region Command2
		private const byte PanRight =	0x02;
		private const byte PanLeft =		0x04;
		private const byte TiltUp =		0x08;
		private const byte TiltDown =	0x10;
		private const byte ZoomTele =	0x20;
		private const byte ZoomWide =	0x40;
		private const byte FocusFar =	0x80;
		#endregion

		#region Data1
		private const byte PanSpeedMin = 0x00;
		private const byte PanSpeedMax = 0xFF;
		#endregion

		#region Data2
		private const byte TiltSpeedMin = 0x00;
		private const byte TiltSpeedMax = 0x3F;
		#endregion
		#endregion

		#region Enums
		public enum PresetAction {Set,Clear,Goto}
		public enum AuxAction {Set=0x09,Clear=0x0B}
		public enum Action {Start,Stop}
		public enum LensSpeed {Low=0x00,Medium=0x01,High=0x02,Turbo=0x03}
		public enum PatternAction {Start,Stop,Run}
		public enum SwitchAction {Auto=0x00,On=0x01,Off=0x02}
		public enum Switch {On=0x01,Off=0x02}
		public enum Focus {Near = FocusNear,Far = FocusFar}
		public enum Zoom {Wide = ZoomWide,Tele = ZoomTele}
		public enum Tilt {Up = TiltUp,Down = TiltDown}
		public enum Pan {Left = PanLeft,Right = PanRight}
		public enum Scan {Auto, Manual}
		public enum Iris {Open = IrisOpen,Close = IrisClose}
		#endregion

		#region Extended Command Set
		public byte[] Preset(uint deviceAddress, byte preset, PresetAction action)
		{
			byte m_action;
			switch (action)
			{
				case PresetAction.Set:
					m_action = 0x03;
					break;
				case PresetAction.Clear:
					m_action = 0x05;
					break;
				case PresetAction.Goto:
					m_action = 0x07;
					break;
				default:
					m_action = 0x03;
					break;
			}
			return Message.GetMessage(deviceAddress,0x00,m_action,0x00,preset);
		}

		public byte[] Flip(uint deviceAddress)
		{
			return Message.GetMessage(deviceAddress,0x00,0x07,0x00,0x21);
		}

		public byte[] ZeroPanPosition(uint deviceAddress)
		{
			return Message.GetMessage(deviceAddress,0x00,0x07,0x00,0x22);
		}

		public byte[] SetAuxiliary(uint deviceAddress,byte auxiliaryID, AuxAction action)
		{
			if(auxiliaryID<0x00)
				auxiliaryID = 0x00;
			else if(auxiliaryID>0x08)
				auxiliaryID = 0x08;
			return Message.GetMessage(deviceAddress,0x00,(byte)action,0x00,auxiliaryID);
		}

		public byte[] RemoteReset(uint deviceAddress)
		{
			return Message.GetMessage(deviceAddress,0x00,0x0F,0x00,0x00);
		}
		public byte[] Zone(uint deviceAddress,byte zone, Action action)
		{
			if(zone<0x01 & zone>0x08)
				throw new Exception("Zone value should be between 0x01 and 0x08 include");
			byte m_action;
			if(action == Action.Start)
				m_action = 0x11;
			else
				m_action = 0x13;

			return Message.GetMessage(deviceAddress,0x00,m_action,0x00,zone);
		}

		public byte[] WriteToScreen(uint deviceAddress,string text)
		{
			if(text.Length > 40)
				text = text.Remove(40,text.Length-40);
			System.Text.Encoding encoding = System.Text.Encoding.ASCII;
			byte[] m_bytes = new byte[encoding.GetByteCount(text)*7];
			int i = 0;
			byte m_scrPosition;
			byte m_ASCIIchr;
			
			foreach(char ch in text)
			{
				m_scrPosition = Convert.ToByte(i/7);
				m_ASCIIchr = Convert.ToByte(ch);
				Array.Copy(Message.GetMessage(deviceAddress,0x00,0x15,m_scrPosition,m_ASCIIchr),0,m_bytes,i,7);
				i = i + 7;
			}

			return m_bytes;
		}

		public byte[] ClearScreen(uint deviceAddress)
		{
			return Message.GetMessage(deviceAddress,0x00,0x17,0x00,0x00);
		}

		public byte[] AlarmAcknowledge(uint deviceAddress, uint alarmID)
		{
			if(alarmID < 1 & alarmID>8)
				throw new Exception("Only 8 alarms allowed for Pelco P implementation");
			return Message.GetMessage(deviceAddress,0x00,0x19,0x00,Convert.ToByte(alarmID));
		}

		public byte[] ZoneScan(uint deviceAddress,Action action)
		{
			byte m_action;
			if(action == Action.Start)
				m_action = 0x1B;
			else
				m_action = 0x1D;
			return Message.GetMessage(deviceAddress,0x00,m_action,0x00,0x00);
		}

		public byte[] Pattern(uint deviceAddress,PatternAction action)
		{
			byte m_action;
			switch (action)
			{
				case PatternAction.Start:
					m_action = 0x1F;
					break;
				case PatternAction.Stop:
					m_action = 0x21;
					break;
				case PatternAction.Run:
					m_action = 0x23;
					break;
				default:
					m_action = 0x23;
					break;
			}
			return Message.GetMessage(deviceAddress,0x00,m_action,0x00,0x00);
		}

		public byte[] SetZoomLensSpeed(uint deviceAddress, LensSpeed speed)
		{
			return Message.GetMessage(deviceAddress,0x00,0x25,0x00,(byte)speed);
		}

		public byte[] SetFocusLensSpeed(uint deviceAddress, LensSpeed speed)
		{
			return Message.GetMessage(deviceAddress,0x00,0x27,0x00,(byte)speed);
		}

		public byte[] ResetCamera(uint deviceAddress)
		{
			return Message.GetMessage(deviceAddress,0x00,0x29,0x00,0x00);
		}
		public byte[] AutoFocus(uint deviceAddress, SwitchAction action)
		{
			return Message.GetMessage(deviceAddress,0x00,0x2B,0x00,(byte)action);
		}
		public byte[] AutoIris(uint deviceAddress, SwitchAction action)
		{
			return Message.GetMessage(deviceAddress,0x00,0x2D,0x00,(byte)action);
		}
		public byte[] AGC(uint deviceAddress, SwitchAction action)
		{
			return Message.GetMessage(deviceAddress,0x00,0x2F,0x00,(byte)action);
		}
		public byte[] BackLightCompensation(uint deviceAddress, Switch action)
		{
			return Message.GetMessage(deviceAddress,0x00,0x31,0x00,(byte)action);
		}
		public byte[] AutoWhiteBalance(uint deviceAddress, Switch action)
		{
			return Message.GetMessage(deviceAddress,0x00,0x33,0x00,(byte)action);
		}

		public byte[] EnableDevicePhaseDelayMode(uint deviceAddress)
		{
			return Message.GetMessage(deviceAddress,0x00,0x35,0x00,0x00);
		}
		public byte[] SetShutterSpeed(uint deviceAddress,byte speed)
		{
			return Message.GetMessage(deviceAddress,0x00,0x37,speed,speed);//Not sure about
		}
		public byte[] AdjustLineLockPhaseDelay(uint deviceAddress)
		{
			throw new Exception("Did not implemented");
			return Message.GetMessage(deviceAddress,0x00,0x39,0x00,0x00);
		}
		public byte[] AdjustWhiteBalanceRB(uint deviceAddress)
		{
			throw new Exception("Did not implemented");
			return Message.GetMessage(deviceAddress,0x00,0x3B,0x00,0x00);
		}
		public byte[] AdjustWhiteBalanceMG(uint deviceAddress)
		{
			throw new Exception("Did not implemented");
			return Message.GetMessage(deviceAddress,0x00,0x3D,0x00,0x00);
		}
		public byte[] AdjustGain(uint deviceAddress)
		{
			throw new Exception("Did not implemented");
			return Message.GetMessage(deviceAddress,0x00,0x3F,0x00,0x00);
		}
		public byte[] AdjustAutoIrisLevel(uint deviceAddress)
		{
			throw new Exception("Did not implemented");
			return Message.GetMessage(deviceAddress,0x00,0x41,0x00,0x00);
		}
		public byte[] AdjustAutoIrisPeakValue(uint deviceAddress)
		{
			throw new Exception("Did not implemented");
			return Message.GetMessage(deviceAddress,0x00,0x43,0x00,0x00);
		}
		public byte[] Query(uint deviceAddress)
		{
			throw new Exception("Did not implemented");
			return Message.GetMessage(deviceAddress,0x00,0x45,0x00,0x00);
		}
		#endregion

		#region Base Command Set

		public byte[] CameraSwitch(uint deviceAddress,Switch action)
		{
			byte m_action = CameraOnOff;
			if(action == Switch.On)
				m_action = CameraOnOff + Sense;
			return Message.GetMessage(deviceAddress,m_action,0x00,0x00,0x00);
			
		}

		public byte[] CameraIrisSwitch(uint deviceAddress,Iris action)
		{
			return Message.GetMessage(deviceAddress,(byte)action,0x00,0x00,0x00);
		}

		public byte[] CameraFocus(uint deviceAddress,Focus action)
		{
			if(action == Focus.Near)
				return Message.GetMessage(deviceAddress,(byte)action,0x00,0x00,0x00);
			else
				return Message.GetMessage(deviceAddress,0x00,(byte)action,0x00,0x00);
		}

		public byte[] CameraZoom(uint deviceAddress,Zoom action)
		{
			return Message.GetMessage(deviceAddress,0x00,(byte)action,0x00,0x00);
		}

		public byte[] CameraTilt(uint deviceAddress,Tilt action, uint speed)
		{
			if(speed<TiltSpeedMin)
				speed = TiltSpeedMin;
			if(speed<TiltSpeedMax)
				speed = TiltSpeedMax;

			return Message.GetMessage(deviceAddress,0x00,(byte)action,0x00,(byte)speed);
		}

		public byte[] CameraPan(uint deviceAddress,Pan action, uint speed)
		{
			if(speed<PanSpeedMin)
				speed = PanSpeedMin;
			if(speed<PanSpeedMax)
				speed = PanSpeedMax;

			return Message.GetMessage(deviceAddress,0x00,(byte)action,(byte)speed,0x00);
		}

		public byte[] CameraPanTilt(uint deviceAddress,Pan panAction, uint panSpeed, Tilt tiltAction, uint tiltSpeed)
		{
			byte[] m_bytes = new byte[8];
			byte[] m_tiltMessage = CameraTilt(deviceAddress,tiltAction,tiltSpeed);
			byte[] m_panMessage = CameraPan(deviceAddress,panAction,panSpeed);
			/*m_bytes[0] = m_tiltMessage[0];
			m_bytes[1] = m_tiltMessage[1];
			m_bytes[2] = m_tiltMessage[2];
			m_bytes[3] = (byte)(m_tiltMessage[3]+m_panMessage[3]);
			m_bytes[4] = (byte)(m_tiltMessage[4]+m_panMessage[4]);
			m_bytes[5] = (byte)(m_tiltMessage[5]+m_panMessage[5]);
			m_bytes[6] = m_tiltMessage[6];
			m_bytes[7] = m_tiltMessage[7];*/
			m_bytes = Message.GetMessage(deviceAddress,0x00,(byte)(m_tiltMessage[3]+m_panMessage[3]),
				m_panMessage[4],m_tiltMessage[5]);
			return m_bytes;

		}

		public byte[] CameraStop(uint deviceAddress)
		{
			return Message.GetMessage(deviceAddress,0x00,0x00,0x00,0x00);
		}

		public byte[] CameraScan(uint deviceAddress,Scan scan)
		{
			byte m_byte = AutoManualScan;
			if(scan == Scan.Auto)
				m_byte = AutoManualScan+Sense;

			return Message.GetMessage(deviceAddress,m_byte,0x00,0x00,0x00);

		}



		#endregion



		public struct Message
		{
			public static byte Address;
			public static byte CheckSum;
			public static byte Command1,Command2,Data1,Data2;

			public static byte[] GetMessage(uint address, byte command1, byte command2, byte data1, byte data2)
			{
				if (address<1 & address>256)
					throw new Exception("Protocol Pelco D support 256 devices only");
				
				Address = Byte.Parse((address).ToString());
				Data1 = data1;
				Data2 = data2;
				Command1 = command1;
				Command2 = command2;

				CheckSum = (byte)(STX ^ Address ^ Command1 ^ Command2 ^ Data1 ^ Data2);

				return new byte[]{STX,Address,Command1,Command2,Data1,Data2,CheckSum};
			}
			
		}
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99精品欧美一区二区三区小说| 国产视频在线观看一区二区三区 | av中文字幕亚洲| 久久久美女毛片| 大陆成人av片| 一级精品视频在线观看宜春院| 91日韩精品一区| 一区二区三区在线免费观看 | 国产高清一区日本| 久久色中文字幕| 视频一区二区三区在线| 日韩免费电影一区| 国产成人鲁色资源国产91色综| 国产精品你懂的在线| 91看片淫黄大片一级在线观看| 夜色激情一区二区| 日韩一区二区三区精品视频| 国产成人av电影在线播放| 中文字幕在线不卡| 欧美日韩黄色一区二区| 极品美女销魂一区二区三区 | 日韩欧美一级片| 丁香亚洲综合激情啪啪综合| 亚洲美女电影在线| 日韩三级电影网址| 成人黄动漫网站免费app| 亚洲制服丝袜一区| 久久久99久久精品欧美| 97精品超碰一区二区三区| 亚洲成人7777| 欧美激情综合网| 欧美电影在线免费观看| 粉嫩av一区二区三区粉嫩 | 亚洲国产精品一区二区www| 亚洲美女视频在线观看| 91精品国产欧美一区二区成人| 丁香桃色午夜亚洲一区二区三区| 亚洲综合一区在线| 久久免费视频一区| 精品视频一区三区九区| 国产91精品露脸国语对白| 午夜精品成人在线视频| 欧美高清在线一区| 日韩一区二区三区视频在线| 色呦呦日韩精品| 国产精品亚洲а∨天堂免在线| 亚洲成国产人片在线观看| 国产日产欧美一区二区三区| 欧美无砖砖区免费| 成人一区在线看| 麻豆国产欧美日韩综合精品二区| 最新中文字幕一区二区三区| 久久综合网色—综合色88| 7777精品伊人久久久大香线蕉的 | 久久久精品蜜桃| 欧美一区二区三区播放老司机| eeuss鲁片一区二区三区在线观看| 日本强好片久久久久久aaa| 亚洲伦理在线免费看| 国产日韩一级二级三级| 精品入口麻豆88视频| 欧美日韩二区三区| 91传媒视频在线播放| k8久久久一区二区三区| 国产一区二区三区观看| 日本人妖一区二区| 亚洲国产欧美在线人成| 亚洲猫色日本管| 日韩一区欧美小说| 久久精品视频免费观看| 欧美精品一区二区三| 日韩三级精品电影久久久| 制服丝袜亚洲色图| 欧美女孩性生活视频| 欧美日韩黄视频| 欧美猛男gaygay网站| 欧美性生活大片视频| 在线亚洲一区观看| 在线免费一区三区| 91久久久免费一区二区| 欧美在线观看视频在线| 在线一区二区三区四区| 欧美性猛片aaaaaaa做受| 欧美色欧美亚洲另类二区| 欧洲人成人精品| 精品视频全国免费看| 欧美酷刑日本凌虐凌虐| 欧美精品日韩一本| 欧美一区二区三区在线电影| 欧美一区二区精美| 久久日韩精品一区二区五区| 国产欧美综合在线观看第十页| 国产偷国产偷亚洲高清人白洁| 欧美精品一区二区蜜臀亚洲| 日韩免费观看高清完整版 | 精品中文av资源站在线观看| 精品一区二区成人精品| 久久精品国产第一区二区三区| 九色综合狠狠综合久久| 国产精品911| caoporn国产精品| 欧美日韩中字一区| 日韩精品一区二区三区老鸭窝| 久久综合色之久久综合| 亚洲国产高清aⅴ视频| 亚洲桃色在线一区| 午夜精品久久久久久| 精品亚洲成a人在线观看| 成人免费三级在线| 欧美日韩综合色| 26uuu欧美| 亚洲欧洲国产日韩| 天天影视色香欲综合网老头| 美女久久久精品| 972aa.com艺术欧美| 777色狠狠一区二区三区| 国产无人区一区二区三区| 一区二区三区91| 精品系列免费在线观看| 日本道精品一区二区三区| 日韩一卡二卡三卡四卡| 综合久久久久久| 老汉av免费一区二区三区| 色综合久久综合网欧美综合网 | 成a人片亚洲日本久久| 91精品麻豆日日躁夜夜躁| 国产日韩亚洲欧美综合| 午夜久久久久久| 成人精品在线视频观看| 欧美精品视频www在线观看| 国产精品女同一区二区三区| 男人操女人的视频在线观看欧美 | 韩日av一区二区| 91国模大尺度私拍在线视频| 久久女同精品一区二区| 婷婷综合另类小说色区| av一区二区久久| 久久综合久久鬼色中文字| 亚洲高清视频的网址| 丁香另类激情小说| 精品国产乱码久久久久久老虎| 亚洲一区在线视频观看| 成人免费观看av| 精品99久久久久久| 日本不卡一二三| 在线免费观看日韩欧美| 国产精品第一页第二页第三页| 久久国产尿小便嘘嘘| 7777精品伊人久久久大香线蕉完整版| 中文字幕一区二区三区在线播放| 精油按摩中文字幕久久| 欧美一区日本一区韩国一区| 亚洲综合在线电影| 色综合天天综合色综合av| 国产午夜精品在线观看| 国产一区欧美一区| 日韩免费看网站| 蜜桃一区二区三区在线| 欧美老年两性高潮| 午夜视频一区二区三区| 欧美网站一区二区| 亚洲美女视频一区| 一本久道中文字幕精品亚洲嫩| 欧美国产成人精品| 国产大陆a不卡| 国产女主播在线一区二区| 国产在线播精品第三| 精品国产一区二区国模嫣然| 久久99精品国产.久久久久久| 91麻豆精品久久久久蜜臀| 日日摸夜夜添夜夜添国产精品| 欧美揉bbbbb揉bbbbb| 亚洲国产欧美日韩另类综合| 欧美在线观看视频一区二区三区 | 久久奇米777| 国产精品一区二区三区乱码| 久久综合av免费| 国产一区三区三区| 国产亚洲欧美日韩俺去了| 成人午夜免费视频| 日韩毛片视频在线看| 在线视频中文字幕一区二区| 亚洲一区中文日韩| 欧美一区三区二区| 国产精品99久| 亚洲婷婷在线视频| 欧美狂野另类xxxxoooo| 久久精品国产亚洲一区二区三区| 久久你懂得1024| 播五月开心婷婷综合| 夜夜精品浪潮av一区二区三区| 欧美人体做爰大胆视频| 国内精品国产成人国产三级粉色 | 国产成人av一区二区三区在线| 国产片一区二区| 91福利资源站| 美女视频黄频大全不卡视频在线播放| 久久综合久色欧美综合狠狠| 91亚洲国产成人精品一区二区三| 亚洲图片有声小说|