public void Run(IBackgroundTaskInstance taskInstance)
        {
            Adapter adapter = null;
            deferral = taskInstance.GetDeferral();

            try
            {
                adapter = new Adapter();
                dsbBridge = new DsbBridge(adapter);

                var initResult = dsbBridge.Initialize();
                if (initResult != 0)
                {
                    throw new Exception("DSB Bridge initialization failed!");
                }
            }
            catch (Exception ex)
            {
                if (dsbBridge != null)
                {
                    dsbBridge.Shutdown();
                }

                if (adapter != null)
                {
                    adapter.Shutdown();
                }

                throw;
            }
        }
        protected void InitAllJoyn()
        {
            try
            {
                adapter   = new Adapter();
                dsbBridge = new DsbBridge(adapter);

                var initResult = dsbBridge.Initialize();
                if (initResult != 0)
                {
                    throw new Exception("DSB Bridge initialization failed!");
                }
            }
            catch (Exception ex)
            {
                if (dsbBridge != null)
                {
                    dsbBridge.Shutdown();
                }

                if (adapter != null)
                {
                    adapter.Shutdown();
                }

                throw;
            }
        }
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            Adapter adapter = null;

            deferral = taskInstance.GetDeferral();

            try
            {
                adapter   = new Adapter();
                dsbBridge = new DsbBridge(adapter);

                var initResult = dsbBridge.Initialize();
                if (initResult != 0)
                {
                    throw new Exception("DSB Bridge initialization failed!");
                }
            }
            catch (Exception)
            {
                if (dsbBridge != null)
                {
                    dsbBridge.Shutdown();
                }

                if (adapter != null)
                {
                    adapter.Shutdown();
                }

                throw;
            }
        }
示例#4
0
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            IAdapter adapter = null;

            deferral = taskInstance.GetDeferral();

            try
            {
                adapter   = new DlmsAdapter.WrappedAdapter();
                dsbBridge = new DsbBridge(adapter);

                var initResult = dsbBridge.Initialize();
                if (initResult != 0)
                {
                    throw new Exception("DSB Bridge initialization failed!");
                }
            }
            catch (Exception ex)
            {
                dsbBridge?.Shutdown();
                adapter?.Shutdown();

                throw;
            }
        }
示例#5
0
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            Adapter adapter = null;

            deferral = taskInstance.GetDeferral();

            try
            {
                adapter            = new Adapter();
                deviceSystemBridge = new DsbBridge(adapter);

                var initResult = deviceSystemBridge.Initialize();
                if (initResult != 0)
                {
                    throw new Exception(EXCEPTION_INIT_FAILED);
                }
            }
            catch (Exception)
            {
                if (deviceSystemBridge != null)
                {
                    deviceSystemBridge.Shutdown();
                }

                if (adapter != null)
                {
                    adapter.Shutdown();
                }

                throw;
            }
        }
        protected void InitAllJoyn()
        {
            try
            {
                adapter = new Adapter();
                dsbBridge = new DsbBridge(adapter);

                var initResult = dsbBridge.Initialize();
                if (initResult != 0)
                {
                    throw new Exception("DSB Bridge initialization failed!");
                }
            }
            catch (Exception ex)
            {
                if (dsbBridge != null)
                {
                    dsbBridge.Shutdown();
                }

                if (adapter != null)
                {
                    adapter.Shutdown();
                }

                throw;
            }
        }
        private void stop_Click(object sender, RoutedEventArgs e)
        {
            if (dsbBridge != null)
            {
                //dsbBridge?.Shutdown();
                dsbBridge.Shutdown();
            }

            if (adapter != null)
            {
                adapter.Shutdown();
            }

            //stop.Visibility = Visibility.Collapsed;
            //start.Visibility = Visibility.Visible;
        }
示例#8
0
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            Adapter adapter = null;

            deferral = taskInstance.GetDeferral();

            try
            {
                //dcgw.enocean-gateway.eu is IP of EnOcean gateway, it needs to be change if you are using local or different gateway
                //Using this IP of gateway, you can see changes in gateway and devices on "http://dcgw.enocean-gateway.eu:8080/devices/stream" (Streaming of gateway)
                adapter = new Adapter("", "", "");
                adapter.setDCGWAttributes();
                dsbBridge = new DsbBridge(adapter);

                //Adapter object need dsbBridge to Add new devices
                adapter.setDsbBridge(dsbBridge);

                var initResult = dsbBridge.Initialize();
                if (initResult != 0)
                {
                    throw new Exception("DSB Bridge initialization failed!");
                }
            }
            catch (Exception ex)
            {
                if (dsbBridge != null)
                {
                    dsbBridge.Shutdown();
                }

                if (adapter != null)
                {
                    adapter.Shutdown();
                }

                throw;
            }
        }
 internal void Closing()
 {
     dsbBridge?.Shutdown();
 }