Пример #1
0
 public ProgramManager(HomeGenieService hg)
 {
     homegenie = hg;
     macroRecorder = new MacroRecorder(this);
     scheduler = new SchedulerService(this);
     scheduler.Start();
 }
Пример #2
0
 public CSharpAppFactory(HomeGenieService hg)
 {
     homegenie = hg;
     masterControlProgram = homegenie.ProgramEngine;
     //AppDomain currentDomain = AppDomain.CurrentDomain;
     //currentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyLookup);
 }
Пример #3
0
 public NetHelper(HomeGenieService hg)
 {
     homegenie = hg;
     // TODO: SSL connection certificate validation
     // TODO: this is just an hack not meant to be used in production enviroment
     ServicePointManager.ServerCertificateValidationCallback = Validator;
 }
Пример #4
0
 public ProgramEngine(HomeGenieService hg)
 {
     homegenie = hg;
     scriptingHost = new CSharpAppFactory(homegenie);
     macroRecorder = new MacroRecorder(this);
     scheduler = new SchedulerService(this);
     scheduler.Start();
 }
Пример #5
0
 public void SetHost(HomeGenieService hg, int programId)
 {
     homegenie = hg;
     netHelper = new NetHelper(homegenie);
     programHelper = new ProgramHelper(homegenie, programId);
     eventsHelper = new EventsHelper(homegenie, programId);
     serialPortHelper = new SerialPortHelper();
     tcpClientHelper = new TcpClientHelper();
     schedulerHelper = new SchedulerHelper(homegenie);
 }
Пример #6
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper;
            AppDomain.CurrentDomain.SetupInformation.ShadowCopyFiles = "true";

            Console.CancelKeyPress += new ConsoleCancelEventHandler(Console_CancelKeyPress);

            _homegenie = new HomeGenieService();
            do { System.Threading.Thread.Sleep(2000); } while (_isrunning);
        }
Пример #7
0
 // if setup has been done
 public ProgramHelper(HomeGenieService hg, int programId)
 {
     homegenie = hg;
     myProgramId = programId;
     //
     //var oldModule = homegenie.VirtualModules.Find(rm => rm.ParentId == myProgramId.ToString() && rm.Address == myProgramId.ToString());
     //if (oldModule == null)
     //{
     //    AddControlWidget(""); // no control widget --> not visible
     //}
     // reset features and other values
     Reset();
 }
Пример #8
0
 private static void ShutDown()
 {
     Console.Write("HomeGenie is now exiting...\n");
     //
     if (_homegenie != null)
     {
         _homegenie.Stop();
         _homegenie = null;
     }
     //
     int exitCode = 0;
     if (_restart)
     {
         exitCode = 1;
         Console.Write("\n\n...RESTART!\n\n");
     }
     else
     {
         Console.Write("\n\n...QUIT!\n\n");
     }
     //
     Environment.Exit(exitCode);
 }
Пример #9
0
        protected override void OnStart(string[] args)
        {
            base.OnStart(args);
            //
            hg = new HomeGenie.Service.HomeGenieService();
            hg.LogEventAction += new Action <HomeGenie.Data.LogEntry>(hg_LogEventAction);
            hg.Start();

            if (hgmanagerservice != null)
            {
                hgmanagerservice.Close();
            }
            // Create a ServiceHost for the CalculatorService type and
            // provide the base address.
            ManagerService mgs = new ManagerService();

            hgmanagerservice = new ServiceHost(mgs);

            // Open the ServiceHostBase to create listeners and start
            // listening for messages.
            hgmanagerservice.Open();
            //
            mgs.SetHomeGenieHost(hg);
        }
Пример #10
0
 internal void SetHomeGenieHost(HomeGenie.Service.HomeGenieService hg)
 {
     homegenie = hg;
 }
Пример #11
0
 public BackupManager(HomeGenieService hg)
 {
     homegenie = hg;
 }
Пример #12
0
 public void SetHost(HomeGenieService hg)
 {
     (this as IProgramEngine).Unload();
     homegenie = hg;
     (this as IProgramEngine).Load();
 }
Пример #13
0
        //private HomeGenieService homegenie = null;

        public CSharpAppFactory(HomeGenieService hg)
        {
            //homegenie = hg;
        }
Пример #14
0
 // TODO: add automatic interval check and "UpdateAvailable", "UpdateChecking" events
 public UpdateChecker(HomeGenieService hg)
 {
     homegenie = hg;
     //
     checkInterval = new Timer(1000 * 60 * 60 * 24); // 24 hours interval between update checks
     checkInterval.AutoReset = true;
     checkInterval.Elapsed += checkInterval_Elapsed;
     //
     remoteUpdates = new List<ReleaseInfo>();
 }
Пример #15
0
 public void SetHost(HomeGenieService hg)
 {
     homegenie = hg;
     // force ScriptingHost assignment
     this.Type = codeType;
 }
Пример #16
0
 public NetHelper(HomeGenieService hg)
 {
     ServicePointManager.ServerCertificateValidationCallback = Validator;
     homegenie = hg;
 }
Пример #17
0
 public WizardEngine(HomeGenieService homegenie)
 {
     this.homegenie = homegenie;
 }
Пример #18
0
 public Automation(HomeGenieService hg)
 {
     homegenie = hg;
 }
Пример #19
0
 public ModulesManager(HomeGenieService hg)
 {
     homegenie = hg;
 }
