__prevState = currentState;
Json option;
- option.set(NULL, PLACE_GEOFENCE_PLACE_ID, __placeId);
+ option.set(NULL, KEY_PLACE_ID, __placeId);
Json data;
- data.set(NULL, PLACE_GEOFENCE_PLACE_ID, __placeId);
- data.set(NULL, PLACE_GEOFENCE_EVENT, __getStateString(currentState));
+ data.set(NULL, KEY_PLACE_ID, __placeId);
+ data.set(NULL, KEY_EVENT, __getStateString(currentState));
__provider->publish(option, ERR_NONE, data);
}
{
switch (state) {
case GEOFENCE_STATE_IN:
- return PLACE_GEOFENCE_IN;
+ return VAL_IN;
case GEOFENCE_STATE_OUT:
- return PLACE_GEOFENCE_OUT;
- case GEOFENCE_STATE_UNCERTAIN:
- return PLACE_GEOFENCE_UNCERTAIN;
+ return VAL_OUT;
default:
- return PLACE_GEOFENCE_UNCERTAIN;
+ return VAL_UNCERTAIN;
}
}
using namespace ctx;
PlaceGeofenceProvider::PlaceGeofenceProvider() :
- ContextProvider(PLACE_SUBJ_GEOFENCE)
+ ContextProvider(SUBJ_PLACE_GEOFENCE)
{
}
int PlaceGeofenceProvider::subscribe(Json option, Json *requestResult)
{
int placeId = -1;
- option.get(NULL, PLACE_GEOFENCE_PLACE_ID, &placeId);
+ option.get(NULL, KEY_PLACE_ID, &placeId);
IF_FAIL_RETURN_TAG(placeId != -1, ERR_INVALID_PARAMETER, _E, "Getting PlaceID failed");
auto it = __handleMap.find(placeId);
int PlaceGeofenceProvider::unsubscribe(Json option)
{
int placeId = -1;
- option.get(NULL, PLACE_GEOFENCE_PLACE_ID, &placeId);
+ option.get(NULL, KEY_PLACE_ID, &placeId);
IF_FAIL_RETURN_TAG(placeId != -1, ERR_INVALID_PARAMETER, _E, "Getting PlaceID failed");
auto it = __handleMap.find(placeId);
#include <map>
#include <ContextProvider.h>
-#include "PlaceGeofenceTypes.h"
+#include <ProviderTypes.h>
namespace ctx {
+++ /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_PLACE_GEOFENCE_TYPES_H_
-#define _CONTEXT_PLACE_GEOFENCE_TYPES_H_
-
-// Subject
-#define PLACE_SUBJ_GEOFENCE "place/geofence"
-
-// Privilege
-#define PLACE_PRIV_GEOFENCE "location"
-
-// Option & Data Key
-#define PLACE_GEOFENCE_PLACE_ID "PlaceId"
-#define PLACE_GEOFENCE_EVENT "Event"
-
-// Data Value
-#define PLACE_GEOFENCE_UNCERTAIN "Uncertain"
-#define PLACE_GEOFENCE_IN "In"
-#define PLACE_GEOFENCE_OUT "Out"
-
-#endif /* End of _CONTEXT_PLACE_GEOFENCE_TYPES_H_ */
#include "../my-place/place_recognition.h"
#endif /* _MOBILE_ */
+#define PRIV_LOCATION "location"
+
template<typename Provider>
void registerProvider(const char *subject, const char *privilege)
{
SO_EXPORT bool ctx::initPlaceContextProvider()
{
#ifdef _MOBILE_
- registerProvider<PlaceGeofenceProvider>(PLACE_SUBJ_GEOFENCE, PLACE_PRIV_GEOFENCE);
+ registerProvider<PlaceGeofenceProvider>(SUBJ_PLACE_GEOFENCE, PRIV_LOCATION);
/*
registerProvider<PlaceRecognitionProvider>(PLACE_SUBJ_RECOGNITION, PLACE_PRIV_RECOGNITION);
#define SUBJ_ACTIVITY_STATIONARY "activity/stationary"
#define SUBJ_ACTIVITY_WALKING "activity/walking"
+#define SUBJ_PLACE_GEOFENCE "place/geofence"
/* Data & Option Keys */
#define KEY_QUERY_RESULT "QueryResult"
#define KEY_TIME_OF_DAY "TimeOfDay"
#define KEY_DAY_OF_WEEK "DayOfWeek"
#define KEY_DAY_OF_MONTH "DayOfMonth"
+#define KEY_PLACE_ID "PlaceId"
/* Data & Option Values */
#define VAL_PERSON "Person"
#define VAL_CHANGED "Changed"
#define VAL_DETECTED "Detected"
+#define VAL_UNCERTAIN "Uncertain"
+#define VAL_IN "In"
+#define VAL_OUT "Out"
#define VAL_ACTIVE VAL_CONNECTED
#define VAL_ALERTING VAL_CONNECTING