private void Start()
        {
            // Prevent launching the producer 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 AllJoynCodeGenerator tool.
                m_producer = new OnboardingProducer(m_busAttachment);

                // Instantiate OnboardingService which will handle the onboarding method calls.
                m_producer.Service = new OnboardingService();
                OnboardingService.ConnectRequestRecieved += OnboardingService_ConnectRequestRecieved;

                // Start listening for consumers.
                m_producer.Start();
            }
        }
Exemple #2
0
        private void Start()
        {
            // Prevent launching the producer 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.EcdheSpeke);
                m_busAttachment.AuthenticationComplete += AlljoynBusAttachment_AuthenticationComplete;
                m_busAttachment.CredentialsRequested   += AlljoynBusAttachment_CredentialsRequested;

                // Generate the one-time 6-digit numeric pre-shared key.
                Random rnd = new Random();
                Key = rnd.Next(100000, 1000000).ToString();

                // Initialize the producer object generated by the AllJoynCodeGenerator tool.
                m_producer = new OnboardingProducer(m_busAttachment);

                // Instantiate OnboardingService which will handle the onboarding method calls.
                m_producer.Service = new OnboardingService();
                OnboardingService.ConnectRequestRecieved += OnboardingService_ConnectRequestRecieved;

                // Start listening for consumers.
                m_producer.Start();
            }
        }
        private void HandleAdapterAdded(DeviceWatcher sender, DeviceInformation information)
        {
            if (String.IsNullOrEmpty(_wlanAdapterId))
            {
                _wlanAdapterId = information.Id;

                lock (_stateLock)
                {
                    if (_state != OnboardingState.ConfiguredValidated)
                    {
                        _softAccessPoint.Start();
                    }
                }
                _onboardingProducer?.Start();
                _iconProducer?.Start();
            }
        }
        private async void HandleAdapterAdded(DeviceWatcher sender, DeviceInformation information)
        {
            if (_wlanAdapterId == null)
            {
                _wlanAdapterId = information.Id;
                _wlanAdapter   = await WiFiAdapter.FromIdAsync(_wlanAdapterId);

                lock (_stateLock)
                {
                    if (_state != OnboardingState.ConfiguredValidated)
                    {
                        _softAccessPoint.Start();
                    }
                }
                _onboardingProducer.Start();
                _iconProducer.Start();
            }
        }
Exemple #5
0
        private void Start()
        {
            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;
                Key                = CryptographicHelpers.GenerateHighEntropyKey(DesiredKeyLength);
                m_producer         = new OnboardingProducer(m_busAttachment);
                m_producer.Service = new OnboardingService();
                OnboardingService.ConnectRequestRecieved += OnboardingService_ConnectRequestRecieved;
                m_producer.Start();
            }
        }
        private void Start()
        {
            // Prevent launching the producer 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 AllJoynCodeGenerator tool.
                m_producer = new OnboardingProducer(m_busAttachment);

                // Instantiate OnboardingService which will handle the onboarding method calls.
                m_producer.Service = new OnboardingService();
                OnboardingService.ConnectRequestRecieved += OnboardingService_ConnectRequestRecieved;

                // Start listening for consumers.
                m_producer.Start();
            }
        }
        private void Start()
        {
            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;
                Key = CryptographicHelpers.GenerateHighEntropyKey(DesiredKeyLength);
                m_producer = new OnboardingProducer(m_busAttachment);
                m_producer.Service = new OnboardingService();
                OnboardingService.ConnectRequestRecieved += OnboardingService_ConnectRequestRecieved;
                m_producer.Start();
            }
        }