Пример #1
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.EcdhePsk);
                m_busAttachment.AuthenticationComplete += AlljoynBusAttachment_AuthenticationComplete;
                m_busAttachment.CredentialsRequested   += AlljoynBusAttachment_CredentialsRequested;

                // Optional - Populate About data for the producer.
                m_busAttachment.AboutData.DefaultManufacturer = "Contoso";
                m_busAttachment.AboutData.SupportUrl          = new Uri("http://www.contoso.com/support");

                // Generate the one-time pre-shared key.
                Key = CryptographicHelpers.GenerateHighEntropyKey(DesiredKeyLength);

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

                // Instantiate SecureInterfaceService which will handle the concatenation method calls.
                m_producer.Service = new SecureInterfaceService();

                // Start advertising the service.
                m_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();
            }
        }
Пример #3
0
        public void Start()
        {
            UpdateStatus("Launching...", NotifyType.StatusMessage);

            // Create a new AllJoyn bus attachment.
            AllJoynBusAttachment alljoynBusAttachment = new AllJoynBusAttachment();

            // Initialize the producer object - where SecureInterfaceProducer is the generated class using AllJoynCodeGen tool.
            SecureInterfaceProducer producer = new SecureInterfaceProducer(alljoynBusAttachment);

            // Initialize an object of SecureInterfaceService - the implementation of ISecureInterfaceService that will handle the concatenation method calls.
            producer.Service = new SecureInterfaceService();

            // Create interface as defined in the introspect xml, create AllJoyn bus object
            // and announce the about interface.
            producer.Start();

            UpdateStatus("Launched.", NotifyType.StatusMessage);
        }
Пример #4
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;

                // Optional - Populate About data for the producer.
                m_busAttachment.AboutData.DefaultManufacturer = "Contoso";
                m_busAttachment.AboutData.SupportUrl          = new Uri("http://www.contoso.com/support");
                m_busAttachment.AboutData.ModelNumber         = "ContosoTestModel";
                m_busAttachment.AboutData.DefaultDescription  = "A secure AllJoyn sample";

                // 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 SecureInterfaceProducer(m_busAttachment);

                // Instantiate SecureInterfaceService which will handle the concatenation method calls.
                m_producer.Service = new SecureInterfaceService();

                // Start advertising the service.
                m_producer.Start();
            }
        }
Пример #5
0
        public void Start()
        {
            // Prevent from Launching the server again if it is already launched.
            if (isLaunched)
            {
                UpdateStatus("Already launched.", NotifyType.StatusMessage);
            }
            else
            {
                UpdateStatus("Launching...", NotifyType.StatusMessage);

                AllJoynBusAttachment alljoynBusAttachment = new AllJoynBusAttachment();
                alljoynBusAttachment.AuthenticationMechanisms.Clear();
                alljoynBusAttachment.AuthenticationMechanisms.Add(AllJoynAuthenticationMechanism.EcdhePsk);
                alljoynBusAttachment.AuthenticationComplete += AlljoynBusAttachment_AuthenticationComplete;
                alljoynBusAttachment.CredentialsRequested   += AlljoynBusAttachment_CredentialsRequested;

                // Generate the one-time pre-shared key.
                // For demonstration purposes, this sample uses a low entropy key.
                // For all practical implementations, it is highly recommended that
                // developers generate a high entropy key (128 bits recommended).
                IBuffer randomBuffer = CryptographicBuffer.GenerateRandom(5);
                Key = CryptographicBuffer.EncodeToHexString(randomBuffer);

                // Initialize the producer object generated by the AllJoynCodeGen tool.
                SecureInterfaceProducer producer = new SecureInterfaceProducer(alljoynBusAttachment);

                // Instantiate SecureInterfaceService which will handle the concatenation method calls.
                producer.Service = new SecureInterfaceService();

                // Start listening for consumers.
                producer.Start();

                UpdateStatus("Launched.", NotifyType.StatusMessage);
                isLaunched = true;
            }
        }
        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 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;

                // Optional - Populate About data for the producer.
                m_busAttachment.AboutData.DefaultManufacturer = "Contoso";
                m_busAttachment.AboutData.SupportUrl = new Uri("http://www.contoso.com/support");
                m_busAttachment.AboutData.ModelNumber = "ContosoTestModel";
                m_busAttachment.AboutData.DefaultDescription = "A secure AllJoyn sample";

                // 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 SecureInterfaceProducer(m_busAttachment);

                // Instantiate SecureInterfaceService which will handle the concatenation method calls.
                m_producer.Service = new SecureInterfaceService();

                // Start advertising the service.
                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;

                // Optional - Populate About data for the producer.
                m_busAttachment.AboutData.DefaultManufacturer = "Contoso";
                m_busAttachment.AboutData.SupportUrl = new Uri("http://www.contoso.com/support");

                // Generate the one-time pre-shared key.
                Key = CryptographicHelpers.GenerateHighEntropyKey(DesiredKeyLength);

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

                // Instantiate SecureInterfaceService which will handle the concatenation method calls.
                m_producer.Service = new SecureInterfaceService();

                // Start advertising the service.
                m_producer.Start();
            }
        }