Ejemplo n.º 1
0
        //------------------------------------------------------------------------------------------------------------------------
        public static YConfig <ZwavePluginConfig> Init(string plugindir)
        {
            var cfgFile = Path.Combine(plugindir, "conf_file.json");
            var yconfig = new YConfig <ZwavePluginConfig>(cfgFile);

            try
            {
                if (yconfig.Retrieve(PreProccessContent: cnt => cnt.Replace("$Role$", "Local")))
                {
                    DebugEx.TraceLog("Config file found: " + cfgFile);
                    return(yconfig);
                }
                DebugEx.TraceLog("Config retrieval failed; falling back to defaults");
            }
            catch (Exception ex) { DebugEx.TraceLog("Loading default configuration: " + ex.Message); }

            //create default conf
            ZwavePluginConfig cfg = new ZwavePluginConfig();

            cfg.SerialPort         = "/dev/ttyAMA0";
            cfg.OpenZWaveDirectory = "/home/pi/open-zwave1/";
            //add new active conf and save to disk
            yconfig.AddActiveConf("Default", cfg);
            yconfig.Save();

            return(yconfig);
        }
Ejemplo n.º 2
0
        public static YConfig <FlicPluginConfig> Init(string plugindir)
        {
            var cfgFile = Path.Combine(plugindir, "conf_file.json");
            var yconfig = new YConfig <FlicPluginConfig>(cfgFile);

            try
            {
                if (yconfig.Retrieve(PreProccessContent: cnt => cnt.Replace("$Role$", "Local")))
                {
                    DebugEx.TraceLog("Config file found: " + cfgFile);
                    return(yconfig);
                }
                DebugEx.TraceLog("Config retrieval failed; falling back to defaults");
            }
            catch (Exception ex) { DebugEx.TraceLog("Loading default configuration: " + ex.Message); }


            //create default conf
            FlicPluginConfig cfg = new FlicPluginConfig();

            cfg.PythonServer        = "http://localhost:8080/";
            cfg.restrouteremoveflic = "removeflic";
            //add new active conf and save to disk
            yconfig.AddActiveConf("Default", cfg);
            yconfig.Save();

            return(yconfig);
        }
Ejemplo n.º 3
0
        void OnPairedCb(NodeKey nodekey, string secret)
        {
            ActiveCfg.NodeKey    = nodekey;
            ActiveCfg.NodeSecret = secret;
            YConfig.Save();

            //connect
            Node.Connect();
        }
Ejemplo n.º 4
0
        private ApiMsg HandleVideoServerDisconnectRequest(object Message)
        {
            var          msg = Message as Yodiwo.API.MediaStreaming.VideoServerDisconnectRequest;
            YVideoClient yclient;
            StatusCode   status = StatusCode.None;
            VideoServerDisconnectResponse rsp = null;

            if (msg != null)
            {
                lock (videosources)
                {
                    if (videosources.TryGetValue(msg.videotoken, out yclient))
                    {
                        status = yclient.TearDown();
                    }
                    else
                    {
                        DebugEx.Assert("No such videotoken connected with a micclient");
                    }
                }
                rsp = new VideoServerDisconnectResponse()
                {
                    status = status,
                };
            }
            else
            {
                rsp = new VideoServerDisconnectResponse()
                {
                    status = StatusCode.Error
                }
            };

            return(rsp);
        }

        //cb when node is paired
        void OnPaired(NodeKey nodekey, string secret)
        {
            ActiveCfg.NodeKey    = nodekey;
            ActiveCfg.NodeSecret = secret;
            YConfig.Save();
        }
Ejemplo n.º 5
0
        public static YConfig <GrovePiNodeConfig> Init()
        {
            var cfgFile = "conf_file.json";

            var yconfig = new YConfig <GrovePiNodeConfig>(cfgFile);

            try
            {
                if (yconfig.Retrieve())
                {
                    Console.WriteLine("Config file found: " + cfgFile);
                    return(yconfig);
                }
                Console.WriteLine("Config retrieval failed; falling back to defaults");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Loading default configuration");
            }

            //create default conf
            GrovePiNodeConfig cfg = new GrovePiNodeConfig();

            cfg.FrontendServer     = "https://localhost:3334";
            cfg.ApiServer          = "localhost";
            cfg.LocalWebServer     = "http://localhost:4040";
            cfg.Uuid               = "1337GrovePi";
            cfg.MqttBrokerHostname = "localhost";
            cfg.YpchannelPort      = Yodiwo.API.Plegma.Constants.YPChannelPort;
            cfg.MqttUseSsl         = false;
            cfg.YpchannelSecure    = false;

            //add new active conf and save to disk
            yconfig.AddActiveConf("LocalGrovePi", cfg);
            yconfig.Save();

            return(yconfig);
        }
Ejemplo n.º 6
0
        public YConfig <RaspNodeConfig> InitConfig()
        {
            var absoluteCfgFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/" + this.cfgFile;

            var yconfig = new YConfig <RaspNodeConfig>(absoluteCfgFile);

            try
            {
                if (yconfig.Retrieve())
                {
                    Console.WriteLine("Config file found: {0}", absoluteCfgFile);
                    return(yconfig);
                }
                Console.WriteLine("Config retrieval failed; falling back to defaults");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Loading default configuration");
            }

            //create default conf
            RaspNodeConfig cfg = new RaspNodeConfig();

            cfg.FrontendServer     = "https://cyan.yodiwo.com";
            cfg.ApiServer          = "api.yodiwo.com";
            cfg.LocalWebServer     = "http://localhost:3339";
            cfg.Uuid               = "1337Raspberry";
            cfg.MqttBrokerHostname = "api.yodiwo.com";
            cfg.YpchannelPort      = Yodiwo.API.Plegma.Constants.YPChannelPort;
            cfg.MqttUseSsl         = false;
            cfg.YpchannelSecure    = false;

            //add new active conf and save to disk
            yconfig.AddActiveConf("default", cfg);
            yconfig.Save();

            return(yconfig);
        }
