Beispiel #1
0
 public virtual bool Init()
 {
     IsConnected = false;
     MyBaseThing.SetStatus(4, "Initializing.");
     TheThing.SetSafePropertyString(MyBaseThing, "StateSensorIcon", "/Images/iconToplogo.png");
     this.GetProperty(nameof(IsConnected), true).RegisterEvent(eThingEvents.PropertyChanged, sinkPropChanged);
     MyBaseThing.SetPublishThrottle(500);
     return(true);
 }
        public bool Init()
        {
            if (mIsInitCalled)
            {
                return(false);
            }
            mIsInitCalled = true;

            MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
            if (TheThing.GetSafePropertyString(MyBaseThing, "VisitorCount") == "")
            {
                VisitorCount = 0;
            }
            MyNodePrintsName = $"NodePrints{TheThing.GetSafeThingGuid(MyBaseThing, "NodePrints")}";
            TheBaseEngine.WaitForStorageReadiness(OnStorageReady, true);
            MyBaseThing.SetPublishThrottle(15000);
            TheCommCore.RegisterRelayEvents(null, null, sinkNewConnection);

            if (MyVisitorLog == null)
            {
                MyVisitorLog = new TheVisitorLog(MyBaseThing);
            }
            TheQueuedSenderRegistry.RegisterHealthTimer(GetSystemInfo);
            TheCDEngines.MyNMIService.RegisterEvent("NMI_MY_LOCATION", (sender2, para) =>
            {
                var t = para as TheNMILocationInfo;
                if (t != null)
                {
                    var NewEntry = new TheVisitorLogData {
                        cdeN = t.cdeN, latitude = t.Latitude, longitude = t.Longitude, ip = t.ClientInfo?.UserID.ToString(), LastVisit = DateTimeOffset.Now, Description = t.ClientInfo != null && t.ClientInfo.UserID != Guid.Empty ? TheUserManager.GetUserFullName(t.ClientInfo.UserID) : "Unknown user"
                    };
                    MyVisitorLog.LogVisitor(NewEntry);
                    myGoogleMap?.SetUXProperty(Guid.Empty, $"AddMarker={TheCommonUtils.SerializeObjectToJSONString(NewEntry)}");
                }
            });
            TheCommCore.MyHttpService.RegisterHttpInterceptorB4("/cdemeshinfo.aspx", sinkRequestMeshInfo);
            MyBaseEngine.ProcessInitialized();
            MyBaseEngine.SetEngineReadiness(true, null);
            MyBaseEngine.SetStatusLevel(1);
            mIsInitialized = true;
            return(true);
        }
Beispiel #3
0
 public virtual void sinkThrottleChanged(cdeP pNewValue)
 {
     MyBaseThing.SetPublishThrottle(TheCommonUtils.CInt(pNewValue));
 }