예제 #1
0
 /// <summary>
 /// Encodes a Camera Zoom Command from the given Values
 /// </summary>
 /// <param name="movementSpeed">The speed of movement requested</param>
 /// <param name="movementMode">The mode of movement requested</param>
 /// <param name="postionValue">The position amount requested</param>
 /// <returns>A Variable which contains the encoded command</returns>
 public static Variable EncodeZoomCommand(byte?movementSpeed, PositionRefrence movementMode, Int32 positionValue)
 {
     return(EncodeCameraCommand("1.3.6.1.4.1.1206.4.2.7.4.3", movementSpeed, movementMode, positionValue));
 }
예제 #2
0
        /// <summary>
        /// Encodes a Camera Command from the given Values
        /// </summary>
        /// <param name="ObjectIdentifier">The Object to bind the PositionRefrence to</param>
        /// <param name="movementSpeed">The speed of movement requested</param>
        /// <param name="movementMode">The mode of movement requested</param>
        /// <param name="postionValue">The position amount requested</param>
        /// <returns>A Variable which contains the encoded command</returns>
        public static Variable EncodeCameraCommand(String ObjectIdentifier, byte?movementSpeed, PositionRefrence movementMode, Int32 positionValue)
        {
            //Build Object
            if (string.IsNullOrEmpty(ObjectIdentifier))
            {
                ObjectIdentifier = "1.3.6.1.4.1.1206.4.2.7.4.1";
            }
            Variable result = new Variable();

            result.Identifier = ObjectIdentifier;
            result.TypeCode   = SnmpType.OctetString;
            result.Value.Add((byte)movementMode);
            result.Value.Add((byte)movementSpeed);
            //result.Value.Add((byte)Postion);
            //result.Value.AddRange(BasicEncodingRules.EncodeInteger32(postionValue, false, false));
            //while (result.Value.Count < 4) result.Value.Add(0x00);

            if (movementMode == PositionRefrence.StopMovement || movementMode == PositionRefrence.Continious)
            {
                while (result.Value.Count < 4)
                {
                    result.Value.Add(0x00);
                }
            }
            else
            {
                //result.Value.AddRange(BitConverter.GetBytes(Convert.ToInt16(postionValue)));
                result.Value.AddRange(BasicEncodingRules.EncodeInteger32(positionValue, false, false));
            }
            return(result);
        }