public bool SetCameraSettings(Packet.Type packetType, int id, string settingsParameter, string value)
        {
            string response;
            string packetString;

            // Create XML command depending on type of camera settings parameter
            switch (packetType)
            {
            case Packet.Type.LensControl:
                packetString = Packet.LensControlParameter(id, settingsParameter, value);
                break;

            case Packet.Type.AutoExposure:
                packetString = Packet.AutoExposureParameter(id, settingsParameter, value);
                break;

            case Packet.Type.Default:
            default:
                packetString = Packet.SettingsParameter(id, settingsParameter, value);
                break;
            }

            // Take control and issue command
            TakeControl();

            bool success = Protocol.SendXML(packetString, out response);

            HandleHostResponse(response);

            return(success);
        }
Beispiel #2
0
        public void GetDataType_1()
        {
            Packet p = new Packet();

            Packet.Type value = (Packet.Type)p.GetDataType("/092345z4903.50N/07201.75W>Test1234");

            Assert.Equal(Packet.Type.PositionWithTimestampNoMessaging, value);
        }
 public void SetCameraSetting(Packet.Type packetType, string setting, double value, bool bypassSkipCounter = false)
 {
     // If nothing has been recieved from QTM then update the settings
     // else wait 200 ms before updating qtm again to Xamarin.Forms time to update
     // and prevent an infinite feedback loop
     if (Urho.Time.SystemTime - lastQTMUpdate > 200 && !ignoreSettingsAfterCameraSelection)
     {
         CurrentCamera.SetSetting(packetType, setting, value);
     }
 }
