void InitServices() { var tThing = TheThingRegistry.GetThingByProperty(MyBaseThing.EngineName, Guid.Empty, "DeviceType", eTheDemoScreensTypes.DemoIFrame); var t = new DemoIFrame(tThing, this); var tThing2 = TheThingRegistry.GetThingByProperty(MyBaseThing.EngineName, Guid.Empty, "DeviceType", eTheDemoScreensTypes.DemoStandardForm); var t2 = new DemoStandardForm(tThing2, this); var tThing3 = TheThingRegistry.GetThingByProperty(MyBaseThing.EngineName, Guid.Empty, "DeviceType", eTheDemoScreensTypes.DemoControls); var t3 = new DemoControls(tThing3, this); var tThing4 = TheThingRegistry.GetThingByProperty(MyBaseThing.EngineName, Guid.Empty, "DeviceType", eTheDemoScreensTypes.DemoWizard); var t4 = new DemoWizard(tThing4, this); var tThing5 = TheThingRegistry.GetThingByProperty(MyBaseThing.EngineName, Guid.Empty, "DeviceType", eTheDemoScreensTypes.AudioWizard); var t5 = new AudioRuleWizard(tThing5, this); var tThing9 = TheThingRegistry.GetThingByProperty(MyBaseThing.EngineName, Guid.Empty, "DeviceType", eTheDemoScreensTypes.MeshPicker); var t9 = new TheMeshPicker(tThing9, this); var tThing10 = TheThingRegistry.GetThingByProperty(MyBaseThing.EngineName, Guid.Empty, "DeviceType", eTheDemoScreensTypes.TestAutomationWizard); var t10 = new TestAutoWizard(tThing10, this); MyBaseEngine.SetStatusLevel(1); }
void sinkRuleThingEvent(ICDEThing sender, object pIncoming) { if (sender == null) { return; } TheThing tThing = TheThingRegistry.GetThingByProperty("*", Guid.Empty, "TriggerObject", TheThing.GetSafePropertyString(sender, "ID")); if (tThing != null) { TheRule tRule = tThing.GetObject() as TheRule; if (tRule == null || !tRule.IsRuleActive) { return; } if (tRule.TriggerStartTime > DateTimeOffset.Now) { return; } if (tRule.TriggerEndTime < DateTimeOffset.Now) { RemoveTrigger(tRule, false); return; } tRule.FireAction(false); } }
public TheServiceHealthData(string pEngineName, string pURL) { MyBaseThing = TheThingRegistry.GetThingByProperty(pEngineName, Guid.Empty, "ID", "PCH@" + TheBaseAssets.MyServiceHostInfo.MyDeviceInfo.DeviceID) ?? new TheThing { DeviceType = "PC-Health", ID = "PCH@" + TheBaseAssets.MyServiceHostInfo.MyDeviceInfo.DeviceID, EngineName = pEngineName }; cdeMID = MyBaseThing.cdeMID; cdeA = MyBaseThing.cdeA; MyBaseThing.SetIThingObject(this); TheThingRegistry.RegisterThing(this); }
public TheCPUInfo(string pEngineName, string pURL) { MyBaseThing = TheThingRegistry.GetThingByProperty(pEngineName, Guid.Empty, "ID", "CPU@" + TheBaseAssets.MyServiceHostInfo.MyDeviceInfo.DeviceID.ToString()); if (MyBaseThing == null) { MyBaseThing = new TheThing(); MyBaseThing.DeviceType = "CPUInfo"; MyBaseThing.ID = "CPU@" + TheBaseAssets.MyServiceHostInfo.MyDeviceInfo.DeviceID.ToString(); MyBaseThing.EngineName = pEngineName; } cdeMID = MyBaseThing.cdeMID; MyBaseThing.SetIThingObject(this); TheThingRegistry.RegisterThing(this); }
public override void HandleMessage(ICDEThing sender, object pIncoming) { TheProcessMessage pMsg = pIncoming as TheProcessMessage; if (pMsg == null) { return; } string[] cmd = pMsg.Message.TXT.Split(':'); switch (cmd[0]) { case "UPDATE_VALUE": ScanAllServices(); break; case "REFRESH_DASH": InitNetworkServices(); mMyDashboard.Reload(pMsg, false); break; case "CDE_INITIALIZED": MyBaseEngine.SetInitialized(pMsg.Message); break; case "CDE_INITIALIZE": if (MyBaseEngine.GetEngineState().IsService) { if (!MyBaseEngine.GetEngineState().IsEngineReady) { MyBaseEngine.SetEngineReadiness(true, null); } MyBaseEngine.ReplyInitialized(pMsg.Message); } break; default: TheThing tt = TheThingRegistry.GetThingByProperty(MyBaseEngine.GetEngineName(), Guid.Empty, "ID", pMsg.Message.PLS); tt?.HandleMessage(sender, pMsg); break; } }
static void sinkReady() { Debug.WriteLine("Registering events for engine... "); TheCDEngines.MyContentEngine.RegisterEvent(eEngineEvents.IncomingMessage, sinkIncoming); if (TheCDEngines.MyNMIService != null) { TheCDEngines.MyNMIService.RegisterEvent(eEngineEvents.IncomingMessage, sinkIncoming); //TheCDEngines.MyContentEngine.RegisterEvent(eEngineEvents.ChannelConnected, sinkEstablished); } TheCommonUtils.cdeRunAsync("LoopDiDoop", true, (o) => { TheThing tTimer = null; TheThing GoogleDNS = null; TheThing ThingBar = null; while (TheBaseAssets.MasterSwitch) { TheCommonUtils.SleepOneEye(5000, 100); if (ThingBar == null) { ThingBar = TheThingRegistry.GetThingByProperty("*", Guid.Empty, "FriendlyName", "ThingBar"); if (ThingBar != null) { TheThingRegistry.RegisterEventOfThing(ThingBar, eThingEvents.ValueChanged, (sender, para) => { TSM tTSM2 = new TSM(eEngineName.ContentService, "UNITY:GAUGE", para.ToString()); TheCommCore.PublishCentral(tTSM2); }); } } if (tTimer == null) { tTimer = TheThingRegistry.GetThingByProperty("*", Guid.Empty, "DeviceType", "Timer"); if (tTimer != null) { TheThingRegistry.RegisterEventOfThing(tTimer, eThingEvents.ValueChanged, (sender, para) => { TSM tTSM2 = new TSM(eEngineName.ContentService, "UNITY:TIMER", para.ToString()); TheCommCore.PublishCentral(tTSM2); }); } } if (GoogleDNS == null) { GoogleDNS = TheThingRegistry.GetThingByProperty("*", Guid.Empty, "FriendlyName", "Google DNS"); if (GoogleDNS != null) { TheThingRegistry.RegisterEventOfThing(GoogleDNS, eThingEvents.PropertyChanged, (sender, para) => { cdeP tP = para as cdeP; if (tP != null && tP.Name == "RoundTripTime") { TSM tTSM2 = new TSM(eEngineName.ContentService, "UNITY:HEART", para.ToString()); TheCommCore.PublishCentral(tTSM2); } }); } } if (GoogleDNS != null && tTimer != null && ThingBar != null) { break; } } }); }