Пример #20
0
 public void SetHost(HomeGenieService hg, SchedulerItem item)
 {
     homegenie = hg;
     schedulerItem = item;
     Reset();
     netHelper = new NetHelper(homegenie);
     serialPortHelper = new SerialPortHelper();
     tcpClientHelper = new TcpClientHelper();
     udpClientHelper = new UdpClientHelper();
     mqttClientHelper = new MqttClientHelper();
     knxClientHelper = new KnxClientHelper();
     schedulerHelper = new SchedulerHelper(homegenie);
     programHelper = new ProgramHelperBase(homegenie);
 }
Пример #21
0
 public PackageManager(HomeGenieService hg)
 {
     homegenie = hg;
     widgetBasePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "html", "pages", "control", "widgets");
 }
Пример #22
0
 public ModuleHelper(HomeGenieService hg, Module module)
     : base(hg)
 {
     this.module = module;
 }
Пример #23
0
 public VirtualMeter(HomeGenieService hg)
 {
     homegenie = hg;
     Start();
 }
Пример #24
0
 public EventsHelper(HomeGenieService hg, int programId)
 {
     homegenie = hg;
     myProgramId = programId;
 }
Пример #25
0
 public SettingsHelper(HomeGenieService hg)
 {
     homegenie = hg;
 }
Пример #26
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper;

            Console.OutputEncoding = Encoding.UTF8;
            /* Change current culture
            CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");
            System.Threading.Thread.CurrentThread.CurrentCulture = culture;
            System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
            */
            var os = Environment.OSVersion;
            var platform = os.Platform;

            // TODO: run "uname" to determine OS type
            if (platform == PlatformID.Unix)
            {

                var libusblink = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libusb-1.0.so");

                // RaspBerry Pi armel dependency check and needed symlink
                // TODO: check for armhf version
                if (File.Exists("/lib/arm-linux-gnueabi/libusb-1.0.so.0.1.0") && !File.Exists(libusblink))
                {
                    ShellCommand("ln", " -s \"/lib/arm-linux-gnueabi/libusb-1.0.so.0.1.0\" \"" + libusblink + "\"");
                }

                // Debian/Ubuntu 64bit dependency and needed symlink check
                if (File.Exists("/lib/x86_64-linux-gnu/libusb-1.0.so.0") && !File.Exists(libusblink))
                {
                    ShellCommand("ln", " -s \"/lib/x86_64-linux-gnu/libusb-1.0.so.0\" \"" + libusblink + "\"");
                }

                // lirc
                var liblirclink = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "liblirc_client.so");
                if (File.Exists("/usr/lib/liblirc_client.so") && !File.Exists(liblirclink))
                {
                    ShellCommand("ln", " -s \"/usr/lib/liblirc_client.so\" \"" + liblirclink + "\"");
                }
                else if (File.Exists("/usr/lib/liblirc_client.so.0") && !File.Exists(liblirclink))
                {
                    ShellCommand("ln", " -s \"/usr/lib/liblirc_client.so.0\" \"" + liblirclink + "\"");
                }

                // video 4 linux interop
                if (Raspberry.Board.Current.IsRaspberryPi)
                {
                    ShellCommand("cp", " -f \"" + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "v4l/raspbian_libCameraCaptureV4L.so") + "\" \"" + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libCameraCaptureV4L.so") + "\"");
                    //
                    //if (File.Exists("/usr/lib/libgdiplus.so") && !File.Exists("/usr/local/lib/libgdiplus.so"))
                    //{
                    //    ShellCommand("ln", " -s \"/usr/lib/libgdiplus.so\" \"/usr/local/lib/libgdiplus.so\"");
                    //}
                }
                else // fallback (ubuntu and other 64bit debians)
                {
                    string v4lfile = "v4l/debian64_libCameraCaptureV4L.so.gd3";
                    if (!File.Exists("/usr/lib/x86_64-linux-gnu/libgd.so.3"))
                    {
                        v4lfile = "v4l/debian64_libCameraCaptureV4L.so";
                    }
                    ShellCommand(
                        "cp",
                        " -f \"" + Path.Combine(
                            AppDomain.CurrentDomain.BaseDirectory,
                            v4lfile
                        ) + "\" \"" + Path.Combine(
                            AppDomain.CurrentDomain.BaseDirectory,
                            "libCameraCaptureV4L.so"
                        ) + "\""
                    );
                }
                //
                var lircrcFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), ".lircrc");
                if (!File.Exists(lircrcFile))
                {
                    var lircrc = "begin\n" +
                        "        prog = homegenie\n" +
                        "        button = KEY_1\n" +
                        "        repeat = 3\n" +
                        "        config = KEY_1\n" +
                        "end\n";
                    try
                    {
                        File.WriteAllText(lircrcFile, lircrc);
                    }
                    catch { }
                }
            }
            //
            Console.CancelKeyPress += new ConsoleCancelEventHandler(Console_CancelKeyPress);
            //
            AppDomain.CurrentDomain.SetupInformation.ShadowCopyFiles = "true";
            //
            _homegenie = new HomeGenieService();
            //
            do { System.Threading.Thread.Sleep(2000); } while (_isrunning);
        }
Пример #27
0
 public SchedulerHelper(HomeGenieService hg)
 {
     homegenie = hg;
 }
Пример #28
0
 internal void SetHomeGenieHost(HomeGenie.Service.HomeGenieService hghost)
 {
     _hghost = hghost;
 }