예제 #1
0
        public override bool Init()
        {
            if (TheCDEngines.MyThingEngine == null || mIsInitCalled)
            {
                return(false);
            }
            mIsInitCalled = true;

            if (string.IsNullOrEmpty(MyBaseThing.ID))
            {
                MyBaseThing.ID = Guid.NewGuid().ToString();
            }

            if (TheBaseAssets.MyServiceHostInfo.IsCloudService)
            {
                mIsInitialized = true;
                return(true);
            }

            if (!TheBaseAssets.MyServiceHostInfo.IsCloudService)//TODO: Allow Cloud Rules
            {
                TheCDEngines.MyThingEngine.RegisterEvent(eEngineEvents.ThingUpdated, sinkThingWasUpdated);
                //TheThingRegistry.eventThingUpdated += sinkThingWasUpdated;
                TheCDEngines.MyThingEngine.RegisterEvent(eEngineEvents.ThingRegistered, sinkThingWasRegistered);
                //TheThingRegistry.eventThingRegistered += sinkThingWasRegistered;
                TheCDEngines.MyThingEngine.RegisterEvent(eEngineEvents.ThingInitCalled, sinkActivateRules);
            }
            MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
            mIsInitialized = true; // CODE REVIEW Markus: Is the rules engine really ready for consumption at this stage, or should we wait until storage is ready?
                                   //CM: The rules engine is ready but the Event Log might not be fully ready as of this time.
            ActivateRules();
            MyBaseEngine.ProcessInitialized();
            return(true);
        }
예제 #2
0
 public virtual bool Init(bool declareInit)
 {
     if (mIsInitCalled)
     {
         return(false);
     }
     mIsInitCalled           = true;
     IsConnected             = false;
     MyBaseThing.StatusLevel = 0;
     MyBaseThing.LastMessage = "Service is ready";
     MyBaseThing.RegisterStatusChanged(sinkUpdateUX);
     MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
     if (string.IsNullOrEmpty(MyBaseThing.ID))
     {
         MyBaseThing.ID = Guid.NewGuid().ToString();
         TheThing.SetSafePropertyBool(MyBaseThing, "IsStateSensor", true);
         TheThing.SetSafePropertyString(MyBaseThing, "StateSensorType", "analog");
         TheThing.SetSafePropertyString(MyBaseThing, "StateSensorUnit", "ms");
         TheThing.SetSafePropertyNumber(MyBaseThing, "StateSensorMaxValue", 100);
         TheThing.SetSafePropertyNumber(MyBaseThing, "StateSensorAverage", 50);
         TheThing.SetSafePropertyNumber(MyBaseThing, "StateSensorMinValue", 0);
         //TheThing.SetSafePropertyString(MyBaseThing, "StateSensorName", MyBaseThing.FriendlyName);
         TheRulesFactory.CreateOrUpdateRule(new TheThingRule(Guid.NewGuid(), "NetService:" + MyBaseThing.FriendlyName + " Failed", MyBaseThing, "StatusLevel", eRuleTrigger.Larger, "1", true, true));
     }
     if (declareInit)
     {
         mIsInitialized = true;
     }
     return(true);
 }
        public override bool Init()
        {
            if (!mIsInitCalled)
            {
                mIsInitCalled           = true;
                MyBaseThing.StatusLevel = 4;
                SetMessage("Service has started", DateTimeOffset.Now);

                MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
                MyBaseEngine.RegisterEvent(eEngineEvents.ThingDeleted, OnThingDeleted);

                // If not lengthy initialized you can remove cdeRunasync and call this synchronously
                TheCommonUtils.cdeRunAsync(MyBaseEngine.GetEngineName() + " Init Services", true, (o) =>
                {
                    // Perform any long-running initialization (i.e. network access, file access) here that must finish before other plug-ins or the C-DEngine can use the plug-in
                    InitServices();

                    // Declare the thing initialized
                    mIsInitialized = true;                                 // For future IsInit() calls
                    FireEvent(eThingEvents.Initialized, this, true, true); // Notify the C-DEngine and other plug-ins that the thing is initialized
                    MyBaseEngine.ProcessInitialized();                     //Set the status of the Base Engine according to the status of the Things it manages
                });
            }
            return(false);
        }