Ejemplo n.º 7
0
        public static YConfig<SkyWriterNodeConfig> Init()
        {
            var cfgFile = "conf_file.json";

            var yconfig = new YConfig<SkyWriterNodeConfig>(cfgFile);

            try
            {
                if (yconfig.Retrieve())
                {
                    Console.WriteLine("Config file found: " + cfgFile);
                    return yconfig;
                }
                Console.WriteLine("Config retrieval failed; falling back to defaults");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Loading default configuration");
            }

            //create default conf
            SkyWriterNodeConfig cfg = new SkyWriterNodeConfig();
            cfg.FrontendServer = "https://localhost:3334";
            cfg.ApiServer = "localhost";
            cfg.LocalWebServer = "http://localhost:4050";
            cfg.Uuid = "1337SkyWriter";
            cfg.MqttBrokerHostname = "localhost";
            cfg.YpchannelPort = Yodiwo.API.Plegma.Constants.YPChannelPort;
            cfg.MqttUseSsl = false;
            cfg.YpchannelSecure = false;

            //add new active conf and save to disk
            yconfig.AddActiveConf("LocalSkyWriter", cfg);
            yconfig.Save();

            return yconfig;
        }
Ejemplo n.º 8
0
        public YConfig <RaspPiGpioNodeConfig> InitConfig()
        {
            var absoluteCfgFile = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/" + this.cfgFile;

            var yconfig = new YConfig <RaspPiGpioNodeConfig>(absoluteCfgFile);

            try
            {
                if (yconfig.Retrieve())
                {
                    Console.WriteLine("Config file found: {0}", absoluteCfgFile);
                    return(yconfig);
                }
                Console.WriteLine("Config retrieval failed; falling back to defaults");
            }
            catch
            {
                Console.WriteLine("Loading default configuration");
            }

            //create default conf
            RaspPiGpioNodeConfig cfg = new RaspPiGpioNodeConfig();

            cfg.FrontendServer  = "https://tcyan.yodiwo.com";
            cfg.ApiServer       = "api.yodiwo.com";
            cfg.LocalWebServer  = "http://localhost:3339";
            cfg.Uuid            = "RaspPiGpioNode";
            cfg.YpchannelPort   = Constants.YPChannelPort;
            cfg.YpchannelSecure = true;

            //add new active conf and save to disk
            yconfig.AddActiveConf("default", cfg);
            yconfig.Save();

            return(yconfig);
        }
Ejemplo n.º 9
0
 //cb when node is paired
 void OnPaired(NodeKey nodekey, SecureString secret)
 {
     ActiveCfg.NodeKey    = nodekey;
     ActiveCfg.NodeSecret = secret.SecureStringToString();
     YConfig.Save();
 }
Ejemplo n.º 10
0
        public YConfig<RaspNodeConfig> InitConfig()
        {
            var absoluteCfgFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/" + this.cfgFile;

            var yconfig = new YConfig<RaspNodeConfig>(absoluteCfgFile);

            try
            {
                if (yconfig.Retrieve())
                {
                    Console.WriteLine("Config file found: {0}", absoluteCfgFile);
                    return yconfig;
                }
                Console.WriteLine("Config retrieval failed; falling back to defaults");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Loading default configuration");
            }

            //create default conf
            RaspNodeConfig cfg = new RaspNodeConfig();
            cfg.FrontendServer = "https://cyan.yodiwo.com";
            cfg.ApiServer = "api.yodiwo.com";
            cfg.LocalWebServer = "http://localhost:3339";
            cfg.Uuid = "1337Raspberry";
            cfg.MqttBrokerHostname = "api.yodiwo.com";
            cfg.YpchannelPort = Yodiwo.API.Plegma.Constants.YPChannelPort;
            cfg.MqttUseSsl = false;
            cfg.YpchannelSecure = false;

            //add new active conf and save to disk
            yconfig.AddActiveConf("default", cfg);
            yconfig.Save();

            return yconfig;
        }
Ejemplo n.º 11
0
        public YConfig<RaspPiGpioNodeConfig> InitConfig()
        {
            var absoluteCfgFile = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/" + this.cfgFile;

            var yconfig = new YConfig<RaspPiGpioNodeConfig>(absoluteCfgFile);

            try
            {
                if (yconfig.Retrieve())
                {
                    Console.WriteLine("Config file found: {0}", absoluteCfgFile);
                    return yconfig;
                }
                Console.WriteLine("Config retrieval failed; falling back to defaults");
            }
            catch
            {
                Console.WriteLine("Loading default configuration");
            }

            //create default conf
            RaspPiGpioNodeConfig cfg = new RaspPiGpioNodeConfig();
            cfg.FrontendServer = "https://tcyan.yodiwo.com";
            cfg.ApiServer = "api.yodiwo.com";
            cfg.LocalWebServer = "http://localhost:3339";
            cfg.Uuid = "RaspPiGpioNode";
            cfg.YpchannelPort = Constants.YPChannelPort;
            cfg.YpchannelSecure = true;

            //add new active conf and save to disk
            yconfig.AddActiveConf("default", cfg);
            yconfig.Save();

            return yconfig;
        }
Ejemplo n.º 12
0
 //cb when node is paired
 void OnPaired(NodeKey nodekey, string secret)
 {
     ActiveCfg.NodeKey    = nodekey;
     ActiveCfg.NodeSecret = secret;
     YConfig.Save();
 }