From: Mu-Woong Lee Date: Tue, 26 Apr 2016 02:10:01 +0000 (+0900) Subject: Add a header file for listing so file names & trigger templates X-Git-Tag: submit/tizen/20160503.015801^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F20%2F67220%2F3;p=platform%2Fcore%2Fcontext%2Fcontext-provider.git Add a header file for listing so file names & trigger templates Change-Id: Ia73e288620653fdbec1e060a23c7a5b286a70b73 Signed-off-by: Mu-Woong Lee --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 2865cb6..10eb09c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,4 +22,10 @@ IF("${PROFILE}" STREQUAL "wearable") ADD_DEFINITIONS("-D_WEARABLE_") ENDIF("${PROFILE}" STREQUAL "wearable") +INSTALL( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/context-service/internal + FILES_MATCHING PATTERN "*.h" +) + ADD_SUBDIRECTORY(src) diff --git a/include/ProviderList.h b/include/ProviderList.h new file mode 100644 index 0000000..e63feb7 --- /dev/null +++ b/include/ProviderList.h @@ -0,0 +1,210 @@ +/* + * Copyright (c) 2016 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_PROVIDER_LIST_H_ +#define _CONTEXT_PROVIDER_LIST_H_ + +#include +#include + +#define LIB_DIRECTORY "/usr/lib/context/" +#define LIB_PREFIX "libctx-prvd-" +#define LIB_EXTENSION ".so" + +const struct { + const char *subject; + const char *library; +} subjectLibraryList[] = { + {SUBJ_ACTIVITY, "activity"}, + {SUBJ_APP_STATS, "app-stats"}, + {SUBJ_STATE_CALL, "call"}, + {SUBJ_STATE_CONTACTS, "contacts"}, + // {SUBJ_CUSTOM, ""}, + {SUBJ_STATE_EMAIL, "email"}, + {SUBJ_PLACE_GEOFENCE, "geofence"}, + {SUBJ_STATE_HEADPHONE, "headphone"}, + {SUBJ_MEDIA_LOGGER, "media-stats"}, + {SUBJ_MUSIC_STATS, "media-stats"}, + {SUBJ_VIDEO_STATS, "media-stats"}, + {SUBJ_STATE_MESSAGE, "message"}, + {SUBJ_PLACE_DETECTION, "my-place"}, + {SUBJ_SOCIAL_STATS, "social-stats"}, + {SUBJ_STATE_BATTERY, "system"}, + {SUBJ_STATE_CHARGER, "system"}, + {SUBJ_STATE_USB, "system"}, + {SUBJ_STATE_GPS, "system"}, + {SUBJ_STATE_PSMODE, "system"}, + {SUBJ_STATE_ALARM, "time"}, + {SUBJ_STATE_TIME, "time"}, + {SUBJ_STATE_WIFI, "wifi"} +}; + +const struct { + const char *subject; + int operation; + const char *attribute; + const char *option; +} triggerTemplateList[] = { + { + SUBJ_ACTIVITY, + OPS_SUBSCRIBE, + "{\"Event\":{\"type\":\"string\", \"values\":[\"Detected\"]}}", + "{\"Accuracy\":{\"type\":\"string\", \"values\":[\"Low\", \"Normal\", \"High\"]}}" + }, + { + SUBJ_APP_FREQUENCY, + OPS_READ, + "{" TRIG_DEF_RANK "," TRIG_DEF_TOTAL_COUNT "}", + "{" + "\"AppId\":{\"type\":\"string\"}," + TRIG_DEF_TIME_OF_DAY "," TRIG_DEF_DAY_OF_WEEK + "}" + }, + { + SUBJ_STATE_CALL, + OPS_SUBSCRIBE | OPS_READ, + /* TODO remove Connecting, Connected */ + "{" + "\"Medium\":{\"type\":\"string\",\"values\":[\"Voice\",\"Video\"]}," + "\"State\":{\"type\":\"string\",\"values\":[\"Idle\",\"Connecting\",\"Connected\"]}," + "\"Address\":{\"type\":\"string\"}" + "}", + NULL + }, + { + SUBJ_STATE_CONTACTS, + OPS_SUBSCRIBE, + "{" + "\"Event\":{\"type\":\"string\",\"values\":[\"Changed\"]}," + "\"Type\":{\"type\":\"string\",\"values\":[\"MyProfile\",\"Person\"]}" + "}", + NULL + }, + { + SUBJ_STATE_EMAIL, + OPS_SUBSCRIBE, + "{" + "\"Event\":{\"type\":\"string\",\"values\":[\"Received\",\"Sent\"]}" + "}", + NULL + }, + { + SUBJ_PLACE_GEOFENCE, + OPS_SUBSCRIBE, + "{" + "\"Event\":{\"type\":\"string\",\"values\":[\"In\",\"Out\"]}" + "}", + "{" + "\"PlaceId\":{\"type\":\"integer\",\"min\":1}" + "}" + }, + { + SUBJ_STATE_HEADPHONE, + OPS_SUBSCRIBE | OPS_READ, + "{" + TRIG_BOOL_ITEM_DEF("IsConnected") "," + "\"Type\":{\"type\":\"string\",\"values\":[\"Normal\",\"Headset\",\"Bluetooth\"]}" + "}", + NULL + }, + { + SUBJ_MUSIC_FREQUENCY, + OPS_READ, + "{" TRIG_DEF_TOTAL_COUNT "}", + "{" TRIG_DEF_TIME_OF_DAY "," TRIG_DEF_DAY_OF_WEEK "}" + }, + { + SUBJ_VIDEO_FREQUENCY, + OPS_READ, + "{" TRIG_DEF_TOTAL_COUNT "}", + "{" TRIG_DEF_TIME_OF_DAY "," TRIG_DEF_DAY_OF_WEEK "}" + }, + { + SUBJ_STATE_MESSAGE, + OPS_SUBSCRIBE, + "{" + "\"Event\":{\"type\":\"string\",\"values\":[\"Received\"]}," + "\"Type\":{\"type\":\"string\",\"values\":[\"SMS\",\"MMS\"]}," + "\"Address\":{\"type\":\"string\"}" + "}", + NULL + }, + { + SUBJ_SOCIAL_FREQUENCY, + OPS_READ, + "{" TRIG_DEF_RANK "," TRIG_DEF_TOTAL_COUNT "}", + "{" + "\"Address\":{\"type\":\"string\"}," + TRIG_DEF_TIME_OF_DAY "," TRIG_DEF_DAY_OF_WEEK + "}" + }, + { + SUBJ_STATE_BATTERY, + OPS_SUBSCRIBE | OPS_READ, + "{" + "\"Level\":{\"type\":\"string\",\"values\":[\"Empty\",\"Critical\",\"Low\",\"Normal\",\"High\",\"Full\"]}," + TRIG_BOOL_ITEM_DEF("IsCharging") + "}", + NULL + }, + { + SUBJ_STATE_CHARGER, + OPS_SUBSCRIBE | OPS_READ, + "{" TRIG_BOOL_ITEM_DEF("IsConnected") "}", + NULL + }, + { + SUBJ_STATE_GPS, + OPS_SUBSCRIBE | OPS_READ, + "{" + "\"State\":{\"type\":\"string\",\"values\":[\"Disabled\",\"Searching\",\"Connected\"]}" + "}", + NULL + }, + { + SUBJ_STATE_PSMODE, + OPS_SUBSCRIBE | OPS_READ, + "{" TRIG_BOOL_ITEM_DEF("IsEnabled") "}", + NULL + }, + { + SUBJ_STATE_USB, + OPS_SUBSCRIBE | OPS_READ, + "{" TRIG_BOOL_ITEM_DEF("IsConnected") "}", + NULL + }, + { + SUBJ_STATE_ALARM, + OPS_SUBSCRIBE, + "{" + "\"TimeOfDay\":{\"type\":\"integer\",\"min\":0,\"max\":1439}," + "\"DayOfWeek\":{\"type\":\"string\",\"values\":[\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\",\"Sun\",\"Weekday\",\"Weekend\"]}" + "}", + NULL + }, + { + SUBJ_STATE_TIME, + OPS_READ, + "{" + "\"TimeOfDay\":{\"type\":\"integer\",\"min\":0,\"max\":1439}," + "\"DayOfWeek\":{\"type\":\"string\",\"values\":[\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\",\"Sun\",\"Weekday\",\"Weekend\"]}," + "\"DayOfMonth\":{\"type\":\"integer\",\"min\":1,\"max\":31}" + "}", + NULL + } +}; + +#endif /* _CONTEXT_PROVIDER_TYPES_H_ */ diff --git a/include/ProviderTypes.h b/include/ProviderTypes.h new file mode 100644 index 0000000..2ab4a96 --- /dev/null +++ b/include/ProviderTypes.h @@ -0,0 +1,185 @@ +/* + * 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_PROVIDER_TYPES_H_ +#define _CONTEXT_PROVIDER_TYPES_H_ + + +/* Privileges */ +#define PRIV_ALARM "alarm.set" +#define PRIV_NETWORK "network.get" +#define PRIV_TELEPHONY "telephony" +#define PRIV_MESSAGE "message.read" +#define PRIV_CONTACT "contact.read" +#define PRIV_LOCATION "location" +#define PRIV_APP_HISTORY "apphistory.read" +#define PRIV_MEDIA_HISTORY "mediahistory.read" +#define PRIV_CALL_HISTORY "callhistory.read" + + +/* FW-wide Data Logger Parameters */ +#define LOG_RETENTION_PERIOD 7776000 /* 90 days in secs */ + + +/* FW-wide Default Values */ +#define DEFAULT_TIMESPAN 30 +#define DEFAULT_LIMIT 10 + + +/* Subjects */ +/* TODO: Cleanup the below namings */ +#define SUBJ_STATE_BATTERY "system/battery" +#define SUBJ_STATE_CHARGER "system/charger" +#define SUBJ_STATE_HEADPHONE "system/headphone" +#define SUBJ_STATE_WIFI "system/wifi" +#define SUBJ_STATE_USB "system/usb" +#define SUBJ_STATE_GPS "system/gps" +#define SUBJ_STATE_PSMODE "system/psmode" +#define SUBJ_STATE_ALARM "device/alarm" +#define SUBJ_STATE_TIME "device/time" + +#define SUBJ_STATE_CALL "social/call" +#define SUBJ_STATE_EMAIL "social/email" +#define SUBJ_STATE_MESSAGE "social/message" +#define SUBJ_STATE_CONTACTS "social/contacts" + +#define SUBJ_ACTIVITY "activity/" +#define SUBJ_ACTIVITY_IN_VEHICLE SUBJ_ACTIVITY "in_vehicle" +#define SUBJ_ACTIVITY_RUNNING SUBJ_ACTIVITY "running" +#define SUBJ_ACTIVITY_STATIONARY SUBJ_ACTIVITY "stationary" +#define SUBJ_ACTIVITY_WALKING SUBJ_ACTIVITY "walking" + +#define SUBJ_APP_STATS "stats/app/" +#define SUBJ_APP_LOGGER SUBJ_APP_STATS "logger" +#define SUBJ_APP_RECENTLY_USED SUBJ_APP_STATS "recently" +#define SUBJ_APP_FREQUENTLY_USED SUBJ_APP_STATS "often" +#define SUBJ_APP_RARELY_USED SUBJ_APP_STATS "rarely" +#define SUBJ_APP_PEAK_TIME SUBJ_APP_STATS "peak_time" +#define SUBJ_APP_COMMON_SETTING SUBJ_APP_STATS "setting" +#define SUBJ_APP_FREQUENCY SUBJ_APP_STATS "frequency" + +#define SUBJ_MEDIA_LOGGER "stats/media/logger" +#define SUBJ_MUSIC_STATS "stats/music/" +#define SUBJ_MUSIC_PEAK_TIME SUBJ_MUSIC_STATS "peak_time" +#define SUBJ_MUSIC_COMMON_SETTING SUBJ_MUSIC_STATS "setting" +#define SUBJ_MUSIC_FREQUENCY SUBJ_MUSIC_STATS "frequency" +#define SUBJ_VIDEO_STATS "stats/video/" +#define SUBJ_VIDEO_PEAK_TIME SUBJ_VIDEO_STATS "peak_time" +#define SUBJ_VIDEO_COMMON_SETTING SUBJ_VIDEO_STATS "setting" +#define SUBJ_VIDEO_FREQUENCY SUBJ_VIDEO_STATS "frequency" + +#define SUBJ_SOCIAL_STATS "stats/contact/" +#define SUBJ_SOCIAL_LOGGER SUBJ_SOCIAL_STATS "logger" +#define SUBJ_SOCIAL_FREQ_ADDRESS SUBJ_SOCIAL_STATS "often" +#define SUBJ_SOCIAL_FREQUENCY SUBJ_SOCIAL_STATS "frequency" + +#define SUBJ_PLACE_GEOFENCE "place/geofence" +#define SUBJ_PLACE_DETECTION "place/pattern/personal_poi" + +/* Data & Option Keys */ +#define KEY_QUERY_RESULT "QueryResult" +#define KEY_RESULT_SIZE "ResultSize" +#define KEY_COL_ROW_ID "rowId" +#define KEY_TIMESPAN "TimeSpan" +#define KEY_START_TIME "StartTime" +#define KEY_END_TIME "EndTime" +#define KEY_LAST_TIME "LastTime" +#define KEY_TOTAL_COUNT "TotalCount" +#define KEY_AVERAGE_COUNT "AvgCount" +#define KEY_DURATION "Duration" +#define KEY_TOTAL_DURATION "TotalDuration" +#define KEY_DAY_OF_WEEK "DayOfWeek" +#define KEY_HOUR_OF_DAY "HourOfDay" +#define KEY_TIME_OF_DAY "TimeOfDay" +#define KEY_TOTAL_COUNT "TotalCount" +#define KEY_APP_ID "AppId" +#define KEY_PKG_ID "PkgId" +#define KEY_AUDIO_JACK "AudioJack" +#define KEY_SYSTEM_VOLUME "SystemVolume" +#define KEY_MEDIA_VOLUME "MediaVolume" +#define KEY_BSSID "BSSID" +#define KEY_UNIV_TIME "UTC" +#define KEY_LOCAL_TIME "LocalTime" +#define KEY_RANK "Rank" + +#define KEY_EVENT "Event" +#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 KEY_IS_CONNECTED "IsConnected" +#define KEY_IS_ENABLED "IsEnabled" +#define KEY_IS_CHARGING "IsCharging" +#define KEY_DETECTED "Detected" +#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_TRUE 1 +#define VAL_FALSE 0 +#define VAL_ENTER "Enter" +#define VAL_EXIT "Exit" +#define VAL_DISABLED "Disabled" +#define VAL_CONNECTED "Connected" +#define VAL_UNCONNECTED "Unconnected" +#define VAL_SEARCHING "Searching" +#define VAL_EMPTY "Empty" +#define VAL_CRITICAL "Critical" +#define VAL_LOW "Low" +#define VAL_NORMAL "Normal" +#define VAL_HIGH "High" +#define VAL_FULL "Full" +#define VAL_HEADSET "Headset" +#define VAL_BLUETOOTH "Bluetooth" +#define VAL_IDLE "Idle" +#define VAL_CONNECTING "Connecting" +#define VAL_CONNECTED "Connected" +#define VAL_HELD "Held" +#define VAL_DIALING "Dialing" +#define VAL_VOICE "Voice" +#define VAL_VIDEO "Video" +#define VAL_SENT "Sent" +#define VAL_RECEIVED "Received" +#define VAL_SMS "SMS" +#define VAL_MMS "MMS" +#define VAL_MY_PROFILE "MyProfile" +#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 +#define VAL_INCOMING VAL_CONNECTING + + +/* Json Formats */ +#define TRIG_DEF_RANK "\"Rank\":{\"type\":\"integer\",\"min\":1}" +#define TRIG_DEF_TOTAL_COUNT "\"TotalCount\":{\"type\":\"integer\",\"min\":0}" +#define TRIG_DEF_TIME_OF_DAY "\"TimeOfDay\":{\"type\":\"string\"}" +#define TRIG_DEF_DAY_OF_WEEK "\"DayOfWeek\":{\"type\":\"string\",\"values\":[\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\",\"Sun\",\"Weekday\",\"Weekend\"]}" +#define TRIG_BOOL_ITEM_DEF(sbj) "\"" sbj "\":{\"type\":\"integer\",\"min\":0,\"max\":1}" + + +#endif /* _CONTEXT_PROVIDER_TYPES_H_ */ diff --git a/packaging/context-provider.spec b/packaging/context-provider.spec index cd48f58..4f97ae2 100644 --- a/packaging/context-provider.spec +++ b/packaging/context-provider.spec @@ -91,3 +91,15 @@ cp LICENSE %{buildroot}/usr/share/license/%{name} /usr/share/license/%{name} %{_libdir}/*.so* %{_libdir}/context/*.so* + +%package devel +Summary: Context Provider Shared Header (Development) +Group: Service/Context +Requires: %{name} = %{version}-%{release} + +%description devel +Context Provider Shared Header (DEV) + +%files devel +%defattr(-,root,root,-) +%{_includedir}/context-service/internal/*.h diff --git a/src/app-stats/AppStatisticsTypes.h b/src/app-stats/AppStatisticsTypes.h index f2ed478..2169d04 100644 --- a/src/app-stats/AppStatisticsTypes.h +++ b/src/app-stats/AppStatisticsTypes.h @@ -17,16 +17,16 @@ #ifndef _CONTEXT_STATS_APP_TYPES_H_ #define _CONTEXT_STATS_APP_TYPES_H_ -#include "../shared/ProviderTypes.h" +#include -#define APP_HISTORY_PRIV "apphistory.read" -#define APP_SUBJ_LOGGER "stats/app/logger" -#define APP_SUBJ_RECENTLY_USED "stats/app/recently" -#define APP_SUBJ_FREQUENTLY_USED "stats/app/often" -#define APP_SUBJ_RARELY_USED "stats/app/rarely" -#define APP_SUBJ_PEAK_TIME "stats/app/peak_time" -#define APP_SUBJ_COMMON_SETTING "stats/app/setting" -#define APP_SUBJ_FREQUENCY "stats/app/frequency" +#define APP_HISTORY_PRIV PRIV_APP_HISTORY +#define APP_SUBJ_LOGGER SUBJ_APP_LOGGER +#define APP_SUBJ_RECENTLY_USED SUBJ_APP_RECENTLY_USED +#define APP_SUBJ_FREQUENTLY_USED SUBJ_APP_FREQUENTLY_USED +#define APP_SUBJ_RARELY_USED SUBJ_APP_RARELY_USED +#define APP_SUBJ_PEAK_TIME SUBJ_APP_PEAK_TIME +#define APP_SUBJ_COMMON_SETTING SUBJ_APP_COMMON_SETTING +#define APP_SUBJ_FREQUENCY SUBJ_APP_FREQUENCY #define APP_TABLE_REMOVABLE_APP "Log_RemovableApp" #define APP_TABLE_REMOVABLE_APP_COLUMNS \ diff --git a/src/media-stats/MediaStatisticsTypes.h b/src/media-stats/MediaStatisticsTypes.h index e0e0700..a2fac9b 100644 --- a/src/media-stats/MediaStatisticsTypes.h +++ b/src/media-stats/MediaStatisticsTypes.h @@ -17,16 +17,16 @@ #ifndef _CONTEXT_STATS_MEDIA_TYPES_H_ #define _CONTEXT_STATS_MEDIA_TYPES_H_ -#include "../shared/ProviderTypes.h" - -#define MEDIA_HISTORY_PRIV "mediahistory.read" -#define MEDIA_SUBJ_LOGGER "stats/media/logger" -#define MEDIA_SUBJ_PEAK_TIME_FOR_MUSIC "stats/music/peak_time" -#define MEDIA_SUBJ_PEAK_TIME_FOR_VIDEO "stats/video/peak_time" -#define MEDIA_SUBJ_COMMON_SETTING_FOR_MUSIC "stats/music/setting" -#define MEDIA_SUBJ_COMMON_SETTING_FOR_VIDEO "stats/video/setting" -#define MEDIA_SUBJ_MUSIC_FREQUENCY "stats/music/frequency" -#define MEDIA_SUBJ_VIDEO_FREQUENCY "stats/video/frequency" +#include + +#define MEDIA_HISTORY_PRIV PRIV_MEDIA_HISTORY +#define MEDIA_SUBJ_LOGGER SUBJ_MEDIA_LOGGER +#define MEDIA_SUBJ_PEAK_TIME_FOR_MUSIC SUBJ_MUSIC_PEAK_TIME +#define MEDIA_SUBJ_PEAK_TIME_FOR_VIDEO SUBJ_VIDEO_PEAK_TIME +#define MEDIA_SUBJ_COMMON_SETTING_FOR_MUSIC SUBJ_MUSIC_COMMON_SETTING +#define MEDIA_SUBJ_COMMON_SETTING_FOR_VIDEO SUBJ_VIDEO_COMMON_SETTING +#define MEDIA_SUBJ_MUSIC_FREQUENCY SUBJ_MUSIC_FREQUENCY +#define MEDIA_SUBJ_VIDEO_FREQUENCY SUBJ_VIDEO_FREQUENCY #define MEDIA_TABLE_NAME "Log_MediaPlayback" #define MEDIA_TABLE_COLUMNS \ diff --git a/src/my-place/place_recognition_types.h b/src/my-place/place_recognition_types.h index 5a645e4..fcde0a7 100644 --- a/src/my-place/place_recognition_types.h +++ b/src/my-place/place_recognition_types.h @@ -17,8 +17,10 @@ #ifndef _CONTEXT_PLACE_RECOGNITION_TYPES_ #define _CONTEXT_PLACE_RECOGNITION_TYPES_ +#include + // Context Items -#define PLACE_SUBJ_RECOGNITION "place/pattern/personal_poi" +#define PLACE_SUBJ_RECOGNITION SUBJ_PLACE_DETECTION #define PLACE_PRIV_RECOGNITION "location" diff --git a/src/shared/DbHandleBase.cpp b/src/shared/DbHandleBase.cpp index 846265d..074a7ac 100644 --- a/src/shared/DbHandleBase.cpp +++ b/src/shared/DbHandleBase.cpp @@ -16,7 +16,7 @@ #include #include -#include "ProviderTypes.h" +#include #include "DbHandleBase.h" #define DAY_OF_WEEK(SECOND) "CAST(strftime('%w', " SECOND ", 'unixepoch') AS INTEGER)" diff --git a/src/shared/ProviderTypes.h b/src/shared/ProviderTypes.h deleted file mode 100644 index f5d0bac..0000000 --- a/src/shared/ProviderTypes.h +++ /dev/null @@ -1,155 +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_PROVIDER_TYPES_H_ -#define _CONTEXT_PROVIDER_TYPES_H_ - - -/* Privileges */ -#define PRIV_ALARM "alarm.set" -#define PRIV_NETWORK "network.get" -#define PRIV_TELEPHONY "telephony" -#define PRIV_MESSAGE "message.read" -#define PRIV_CONTACT "contact.read" -#define PRIV_LOCATION "location" - - -/* FW-wide Data Logger Parameters */ -#define LOG_RETENTION_PERIOD 7776000 /* 90 days in secs */ - - -/* FW-wide Default Values */ -#define DEFAULT_TIMESPAN 30 -#define DEFAULT_LIMIT 10 - - -/* Subjects */ -#define SUBJ_STATE_BATTERY "system/battery" -#define SUBJ_STATE_CHARGER "system/charger" -#define SUBJ_STATE_HEADPHONE "system/headphone" -#define SUBJ_STATE_WIFI "system/wifi" -#define SUBJ_STATE_USB "system/usb" -#define SUBJ_STATE_GPS "system/gps" -#define SUBJ_STATE_PSMODE "system/psmode" -#define SUBJ_STATE_ALARM "device/alarm" -#define SUBJ_STATE_TIME "device/time" - -#define SUBJ_STATE_CALL "social/call" -#define SUBJ_STATE_EMAIL "social/email" -#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" - -#define SUBJ_PLACE_GEOFENCE "place/geofence" - -/* Data & Option Keys */ -#define KEY_QUERY_RESULT "QueryResult" -#define KEY_RESULT_SIZE "ResultSize" -#define KEY_COL_ROW_ID "rowId" -#define KEY_TIMESPAN "TimeSpan" -#define KEY_START_TIME "StartTime" -#define KEY_END_TIME "EndTime" -#define KEY_LAST_TIME "LastTime" -#define KEY_TOTAL_COUNT "TotalCount" -#define KEY_AVERAGE_COUNT "AvgCount" -#define KEY_DURATION "Duration" -#define KEY_TOTAL_DURATION "TotalDuration" -#define KEY_DAY_OF_WEEK "DayOfWeek" -#define KEY_HOUR_OF_DAY "HourOfDay" -#define KEY_TIME_OF_DAY "TimeOfDay" -#define KEY_TOTAL_COUNT "TotalCount" -#define KEY_APP_ID "AppId" -#define KEY_PKG_ID "PkgId" -#define KEY_AUDIO_JACK "AudioJack" -#define KEY_SYSTEM_VOLUME "SystemVolume" -#define KEY_MEDIA_VOLUME "MediaVolume" -#define KEY_BSSID "BSSID" -#define KEY_UNIV_TIME "UTC" -#define KEY_LOCAL_TIME "LocalTime" -#define KEY_RANK "Rank" - -#define KEY_EVENT "Event" -#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 KEY_IS_CONNECTED "IsConnected" -#define KEY_IS_ENABLED "IsEnabled" -#define KEY_IS_CHARGING "IsCharging" -#define KEY_DETECTED "Detected" -#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_TRUE 1 -#define VAL_FALSE 0 -#define VAL_ENTER "Enter" -#define VAL_EXIT "Exit" -#define VAL_DISABLED "Disabled" -#define VAL_CONNECTED "Connected" -#define VAL_UNCONNECTED "Unconnected" -#define VAL_SEARCHING "Searching" -#define VAL_EMPTY "Empty" -#define VAL_CRITICAL "Critical" -#define VAL_LOW "Low" -#define VAL_NORMAL "Normal" -#define VAL_HIGH "High" -#define VAL_FULL "Full" -#define VAL_HEADSET "Headset" -#define VAL_BLUETOOTH "Bluetooth" -#define VAL_IDLE "Idle" -#define VAL_CONNECTING "Connecting" -#define VAL_CONNECTED "Connected" -#define VAL_HELD "Held" -#define VAL_DIALING "Dialing" -#define VAL_VOICE "Voice" -#define VAL_VIDEO "Video" -#define VAL_SENT "Sent" -#define VAL_RECEIVED "Received" -#define VAL_SMS "SMS" -#define VAL_MMS "MMS" -#define VAL_MY_PROFILE "MyProfile" -#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 -#define VAL_INCOMING VAL_CONNECTING - - -/* Json Formats */ -#define TRIG_DEF_RANK "\"Rank\":{\"type\":\"integer\",\"min\":1}" -#define TRIG_DEF_TOTAL_COUNT "\"TotalCount\":{\"type\":\"integer\",\"min\":0}" -#define TRIG_DEF_TIME_OF_DAY "\"TimeOfDay\":{\"type\":\"string\"}" -#define TRIG_DEF_DAY_OF_WEEK "\"DayOfWeek\":{\"type\":\"string\",\"values\":[\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\",\"Sun\",\"Weekday\",\"Weekend\"]}" -#define TRIG_BOOL_ITEM_DEF(sbj) "\"" sbj "\":{\"type\":\"integer\",\"min\":0,\"max\":1}" - - -#endif /* _CONTEXT_PROVIDER_TYPES_H_ */ diff --git a/src/social-stats/SocialStatisticsTypes.h b/src/social-stats/SocialStatisticsTypes.h index 845f577..cbe852d 100644 --- a/src/social-stats/SocialStatisticsTypes.h +++ b/src/social-stats/SocialStatisticsTypes.h @@ -17,12 +17,12 @@ #ifndef _CONTEXT_STATS_SOCIAL_TYPES_H_ #define _CONTEXT_STATS_SOCIAL_TYPES_H_ -#include "../shared/ProviderTypes.h" +#include -#define SOCIAL_HISTORY_PRIV "callhistory.read" -#define SOCIAL_SUBJ_LOGGER "stats/contact/logger" -#define SOCIAL_SUBJ_FREQ_ADDRESS "stats/contact/often" -#define SOCIAL_SUBJ_FREQUENCY "stats/contact/frequency" +#define SOCIAL_HISTORY_PRIV PRIV_CALL_HISTORY +#define SOCIAL_SUBJ_LOGGER SUBJ_SOCIAL_LOGGER +#define SOCIAL_SUBJ_FREQ_ADDRESS SUBJ_SOCIAL_FREQ_ADDRESS +#define SOCIAL_SUBJ_FREQUENCY SUBJ_SOCIAL_FREQUENCY #define SOCIAL_TABLE_CONTACT_LOG "Log_Contact" #define SOCIAL_TABLE_CONTACT_LOG_COLUMNS \