예제 #4
0
        public override bool Init()
        {
            if (mIsInitCalled)
            {
                return(false);
            }
            mIsInitCalled = true;

            MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
            MyBaseEngine.RegisterEvent(eEngineEvents.ThingDeleted, OnDeletedThing);
            MyBaseEngine.RegisterEvent(eEngineEvents.ThingRegistered, OnThingRegistered);
            MyBaseEngine.RegisterEvent(eEngineEvents.ShutdownEvent, OnShutdown);
            TheCommonUtils.cdeRunAsync("Init Prometheus Exporters", false, (state) =>
            {
                try
                {
                    InitServers();
                }
                catch (Exception e)
                {
                    TheBaseAssets.MySYSLOG.WriteToLog(181001, TSM.L(eDEBUG_LEVELS.OFF) ? null : new TSM(MyBaseThing.EngineName, "Error initializing instances", eMsgLevel.l1_Error, e.ToString()));
                }

                mIsInitialized = true;
                FireEvent(eThingEvents.Initialized, this, true, true);
                MyBaseEngine.ProcessInitialized();
            }, null);

            return(false);
        }
예제 #5
0
        public override bool Init()
        {
            if (mIsInitCalled)
            {
                return(false);
            }
            mIsInitCalled = true;

            MyBaseThing.StatusLevel = 4;
            MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
            MyBaseEngine.RegisterEvent(eEngineEvents.ThingRegistered, sinkRegistered);
            MyBaseEngine.RegisterEvent(eEngineEvents.ThingDeleted, sinkRegistered);

            if (EnableTracing)
            {
                Opc.Ua.Utils.SetTraceOutput(Utils.TraceOutput.FileOnly);
                Opc.Ua.Utils.SetTraceLog("opcclient.log", false);
            }
            else
            {
                Opc.Ua.Utils.SetTraceOutput(Utils.TraceOutput.Off);
            }
            if (EnableTracingToLog)
            {
                Opc.Ua.Utils.Tracing.TraceEventHandler += OnOpcLibraryTrace;
            }
            TheCommonUtils.cdeRunAsync("Init OPC Servers", true, (a) =>
            {
                InitServers();
                mIsInitialized = true;
                FireEvent(eThingEvents.Initialized, this, true, true);
                MyBaseEngine.ProcessInitialized();
            });
            return(false);
        }
예제 #6
0
 public void RegisterEvent(string pName, Action <ICDEThing, object> pCallBack)
 {
     if (MyBaseThing != null)
     {
         MyBaseThing.RegisterEvent(pName, pCallBack);
     }
 }
