Rename DeviceProviderBase as BasicProvider 75/66775/1
authorMu-Woong Lee <muwoong.lee@samsung.com>
Thu, 21 Apr 2016 05:07:49 +0000 (14:07 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Thu, 21 Apr 2016 05:07:49 +0000 (14:07 +0900)
Change-Id: I0d7e97a0d988ce3d619585ad4cbfd81e08b9af85
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
26 files changed:
src/activity/ActivityBase.cpp
src/activity/ActivityBase.h
src/call/Call.cpp
src/call/Call.h
src/contacts/Contacts.cpp
src/contacts/Contacts.h
src/email/Email.cpp
src/email/Email.h
src/headphone/Headphone.cpp
src/headphone/Headphone.h
src/message/Message.cpp
src/message/Message.h
src/shared/BasicProvider.cpp [new file with mode: 0644]
src/shared/BasicProvider.h [new file with mode: 0644]
src/shared/DeviceProviderBase.cpp [deleted file]
src/shared/DeviceProviderBase.h [deleted file]
src/system/Battery.cpp
src/system/Battery.h
src/system/Psmode.cpp
src/system/Psmode.h
src/system/RuntimeInfoBase.cpp
src/system/RuntimeInfoBase.h
src/time/Time.cpp
src/time/Time.h
src/wifi/Wifi.cpp
src/wifi/Wifi.h

index 4abda042dace549c18286079736d7d2fc678df1b..2611aa22a21fc4d038088f4d48f004ae4c5729fe 100644 (file)
@@ -21,7 +21,7 @@
 using namespace ctx;
 
 UserActivityBase::UserActivityBase(const char *subject, activity_type_e type)  :
-       DeviceProviderBase(subject),
+       BasicProvider(subject),
        __activityType(type),
        __activityHandle(NULL)
 {
index 56b709f310467a4feaa6607e608cbcb12088ff5f..16235c6600394386c1095b98935564b2dc2c499c 100644 (file)
 
 #include <string>
 #include <activity_recognition.h>
-#include "../shared/DeviceProviderBase.h"
+#include "../shared/BasicProvider.h"
 
 namespace ctx {
 
-       class UserActivityBase : public DeviceProviderBase {
+       class UserActivityBase : public BasicProvider {
        public:
                UserActivityBase(const char *subject, activity_type_e type);
                virtual ~UserActivityBase();
index a19a2b947e8cd105b97cb5243350c8c0fb7da8d5..3cc49d6e90eff310a0d1168160f9d49bbb54dfab 100644 (file)
@@ -38,7 +38,7 @@ static telephony_noti_e __callNotiIds[] =
 static Json __latest;
 
 SocialStatusCall::SocialStatusCall() :
-       DeviceProviderBase(SOCIAL_ST_SUBJ_CALL)
+       BasicProvider(SOCIAL_ST_SUBJ_CALL)
 {
        __handleList.count = 0;
        __handleList.handle = NULL;
index a53276f0a29eda1b94712e016dcd85db78ab2bea..23d589dbafbfac3bf183c61c44c4c565bbe8e982 100644 (file)
 
 #include <telephony.h>
 #include "../shared/SocialTypes.h"
-#include "../shared/DeviceProviderBase.h"
+#include "../shared/BasicProvider.h"
 
 namespace ctx {
 
-       class SocialStatusCall : public DeviceProviderBase {
+       class SocialStatusCall : public BasicProvider {
        public:
                SocialStatusCall();
                ~SocialStatusCall();
index 42789a356b48b4036c6191755ec087a0f8ca2444..6b195f73ce5ba5f06366249af7171fc71ca73b90 100644 (file)
@@ -23,7 +23,7 @@
 using namespace ctx;
 
 SocialStatusContacts::SocialStatusContacts() :
-       DeviceProviderBase(SOCIAL_ST_SUBJ_CONTACTS),
+       BasicProvider(SOCIAL_ST_SUBJ_CONTACTS),
        __latestMyProfile(0),
        __latestPerson(0)
 {
index 28b68ce4ab66110c19479785dd18c9206686b556..4211a6c6c931823ae774669342f1304d76c12473 100644 (file)
 
 #include <contacts.h>
 #include "../shared/SocialTypes.h"
-#include "../shared/DeviceProviderBase.h"
+#include "../shared/BasicProvider.h"
 
 namespace ctx {
 
-       class SocialStatusContacts : public DeviceProviderBase {
+       class SocialStatusContacts : public BasicProvider {
        public:
                SocialStatusContacts();
                ~SocialStatusContacts();
index fbf5c8d1b453cf932849d79c9fc6bfeb09fbe4f8..e16b6d58c5617f80604567d4117e5e67c75d45ec 100644 (file)
@@ -20,7 +20,7 @@
 using namespace ctx;
 
 SocialStatusEmail::SocialStatusEmail() :
-       DeviceProviderBase(SOCIAL_ST_SUBJ_EMAIL),
+       BasicProvider(SOCIAL_ST_SUBJ_EMAIL),
        __dbusSignalId(-1),
        __dbusWatcher(DBusType::SESSION)
 {
index b78eb336e73aca3e44befbfd4d6cf635e75a14ed..bfd7702577ea722c94ac2bf6248b8c20da1a87f3 100644 (file)
 
 #include <DBusSignalWatcher.h>
 #include "../shared/SocialTypes.h"
-#include "../shared/DeviceProviderBase.h"
+#include "../shared/BasicProvider.h"
 
 namespace ctx {
 
-       class SocialStatusEmail : public DeviceProviderBase, public IDBusSignalListener {
+       class SocialStatusEmail : public BasicProvider, public IDBusSignalListener {
        public:
                SocialStatusEmail();
                ~SocialStatusEmail();
index 3ee6dfa18b6d1d25e8f87941901ee7eadcc9f3da..a8da0ae054c0979e506243c8872c81b0cf5e9949 100644 (file)
@@ -22,7 +22,7 @@
 using namespace ctx;
 
 DeviceStatusHeadphone::DeviceStatusHeadphone() :
-       DeviceProviderBase(DEVICE_ST_SUBJ_HEADPHONE),
+       BasicProvider(DEVICE_ST_SUBJ_HEADPHONE),
        __connected(false),
        __audioJackState(RUNTIME_INFO_AUDIO_JACK_STATUS_UNCONNECTED),
        __btAudioState(false),
index 2fdd780991bebce711f9a6be1d9d73d5a2561a83..5d88b368332a6560759aa872634291b30ac4845c 100644 (file)
 #include <runtime_info.h>
 #include <bluetooth.h>
 #include "../shared/SystemTypes.h"
-#include "../shared/DeviceProviderBase.h"
+#include "../shared/BasicProvider.h"
 
 namespace ctx {
 
-       class DeviceStatusHeadphone : public DeviceProviderBase {
+       class DeviceStatusHeadphone : public BasicProvider {
        public:
                DeviceStatusHeadphone();
                ~DeviceStatusHeadphone();
index 9316806e2c313ade9db1e2b33077186e8e42ef03..9e8c350b0c071403f9bb4dc21b886c6cd9c5746f 100644 (file)
@@ -21,7 +21,7 @@
 using namespace ctx;
 
 SocialStatusMessage::SocialStatusMessage() :
-       DeviceProviderBase(SOCIAL_ST_SUBJ_MESSAGE),
+       BasicProvider(SOCIAL_ST_SUBJ_MESSAGE),
        __messageHandle(NULL)
 {
 }
index 79e489a382b724211a002861611983a7d019ed4b..a272144de76c3681a3a35f66cf3417998d3683b9 100644 (file)
 #include <msg.h>
 #include <msg_transport.h>
 #include "../shared/SocialTypes.h"
-#include "../shared/DeviceProviderBase.h"
+#include "../shared/BasicProvider.h"
 
 namespace ctx {
 
-       class SocialStatusMessage : public DeviceProviderBase {
+       class SocialStatusMessage : public BasicProvider {
        public:
                SocialStatusMessage();
                ~SocialStatusMessage();
diff --git a/src/shared/BasicProvider.cpp b/src/shared/BasicProvider.cpp
new file mode 100644 (file)
index 0000000..95cba6b
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <system_info.h>
+#include "BasicProvider.h"
+
+using namespace ctx;
+
+BasicProvider::BasicProvider(const char *subject) :
+       ContextProvider(subject),
+       __beingSubscribed(false)
+{
+}
+
+BasicProvider::~BasicProvider()
+{
+}
+
+bool BasicProvider::isSupported()
+{
+       return true;
+}
+
+void BasicProvider::submitTriggerItem()
+{
+}
+
+int BasicProvider::subscribe(Json option, Json *requestResult)
+{
+       IF_FAIL_RETURN(!__beingSubscribed, ERR_NONE);
+
+       int ret = subscribe();
+
+       if (ret == ERR_NONE)
+               __beingSubscribed = true;
+
+       return ret;
+}
+
+int BasicProvider::unsubscribe(Json option)
+{
+       int ret = ERR_NONE;
+
+       if (__beingSubscribed)
+               ret = unsubscribe();
+
+       return ret;
+}
+
+int BasicProvider::read(Json option, Json *requestResult)
+{
+       return read();
+}
+
+int BasicProvider::write(Json data, Json *requestResult)
+{
+       return write(data);
+}
+
+int BasicProvider::subscribe()
+{
+       return ERR_NOT_SUPPORTED;
+}
+
+int BasicProvider::unsubscribe()
+{
+       return ERR_NOT_SUPPORTED;
+}
+
+int BasicProvider::read()
+{
+       return ERR_NOT_SUPPORTED;
+}
+
+int BasicProvider::write(Json &data)
+{
+       return ERR_NOT_SUPPORTED;
+}
+
+bool BasicProvider::getSystemInfoBool(const char *key)
+{
+       bool supported = false;
+       int ret = system_info_get_platform_bool(key, &supported);
+       IF_FAIL_RETURN_TAG(ret == SYSTEM_INFO_ERROR_NONE, false, _E, "system_info_get_platform_bool() failed");
+       return supported;
+}
diff --git a/src/shared/BasicProvider.h b/src/shared/BasicProvider.h
new file mode 100644 (file)
index 0000000..c7a7f5d
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CONTEXT_BASIC_PROVIDER_H_
+#define _CONTEXT_BASIC_PROVIDER_H_
+
+#include <ContextProvider.h>
+
+namespace ctx {
+
+       /* BasicProvider implements the very basic form of context providers,
+          which has no controllable options, and does not set the requestResult
+          parameter to reply to clients' requests immediately. */
+       class BasicProvider : public ContextProvider {
+       public:
+               int subscribe(Json option, Json *requestResult);
+               int unsubscribe(Json option);
+               int read(Json option, Json *requestResult);
+               int write(Json data, Json *requestResult);
+
+               virtual bool isSupported();
+
+               /* TODO: This function will be deprecated */
+               virtual void submitTriggerItem();
+
+       protected:
+               bool __beingSubscribed;
+
+               BasicProvider(const char *subject);
+               virtual ~BasicProvider();
+
+               virtual int subscribe();
+               virtual int unsubscribe();
+               virtual int read();
+               virtual int write(Json &data);
+
+               /* TODO: This function needs to be removed from here */
+               static bool getSystemInfoBool(const char *key);
+       };
+}
+
+#endif /* _CONTEXT_BASIC_PROVIDER_H_ */
diff --git a/src/shared/DeviceProviderBase.cpp b/src/shared/DeviceProviderBase.cpp
deleted file mode 100644 (file)
index 1c5f5ef..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <system_info.h>
-#include "DeviceProviderBase.h"
-
-using namespace ctx;
-
-DeviceProviderBase::DeviceProviderBase(const char *subject) :
-       ContextProvider(subject),
-       __beingSubscribed(false)
-{
-}
-
-bool DeviceProviderBase::isSupported()
-{
-       return true;
-}
-
-void DeviceProviderBase::submitTriggerItem()
-{
-}
-
-int DeviceProviderBase::subscribe(Json option, Json *requestResult)
-{
-       IF_FAIL_RETURN(!__beingSubscribed, ERR_NONE);
-
-       int ret = subscribe();
-
-       if (ret == ERR_NONE)
-               __beingSubscribed = true;
-
-       return ret;
-}
-
-int DeviceProviderBase::unsubscribe(Json option)
-{
-       int ret = ERR_NONE;
-
-       if (__beingSubscribed)
-               ret = unsubscribe();
-
-       return ret;
-}
-
-int DeviceProviderBase::read(Json option, Json *requestResult)
-{
-       return read();
-}
-
-int DeviceProviderBase::write(Json data, Json *requestResult)
-{
-       return write();
-}
-
-int DeviceProviderBase::subscribe()
-{
-       return ERR_NOT_SUPPORTED;
-}
-
-int DeviceProviderBase::unsubscribe()
-{
-       return ERR_NOT_SUPPORTED;
-}
-
-int DeviceProviderBase::read()
-{
-       return ERR_NOT_SUPPORTED;
-}
-
-int DeviceProviderBase::write()
-{
-       return ERR_NOT_SUPPORTED;
-}
-
-bool DeviceProviderBase::getSystemInfoBool(const char *key)
-{
-       bool supported = false;
-       int ret = system_info_get_platform_bool(key, &supported);
-       IF_FAIL_RETURN_TAG(ret == SYSTEM_INFO_ERROR_NONE, false, _E, "system_info_get_platform_bool() failed");
-       return supported;
-}
diff --git a/src/shared/DeviceProviderBase.h b/src/shared/DeviceProviderBase.h
deleted file mode 100644 (file)
index f5a55da..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _CONTEXT_DEVICE_PROVIDER_BASE_H_
-#define _CONTEXT_DEVICE_PROVIDER_BASE_H_
-
-#include <ContextProvider.h>
-
-namespace ctx {
-
-       class DeviceProviderBase : public ContextProvider {
-       public:
-               int subscribe(Json option, Json *requestResult);
-               int unsubscribe(Json option);
-               int read(Json option, Json *requestResult);
-               int write(Json data, Json *requestResult);
-
-               virtual bool isSupported();
-               virtual void submitTriggerItem();
-
-       protected:
-               bool __beingSubscribed;
-
-               DeviceProviderBase(const char *subject);
-               virtual ~DeviceProviderBase() {}
-
-               virtual int subscribe();
-               virtual int unsubscribe();
-               virtual int read();
-               virtual int write();
-
-               static bool getSystemInfoBool(const char *key);
-       };
-}
-
-#endif // _CONTEXT_DEVICE_PROVIDER_BASE_H_
index 69b1ecd116d2afcc457517d16bf975ddf31d324e..e86a595947b6c3a3374fee36ac8bc964b31e47c2 100644 (file)
@@ -19,7 +19,7 @@
 using namespace ctx;
 
 DeviceStatusBattery::DeviceStatusBattery()
-       : DeviceProviderBase(DEVICE_ST_SUBJ_BATTERY)
+       : BasicProvider(DEVICE_ST_SUBJ_BATTERY)
 {
 }
 
index 34482b4a1f3321e76ff33ead7c696af6680a2d00..40e4ce07ecf7735aedb340bddebc9301cc46b1be 100644 (file)
 #include <device/callback.h>
 #include <device/battery.h>
 #include "../shared/SystemTypes.h"
-#include "../shared/DeviceProviderBase.h"
+#include "../shared/BasicProvider.h"
 
 namespace ctx {
 
-       class DeviceStatusBattery : public DeviceProviderBase {
+       class DeviceStatusBattery : public BasicProvider {
        public:
                DeviceStatusBattery();
                ~DeviceStatusBattery();
index c7d61d78e2f82ba0f65b18c90af5b5dcf74a27e8..cc0cf30ee2152ea4c00a9e97598c55be24b4f71b 100644 (file)
@@ -19,7 +19,7 @@
 using namespace ctx;
 
 DeviceStatusPsmode::DeviceStatusPsmode() :
-       DeviceProviderBase(DEVICE_ST_SUBJ_PSMODE)
+       BasicProvider(DEVICE_ST_SUBJ_PSMODE)
 {
 }
 
index 0cbe3cb7f053027b8d4b968a97aa833622d506c4..78ec7ec0927ce26affbb145c659ff955fc263d05 100644 (file)
 
 #include <vconf.h>
 #include "../shared/SystemTypes.h"
-#include "../shared/DeviceProviderBase.h"
+#include "../shared/BasicProvider.h"
 
 namespace ctx {
 
-       class DeviceStatusPsmode : public DeviceProviderBase {
+       class DeviceStatusPsmode : public BasicProvider {
        public:
                DeviceStatusPsmode();
                ~DeviceStatusPsmode();
index 1f745ad88824d86f24d13692d525494c663460e3..67e3710aac2482666a9710a1cb57efb77281c9fb 100644 (file)
@@ -19,7 +19,7 @@
 using namespace ctx;
 
 DeviceStatusRuntimeInfo::DeviceStatusRuntimeInfo(const char *subject, runtime_info_key_e key) :
-       DeviceProviderBase(subject),
+       BasicProvider(subject),
        __infoKey(key)
 {
 }
index 7d8f6ee0025c1c12cbaace63954234f3a5d22c3b..c99f462a6d3e3cb8c8f33fff81078caeb24105c0 100644 (file)
 
 #include <runtime_info.h>
 #include "../shared/SystemTypes.h"
-#include "../shared/DeviceProviderBase.h"
+#include "../shared/BasicProvider.h"
 
 namespace ctx {
 
-       class DeviceStatusRuntimeInfo : public DeviceProviderBase {
+       class DeviceStatusRuntimeInfo : public BasicProvider {
        public:
                DeviceStatusRuntimeInfo(const char *subject, runtime_info_key_e key);
 
index 73f3f379be16824cfaa4cf1a55e803503f081a3b..d4ba82f1c35df8d0d360333eca0a8c95f49f837e 100644 (file)
@@ -20,7 +20,7 @@
 using namespace ctx;
 
 DeviceStatusTime::DeviceStatusTime() :
-       DeviceProviderBase(DEVICE_ST_SUBJ_TIME)
+       BasicProvider(DEVICE_ST_SUBJ_TIME)
 {
 }
 
index 48e22024cf12eba9ede6316750b2f415b98b1162..956272372862471d853275291a22cd71d998ec16 100644 (file)
 #ifndef _DEVICE_SYSTEM_STATUS_TIME_H_
 #define _DEVICE_SYSTEM_STATUS_TIME_H_
 
-#include "../shared/DeviceProviderBase.h"
+#include "../shared/BasicProvider.h"
 #include "../shared/SystemTypes.h"
 
 namespace ctx {
 
-       class DeviceStatusTime : public DeviceProviderBase {
+       class DeviceStatusTime : public BasicProvider {
        public:
                DeviceStatusTime();
                ~DeviceStatusTime();
index 8de9fa49e0f9b9aecb40ea6db7b86759a9c671e2..c8a1d025cf6a6181f1a9f37ab7984495b174773f 100644 (file)
@@ -20,7 +20,7 @@
 using namespace ctx;
 
 DeviceStatusWifi::DeviceStatusWifi() :
-       DeviceProviderBase(DEVICE_ST_SUBJ_WIFI),
+       BasicProvider(DEVICE_ST_SUBJ_WIFI),
        __lastState(UNKNOWN),
        __isInitialized(false),
        __isActivated(false),
index 2c5cee68b550070d2c4674cc751335c5812e0fed..7fbe2f25ca3d8752ab9a1946971547d043f4ac8e 100644 (file)
 
 #include <string>
 #include <wifi.h>
-#include "../shared/DeviceProviderBase.h"
+#include "../shared/BasicProvider.h"
 #include "../shared/SystemTypes.h"
 
 namespace ctx {
 
-       class DeviceStatusWifi : public DeviceProviderBase {
+       class DeviceStatusWifi : public BasicProvider {
        public:
                DeviceStatusWifi();
                ~DeviceStatusWifi();