Capabilities is the name of the bi-directional HTTP REST protocol used to communicate non real-time transactions such as teleporting or group messaging
 /// <summary>
 /// Register an event handler
 /// </summary>
 /// <remarks>Use String.Empty to fire this event on every CAPS event</remarks>
 /// <param name="capsEvent">Capability event name to register the 
 /// handler for</param>
 /// <param name="eventHandler">Callback to fire</param>
 public void RegisterEvent(string capsEvent, Caps.EventQueueCallback eventHandler)
 {
     lock (_EventTable)
     {
         if (_EventTable.ContainsKey(capsEvent))
             _EventTable[capsEvent] += eventHandler;
         else
             _EventTable[capsEvent] = eventHandler;
     }
 }
 /// <summary>
 /// Register an new event handler for a capabilities event sent via the EventQueue
 /// </summary>
 /// <remarks>Use String.Empty to fire this event on every CAPS event</remarks>
 /// <param name="capsEvent">Capability event name to register the 
 /// handler for</param>
 /// <param name="eventHandler">Callback to fire</param>
 public void RegisterEvent(string capsEvent, Caps.EventQueueCallback eventHandler)
 {
     // TODO: Should we add support for synchronous CAPS handlers?
     lock (_EventTable)
     {
         if (_EventTable.ContainsKey(capsEvent))
             _EventTable[capsEvent] += eventHandler;
         else
             _EventTable[capsEvent] = eventHandler;
     }
 }
Exemple #3
0
        /// <summary>
        /// Disconnect from this simulator
        /// </summary>
        public void Disconnect(bool sendCloseCircuit)
        {
            if (connected)
            {
                connected = false;

                // Destroy the timers
                if (AckTimer != null)
                {
                    AckTimer.Dispose();
                }
                if (StatsTimer != null)
                {
                    StatsTimer.Dispose();
                }
                if (PingTimer != null)
                {
                    PingTimer.Dispose();
                }

                AckTimer   = null;
                StatsTimer = null;
                PingTimer  = null;

                // Kill the current CAPS system
                if (Caps != null)
                {
                    Caps.Disconnect(true);
                    Caps = null;
                }

                if (sendCloseCircuit)
                {
                    // Try to send the CloseCircuit notice
                    CloseCircuitPacket close = new CloseCircuitPacket();
                    UDPPacketBuffer    buf   = new UDPPacketBuffer(remoteEndPoint);
                    byte[]             data  = close.ToBytes();
                    Buffer.BlockCopy(data, 0, buf.Data, 0, data.Length);
                    buf.DataLength = data.Length;

                    AsyncBeginSend(buf);
                }

                // Shut the socket communication down
                Stop();
            }
        }
Exemple #4
0
        /// <summary>
        /// Disconnect from this simulator
        /// </summary>
        public void Disconnect(bool sendCloseCircuit)
        {
            if (connected)
            {
                connected = false;

                // Destroy the timers
                if (AckTimer != null) AckTimer.Dispose();
                if (StatsTimer != null) StatsTimer.Dispose();
                if (PingTimer != null) PingTimer.Dispose();

                AckTimer = null;
                StatsTimer = null;
                PingTimer = null;

                // Kill the current CAPS system
                if (Caps != null)
                {
                    Caps.Disconnect(true);
                    Caps = null;
                }

                if (sendCloseCircuit)
                {
                    // Try to send the CloseCircuit notice
                    CloseCircuitPacket close = new CloseCircuitPacket();
                    UDPPacketBuffer buf = new UDPPacketBuffer(remoteEndPoint);
                    byte[] data = close.ToBytes();
                    Buffer.BlockCopy(data, 0, buf.Data, 0, data.Length);
                    buf.DataLength = data.Length;

                    AsyncBeginSend(buf);
                }

                // Shut the socket communication down
                Stop();
            }
        }
Exemple #5
0
        public void SetSeedCaps(string seedcaps)
        {
            if (Caps != null)
            {
                if (Caps._SeedCapsURI == seedcaps) return;

                Logger.Log("Unexpected change of seed capability", Helpers.LogLevel.Warning, Client);
                Caps.Disconnect(true);
                Caps = null;
            }

            if (Client.Settings.ENABLE_CAPS)
            {
                // Connect to the new CAPS system
                if (!String.IsNullOrEmpty(seedcaps))
                    Caps = new Caps(this, seedcaps);
                else
                    Logger.Log("Setting up a sim without a valid capabilities server!", Helpers.LogLevel.Error, Client);
            }

        }
Exemple #6
0
 /// <summary>
 /// Unregister a CAPS event handler. This is a low level event interface
 /// and should only be used if you are doing something not supported in
 /// the library
 /// </summary>
 /// <param name="capsEvent">Name of the CAPS event this callback is
 /// registered with</param>
 /// <param name="callback">Callback to stop firing events for</param>
 public void UnregisterEventCallback(string capsEvent, Caps.EventQueueCallback callback)
 {
     CapsEvents.UnregisterEvent(capsEvent, callback);
 }
Exemple #7
0
 /// <summary>
 /// Unregister a previously registered capabilities handler 
 /// </summary>
 /// <param name="capsEvent">Capability event name unregister the 
 /// handler for</param>
 /// <param name="eventHandler">Callback to unregister</param>
 public void UnregisterEvent(string capsEvent, Caps.EventQueueCallback eventHandler)
 {
     lock (_EventTable)
     {
         if (_EventTable.ContainsKey(capsEvent) && _EventTable[capsEvent] != null)
             _EventTable[capsEvent] -= eventHandler;
     }
 }
 public void RegisterEventCallback(string capsEvent, Caps.EventQueueCallback callback)
 {
     return;
 }