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() { // 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(); } }