public override void Start() { logger.Log("Started: {0}", ToString()); SmartCamSvc service = new SmartCamSvc(logger, this); serviceHost = new SafeServiceHost(logger, typeof(ISmartCamContract), service, this, Constants.AjaxSuffix, moduleInfo.BaseURL()); serviceHost.Open(); appServer = new WebFileServer(moduleInfo.BinaryDir(), moduleInfo.BaseURL(), logger); this.videosDir = moduleInfo.WorkingDir() + "\\" + VIDEO_SUB_DIR_NAME; this.videosBaseUrl = moduleInfo.BaseURL() + "/" + VIDEO_SUB_DIR_NAME; recordingServer = new WebFileServer(videosDir, videosBaseUrl, logger); logger.Log("camera service is open for business at " + moduleInfo.BaseURL()); //..... get the list of current ports from the platform IList<VPort> allPortsList = GetAllPortsFromPlatform(); if (allPortsList != null) { foreach (VPort port in allPortsList) { PortRegistered(port); } } }
public override void Start() { logger.Log("Started: {0} ", ToString()); DummyService dummyService = new DummyService(logger, this); serviceHost = new SafeServiceHost(logger,typeof(IMatlabInterfaceContract), dummyService , this, Constants.AjaxSuffix, moduleInfo.BaseURL()); serviceHost.Open(); appServer = new WebFileServer(moduleInfo.BinaryDir(), moduleInfo.BaseURL(), logger); //........... instantiate the list of other ports that we are interested in accessibleDummyPorts = new List<VPort>(); //..... get the list of current ports from the platform IList<VPort> allPortsList = GetAllPortsFromPlatform(); if (allPortsList != null) ProcessAllPortsList(allPortsList); this.receivedMessageList = new List<string>(); this.receivedMessageListMatlab = new List<string>(); // remoteSync flag can be set to true, if the Platform Settings has the Cloud storage // information i.e., DataStoreAccountName, DataStoreAccountKey values datastream = base.CreateValueDataStream<StrKey, StrValue>("test", false /* remoteSync */); worker = new SafeThread(delegate() { Work(); }, "AppDummy-worker", logger); worker.Start(); }
public override void Start() { logger.Log("Started: {0} ", ToString()); DoorjambService simplexService = new DoorjambService(logger, this); simplexServiceHost = DoorjambService.CreateServiceHost(logger, this, simplexService, moduleInfo.BaseURL() + "/webapp"); simplexServiceHost.Open(); appServer = new WebFileServer(moduleInfo.BinaryDir(), moduleInfo.BaseURL(), logger); //........... instantiate the list of other ports that we are interested in accessibleDoorjambPorts = new List<VPort>(); //..... get the list of current ports from the platform IList<VPort> allPortsList = GetAllPortsFromPlatform(); if (allPortsList != null) ProcessAllPortsList(allPortsList); this.receivedMessageList = new List<string>(); this.irDataList = new List<string>(); this.irDataList.Add(""); this.usDataList = new List<string>(); this.usDataList.Add(""); this.eventTime = ""; worker = new SafeThread(delegate() { Work(); }, "AppDoorjamb-worker", logger); worker.Start(); }
public override void Start() { logger.Log("Started: {0}", ToString()); service = new AppValveControllerService(this, logger); serviceHost = AppValveControllerService.CreateServiceHost(logger, this, service, moduleInfo.BaseURL() + "/webapp"); serviceHost.Open(); webUiServer = new WebFileServer(moduleInfo.BinaryDir(), moduleInfo.BaseURL(), logger); logger.Log("{0}: service is open for business at {1}", ToString(), moduleInfo.BaseURL()); //... get the list of current ports from the platform IList<VPort> allPortsList = GetAllPortsFromPlatform(); if (allPortsList != null) { foreach (VPort port in allPortsList) { PortRegistered(port); } } }
public override void Start() { logger.Log("Started: {0} ", ToString()); BluetoothAppService bluetoothService = new BluetoothAppService(logger, this); serviceHost = new SafeServiceHost(logger, typeof(IBluetoothAppContract), bluetoothService, this, Constants.AjaxSuffix, moduleInfo.BaseURL()); serviceHost.Open(); //create the app server appServer = new WebFileServer(moduleInfo.BinaryDir(), moduleInfo.BaseURL(), logger); //Create a new thread that will try connect to all configured device asynchronously every 10 sec worker = new SafeThread(delegate() { tryConnectToDevices(); }, "AppBluetoothPing-worker", logger); worker.Start(); }
public override void Start() { logger.Log("Started: {0} ", ToString()); PowerMeterService powermeterService = new PowerMeterService(logger, this); serviceHost = new SafeServiceHost(logger, typeof(IPowerMeterContract), powermeterService, this, Constants.AjaxSuffix, moduleInfo.BaseURL()); serviceHost.Open(); appServer = new WebFileServer(moduleInfo.BinaryDir(), moduleInfo.BaseURL(), logger); //........... instantiate the list of other ports that we are interested in accessiblePowerMeterPorts = new List<VPort>(); //..... get the list of current ports from the platform IList<VPort> allPortsList = GetAllPortsFromPlatform(); if (allPortsList != null) ProcessAllPortsList(allPortsList); this.receivedMessageList = new List<string>(); // remoteSync flag can be set to true, if the Platform Settings has the Cloud storage // information i.e., DataStoreAccountName, DataStoreAccountKey values datastream = base.CreateFileStream<StrKey, StrValue>("dumb", false /* remoteSync */); //you can change SerialportName:"COM3",Maybe yours is not "COM3" foreach (VPort port in accessiblePowerMeterPorts) { Invoke(port, RolePowerMeter.Instance, RolePowerMeter.OpOpenSerialPort, new ParamType(ParamType.SimpleType.text, "SerialPortName", "COM3")); } SendCommand("status"); GetAllPowerMeterStatus(); worker = new SafeThread(delegate() { Work(); }, "AppPowerMeter-worker", logger); worker.Start(); }
public BluetoothScoutService(string baseAddress, BluetoothScout btScout, ScoutViewOfPlatform platform, VLogger logger) { this.logger = logger; this.bluetoothScout = btScout; service = new SafeServiceHost(logger, platform, this, baseAddress); var contract = ContractDescription.GetContract(typeof(IBluetoothScoutContract)); var webBinding = new WebHttpBinding(); var webEndPoint = new ServiceEndpoint(contract, webBinding, new EndpointAddress(baseAddress)); webEndPoint.EndpointBehaviors.Add(new WebHttpBehavior()); service.AddServiceEndpoint(webEndPoint); service.AddServiceMetadataBehavior(new ServiceMetadataBehavior()); service.Open(); }
public override void Start() { logger.Log("Started: {0} ", ToString()); AirConditionCtrlService airConditionCtrlService = new AirConditionCtrlService(logger, this); serviceHost = new SafeServiceHost(logger, typeof(IAirConditionCtrlContract), airConditionCtrlService, this, Constants.AjaxSuffix, moduleInfo.BaseURL()); serviceHost.Open(); appServer = new WebFileServer(moduleInfo.BinaryDir(), moduleInfo.BaseURL(), logger); //........... instantiate the list of other ports that we are interested in accessibleAirConditionCtrlPorts = new List<VPort>(); //..... get the list of current ports from the platform IList<VPort> allPortsList = GetAllPortsFromPlatform(); if (allPortsList != null) ProcessAllPortsList(allPortsList); receivedMessageList = new List<string>(); readMsgByIdList = new List<string>(); rcvdNewMsgList = new List<string>(); //remoteSync flag can be set to true, if the Platform Settings has the Cloud storage //information i.e., DataStoreAccountName, DataStoreAccountKey values datastream = base.CreateFileStream<StrKey, StrValue>("dumb", false /* remoteSync */); worker = new SafeThread(delegate() { Work(); }, "AppAirConditionCtrl-worker", logger); worker.Start(); //gm.ComPort = "COM6"; //gm.BaudRate = 9600; //gm.Open(); //gm.SmsRecieved += new EventHandler(gm_SmsRecieved); }
public override void Start() { logger.Log("Started: {0}", ToString()); SwitchSvc service = new SwitchSvc(logger, this); serviceHost = new SafeServiceHost(logger, typeof(ISwitchSvcContract), service, this, Constants.AjaxSuffix, moduleInfo.BaseURL()); serviceHost.Open(); appServer = new WebFileServer(moduleInfo.BinaryDir(), moduleInfo.BaseURL(), logger); logger.Log("switch controller is open for business at " + moduleInfo.BaseURL()); //..... get the list of current ports from the platform IList<VPort> allPortsList = GetAllPortsFromPlatform(); foreach (VPort port in allPortsList) { PortRegistered(port); } }
public override void Start() { logger.Log("Started: {0} ", ToString()); WeatherService dummyService = new WeatherService(logger, this); serviceHost = new SafeServiceHost(logger,typeof(IWeatherContract), dummyService , this, Constants.AjaxSuffix, moduleInfo.BaseURL()); serviceHost.Open(); appServer = new WebFileServer(moduleInfo.BinaryDir(), moduleInfo.BaseURL(), logger); //........... instantiate the list of other ports that we are interested in accessibleWeatherPorts = new List<VPort>(); //..... get the list of current ports from the platform IList<VPort> allPortsList = GetAllPortsFromPlatform(); if (allPortsList != null) ProcessAllPortsList(allPortsList); }
public MindWaveScoutService(string baseAddress, MindWaveScout wcScout, ScoutViewOfPlatform platform, VLogger logger) { this.logger = logger; this.webCamScout = wcScout; service = new SafeServiceHost(logger, platform, this, baseAddress); var contract = ContractDescription.GetContract(typeof(IMindWaveScoutContract)); var webBinding = new WebHttpBinding(); var webEndPoint = new ServiceEndpoint(contract, webBinding, new EndpointAddress(baseAddress)); webEndPoint.EndpointBehaviors.Add(new WebHttpBehavior()); service.AddServiceEndpoint(webEndPoint); //service.Description.Behaviors.Add(new ServiceMetadataBehavior()); //service.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex"); service.AddServiceMetadataBehavior(new ServiceMetadataBehavior()); service.Open(); }
public override void Start() { //Using "Sensor:" to indicate clearly in the log where this line came from. logger.Log("Sensor:Started: {0} ", ToString()); SensorDBService sensorService = new SensorDBService(logger, this); serviceHost = new SafeServiceHost(logger, typeof(ISensorContract), sensorService, this, Constants.AjaxSuffix, moduleInfo.BaseURL()); serviceHost.Open(); appServer = new WebFileServer(moduleInfo.BinaryDir(), moduleInfo.BaseURL(), logger); //........... instantiate the list of other ports that we are interested in accessibleSensorPorts = new List<VPort>(); //..... get the list of current ports from the platform IList<VPort> allPortsList = GetAllPortsFromPlatform(); if (allPortsList != null) ProcessAllPortsList(allPortsList); this.receivedMessageList = new Queue<string>(); //gAlertEmailAddress = GetPrivateConfSetting("NotificationEmail"); gHome_Id = GetConfSetting("HomeId"); //location to save information Directory.CreateDirectory(moduleInfo.WorkingDir()); //#########test to see if insert (to db) operation works############### for (int i = 1; i < 10;i++ ) WriteToDB("_test_", i); //##################################################################### }
public override void Start() { //Using "Sensor:" to indicate clearly in the log where this line came from. logger.Log("Sensor:Started: {0} ", ToString()); // remoteSync flag can be set to true, if the Platform Settings has the Cloud storage // information i.e., DataStoreAccountName, DataStoreAccountKey values datastream = base.CreateValueDataStream<StrKey, StrValue>("data", true, 10 * 60); SensorService sensorService = new SensorService(logger, this); serviceHost = new SafeServiceHost(logger, typeof(ISensorContract), sensorService, this, Constants.AjaxSuffix, moduleInfo.BaseURL()); serviceHost.Open(); appServer = new WebFileServer(moduleInfo.BinaryDir(), moduleInfo.BaseURL(), logger); //........... instantiate the list of other ports that we are interested in accessibleSensorPorts = new List<VPort>(); //..... get the list of current ports from the platform IList<VPort> allPortsList = GetAllPortsFromPlatform(); if (allPortsList != null) ProcessAllPortsList(allPortsList); this.receivedMessageList = new Queue<string>(); mTimer = new Timer(60000); //1 minute mTimer.Elapsed += new ElapsedEventHandler(doDataMonitoring); gAlertEmailAddress = GetPrivateConfSetting("NotificationEmail"); gHome_Id = GetConfSetting("HomeId"); //location to save information Directory.CreateDirectory(moduleInfo.WorkingDir()); gMonitoringMemoryFile = moduleInfo.WorkingDir() + "\\" + "monitoringMemory.txt"; CheckForPreviousMonitoringValues(); }
private SafeServiceHost OpenSafeServiceWebSec(string baseUrl) { var svcHost = new SafeServiceHost(logger, platform, this, baseUrl); var contract = ContractDescription.GetContract(typeof(IGuiServiceWebSec)); var webEndPoint = new ServiceEndpoint(contract, new WebHttpBinding(), new EndpointAddress(baseUrl)); webEndPoint.EndpointBehaviors.Add(new WebHttpBehavior()); svcHost.AddServiceEndpoint(webEndPoint); svcHost.AddServiceMetadataBehavior(new ServiceMetadataBehavior()); //svcHost.Description.Behaviors.Add(new ServiceMetadataBehavior()); //svcHost.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex"); svcHost.Open(); return svcHost; }
////Email address to receive the alert pictures. //string emailAdrs; public override void Start() { logger.Log("Started: {0}", ToString()); try { settings = new AlertSettings(); settings.Mode = (moduleInfo.Args().Length > 0) ? (AlertMode)Enum.Parse(typeof(AlertMode), moduleInfo.Args()[0], true) : AlertMode.emailonly; settings.StartHourMin = (moduleInfo.Args().Length > 1) ? int.Parse(moduleInfo.Args()[1]) : 0; settings.EndHourMin = (moduleInfo.Args().Length > 2) ? int.Parse(moduleInfo.Args()[2]) : 2400; settings.SuppressSeconds = (moduleInfo.Args().Length > 3) ? int.Parse(moduleInfo.Args()[3]) : 5; //AJB shorten suppression settings.UserName = (moduleInfo.Args().Length > 4) ? moduleInfo.Args()[4] : "user"; settings.emailAddress = GetPrivateConfSetting("NotificationEmail"); } catch (Exception exception) { logger.Log("{0}: error parsing arguments: {1}", exception.ToString(), String.Join(" ", moduleInfo.Args())); } DoorNotifierSvc service = new DoorNotifierSvc(logger, this); //serviceHost = DoorNotifierSvc.CreateServiceHost( // service, // new Uri(moduleInfo.BaseURL()+"/webapp")); serviceHost = DoorNotifierSvc.CreateServiceHost(logger, this, service, moduleInfo.BaseURL() + "/webapp"); serviceHost.Open(); webUiServer = new WebFileServer(moduleInfo.BinaryDir(), moduleInfo.BaseURL(), logger); logger.Log("{0}: service is open for business at {1}", ToString(), moduleInfo.BaseURL()); //no services are exported by this application //..... get the list of current ports from the platform IList<VPort> allPortsList = GetAllPortsFromPlatform(); if (allPortsList != null) { foreach (VPort port in allPortsList) { PortRegistered(port); } } //insert a fake notification for testing Alert newAlert = new Alert() { TimeTriggered = DateTime.Now, SensorFriendlyName = "fake sensor", SensorLocation = "fake location", Value = 1, Acknowledged = false, }; InsertAlert(newAlert); }
public override void Start() { logger.Log("Started: {0}", ToString()); ArduinoCamSvc service = new ArduinoCamSvc(logger, this); serviceHost = new SafeServiceHost(logger, typeof(IArduinoCamContract), service, this, Constants.AjaxSuffix, moduleInfo.BaseURL()); serviceHost.Open(); appServer = new WebFileServer(moduleInfo.BinaryDir(), moduleInfo.BaseURL(), logger); this.videosDir = moduleInfo.WorkingDir() + "\\" + VIDEO_SUB_DIR_NAME; this.videosBaseUrl = moduleInfo.BaseURL() + "/" + VIDEO_SUB_DIR_NAME; recordingServer = new WebFileServer(videosDir, videosBaseUrl, logger); logger.Log("camera service is open for business at " + moduleInfo.BaseURL()); //........... instantiate the list of other ports that we are interested in accessibleDummyPorts = new List<VPort>(); //..... get the list of current ports from the platform IList<VPort> allPortsList = GetAllPortsFromPlatform(); if (allPortsList != null) { foreach (VPort port in allPortsList) { PortRegistered(port); } } this.receivedMessageList = new List<string>(); // initiate a data stream to upload images or video files to a Server // remoteSync flag can be set to true, if the Platform Settings has the Cloud storage // information i.e., DataStoreAccountName, DataStoreAccountKey values datastream = base.CreateFileDataStream<StrKey, StrValue>("test", true /* remoteSync */); //ardui_worker = new SafeThread(delegate() //{ // SerialWork(); //}, "AppArduinoCam-worker", logger); //ardui_worker.Start(); }