2 * ***************************************************************
4 * Copyright 2016 Samsung Electronics All Rights Reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * ****************************************************************
21 package org.iotivity.service.easysetup.mediator.samsung;
23 import android.util.Log;
25 import org.iotivity.base.OcException;
26 import org.iotivity.base.OcRepresentation;
27 import org.iotivity.service.easysetup.mediator.ESConstants;
28 import org.iotivity.service.easysetup.mediator.EnrolleeConf;
30 import java.util.List;
33 * This class stores Enrollee's configuration including WiFi and Device configuration
34 * including supported WiFi frequency and device name
36 public class SCEnrolleeConf extends EnrolleeConf
38 private static final String TAG = SCEnrolleeConf.class.getName();
43 * @param rep received properties in a form of OcRepresentation
45 public SCEnrolleeConf(EnrolleeConf enrolleeConf) {
50 * Get Device type property in DevConf resource
54 public String getDeviceType()
56 List<OcRepresentation> children = mEasySetupRep.getChildren();
58 for (OcRepresentation child : children) {
59 if(child.getUri().indexOf(ESConstants.OC_RSRVD_ES_URI_DEVCONF) != -1)
63 if(child.hasAttribute(ESConstants.OC_RSRVD_ES_VENDOR_DEVTYPE)) {
64 return (String) child.getValue(ESConstants.OC_RSRVD_ES_VENDOR_DEVTYPE);
66 } catch (OcException e) {
67 Log.e(TAG, "getDeviceType is failed.");
71 return new String("");
75 * Get Device sub-type property in DevConf resource
77 * @return device sub-type
79 public String getDeviceSubType()
81 List<OcRepresentation> children = mEasySetupRep.getChildren();
83 for (OcRepresentation child : children) {
84 if(child.getUri().indexOf(ESConstants.OC_RSRVD_ES_URI_DEVCONF) != -1)
88 if(child.hasAttribute(ESConstants.OC_RSRVD_ES_VENDOR_DEVSUBTYPE)) {
89 return (String) child.getValue(ESConstants.OC_RSRVD_ES_VENDOR_DEVSUBTYPE);
91 } catch (OcException e) {
92 Log.e(TAG, "getDeviceType is failed.");
96 return new String("");