예제 #7
0
 public override bool CreateUX()
 {
     if (!mIsUXInitialized)
     {
         mIsUXInitialized = true;
         TheFormInfo tMyLiveForm = new TheFormInfo(MyBaseThing) //, eEngineName.NMIService, "BTMid:" + MyBaseThing.cdeMID.ToString(), null)
         {
             DefaultView = eDefaultView.IFrame, PropertyBag = new nmiCtrlIFrameView {
                 TileWidth = 18, TileHeight = 11, Source = $"/CDEWRA{MyBaseThing.cdeMID}", OnIFrameLoaded = "NOWN:IFRA"
             }
         };
         tMyLiveForm.RegisterEvent2(eUXEvents.OnLoad, (pMsg, Para) => {
             //TheNMIEngine.SetUXProperty(pMsg.Message.GetOriginator(), tMyLiveForm.cdeMID, $"Source={HostUrl}/CDEWRA{MyBaseThing.cdeMID}");
         });
         TheNMIEngine.AddFormToThingUX(MyBaseThing, tMyLiveForm, "CMyForm", $"WebApp: {MyBaseThing.FriendlyName}", 1, 3, 0, Category, null, new ThePropertyBag()
         {
         });
         MyBaseThing.RegisterEvent($"OnLoaded:{tMyLiveForm.cdeMID}:IFRA", (sender, obj) =>
         {
             if (!(obj is TheProcessMessage t))
             {
                 return;
             }
             //TheNMIEngine.SetUXProperty(t.Message.GetOriginator(), tMyLiveForm.cdeMID, "Source=http://www.c-labs.com");
         });
예제 #8
0
        public override bool Init()
        {
            if (mIsInitCalled)
            {
                return(false);
            }
            mIsInitCalled = true;

            ReqBuffer = new TheMirrorCache <TheRequestData>(0);
            string t = TheCommonUtils.CStr(TheBaseAssets.MySettings.GetSetting("WRA_RequestTimeout"));

            if (!string.IsNullOrEmpty(t))
            {
                RequestTimeout = TheCommonUtils.CInt(t);
            }
            if (RequestTimeout < 15)
            {
                RequestTimeout = 15;
            }

            InitServices();

            TheCommCore.MyHttpService.RegisterHttpInterceptorB4("/", InterceptHttpRequest);
            TheScopeManager.RegisterScopeChanged(sinkScopeIDUpdate);
            MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);

            mIsInitialized = true;
            MyBaseEngine.ProcessInitialized();
            return(true);
        }
예제 #9
0
 public TheOPCUATagThing(TheThing pThing, TheOPCTag pTag)
     : base(pThing)
 {
     MyBaseThing.DeviceType = eOPCDeviceTypes.OPCLiveTag;
     Reset();
     MyBaseThing.RegisterEvent("OnInitialized", sinkInit);
     MyBaseThing.SetIThingObject(this);
 }
예제 #10
0
        public override bool Init()
        {
            if (!mIsInitStarted)
            {
                mIsInitStarted          = true;
                MyBaseThing.StatusLevel = 4;
                MyBaseThing.LastMessage = "Logger Service has started";

                MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
                MyBaseEngine.RegisterEvent(eEngineEvents.ThingDeleted, OnThingDeleted);

                cdeP tP = null;
                if (TheBaseAssets.MyServiceHostInfo.DisableConsole)
                {
                    TheThing.SetSafePropertyBool(MyBaseThing, "DisableStandardLog", TheBaseAssets.MyServiceHostInfo.DisableConsole);
                }
                else
                {
                    tP = GetProperty("DisableStandardLog", true);
                }
                tP.RegisterEvent(eThingEvents.PropertyChanged, sinkDisableChanged);
                if (TheCommonUtils.CBool(tP.ToString()))
                {
                    TheBaseAssets.MyServiceHostInfo.DisableConsole = true;
                }

                if (TheBaseAssets.MyServiceHostInfo.UseGELFLoggingFormat)
                {
                    tP = TheThing.SetSafePropertyBool(MyBaseThing, "UseGELF", TheBaseAssets.MyServiceHostInfo.UseGELFLoggingFormat);
                }
                else
                {
                    tP = GetProperty("UseGELF", true);
                }
                tP.RegisterEvent(eThingEvents.PropertyChanged, sinkGELF);
                if (TheCommonUtils.CBool(tP.ToString()))
                {
                    TheBaseAssets.MyServiceHostInfo.UseGELFLoggingFormat = true;
                }

                bool DoLogKPIs = TheCommonUtils.CBool(TheBaseAssets.MySettings.GetSetting("LogKPIs"));
                if (DoLogKPIs)
                {
                    TheThing.SetSafePropertyBool(MyBaseThing, "LogKPIs", true);
                }

                TheQueuedSenderRegistry.RegisterHealthTimer(sinkTimer);
                // If not lengthy initialized you can remove cdeRunasync and call this synchronously
                TheCommonUtils.cdeRunAsync(MyBaseEngine.GetEngineName() + " Init Services", true, (o) =>
                {
                    // Perform any long-running initialization (i.e. network access, file access) here
                    InitServices();
                    MyBaseEngine.ProcessInitialized(); //Set the status of the Base Engine according to the status of the Things it manages
                    mIsInitCompleted = true;
                });
            }
            return(false);
        }
예제 #11
0
 public override bool Init()
 {
     if (!mIsInitialized)
     {
         mIsInitialized = true;
         MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
     }
     return(true);
 }
예제 #12
0
 public TheOPCUAMethodThing(TheThing pThing, string pEngineName)
     : base(pThing)
 {
     MyBaseThing.DeviceType = eOPCDeviceTypes.OPCMethod;
     MyBaseThing.EngineName = pEngineName;
     Reset();
     MyBaseThing.RegisterEvent("OnInitialized", sinkInit);
     MyBaseThing.SetIThingObject(this);
 }
예제 #13
0
 public override bool Init()
 {
     if (!mIsInitCalled)
     {
         mIsInitCalled = true;
         MyBaseThing.RegisterEvent(eEngineEvents.FileReceived, sinkFileReceived);
         MyBaseThing.LastMessage = "Thing has started";
         MyBaseThing.StatusLevel = 1;
         mIsInitialized          = true;
     }
     return(true);
 }
예제 #14
0
        /// <summary>
        /// Initializes The Thing Engine
        /// </summary>
        /// <returns></returns>
        public override bool Init()
        {
            if (mIsInitCalled)
            {
                return(false);
            }
            mIsInitCalled = true;

            MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);        //Event when C-DEngine has new Telegram for this service as a subscriber (Client Side)
            MyBaseEngine.SetInitialized(null);
            mIsInitialized = true;
            return(true);
        }