Beispiel #4
0
 public bool HasPacketOfType(Packet.Type givenType)
 {
     foreach (var packet in packets)
     {
         if (packet.type == givenType)
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #5
0
    public void Send(Packet.Type type, IMessage message)
    {
        short messageSize = (short)message.CalculateSize();

        byte[] buffer = new byte[HeaderSize + messageSize];

        MemoryStream ms           = new MemoryStream(buffer);
        BinaryWriter binaryStream = new BinaryWriter(ms);

        binaryStream.Write(messageSize);
        binaryStream.Write((short)type);
        message.WriteTo(ms);

        Send(buffer, 0, (int)ms.Position);
    }
Beispiel #6
0
 public static int OrderOfPacket(Packet.Type type)
 {
     if (type == Packet.Type.Ant)
     {
         return(16);
     }
     if (type == Packet.Type.Target)
     {
         return(2);
     }
     if (type == Packet.Type.Hole)
     {
         return(1);
     }
     return(4);
 }
        /// <summary>
        /// Sends new settings to QTM
        /// </summary>
        /// <param name="id">Camera ID</param>
        /// <param name="settingsParameter">Parameter to send</param>
        /// <param name="value">Parameter's value</param>
        /// <returns>Returns true if successful</returns>
        public static bool SetCameraSettings(Packet.Type packetType, int id, string settingsParameter, string value)
        {
            if (isDemoModeActive)
            {
                return(false);
            }

            try
            {
                return(MasterDelegate(() => connection.SetCameraSettings(packetType, id, settingsParameter, value)));
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                return(false);
            }
        }
Beispiel #8
0
 /// <summary>
 /// 서버와 최대 대기 할수 있는 시간을 지정합니다.
 /// </summary>
 /// <returns>패킷 데이터를 리턴합니다. (시간 초과시 널이 리턴됨)</returns>
 /// <param name="waitForSecond">최대 대기 시간</param>
 /// <param name="type">Type.</param>
 private async Task<PacketInfo?> SetTimeOut(float waitForSecond, Packet.Type type)
 {
     while (waitForSecond > 0)
     {
         long t1 = DateTime.UtcNow.Ticks;
         Network.Update();
         PacketInfo info;
         while (Network.TryGetPacket(out info))
         {
             Debug.Log(info.Type.ToString());
             if (info.Type == type)
             {
                 return await Task.FromResult(info);
             }
         }
         await Task.Delay(100);
         long t2 = DateTime.UtcNow.Ticks;
         waitForSecond -= ((t2 - t1) / TimeSpan.TicksPerMillisecond) / 1000.0f;
     }
     return null;
 }
Beispiel #9
0
 internal EmptyPacket(Packet.Type type) : base(type)
 {
 }
 /// <summary>
 /// Constructor for incomming packets
 /// </summary>
 /// <param name="type">the Packet.Type of the message</param>
 /// <param name="data">the byte array from the socket</param>
 internal PrivateGroupJoinPacket(Packet.Type type, byte[] data) : base(type, data)
 {
 }
Beispiel #11
0
 internal ClientNamePacket(Packet.Type type, byte[] data) : base(type, data)
 {
 }
Beispiel #12
0
 internal FriendAddPacket(Packet.Type type, byte[] data) : base(type, data)
 {
 }
 /// <summary>
 /// Constructor for incomming packets
 /// </summary>
 /// <param name="type">the Packet.Type of the message</param>
 /// <param name="data">the byte array from the socket</param>
 internal PrivateGroupMessagePacket(Packet.Type type, byte[] data) :
     base(type, data)
 {
 }
Beispiel #14
0
 /// <summary>
 /// Constructor for incomming packets
 /// </summary>
 /// <param name="type">the Packet.Type of this packet</param>
 /// <param name="data">the byte array containing socket data</param>
 internal AnonVicinityPacket(Packet.Type type, byte[] data) : base(type, data)
 {
 }
Beispiel #15
0
 internal SimpleStringPacket(Packet.Type type, byte[] data) : base(type, data)
 {
 }
Beispiel #16
0
 /// <summary>
 /// the constructor for incomming packets
 /// </summary>
 /// <param name="type">the Packet.Type of the message</param>
 /// <param name="data">the byte array containing socket data</param>
 internal Packet(Packet.Type type, byte[] data)
 {
     BytesToData(data);
     this._type = type;
 }
Beispiel #17
0
 /// <summary>
 /// Constructor for setting packet type and direction
 /// </summary>
 /// <param name="type">the Packet.Type of the message</param>
 /// <param name="dir">the direction of the packet, in or out</param>
 internal Packet(Packet.Type type)
 {
     this._type = type;
 }
Beispiel #18
0
 /// <summary>
 /// Constructor for creating event args
 /// </summary>
 /// <param name="Message"></param>
 public UnknownPacketEventArgs(Packet.Type type, String Message)
 {
     this._type = type;
     this._text = Message;
 }
Beispiel #19
0
 /// <summary>
 /// Constructor for incomming packets
 /// </summary>
 /// <param name="type">the Packet.Type of the message</param>
 /// <param name="data">the byte array with socket data</param>
 internal UnknownPacket(Packet.Type type, byte[] data) : base(type, data)
 {
 }
Beispiel #20
0
 internal FriendRemovePacket(Packet.Type type, byte[] data) : base(type, data)
 {
 }
Beispiel #21
0
 internal ChannelUpdatePacket(Packet.Type type, byte[] data) : base(type, data)
 {
 }
 internal PrivateChannelStatusPacket(Packet.Type type, byte[] data) : base(type, data)
 {
 }
Beispiel #23
0
 /// <summary>
 /// Constructor used for incomming packets
 /// </summary>
 /// <param name="type">the Packet.Type of the packet</param>
 /// <param name="data">the byte array from the socket</param>
 internal BuddyStatusPacket(Packet.Type type, byte[] data) : base(type, data)
 {
 }
Beispiel #24
0
 internal ChannelMessagePacket(Packet.Type type, byte[] data) : base(type, data)
 {
 }
Beispiel #25
0
    public void UpdateType()
    {
        packet.dirty = false;
        currentType  = packet.type;
        GetComponent <SpriteRenderer>().sortingOrder = GridManager.OrderOfPacket(currentType);
        arrowReminder.sortingOrder = GridManager.OrderOfPacket(currentType) - 1;
        string filepath = "Sprites/{0}";

        switch (currentType)
        {
        case Packet.Type.Ant:
            if (packet.Holder)
            {
                if (packet.Holding)
                {
                    filepath = "holding";
                }
                else
                {
                    filepath = "character";
                }
            }
            else if (packet.Packer)
            {
                filepath = "packer";
            }
            else if (packet.Unpacker)
            {
                filepath = "unpacker";
            }
            int x = 0, y = 0;
            switch (packet.AntOrientation)
            {
            case Orientation.UP:    y = 1;  break;

            case Orientation.LEFT:  x = -1; break;

            case Orientation.DOWN:  y = -1; break;

            case Orientation.RIGHT: x = 1;  break;

            default: break;
            }
            arrowReminder.transform.up = new Vector3(x, y, 0);
            break;

        case Packet.Type.Target:
            filepath = "target";
            break;

        case Packet.Type.Box:  filepath = "box";        break;

        case Packet.Type.Wall: filepath = "wall";       break;

        case Packet.Type.Hole: filepath = "hole";       break;

        default: filepath = "box";  break;
        }

        filepath = string.Format("Sprites/{0}", filepath);
        GetComponent <SpriteRenderer>().sprite = ResourceLoader.LoadImage(filepath);
    }
Beispiel #26
0
 internal ForwardPacket(Packet.Type type, byte[] data) : base(type, data)
 {
 }
 internal SystemMessagePacket(Packet.Type type, byte[] data) : base(type, data)
 {
 }
Beispiel #28
0
 internal ChatCommandPacket(Packet.Type type, byte[] data) : base(type, data)
 {
 }
Beispiel #29
0
 internal LoginCharacterListPacket(Packet.Type type, byte[] data) : base(type, data)
 {
 }
Beispiel #30
0
 internal LoginSeedPacket(Packet.Type type, byte[] data) : base(type, data)
 {
 }