/// <summary>
        /// Al abrirse una conexión Socket
        /// </summary>
        /// <param name="sender">Emisor</param>
        /// <param name="e">Datos de conexión</param>
        private void SocketServer_OnSocketOpen(object sender, SocketConnection e)
        {
            SocketChannel channel = new SocketChannel(e);

            m_channels.Add(e.ConnectionId, channel);
            OnChannelConnected?.Invoke(this, channel);
        }
        /// <summary>
        /// Crear canal de comunicación Unity
        /// </summary>
        /// <param name="unityId">Identificador de Unity para el canal</param>
        private void CreateChannel(string unityId)
        {
            Debug.WriteLine(this, "Canal de comunicación creado: " + unityId, VerbosityLevel.Debug);
            IChannel channel = new UnityChannel(unityId, m_commServer);

            m_channels.Add(unityId, channel);
            OnChannelConnected?.Invoke(this, channel);
        }
        /// <summary>
        /// Añadir canal
        /// </summary>
        /// <param name="channel">Canal a añadir</param>
        public void AddChannel(IChannel channel)
        {
            if (m_channels.Contains(channel))
            {
                return;
            }

            m_channels.Add(channel);
            OnChannelConnected?.Invoke(this, channel);
            Debug.WriteLine(this, "Canal en memoria añadido: " + channel.GetType().FullName, VerbosityLevel.Debug);
        }
Пример #4
0
        /// <summary>
        /// Añadir canal en base a acceso
        /// </summary>
        /// <param name="access">Acceso</param>
        private void AddChannel(ServerUserAccess access)
        {
            if (m_channels.ContainsKey(access.UserIdentifier))
            {
                return;
            }

            CloudChannel channel = new CloudChannel(access, _pusherChannel);

            m_channels.Add(access.UserIdentifier, channel);
            OnChannelConnected?.Invoke(this, channel);
            Debug.WriteLine(this, "Canal por acceso añadido", VerbosityLevel.Debug);
        }
Пример #5
0
        /// <summary>
        /// Añadir canal
        /// </summary>
        /// <param name="ipPort">IP / Puerto</param>
        private void AddChannel(string ipPort)
        {
            if (m_channels.ContainsKey(ipPort))
            {
                Debug.WriteLine(this, "Se está tratando de conectar un nuevo canal desde una conexión ya registrada, suprimiendo...", VerbosityLevel.Warning);
                return;
            }

            IChannel channel = new TcpSocketChannel(m_server, ipPort);

            m_channels.Add(ipPort, channel);
            OnChannelConnected?.Invoke(this, channel);
            Debug.WriteLine(this, "Se conecto un nuevo canal TCP Socket", VerbosityLevel.Debug);
        }
Пример #6
0
        /// <summary>
        /// Crear canal de comunicación mesh
        /// </summary>
        /// <param name="mac">Dirección MAC del canal</param>
        /// <param name="layer">Capa del dispositivo</param>
        private void CreateChannel(string mac, int layer = 1)
        {
            if (m_channels.ContainsKey(mac))
            {
                Debug.WriteLine(this, $"Se está intentando conectar la dirección {mac} pero ya se está registrada, se ignorara el nuevo intento", VerbosityLevel.Warning);
                DeviceIntegrityRequest request        = new DeviceIntegrityRequest();
                MeshChannel            routingChannel = m_channels[mac] as MeshChannel;
                routingChannel.RouteMessage(request);
                return;
            }
            Debug.WriteLine(this, "Canal de comunicación creado: " + mac, VerbosityLevel.Debug);
            IChannel channel = new MeshChannel(mac, m_meshServer, layer);

            m_channels.Add(mac, channel);
            OnChannelConnected?.Invoke(this, channel);
        }