示例#1
0
        public static VirtNodeConfig GetLocalConfig()
        {
            //create default conf
            VirtNodeConfig cfg = new VirtNodeConfig();

            cfg.FrontendServer  = "http://localhost:3334";
            cfg.ApiServer       = "localhost";
            cfg.YpchannelPort   = Yodiwo.API.Plegma.Constants.YPChannelPort;
            cfg.YpchannelSecure = false;
            return(cfg);
        }
示例#2
0
        public static VirtNodeConfig GetCyanConfig()
        {
            //create default conf
            VirtNodeConfig cfg = new VirtNodeConfig();

            cfg.FrontendServer  = "https://cyan.yodiwo.com";
            cfg.ApiServer       = "cyan.yodiwo.com";
            cfg.YpchannelPort   = Yodiwo.API.Plegma.Constants.YPChannelPort;
            cfg.YpchannelSecure = true;
            return(cfg);
        }
示例#3
0
        public MainPage()
        {
            this.InitializeComponent();

            //load configs
            ActiveCfg = VirtNodeConfig.GetDefaultConfig();

            //load keys (untile a full configuration ui is implemented, just load these 2 for now)
            ActiveCfg.NodeKey    = _storageService.LoadSettingString("NodeKey");
            ActiveCfg.NodeSecret = _storageService.LoadSettingString("SecretKey");

            //add me as entry assembly
            TypeCache.AddEntryAssembly(typeof(Program));

            //init nodelibrary confs
            NodeConfig conf = new NodeConfig()
            {
                uuid                           = "UniversalSampleNode2", //ActiveCfg.Uuid,
                Name                           = "Universal Sample Node",
                YpServer                       = ActiveCfg.ApiServer,
                YpchannelPort                  = ActiveCfg.YpchannelPort,
                SecureYpc                      = ActiveCfg.YpchannelSecure,
                CertificationServerName        = ActiveCfg.CertificationServerName,
                FrontendServer                 = ActiveCfg.FrontendServer,
                CanSolveGraphs                 = ActiveCfg.CanSolveGraphs,
                Pairing_CompletionInstructions = "Close the browser tab and switch back to the App",
                Pairing_NoUUIDAuthentication   = true, //same machine authentication, no uuid authentiation required

                EnableNodeDiscovery = false,
#if false
                NodeDiscovery_YPCPort_Start = 5000,
                NodeDiscovery_YPCPort_End   = 65000,
#else
                NodeDiscovery_YPCPort_Start = 0,
                NodeDiscovery_YPCPort_End   = 0,
#endif
            };

            //prepare pairing module
            pairmodule = new Yodiwo.Node.Pairing.CommonDevicePairingPolling();

            //create node
            node = new Yodiwo.NodeLibrary.Node(conf,
                                               Helper.GatherThings(),
                                               pairmodule,
                                               NodeDataLoad, NodeDataSave
                                               );

            //register node  cbs
            //node.OnChangedState += ChangedState;
            node.OnTransportConnected    += OnConnected;
            node.OnTransportDisconnected += OnDisconnected;
            node.OnTransportError        += OnTransportError;
            node.OnNodePaired            += OnPaired;
            node.OnUnexpectedMessage      = HandleUnknownMessage;
            node.OnThingActivated        += Node_OnThingActivated;
            node.OnThingDeactivated      += Node_OnThingDeactivated;

            //register port events
            RegisterThings();
        }