Example #1
0
        private async Task LoadParameterDescriptions(IHomeMaticXmlRpcApi homeMaticXmlRpcApi)
        {
            Console.WriteLine("Press key to continue...");
            Console.ReadKey();
            Console.WriteLine("Starting xml rpc server...");

            var httpServer = new AspNetCoreHttpServer
            {
                DisableLogging     = false,
                AllowSynchronousIO = true
            };

            var xmlRpcServer = new XmlRpcServer(httpServer)
            {
                Encoding = Encoding.GetEncoding("iso-8859-1")
            };

            xmlRpcServer.Urls.Add(XmlRpcUrl);

            var ccuXmlRpcServer =
                new CcuXmlRpcEventServer(xmlRpcServer);

            //var eventReceiver = new CcuEventReceiver();
            //eventReceiver.EventMessageTopic
            //    .Register<HomeMaticEventMessage>()
            //    .SubscribeOn(new TaskPoolScheduler(new TaskFactory()))
            //    .Subscribe(msg => Console.WriteLine($"{msg.Address}.{msg.ValueKey} = {msg.Value}"));

            StartServer(ccuXmlRpcServer, homeMaticXmlRpcApi);

            Console.ReadKey();

            await homeMaticXmlRpcApi.InitAsync("", "TestIntf");

            await ccuXmlRpcServer.StopAsync();
        }
Example #2
0
        protected override async ValueTask OnDisposeAsync()
        {
            await _xmlRpcApi.InitAsync("", $"GW_{_gatewaySetupInfo.Id.Gateway}");

            await _eventServer.StopAsync();
        }