2 * ***************************************************************
4 * Copyright 2015 Samsung Electronics All Rights Reserved.
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
20 * ****************************************************************
23 package org.iotivity.service.easysetup.mediator;
25 import android.content.Context;
28 * This a factory class provides the native implementation of the various Enrollee devices.
29 * Application can make use of Enrollee factory if it does not want to create its own Enrollee devices.
31 public class EnrolleeDeviceFactory {
36 * This method create & returns instance of EnrolleeDeviceFactory
38 * @param context This is Android Application context
40 public static EnrolleeDeviceFactory newInstance(Context context) {
41 return new EnrolleeDeviceFactory(context);
44 private EnrolleeDeviceFactory(Context context) {
49 * This method create & returns instance of Enrollee device of supported configuration
51 * @param onboardingConfig Contains details about the connectivity to be established between the Enrollee device & Mediator device in order to perform on-boarding
52 * @param provConfig Contains details about the network to which Enrollee device is going to connect.
53 * @return Instance of the Enrollee device created natively.
56 public EnrolleeDevice newEnrolleeDevice(ProvisioningConfig provConfig, OnBoardingConfig onboardingConfig) {
58 if (onboardingConfig.getConnType() != OnBoardingConfig.ConnType.WiFi) {
59 throw new IllegalArgumentException("OnBoarding configuration is not supported");
62 return new EnrolleeDeviceWiFiOnboarding(mContext, onboardingConfig, provConfig);
66 * This method create & returns instance of Enrollee device of supported configuration
67 * [When SoftAP is going to be created on Enrollee side]
69 * @param provConfig Contains details about the network to which Enrollee device is going to connect.
70 * @return Instance of the Enrollee device created natively.
72 public EnrolleeDevice newEnrolleeDevice(ProvisioningConfig provConfig){
73 return new EnrolleeDeviceWiFiOnboarding(mContext, new IpOnBoardingConnection(true), provConfig);