public async Task Initialize(ICamera camera, IStorage storage) { this.camera = camera; this.storage = storage; var cacheFolder = KnownFolders.PicturesLibrary; this.dropFolder = await cacheFolder.GetFolderAsync("securitysystem-cameradrop"); this.dropFolderWatcher = dropFolder.CreateFileQuery(); var images = await this.dropFolderWatcher.GetFilesAsync(); var orderedImages = images.OrderByDescending(x => x.DateCreated); this.newestImage = orderedImages.FirstOrDefault(); this.dropFolderWatcher.ContentsChanged += DropFolderWatcher_ContentsChanged; this.allJoynBusAttachment = new AllJoynBusAttachment(); this.producer = new SecuritySystemProducer(this.allJoynBusAttachment); this.allJoynBusAttachment.AboutData.DefaultAppName = Package.Current.DisplayName; this.allJoynBusAttachment.AboutData.DefaultDescription = Package.Current.Description; this.allJoynBusAttachment.AboutData.DefaultManufacturer = Package.Current.Id.Publisher; this.allJoynBusAttachment.AboutData.SoftwareVersion = Package.Current.Id.Version.ToString(); this.allJoynBusAttachment.AboutData.IsEnabled = true; this.producer.Service = this; this.producer.Start(); }
public RelayServer(HardwareManager hm) { _hm = hm; _relayNodeProducer = null; _bus = new AllJoynBusAttachment(); StartService(); }
private void StartWatcher() { AllJoynBusAttachment toasterBusAttachment = new AllJoynBusAttachment(); ToasterWatcher toasterWatcher = new ToasterWatcher(toasterBusAttachment); toasterWatcher.Added += ToasterWatcher_Added; toasterWatcher.Start(); }
public void FindLamp() { Debug.WriteLine("Starting consumer ..."); AllJoynBusAttachment busAttachment = new AllJoynBusAttachment(); LampStateWatcher watcher = new LampStateWatcher(busAttachment); watcher.Added += LampFound; watcher.Start(); }
public async void Start() { try { _iconFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///IoTOnboardingService/icon72x72.png")); await _config.InitAsync(); var connectionProfiles = NetworkInformation.GetConnectionProfiles(); foreach (var profile in connectionProfiles) { if (profile.IsWlanConnectionProfile) { lock (_stateLock) { _state = OnboardingState.ConfiguredValidated; } break; } } if (_softAccessPoint == null) { _softAccessPoint = new OnboardingAccessPoint(_config.Ssid, _config.Password); } if (_busAttachment == null) { _busAttachment = new AllJoynBusAttachment(); _busAttachment.AboutData.DefaultDescription = _config.DefaultDescription; _busAttachment.AboutData.DefaultManufacturer = _config.DefaultManufacturer; _onboardingProducer = new OnboardingProducer(_busAttachment); _onboardingProducer.Service = this; _iconProducer = new IconProducer(_busAttachment); _iconProducer.Service = this; } if (_deviceWatcher == null) { var accessStatus = await WiFiAdapter.RequestAccessAsync(); if (accessStatus == WiFiAccessStatus.Allowed) { _deviceWatcher = DeviceInformation.CreateWatcher(WiFiAdapter.GetDeviceSelector()); _deviceWatcher.Added += this.HandleAdapterAdded; _deviceWatcher.Removed += this.HandleAdapterRemoved; _deviceWatcher.Start(); } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } }
public void FindPhone() { Debug.WriteLine("Starting Phone Consumer ..."); AllJoynBusAttachment busAttachment2 = new AllJoynBusAttachment(); ProducerWatcher phoneProducer = new ProducerWatcher(busAttachment2); phoneProducer.Added += PhoneProducer_Added; // phoneProducer_Added(); }
void StartDiscoveringFezHats() { _busAttachment = new AllJoynBusAttachment(); _busAttachment.AuthenticationMechanisms.Add(AllJoynAuthenticationMechanism.SrpAnonymous); _fezHatWatcher = new FezHatWatcher(_busAttachment); _fezHatWatcher.Added += OnAdded; _fezHatWatcher.Start(); }
public ToasterServer() { AllJoynBusAttachment toasterBusAttachment = new AllJoynBusAttachment(); toasterProducer = new ToasterProducer(toasterBusAttachment); toasterService = new ToasterService(); toasterService.ToastBurnt += ToasterService_ToastBurnt; toasterProducer.Service = toasterService; toasterProducer.Start(); }
private void InitializeNotification() { AllJoynBusAttachment bus = new AllJoynBusAttachment(); bus.AboutData.DefaultDescription = "AllJoyn Device Simulator"; bus.AboutData.ModelNumber = "Notification Consumer"; org.alljoyn.Notification.NotificationWatcher watcher = new org.alljoyn.Notification.NotificationWatcher(bus); watcher.Start(); watcher.Added += Watcher_Added; }
public void Start() { AllJoynBusAttachment bus = new AllJoynBusAttachment(); bus.AuthenticationMechanisms.Add(AllJoynAuthenticationMechanism.SrpAnonymous); _consumer = new CurrentTemperatureConsumer(bus); _watcher = new CurrentTemperatureWatcher(bus); _watcher.Added += _watcher_Added; _watcher.Start(); }
internal void Initialize() { this.allJoynBusAttachment = new AllJoynBusAttachment(); this.producer = new InternetRadioProducer(this.allJoynBusAttachment); this.allJoynBusAttachment.AboutData.DefaultAppName = Package.Current.DisplayName; this.allJoynBusAttachment.AboutData.DefaultDescription = Package.Current.Description; this.allJoynBusAttachment.AboutData.DefaultManufacturer = Package.Current.Id.Publisher; this.allJoynBusAttachment.AboutData.SoftwareVersion = Package.Current.Id.Version.ToString(); this.allJoynBusAttachment.AboutData.IsEnabled = true; this.producer.Service = this; this.producer.Start(); }
private void MainPage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { launcher = Task.Run(Launcher.CreateAsync).Result; Task.Run(() => launcher.SetLightAsync(true)); var busAttachment = new AllJoynBusAttachment(); busAttachment.AuthenticationMechanisms.Add(AllJoynAuthenticationMechanism.SrpAnonymous); var producer = new missileProducer(busAttachment); producer.Service = new MissileService(launcher); producer.Start(); }
public LampHandler() { Consumers = new Dictionary<string, LampStateConsumer>(); _busAttachment = new AllJoynBusAttachment(); _watcher = new LampStateWatcher(_busAttachment); _watcher.Added += OnWatcherAdded; _watcher.Start(); _defaulsWhenOff = new LampValue() { On = false, Brightness = 100, ColorTemp = 9000, Hue = 260, Saturation = 100 }; _defaulsWhenOn = new LampValue() { On = true, Brightness = 100, ColorTemp = 9000, Hue = 260, Saturation = 100 }; _defaulsBeforeBlink = new LampValue() { On = true, Brightness = 100, ColorTemp = 9000, Hue = 260, Saturation = 100 }; _lastValues = null; }
public ControllerService(AllJoynBusAttachment bus) { this.bus = bus; ControllerServiceProducer = new org.allseen.LSF.ControllerService.ControllerServiceProducer(bus) { Service = this }; LampProducer = new org.allseen.LSF.ControllerService.Lamp.LampProducer(bus) { Service = this }; LoadLampGroups(); LampGroupProducer = new org.allseen.LSF.ControllerService.LampGroup.LampGroupProducer(bus) { Service = this }; LoadMasterScenes(); MasterSceneProducer = new org.allseen.LSF.ControllerService.MasterScene.MasterSceneProducer(bus) { Service = this }; LoadPresets(); LoadDefaultLampState(); PresetProducer = new org.allseen.LSF.ControllerService.Preset.PresetProducer(bus) { Service = this }; SceneProducer = new org.allseen.LSF.ControllerService.Scene.SceneProducer(bus) { Service = this }; }
public MainPage() { this.InitializeComponent(); devices = new ObservableCollection<InternetRadioDeviceRegistrationInfo>(); this.AvailableRadios.ItemsSource = devices; alljoynBusAttachment = new AllJoynBusAttachment(); radioWatcher = new InternetRadioWatcher(alljoynBusAttachment); radioWatcher.Added += RadioWatcher_Added; radioWatcher.Start(); }
private void MainPage_Loaded(object sender, RoutedEventArgs e) { AllJoynBusAttachment bus = new AllJoynBusAttachment(); bus.AuthenticationMechanisms.Add(AllJoynAuthenticationMechanism.SrpAnonymous); _producer = new GarageDoorProducer(bus); _producer.Service = new GarageDoorService(); _producer.Start(); _timer = new Timer(TimerCallBack, null, 10000, Timeout.Infinite); _watcher = new GarageDoorWatcher(bus); _watcher.Added += _watcher_Added; _watcher.Start(); }
void OnAdvertise(object sender, RoutedEventArgs args) { if (!this.advertised) { this.advertised = true; IlightbulbService service = !this.IsIoT ? (IlightbulbService)this : new GpioLightbulbService(GPIO_LED_PIN, this.txtRoom.Text); AllJoynBusAttachment busAttachment = new AllJoynBusAttachment(); lightbulbProducer producer = new lightbulbProducer(busAttachment); producer.Service = service; producer.Start(); } }
public int Start() { AllJoynBusAttachment busAttachment = new AllJoynBusAttachment(); busAttachment.AuthenticationMechanisms.Add(AllJoynAuthenticationMechanism.SrpAnonymous); var data = busAttachment.AboutData; data.DefaultManufacturer = "Protosystem"; data.DefaultAppName = "LIFX Client"; LampWatcher lampWatcher = new LampWatcher(busAttachment); lampWatcher.Added += LampWatcher_Added; lampWatcher.Start(); //var model = new LampStateViewModel(this); //model.Name = "TEst"; //Lamps.Add(model); return 0; }
private async void MainPage_Loaded(object sender, RoutedEventArgs e) { AllJoynBusAttachment bus = new AllJoynBusAttachment(); bus.AuthenticationMechanisms.Add(AllJoynAuthenticationMechanism.SrpAnonymous); _garageDoorProducer = new GarageDoorProducer(bus); _garageDoorDriver = new GarageDoorDriver(_garageDoorProducer); _garageDoorProducer.Service = new GarageDoorService(_garageDoorDriver); _garageDoorProducer.Start(); AllJoynBusAttachment bus2 = new AllJoynBusAttachment(); bus2.AuthenticationMechanisms.Add(AllJoynAuthenticationMechanism.SrpAnonymous); _adcDriver = new Mcp3008(0); await _adcDriver.Connect(); _garageTempProducer = new CurrentTemperatureProducer(bus2); _garageTempProducer.Service = new CurrentTemperatureService(new TemperatureDriver(_adcDriver, 0,_garageTempProducer)); _garageTempProducer.Start(); }
public MainPage() { BusAttachment = new AllJoynBusAttachment(); Pin5Watcher = new pin5.interface_1Watcher(BusAttachment); Pin6Watcher = new pin6.interface_1Watcher(BusAttachment); Pin12Watcher = new pin12.interface_1Watcher(BusAttachment); Pin16Watcher = new pin16.interface_1Watcher(BusAttachment); Pin5Watcher.Added += Pin5Watcher_Added; Pin5Watcher.Start(); Pin6Watcher.Added += Pin6Watcher_Added; Pin6Watcher.Start(); Pin12Watcher.Added += Pin12Watcher_Added; Pin12Watcher.Start(); Pin16Watcher.Added += Pin16Watcher_Added; Pin16Watcher.Start(); this.InitializeComponent(); }
private void AlljoynBusAttachment_CredentialsRequested(AllJoynBusAttachment sender, AllJoynCredentialsRequestedEventArgs args) { if (args.Credentials.AuthenticationMechanism == AllJoynAuthenticationMechanism.EcdhePsk) { args.Credentials.PasswordCredential.Password = m_key; } else { UpdateStatusAsync("Unexpected authentication mechanism.", NotifyType.ErrorMessage); } }
private async void BusAttachment_CredentialsRequested(AllJoynBusAttachment sender, AllJoynCredentialsRequestedEventArgs args) { Windows.Foundation.Deferral credentialsDeferral = args.GetDeferral(); m_isCredentialsRequested = true; if (args.Credentials.AuthenticationMechanism == AllJoynAuthenticationMechanism.EcdhePsk) { m_authenticateClicked = new TaskCompletionSource<bool>(); AuthenticationVisibility = Visibility.Visible; UpdateStatusAsync("Please enter the key.", NotifyType.StatusMessage); await m_authenticateClicked.Task; m_authenticateClicked = null; if (!String.IsNullOrEmpty(m_key)) { args.Credentials.PasswordCredential.Password = m_key; } else { UpdateStatusAsync("Please enter a key.", NotifyType.ErrorMessage); } } else { UpdateStatusAsync("Unexpected authentication mechanism.", NotifyType.ErrorMessage); } credentialsDeferral.Complete(); }
private void BusAttachment_AuthenticationComplete(AllJoynBusAttachment sender, AllJoynAuthenticationCompleteEventArgs args) { if (args.Succeeded) { UpdateStatusAsync("Authentication was successful.", NotifyType.StatusMessage); } else { UpdateStatusAsync("Authentication failed.", NotifyType.ErrorMessage); } m_isAuthenticated = args.Succeeded; EnteredKey = ""; AuthenticationVisibility = Visibility.Collapsed; }
private void BusAttachment_StateChanged(AllJoynBusAttachment sender, AllJoynBusAttachmentStateChangedEventArgs args) { if (args.State == AllJoynBusAttachmentState.Disconnected) { UpdateStatusAsync(string.Format("AllJoyn bus attachment has disconnected with AllJoyn error: 0x{0:X}.", args.Status), NotifyType.StatusMessage); ResetControls(); } }
private void ScanForOnboardingInterfaces() { ScenarioCleanup(); m_busAttachment = new AllJoynBusAttachment(); m_busAttachment.StateChanged += BusAttachment_StateChanged; m_busAttachment.AuthenticationMechanisms.Clear(); m_busAttachment.AuthenticationMechanisms.Add(AllJoynAuthenticationMechanism.EcdhePsk); m_busAttachment.AuthenticationComplete += BusAttachment_AuthenticationComplete; m_busAttachment.CredentialsRequested += BusAttachment_CredentialsRequested; m_watcher = new OnboardingWatcher(m_busAttachment); m_watcher.Added += Watcher_Added; UpdateStatusAsync("Searching for onboarding interface...", NotifyType.StatusMessage); m_watcher.Start(); }
public void ScenarioCleanup() { DisposeConsumer(); DisposeWatcher(); if (m_busAttachment != null) { m_busAttachment.CredentialsRequested -= BusAttachment_CredentialsRequested; m_busAttachment.AuthenticationComplete -= BusAttachment_AuthenticationComplete; m_busAttachment.StateChanged -= BusAttachment_StateChanged; m_busAttachment.Disconnect(); m_busAttachment = null; } }
private void OnLoaded(object sender, RoutedEventArgs e) { _busAttachment = new AllJoynBusAttachment(); PopulateAboutData(_busAttachment); _producer = new FezHatProducer(_busAttachment) { Service = this }; _producer.Start(); }
private void Start() { // Prevent from Launching the server again if it is already launched. if (m_isBusAttachmentConnected) { UpdateStatusAsync("Already launched.", NotifyType.StatusMessage); } else { UpdateStatusAsync("Launching...", NotifyType.StatusMessage); m_busAttachment = new AllJoynBusAttachment(); m_busAttachment.StateChanged += AlljoynBusAttachment_StateChanged; m_busAttachment.AuthenticationMechanisms.Clear(); m_busAttachment.AuthenticationMechanisms.Add(AllJoynAuthenticationMechanism.EcdhePsk); m_busAttachment.AuthenticationComplete += AlljoynBusAttachment_AuthenticationComplete; m_busAttachment.CredentialsRequested += AlljoynBusAttachment_CredentialsRequested; // Generate the one-time pre-shared key. Key = CryptographicHelpers.GenerateHighEntropyKey(DesiredKeyLength); // Initialize the producer object generated by the AllJoynCodeGen tool. m_producer = new SecureInterfaceProducer(m_busAttachment); // Instantiate SecureInterfaceService which will handle the concatenation method calls. m_producer.Service = new SecureInterfaceService(); // Start listening for consumers. m_producer.Start(); } }
private void AlljoynBusAttachment_AuthenticationComplete(AllJoynBusAttachment sender, AllJoynAuthenticationCompleteEventArgs args) { if (args.Succeeded) { UpdateStatusAsync("Authentication was successful.", NotifyType.StatusMessage); } else { UpdateStatusAsync("Authentication failed.", NotifyType.ErrorMessage); } }
private void AlljoynBusAttachment_StateChanged(AllJoynBusAttachment sender, AllJoynBusAttachmentStateChangedEventArgs args) { switch (args.State) { case AllJoynBusAttachmentState.Disconnected: UpdateStatusAsync(string.Format("Disconnected from the AllJoyn bus attachment with AllJoyn status: 0x{0:X}.", args.Status), NotifyType.StatusMessage); m_isBusAttachmentConnected = false; ServerOptionsVisibility = Visibility.Collapsed; AppData.IsUpperCaseEnabledPropertyDataChanged -= AppData_IsUpperCaseEnabledPropertyDataChanged; break; case AllJoynBusAttachmentState.Connected: UpdateStatusAsync("Launched.", NotifyType.StatusMessage); m_isBusAttachmentConnected = true; ServerOptionsVisibility = Visibility.Visible; AppData.IsUpperCaseEnabledPropertyDataChanged += AppData_IsUpperCaseEnabledPropertyDataChanged; break; default: break; } }