예제 #15
0
        public override bool DoInit()
        {
            if (MyBaseThing.StatusLevel != 1)
            {
                MyBaseThing.LastMessage = "Tag Ready";
                MyBaseThing.StatusLevel = 0;
            }
            cdeP Mon = MyBaseThing.GetProperty("DontMonitor", true);

            Mon.RegisterEvent(eThingEvents.PropertyChanged, sinkPChanged);
            MyBaseThing.RegisterEvent(eThingEvents.PropertyChanged, sinkUXUpdatedThing);
            MyBaseThing.RegisterEvent(eThingEvents.ValueChanged, sinkRulesUpdatedThing);
            return(true);
        }
예제 #16
0
        public override bool Init()
        {
            if (mIsInitCalled)
            {
                return(false);
            }
            mIsInitCalled = true;
            MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
            MyBaseThing.RegisterProperty("sendmail");
            MyBaseThing.StatusLevel = 1;

            MyBaseThing.DeclareSecureProperty(nameof(Password), ePropertyTypes.TString);

            mIsInitialized = true;
            return(true);
        }
예제 #17
0
 public override bool Init()
 {
     if (!mIsInitCalled)
     {
         mIsInitCalled = true;
         //TheChartFactory.MyDefaultChartsFactory = new TheC3ChartsFactory();
         MyBaseThing.LastMessage = "Service has started";
         MyBaseThing.AddCapability(eThingCaps.NMIControls);
         MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
         MyBaseEngine.ProcessInitialized();
         MyBaseEngine.SetEngineReadiness(true, null);
         MyBaseEngine.SetStatusLevel(1);
         mIsInitialized = true;
     }
     return(true);
 }
예제 #18
0
 public override bool Init()
 {
     if (!mIsInitCalled)
     {
         mIsInitCalled = true;
         MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
         // Additional initialization processing goes here
         // If additional processing could fail or last longer, set status level to 4 and/or consider finishing Init() asynchronously (return false, fire eThingEvent.Initialized when ready)
         // MyBaseThing.StatusLevel = 4;
         // MyBaseThing.LastMessage="Service is starting";
         MyBaseThing.StatusLevel = 1;
         MyBaseThing.LastMessage = "Service has started";
         mIsInitialized          = true;
         MyBaseEngine.ProcessInitialized();
     }
     return(true);
 }
예제 #19
0
        public override bool Init()
        {
            if (!mIsInitCalled)
            {
                mIsInitCalled = true;
                MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
                // Additional initialization processing goes here

                MyBaseThing.StatusLevel = 1;
                MyBaseThing.LastMessage = "Historian Sample service has started.";
                mIsInitialized          = true;
                MyBaseEngine.ProcessInitialized();

                StartPropertyUpdateLoop();
                ConsumeHistory();
            }
            return(true);
        }
예제 #20
0
        public override bool Init()
        {
            if (!mIsInitCalled)
            {
                mIsInitCalled           = true;
                MyBaseThing.StatusLevel = 4;
                MyBaseThing.LastMessage = "Service has started";

                MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
                MyBaseEngine.RegisterEvent(eEngineEvents.ThingDeleted, OnThingDeleted);
                MyBaseThing.RegisterEvent(eEngineEvents.FileReceived, sinkFileReceived);

                InitServices();
                MyBaseEngine.ProcessInitialized(); //Set the status of the Base Engine according to the status of the Things it manages
                mIsInitialized = true;
            }
            return(false);
        }
