using namespace ctx;
UserActivityBase::UserActivityBase(const char *subject, activity_type_e type) :
- DeviceProviderBase(subject),
+ BasicProvider(subject),
__activityType(type),
__activityHandle(NULL)
{
#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();
static Json __latest;
SocialStatusCall::SocialStatusCall() :
- DeviceProviderBase(SOCIAL_ST_SUBJ_CALL)
+ BasicProvider(SOCIAL_ST_SUBJ_CALL)
{
__handleList.count = 0;
__handleList.handle = NULL;
#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();
using namespace ctx;
SocialStatusContacts::SocialStatusContacts() :
- DeviceProviderBase(SOCIAL_ST_SUBJ_CONTACTS),
+ BasicProvider(SOCIAL_ST_SUBJ_CONTACTS),
__latestMyProfile(0),
__latestPerson(0)
{
#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();
using namespace ctx;
SocialStatusEmail::SocialStatusEmail() :
- DeviceProviderBase(SOCIAL_ST_SUBJ_EMAIL),
+ BasicProvider(SOCIAL_ST_SUBJ_EMAIL),
__dbusSignalId(-1),
__dbusWatcher(DBusType::SESSION)
{
#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();
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),
#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();
using namespace ctx;
SocialStatusMessage::SocialStatusMessage() :
- DeviceProviderBase(SOCIAL_ST_SUBJ_MESSAGE),
+ BasicProvider(SOCIAL_ST_SUBJ_MESSAGE),
__messageHandle(NULL)
{
}
#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();
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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_ */
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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_
using namespace ctx;
DeviceStatusBattery::DeviceStatusBattery()
- : DeviceProviderBase(DEVICE_ST_SUBJ_BATTERY)
+ : BasicProvider(DEVICE_ST_SUBJ_BATTERY)
{
}
#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();
using namespace ctx;
DeviceStatusPsmode::DeviceStatusPsmode() :
- DeviceProviderBase(DEVICE_ST_SUBJ_PSMODE)
+ BasicProvider(DEVICE_ST_SUBJ_PSMODE)
{
}
#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();
using namespace ctx;
DeviceStatusRuntimeInfo::DeviceStatusRuntimeInfo(const char *subject, runtime_info_key_e key) :
- DeviceProviderBase(subject),
+ BasicProvider(subject),
__infoKey(key)
{
}
#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);
using namespace ctx;
DeviceStatusTime::DeviceStatusTime() :
- DeviceProviderBase(DEVICE_ST_SUBJ_TIME)
+ BasicProvider(DEVICE_ST_SUBJ_TIME)
{
}
#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();
using namespace ctx;
DeviceStatusWifi::DeviceStatusWifi() :
- DeviceProviderBase(DEVICE_ST_SUBJ_WIFI),
+ BasicProvider(DEVICE_ST_SUBJ_WIFI),
__lastState(UNKNOWN),
__isInitialized(false),
__isActivated(false),
#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();