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 java.util.ArrayList;
24 import java.util.Arrays;
26 import android.util.Log;
28 import org.iotivity.service.easysetup.mediator.DeviceProp;
29 import org.iotivity.service.easysetup.mediator.ESConstants;
30 import org.iotivity.service.easysetup.mediator.enums.WIFI_AUTHTYPE;
31 import org.iotivity.service.easysetup.mediator.enums.WIFI_ENCTYPE;
33 import org.iotivity.base.OcException;
34 import org.iotivity.base.OcRepresentation;
37 * This class contains device properties to be delivered to Enrollee
39 public class SCDeviceProp extends DeviceProp {
40 private static final String TAG = SCDeviceProp.class.getName();
41 final int INVALID_DISCOVERY_CHANNEL = -1;
44 * Set Channel of Enroller for fast discover
46 public void setDiscoveryChannel(int discoveryChannel)
50 mRep.setValue(ESConstants.OC_RSRVD_ES_VENDOR_DISCOVERYCHANNEL, discoveryChannel);
51 } catch (OcException e) {
52 Log.e(TAG, "setDiscoveryChannel is failed.");
57 * Get Channel of Enroller for fast discover
59 * @return int Enroller's DiscoveryChannel
61 public int getDiscoveryChannel()
64 if(mRep.hasAttribute(ESConstants.OC_RSRVD_ES_VENDOR_DISCOVERYCHANNEL))
65 return mRep.getValue(ESConstants.OC_RSRVD_ES_VENDOR_DISCOVERYCHANNEL);
66 } catch (OcException e) {
67 Log.e(TAG, "getDiscoveryChannel is failed.");
69 return INVALID_DISCOVERY_CHANNEL;
73 * Set samsung-specific location property to be delivered to Enrollee
75 * @param locations a set of location information
77 public void setSCLocation(ArrayList<String> locations)
81 mRep.setValue(ESConstants.SC_RSRVD_ES_VENDOR_LOCATION, locations.toArray(new
82 String[locations.size()]));
83 } catch (OcException e) {
84 Log.e(TAG, "setSCLocation is failed.");