Code cleanup: merge activity-related macros into ProviderTypes.h 12/66812/1
authorMu-Woong Lee <muwoong.lee@samsung.com>
Thu, 21 Apr 2016 07:20:58 +0000 (16:20 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Thu, 21 Apr 2016 07:20:58 +0000 (16:20 +0900)
Change-Id: I79350b4d5e3894a8b134357884dca6bc9c918033
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
src/activity/Activity.cpp
src/activity/Activity.h
src/activity/ActivityTypes.h [deleted file]
src/shared/DeviceContextProvider.cpp
src/shared/ProviderTypes.h

index faf864dbca4fade3d1a5f14e84508c1467fb231b..a71dbfb282e404c9a2d002aa5d953fd54db336cd 100644 (file)
@@ -58,20 +58,20 @@ void ActivityProvider::__handleUpdate(activity_type_e activity, const activity_d
        IF_FAIL_VOID_TAG(activity == __activityType, _E, "Invalid activity: %d", activity);
 
        Json dataRead;
-       dataRead.set(NULL, CTX_ACTIVITY_EVENT, CTX_ACTIVITY_DETECTED);
+       dataRead.set(NULL, KEY_EVENT, VAL_DETECTED);
 
        activity_accuracy_e accuracy = ACTIVITY_ACCURACY_LOW;
        activity_get_accuracy(data, &accuracy);
 
        switch (accuracy) {
        case ACTIVITY_ACCURACY_HIGH:
-               dataRead.set(NULL, CTX_ACTIVITY_ACCURACY, CTX_ACTIVITY_HIGH);
+               dataRead.set(NULL, KEY_ACCURACY, VAL_HIGH);
                break;
        case ACTIVITY_ACCURACY_MID:
-               dataRead.set(NULL, CTX_ACTIVITY_ACCURACY, CTX_ACTIVITY_NORMAL);
+               dataRead.set(NULL, KEY_ACCURACY, VAL_NORMAL);
                break;
        default:
-               dataRead.set(NULL, CTX_ACTIVITY_ACCURACY, CTX_ACTIVITY_LOW);
+               dataRead.set(NULL, KEY_ACCURACY, VAL_LOW);
                break;
        }
 
index c3c3dfe2ad61b91406d82e1b044c795a86ee28d9..b1bfe77d53a3d488f5b5d14cd610bed5e0d60b09 100644 (file)
@@ -19,8 +19,8 @@
 
 #include <string>
 #include <activity_recognition.h>
+#include <ProviderTypes.h>
 #include <BasicProvider.h>
-#include "ActivityTypes.h"
 
 #define GENERATE_ACTIVITY_PROVIDER(actPrvd, actSubj, actType) \
        class actPrvd : public ActivityProvider { \
@@ -51,10 +51,10 @@ namespace ctx {
        };
 
 
-       GENERATE_ACTIVITY_PROVIDER(StationaryActivityProvider, CTX_ACTIVITY_SUBJ_STATIONARY, ACTIVITY_STATIONARY);
-       GENERATE_ACTIVITY_PROVIDER(WalkingActivityProvider, CTX_ACTIVITY_SUBJ_WALKING, ACTIVITY_WALK);
-       GENERATE_ACTIVITY_PROVIDER(RunningActivityProvider, CTX_ACTIVITY_SUBJ_RUNNING, ACTIVITY_RUN);
-       GENERATE_ACTIVITY_PROVIDER(InVehicleActivityProvider, CTX_ACTIVITY_SUBJ_IN_VEHICLE, ACTIVITY_IN_VEHICLE);
+       GENERATE_ACTIVITY_PROVIDER(StationaryActivityProvider, SUBJ_ACTIVITY_STATIONARY, ACTIVITY_STATIONARY);
+       GENERATE_ACTIVITY_PROVIDER(WalkingActivityProvider, SUBJ_ACTIVITY_WALKING, ACTIVITY_WALK);
+       GENERATE_ACTIVITY_PROVIDER(RunningActivityProvider, SUBJ_ACTIVITY_RUNNING, ACTIVITY_RUN);
+       GENERATE_ACTIVITY_PROVIDER(InVehicleActivityProvider, SUBJ_ACTIVITY_IN_VEHICLE, ACTIVITY_IN_VEHICLE);
 }
 
 #endif // _CONTEXT_ACTIVITY_PROVIDER_H_
diff --git a/src/activity/ActivityTypes.h b/src/activity/ActivityTypes.h
deleted file mode 100644 (file)
index 8a58776..0000000
+++ /dev/null
@@ -1,36 +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_ACTIVITY_TYPES_H_
-#define        _CONTEXT_ACTIVITY_TYPES_H_
-
-/* Subject */
-#define CTX_ACTIVITY_SUBJ_IN_VEHICLE   "activity/in_vehicle"
-#define CTX_ACTIVITY_SUBJ_RUNNING              "activity/running"
-#define CTX_ACTIVITY_SUBJ_STATIONARY   "activity/stationary"
-#define CTX_ACTIVITY_SUBJ_WALKING              "activity/walking"
-
-/* Data Key */
-#define CTX_ACTIVITY_EVENT             "Event"
-#define CTX_ACTIVITY_ACCURACY  "Accuracy"
-
-/* Data Value */
-#define CTX_ACTIVITY_DETECTED  "Detected"
-#define CTX_ACTIVITY_LOW               "Low"
-#define CTX_ACTIVITY_NORMAL            "Normal"
-#define CTX_ACTIVITY_HIGH              "High"
-
-#endif /* _CONTEXT_ACTIVITY_TYPES_H_ */
index f1eb8d43af9daa18ff01c21771a2e0858733e4a9..46a6ae984730d173de5f807ec9f1eeda1f7cae68 100644 (file)
@@ -69,10 +69,10 @@ SO_EXPORT bool ctx::initDeviceContextProvider()
        registerProvider<DeviceStatusBattery>(SUBJ_STATE_BATTERY, NULL);
        registerProvider<DeviceStatusPsmode>(SUBJ_STATE_PSMODE, NULL);
 
-       registerProvider<StationaryActivityProvider>(CTX_ACTIVITY_SUBJ_STATIONARY, NULL);
-       registerProvider<WalkingActivityProvider>(CTX_ACTIVITY_SUBJ_WALKING, NULL);
-       registerProvider<RunningActivityProvider>(CTX_ACTIVITY_SUBJ_RUNNING, NULL);
-       registerProvider<InVehicleActivityProvider>(CTX_ACTIVITY_SUBJ_IN_VEHICLE, NULL);
+       registerProvider<StationaryActivityProvider>(SUBJ_ACTIVITY_STATIONARY, NULL);
+       registerProvider<WalkingActivityProvider>(SUBJ_ACTIVITY_WALKING, NULL);
+       registerProvider<RunningActivityProvider>(SUBJ_ACTIVITY_RUNNING, NULL);
+       registerProvider<InVehicleActivityProvider>(SUBJ_ACTIVITY_IN_VEHICLE, NULL);
 
 #ifdef _MOBILE_
        registerProvider<SocialStatusCall>(SUBJ_STATE_CALL, PRIV_TELEPHONY);
index 84f5c68218ff4fa1afa657bbb862de1727020ba4..667da28550c335f8e3b39ce5d34aec6d7246f42a 100644 (file)
 #define SUBJ_STATE_MESSAGE             "social/message"
 #define SUBJ_STATE_CONTACTS            "social/contacts"
 
+#define SUBJ_ACTIVITY_IN_VEHICLE       "activity/in_vehicle"
+#define SUBJ_ACTIVITY_RUNNING          "activity/running"
+#define SUBJ_ACTIVITY_STATIONARY       "activity/stationary"
+#define SUBJ_ACTIVITY_WALKING          "activity/walking"
+
 
 /* Data & Option Keys */
 #define KEY_QUERY_RESULT       "QueryResult"
@@ -74,6 +79,7 @@
 #define KEY_STATE                      "State"
 #define KEY_TYPE                       "Type"
 #define KEY_LEVEL                      "Level"
+#define KEY_ACCURACY           "Accuracy"
 #define KEY_BSSID                      "BSSID"
 #define KEY_MEDIUM                     "Medium"
 #define KEY_ADDRESS                    "Address"
 #define VAL_MY_PROFILE         "MyProfile"
 #define VAL_PERSON                     "Person"
 #define VAL_CHANGED                    "Changed"
+#define VAL_DETECTED           "Detected"
 
 #define VAL_ACTIVE             VAL_CONNECTED
 #define VAL_ALERTING   VAL_CONNECTING