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; } }
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; } }
private async void start_Click(object sender, RoutedEventArgs e) { //string DCGW_URL = DCGWURL.Text; //string user = userName.Text; //string password = userPassword.Text; //This code is placed here becuase we need to start Bridge after IP of EnOcean Gateway is available await ThreadPool.RunAsync(new WorkItemHandler((IAsyncAction action) => { try { //adapter = new AdapterLib.Adapter(DCGW_URL, user, pas); 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) { throw ex; } })); //start.Visibility = Visibility.Collapsed; //stop.Visibility = Visibility.Visible; }
public MainPageViewModel() { Bulbs = new ObservableCollection <Bulb>(); if (IsDesign) { Bulbs.Add(CreateBulb()); Bulbs.Add(CreateBulb()); } else { #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed ThreadPool.RunAsync(new WorkItemHandler((IAsyncAction action) => { try { adapter = new Adapter(); dsbBridge = new DsbBridge(adapter); var initResult = this.dsbBridge.Initialize(); if (initResult != 0) { throw new Exception("DSB Bridge initialization failed!"); } } catch (Exception) { throw; } })); } }
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; } }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = true; } #endif Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed startupTask = ThreadPool.RunAsync(new WorkItemHandler((IAsyncAction action) => { try { var adapter = new Adapter(); dsbBridge = new DsbBridge(adapter); var initResult = dsbBridge.Initialize(); if (initResult != 0) { throw new Exception("DSB Bridge initialization failed!"); } } catch (Exception) { throw; } })).AsTask(); } if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); }
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; } }
private AllJoynDeviceManager() { #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed StartupTask = ThreadPool.RunAsync(new WorkItemHandler((IAsyncAction action) => { try { adapter = new Adapter(); dsbBridge = new DsbBridge(adapter); var initResult = dsbBridge.Initialize(); if (initResult != 0) { throw new Exception("DSB Bridge initialization failed!"); } } catch (Exception) { throw; } })).AsTask(); InitializeNotification(); }
//Setting DsBBridge for the purpose of adding and removing AllJoyn devices when bridge is running public void setDsbBridge(DsbBridge dsbBridge) { this.dsbBridge = dsbBridge; }