Beispiel #1
0
        /// <summary>创建在线</summary>
        /// <param name="sessionid"></param>
        /// <returns></returns>
        protected override IOnline CreateOnline(String sessionid)
        {
            var ns = Session as NetSession;

            var olt = DeviceOnline.FindBySessionID(sessionid) ?? new DeviceOnline();

            olt.Version     = Version;
            olt.ExternalUri = ns.Remote + "";

            return(olt);
        }
Beispiel #2
0
        /// <summary>检查在线</summary>
        /// <returns></returns>
        protected virtual DeviceOnline CheckOnline()
        {
            var olt = Online;

            if (olt != null)
            {
                return(olt);
            }

            var uri = Remote.EndPoint + "";

            olt = DeviceOnline.FindBySessionID(uri);
            if (olt == null)
            {
                olt = new DeviceOnline
                {
                    SessionID = uri,
                };

                olt.Insert();
            }

            var dv = Device;

            if (dv != null)
            {
                olt.Name     = dv + "";
                olt.DeviceID = dv.ID;
            }

            olt.InternalUri = dv.LocalIP;
            olt.ExternalUri = Remote + "";

            olt.SaveAsync();

            Online = olt;

            return(olt);
        }
Beispiel #3
0
        protected virtual DeviceOnline GetOnline(String mac)
        {
            var sid = $"{mac}@{Remote.EndPoint}";

            return(DeviceOnline.FindBySessionID(sid));
        }