IoTOnboardingService.OnboardingService.ConfigureWifiAsync C# (CSharp) Method

ConfigureWifiAsync() public method

public ConfigureWifiAsync ( AllJoynMessageInfo info, string interfaceMemberSSID, string interfaceMemberPassphrase, short interfaceMemberAuthType ) : IAsyncOperation
info AllJoynMessageInfo
interfaceMemberSSID string
interfaceMemberPassphrase string
interfaceMemberAuthType short
return IAsyncOperation
        public IAsyncOperation<OnboardingConfigureWifiResult> ConfigureWifiAsync(AllJoynMessageInfo info, string interfaceMemberSSID, string interfaceMemberPassphrase, short interfaceMemberAuthType)
        {
            return Task.Run(() =>
            {
                // make sure a valid value is provided for auth type
                if (!Enum.IsDefined(typeof(AuthType), interfaceMemberAuthType))
                {
                    return OnboardingConfigureWifiResult.CreateFailureResult(AllJoynStatus.InvalidArgument3);
                }

                // May want to switch this to concurrent mode if possible:
                // "Concurrent step used to validate the personal AP connection. In this case, the Onboarder application must wait for the
                // ConnectionResult signal to arrive over the AllJoyn session established over the SoftAP link."
                _personalApSsid = interfaceMemberSSID;
                _personalApPassword = interfaceMemberPassphrase;
                _authType = (AuthType)interfaceMemberAuthType;

                lock (_stateLock)
                {
                    _state = OnboardingState.ConfiguredNotValidated;
                }

                // Status "1" indicates the SoftAP will remain available until the Connect method is invoked
                return OnboardingConfigureWifiResult.CreateSuccessResult(1);

            }).AsAsyncOperation();
        }