예제 #21
0
        public override bool Init()
        {
            if (mIsInitCalled)
            {
                return(false);
            }
            mIsInitCalled = true;

            MyBaseThing.RegisterStatusChanged(sinkStatChanged);
            MyBaseThing.StatusLevel = 4;
            MyBaseThing.Value       = "0";
            MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
            MyBaseEngine.RegisterEvent(eEngineEvents.ThingDeleted, OnThingDeleted);
            MyBaseEngine.RegisterEvent(eEngineEvents.ThingRegistered, OnThingRegisterd);

            if (!TheBaseAssets.MyServiceHostInfo.IsCloudService && !TheThing.GetSafePropertyBool(MyBaseThing, "RanBefore"))
            {
                TheThing.SetSafePropertyBool(MyBaseThing, "RanBefore", true);
                string tAutoPing = TheBaseAssets.MySettings.GetSetting("AutoPing");
                if (!string.IsNullOrEmpty(tAutoPing))
                {
                    TheThing tThing = new TheThing();
                    tThing.EngineName   = MyBaseEngine.GetEngineName();
                    tThing.DeviceType   = eNetworkServiceTypes.PingService;
                    tThing.Address      = tAutoPing;
                    tThing.FriendlyName = tAutoPing;
                    TheThing.SetSafePropertyBool(tThing, "AllowRTT", true);
                    TheThing.SetSafePropertyBool(tThing, "AutoConnect", true);
                    TheThingRegistry.RegisterThing(tThing);
                }
            }

            if (MyBaseEngine.GetEngineState().IsService)
            {
                TheCommonUtils.cdeRunAsync("Init Networkers", true, (o) =>
                {
                    InitNetworkServices();
                    mIsInitialized = true;
                    FireEvent(eThingEvents.Initialized, this, true, true);
                    MyBaseEngine.ProcessInitialized();
                });
            }
            return(false);
        }
예제 #22
0
        public override bool Init()
        {
            if (mIsInitCalled)
            {
                return(false);
            }
            mIsInitCalled = true;

            MyBaseThing.StatusLevel = 4;
            MyBaseThing.LastMessage = "Plugin has started";

            MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
            MyBaseEngine.RegisterEvent(eEngineEvents.ThingDeleted, (t, o) => OnThingDeleted(t, o));
            MyBaseEngine.RegisterEvent(eEngineEvents.ThingRegistered, sinkRegistered);
            MyBaseThing.RegisterEvent("FileReceived", sinkFileReceived);

            // Create any properties and set them to default values on first run only
            bool bFirstRun = MyBaseThing.ID == null; // Using the ID property to detect first run - any other property would work as well if you don't need/want an ID property

            // Tip: If you want to reset all properties to their defaults just set the ID property to null

            SetPropertyIfNotExist("FriendlyName", "Modbus Plugin", bFirstRun); //Declare the Property and optionally Initalize (change null with initialization)
            if (bFirstRun)
            {
                MyBaseThing.ID = Guid.NewGuid().ToString();
            }

            TheCommonUtils.cdeRunAsync(MyBaseEngine.GetEngineName() + " Init Services", true, (o) =>
            {
                // Perform any long-running initialization (i.e. network access, file access) here
                InitServices();

                // Only then declare the service as initizlied
                if (MyBaseThing.StatusLevel == 4)
                {
                    MyBaseThing.StatusLevel = 1;
                }
                FireEvent(eThingEvents.Initialized, this, true, true);
                MyBaseEngine.ProcessInitialized(); // If not lengthy initialized you can remove cdeRunasync and call this synchronously
            });
            mIsInitialized = true;

            return(IsInit());
        }
예제 #23
0
        public override bool Init()
        {
            if (mIsInitCalled)
            {
                return(false);
            }
            mIsInitCalled = true;

            if (TheCDEngines.MyIStorageService == null)
            {
                MyBaseThing.StatusLevel = 3;
                MyBaseThing.LastMessage = "Failure during Storage Service Rampup"; //TODO: Add reason why
                return(true);                                                      //We return true as in complete Init but no processing anymore
            }
            MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
            TheBaseEngine.WaitForStorageReadiness(sinkStorageStationIsReadyFired, true);
            mIsInitialized = true;
            MyBaseEngine.SetInitialized(null);
            return(true);
        }
예제 #24
0
        public override bool Init()
        {
            if (mIsInitCalled)
            {
                return(false);
            }
            mIsInitCalled = true;

            MyBaseThing.StatusLevel = 4;
            MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);
            SetProperty("LastMessage", "Plugin has started");
            if (MyBaseEngine.GetEngineState().IsService)
            {
                InitServers();
                TheCommCore.MyHttpService.RegisterHttpInterceptorB4("/getmsgs", sinkProcessBand);
            }
            MyBaseEngine.ProcessInitialized();

            mIsInitialized = true;
            return(true);
        }
