Imported Upstream version 1.0.0
[platform/upstream/iotivity.git] / service / easy-setup / sdk / mediator / android / EasySetupCore / src / main / java / org / iotivity / service / easysetup / core / EasySetupCallbackHandler.java
1 /**\r
2  * ***************************************************************\r
3  * <p>\r
4  * Copyright 2015 Samsung Electronics All Rights Reserved.\r
5  * <p>\r
6  * <p>\r
7  * <p>\r
8  * Licensed under the Apache License, Version 2.0 (the "License");\r
9  * you may not use this file except in compliance with the License.\r
10  * You may obtain a copy of the License at\r
11  * <p>\r
12  * http://www.apache.org/licenses/LICENSE-2.0\r
13  * <p>\r
14  * Unless required by applicable law or agreed to in writing, software\r
15  * distributed under the License is distributed on an "AS IS" BASIS,\r
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
17  * See the License for the specific language governing permissions and\r
18  * limitations under the License.\r
19  * <p>\r
20  * ****************************************************************\r
21  */\r
22 package org.iotivity.service.easysetup.core;\r
23 \r
24 import android.util.Log;\r
25 \r
26 public class EasySetupCallbackHandler {\r
27     private static final String TAG = "ESCallbackHandler";\r
28     ProvisionEnrollee provisioningListener;\r
29 \r
30     private static EasySetupCallbackHandler easySetupCallbackHandlerObj;\r
31 \r
32     public static synchronized EasySetupCallbackHandler getInstance() {\r
33         if (null == easySetupCallbackHandlerObj) {\r
34             easySetupCallbackHandlerObj = new EasySetupCallbackHandler();\r
35         }\r
36         return easySetupCallbackHandlerObj;\r
37     }\r
38 \r
39     public void ProvisioningStatusCallBack(int statuscode) {\r
40         Log.d(TAG,\r
41                 "onFinishProvisioning() inside Android Java application. statuscode - "\r
42                         + statuscode);\r
43         if (this.provisioningListener != null) {\r
44             this.provisioningListener.ProvisioningStatusCallBack(statuscode);\r
45         } else {\r
46             Log.e(TAG, "provisioningListener is not registered");\r
47         }\r
48     }\r
49 \r
50     public void registerProvisioningHandler(\r
51             ProvisionEnrollee provisioningListener) {\r
52         this.provisioningListener = provisioningListener;\r
53     }\r
54 }\r