summaryrefslogtreecommitdiff
path: root/lib/details/ct-detail-vibration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/details/ct-detail-vibration.cpp')
-rw-r--r--lib/details/ct-detail-vibration.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/lib/details/ct-detail-vibration.cpp b/lib/details/ct-detail-vibration.cpp
new file mode 100644
index 0000000..cacca96
--- /dev/null
+++ b/lib/details/ct-detail-vibration.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 "ct-detail-vibration.h"
+#include "phone.h"
+#include "phone-common.h"
+#include "phone-text.h"
+
+/**
+ * FIXME: the following paths are not real because we don't have these
+ * vibration patterns yet
+ */
+
+#define CT_VIBRATION_PATH_PREFIX "/opt/share/svi/haptic/default"
+static const char * const CT_VIBRATION_PATH[] =
+{
+ "",
+ CT_VIBRATION_PATH_PREFIX"heartbeat.ivt",
+ CT_VIBRATION_PATH_PREFIX"jinglebell.ivt",
+ CT_VIBRATION_PATH_PREFIX"ticktock.ivt",
+ CT_VIBRATION_PATH_PREFIX"waltz.ivt",
+ CT_VIBRATION_PATH_PREFIX"zigizigzig.ivt"
+};
+
+int ct_detail_vibration_get_msgid(const char *path)
+{
+ PH_TRACE;
+ if(NULL == path || '\0' == *path)
+ {
+ return CTTEXT_VIBRATION_DEFAULT;
+ }
+
+ path = strrchr(path, '/');
+ for(unsigned msgid = CTTEXT_VIBRATION_DEFAULT + 1;
+ msgid < ARRAY_SIZE(CT_VIBRATION_PATH); ++msgid)
+ {
+ if(strcmp(path, strrchr(CT_VIBRATION_PATH[msgid], '/')) == 0)
+ {
+ return msgid;
+ }
+ }
+
+ return CTTEXT_VIBRATION_DEFAULT;
+}
+
+const char * ct_detail_vibration_get_path(int vibration_msgid)
+{
+ PH_TRACE;
+ p_retvm_if(vibration_msgid < 0
+ || vibration_msgid > (int) ARRAY_SIZE(CT_VIBRATION_PATH),
+ NULL, "invalid msgid");
+ return CT_VIBRATION_PATH[vibration_msgid];
+}