예제 #25
0
        public override void DoCreateUX()
        {
            TheFormInfo tMyLiveForm = new TheFormInfo(new Guid("{CCCCCCCC-978D-4443-BC88-543962366B81}"), eEngineName.NMIService, "BTMid:" + MyBaseThing.cdeMID.ToString(), null)
            {
                DefaultView = eDefaultView.IFrame, PropertyBag = new nmiCtrlIFrameView {
                    TileWidth = 18, TileHeight = 11, Source = "http://www.chrisan.me:8080", OnIFrameLoaded = "NOWN:IFRA"
                }
            };

            TheNMIEngine.AddFormToThingUX(MyBaseThing, tMyLiveForm, "CMyForm", $"IFrame Demo:{MyBaseThing.cdeMID}", 1, 3, 0, "..Demos", null, new ThePropertyBag()
            {
            });
            MyBaseThing.RegisterEvent($"OnLoaded:{tMyLiveForm.cdeMID}:IFRA", (sender, obj) => {
                TheProcessMessage t = obj as TheProcessMessage;
                if (t == null || t.Message.PLS == "http://www.c-labs.com")
                {
                    return;
                }
                TheNMIEngine.SetUXProperty(t.Message.GetOriginator(), tMyLiveForm.cdeMID, "Source=http://www.c-labs.com");
                //TheCommCore.PublishToOriginator(t.Message, new TSM(eEngineName.NMIService, "Something"));
            });
        }
예제 #26
0
        public override bool Init()
        {
            if (mIsInitCalled)
            {
                return(false);
            }
            mIsInitCalled = true;

            MyBaseThing.StatusLevel = 4;
            string temp;

            TheBaseAssets.MyCmdArgs.TryGetValue("IsHealthCollectionOff", out temp);
            if (!string.IsNullOrEmpty(temp))
            {
                IsHealthCollectionOff = TheCommonUtils.CBool(temp);
            }
            if (HealthCollectionCycle == 0)
            {
                TheBaseAssets.MyCmdArgs.TryGetValue("HealthCollectionCycle", out temp);
                if (!string.IsNullOrEmpty(temp))
                {
                    HealthCollectionCycle = TheCommonUtils.CInt(temp);
                }
                if (HealthCollectionCycle == 0)
                {
                    HealthCollectionCycle = 15;
                }
            }

            if (SensorDelay == 0)
            {
                TheBaseAssets.MyCmdArgs.TryGetValue("SensorDelay", out temp);
                if (!string.IsNullOrEmpty(temp))
                {
                    SensorDelay = TheCommonUtils.CInt(temp);
                }
                if (SensorDelay == 0)
                {
                    SensorDelay = 500;
                }
            }

            if (SensorAccelDeadband < 1)
            {
                TheBaseAssets.MyCmdArgs.TryGetValue("SensorAccelDeadband", out temp);
                if (!string.IsNullOrEmpty(temp))
                {
                    SensorAccelDeadband = TheCommonUtils.CDbl(temp);
                }
                if (SensorAccelDeadband < 0.1)
                {
                    SensorAccelDeadband = 3.0;
                }
            }
            int tBS = (int)TheThing.GetSafePropertyNumber(MyBaseThing, "ChartValues");

            if (tBS < 10)
            {
                tBS = 1000;
                TheThing.SetSafePropertyNumber(MyBaseThing, "ChartValues", tBS);
            }
            tBS = (int)TheThing.GetSafePropertyNumber(MyBaseThing, "ChartSize");
            if (tBS < 6)
            {
                tBS = 18;
                TheThing.SetSafePropertyNumber(MyBaseThing, "ChartSize", tBS);
            }

            TheUserManager.RegisterNewRole(new TheUserRole(new Guid("{0A254170-D4D4-4B2D-9E05-D471729BE739}"), "ComputerManager", 1, new Guid("{3FB56264-9AA8-4AC9-9208-A01F1142B153}"), true, "Person allowed to view Computer Details"));
            MyBaseThing.RegisterEvent(eEngineEvents.IncomingMessage, HandleMessage);        //Event when C-DEngine has new Telegram for this service as a subscriber (Client Side)
            MyBaseThing.RegisterEvent("FileReceived", sinkFileReceived);
            MyBaseThing.RegisterEvent(eEngineEvents.ShutdownEvent, sinkEngineShutdown);
            StartEngineServices();
            if (MyBaseThing.StatusLevel == 4)
            {
                MyBaseThing.StatusLevel = 1;
            }
            mIsInitialized = true;
            return(true);
        }