[Verification] Code compiles without errors.
tizen.callhistory is visible.
Change-Id: I15dd2a5c48d90c77a607aa1a0453be4ac26e59a3
Signed-off-by: Tomasz Marciniak <t.marciniak@samsung.com>
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xrandr)
BuildRequires: python
-
+BuildRequires: pkgconfig(tapi)
+BuildRequires: pkgconfig(libpcrecpp)
+BuildRequires: pkgconfig(contacts-service2)
%if 0%{?tizen_feature_badge_support}
BuildRequires: pkgconfig(badge)
--- /dev/null
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "callhistory.h"
+
+namespace extension {
+namespace callhistory {
+
+CallHistory::CallHistory()
+{
+}
+
+CallHistory::~CallHistory()
+{
+}
+
+CallHistory* CallHistory::getInstance(){
+ static CallHistory instance;
+ return &instance;
+}
+
+void CallHistory::find()
+{
+
+}
+
+void CallHistory::remove()
+{
+
+}
+
+void CallHistory::removeBatch()
+{
+
+}
+
+void CallHistory::removeAll()
+{
+
+}
+
+long CallHistory::addChangeListener()
+{
+
+}
+
+void CallHistory::removeChangeListener()
+{
+
+}
+
+} // namespace callhistory
+} // namespace extension
--- /dev/null
+{
+ 'includes':[
+ '../common/common.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'tizen_callhistory',
+ 'type': 'loadable_module',
+ 'sources': [
+ 'callhistory_api.js',
+ 'callhistory.cc',
+ 'callhistory.h',
+ 'callhistory_extension.cc',
+ 'callhistory_extension.h',
+ 'callhistory_instance.cc',
+ 'callhistory_instance.h',
+ 'callhistory_utils.cc',
+ 'callhistory_utils.h',
+ ],
+ 'includes': [
+ '../common/pkg-config.gypi',
+ ],
+ 'conditions': [
+ ['tizen == 1', {
+ 'variables': {
+ 'packages': [
+ 'glib-2.0',
+ 'contacts-service2',
+ 'libpcrecpp',
+ 'tapi',
+ ]
+ },
+ }],
+ ],
+ },
+ ],
+}
\ No newline at end of file
--- /dev/null
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CALLHISTORY_CALLHISTORY_H_
+#define CALLHISTORY_CALLHISTORY_H_
+
+namespace extension {
+namespace callhistory {
+
+class CallHistory
+{
+public:
+ static CallHistory* getInstance();
+
+ void find();
+ void remove();
+ void removeBatch();
+ void removeAll();
+ long addChangeListener();
+ void removeChangeListener();
+
+private:
+ CallHistory();
+ virtual ~CallHistory();
+
+};
+
+} // namespace callhistory
+} // namespace extension
+
+#endif // CALLHISTORY_CALLHISTORY_H_
--- /dev/null
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var Common = function() {
+function _getException(type, msg) {
+ return new WebAPIException(type, msg || 'Unexpected exception');
+}
+
+function _getTypeMismatch(msg) {
+ return _getException(WebAPIException.TYPE_MISMATCH_ERR,
+ msg || 'Provided arguments are not valid.');
+}
+
+function _throwTypeMismatch(msg) {
+ throw _getTypeMismatch(msg);
+}
+
+var _type = xwalk.utils.type;
+var _converter = xwalk.utils.converter;
+var _validator = xwalk.utils.validator;
+
+function Common() {}
+
+function _prepareRequest(module, method, args) {
+ var request = {
+ module : module
+ };
+ request.data = {
+ method : method,
+ args : args
+ };
+ return request;
+}
+
+Common.prototype.getCallSync = function (msg) {
+ var ret = extension.internal.sendSyncMessage(JSON.stringify(msg));
+ var obj = JSON.parse(ret);
+ if (obj.error) {
+ throwException_(obj.error);
+ }
+
+ return obj.result;
+};
+
+Common.prototype.getCall = function (module) {
+ return function _call(method, args, callback) {
+ return JSON.parse(native.call(_prepareRequest(module, method, args), function (result) {
+ if (typeof callback === 'function') {
+ callback(JSON.parse(result));
+ }
+ }));
+ };
+};
+
+Common.prototype.isSuccess = function (result) {
+ return (result.status !== 'error');
+};
+
+Common.prototype.isFailure = function (result) {
+ return !this.isSuccess(result);
+};
+
+Common.prototype.getErrorObject = function (result) {
+ return new WebAPIException(result.error);
+};
+
+Common.prototype.getResultObject = function (result) {
+ return result.result;
+};
+
+Common.prototype.callIfPossible = function(callback) {
+ if (!_type.isNullOrUndefined(callback)) {
+ callback.apply(callback, [].slice.call(arguments, 1));
+ }
+};
+
+Common.prototype.getTypeMismatch = function(msg) {
+ _getTypeMismatch(msg);
+};
+
+Common.prototype.throwTypeMismatch = function(msg) {
+ _throwTypeMismatch(msg);
+};
+
+Common.prototype.getInvalidValues = function(msg) {
+ return _getException('InvalidValuesError',
+ msg || 'There\'s a problem with input value.');
+};
+
+Common.prototype.throwInvalidValues = function(msg) {
+ throw this.getInvalidValues(msg);
+};
+
+Common.prototype.getIOError = function (msg) {
+ return _getException('IOError', msg || 'Unexpected IO error.');
+};
+
+Common.prototype.throwIOError = function (msg) {
+ throw this.getIOError(msg);
+};
+
+Common.prototype.getNotSupported = function (msg) {
+ return _getException(WebAPIException.NOT_SUPPORTED_ERR, msg || 'Not supported.');
+};
+
+Common.prototype.throwNotSupported = function (msg) {
+ throw this.getNotSupported(msg);
+};
+
+Common.prototype.getNotFound = function (msg) {
+ return _getException('NotFoundError', msg || 'Not found.');
+};
+
+Common.prototype.throwNotFound = function (msg) {
+ throw this.getNotFound(msg);
+};
+
+Common.prototype.getUnknownError = function (msg) {
+ return _getException('UnknownError', msg || 'Unknown error.');
+};
+
+Common.prototype.throwUnknownError = function (msg) {
+ throw this.getUnknownError(msg);
+};
+
+Common.prototype.throwTypeMismatch = function(msg) {
+ _throwTypeMismatch(msg);
+};
+
+Common.prototype.sort = function (arr, sortMode) {
+ var _getSortProperty = function (obj, props) {
+ for (var i = 0; i < props.length; ++i) {
+ if (!obj.hasOwnProperty(props[i])) {
+ return null;
+ }
+ obj = obj[props[i]];
+ }
+ return obj;
+ };
+
+ if (sortMode instanceof tizen.SortMode) {
+ var props = sortMode.attributeName.split('.');
+ arr.sort(function (a, b) {
+ var aValue = _getSortProperty(a, props);
+ var bValue = _getSortProperty(b, props);
+
+ if (sortMode.order === 'DESC') {
+ return aValue < bValue;
+ }
+ return bValue < aValue;
+ });
+ }
+ return arr;
+};
+
+Common.prototype.filter = function (arr, filter) {
+ if (_type.isNullOrUndefined(arr))
+ return arr;
+ if (filter instanceof tizen.AttributeFilter ||
+ filter instanceof tizen.AttributeRangeFilter ||
+ filter instanceof tizen.CompositeFilter) {
+ arr = arr.filter(function(element) {
+ return filter._filter(element);
+ });
+ }
+ return arr;
+};
+
+Common.prototype.repackFilter = function (filter) {
+ if (filter instanceof tizen.AttributeFilter) {
+ return {
+ filterType: "AttributeFilter",
+ attributeName: filter.attributeName,
+ matchFlag: filter.matchFlag,
+ matchValue: filter.matchValue,
+ };
+ }
+ if (filter instanceof tizen.AttributeRangeFilter) {
+ return {
+ filterType: "AttributeRangeFilter",
+ attributeName: filter.attributeName,
+ initialValue: _type.isNullOrUndefined(filter.initialValue) ? null : filter.initialValue,
+ endValue: _type.isNullOrUndefined(filter.endValue) ? null : filter.endValue
+ };
+ }
+ if (filter instanceof tizen.CompositeFilter) {
+ var _f = [];
+ var filters = filter.filters;
+
+ for (var i = 0; i < filters.length; ++i) {
+ _f.push(this.repackFilter(filters[i]));
+ }
+
+ return {
+ filterType: "CompositeFilter",
+ type: filter.type,
+ filters: _f
+ };
+ }
+
+ return null;
+}
+ var _common = new Common();
+
+ return {
+ Type : _type,
+ Converter : _converter,
+ ArgumentValidator : _validator,
+ Common : _common
+ };
+};
+
+var _common = new Common();
+var T = _common.Type;
+var Converter = _common.Converter;
+var AV = _common.ArgumentValidator;
+var C = _common.Common;
+
+var _listeners = {};
+var _nextId = 0;
+
+extension.setMessageListener(function(msg) {
+
+});
+
+function CallHistory() {
+}
+
+CallHistory.prototype.find = function() {
+
+}
+
+CallHistory.prototype.remove = function() {
+
+}
+
+CallHistory.prototype.removeBatch = function() {
+
+}
+
+CallHistory.prototype.removeAll = function() {
+
+}
+
+CallHistory.prototype.addChangeListener = function() {
+
+}
+
+CallHistory.prototype.removeChangeListener = function() {
+
+}
+
+function RemoteParty(data) {
+
+}
+
+function CallHistoryEntry(data) {
+
+}
+
+// Exports
+var CallHistoryObject = new CallHistory();
+
+exports.find = CallHistoryObject.find;
+exports.remove = CallHistoryObject.remove;
+exports.removeBatch = CallHistoryObject.removeBatch;
+exports.removeAll = CallHistoryObject.removeAll;
+exports.addChangeListener = CallHistoryObject.addChangeListener;
+exports.removeChangeListener = CallHistoryObject.removeChangeListener;
--- /dev/null
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "callhistory/callhistory_extension.h"
+#include "callhistory/callhistory_instance.h"
+
+// This will be generated from power_api.js
+extern const char kSource_callhistory_api[];
+
+common::Extension* CreateExtension() {
+ return new CallHistoryExtension;
+}
+
+CallHistoryExtension::CallHistoryExtension() {
+ SetExtensionName("tizen.callhistory");
+ SetJavaScriptAPI(kSource_callhistory_api);
+}
+
+CallHistoryExtension::~CallHistoryExtension() {}
+
+common::Instance* CallHistoryExtension::CreateInstance() {
+ return new extension::callhistory::CallHistoryInstance;
+}
--- /dev/null
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CALLHISTORY_CALLHISTORY_EXTENSION_H_
+#define CALLHISTORY_CALLHISTORY_EXTENSION_H_
+
+#include "common/extension.h"
+
+class CallHistoryExtension : public common::Extension {
+public:
+ CallHistoryExtension();
+ virtual ~CallHistoryExtension();
+
+private:
+ virtual common::Instance* CreateInstance();
+};
+
+#endif // CALLHISTORY_CALLHISTORY_EXTENSION_H_
--- /dev/null
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "callhistory/callhistory_instance.h"
+
+#include "common/picojson.h"
+#include "common/logger.h"
+#include "common/platform_exception.h"
+
+namespace extension {
+namespace callhistory {
+
+namespace {
+// The privileges that required in CallHistory API
+const std::string kPrivilegeCallHistoryRead = "http://tizen.org/privilege/callhistory.read";
+const std::string kPrivilegeCallHistoryWrite = "http://tizen.org/privilege/callhistory.write";
+}
+
+using namespace common;
+
+CallHistoryInstance::CallHistoryInstance() {
+ using namespace std::placeholders;
+#define REGISTER_SYNC(c,x) \
+ RegisterSyncHandler(c, std::bind(&CallHistoryInstance::x, this, _1, _2));
+ REGISTER_SYNC("remove", Remove);
+ REGISTER_SYNC("addChangeListener", AddChangeListener);
+ REGISTER_SYNC("removeChangeListener", RemoveChangeListener);
+#undef REGISTER_SYNC
+#define REGISTER_ASYNC(c,x) \
+ RegisterHandler(c, std::bind(&CallHistoryInstance::x, this, _1, _2));
+ REGISTER_ASYNC("find", Find);
+ REGISTER_ASYNC("removeBatch", RemoveBatch);
+ REGISTER_ASYNC("removeAll", RemoveAll);
+#undef REGISTER_ASYNC
+}
+
+CallHistoryInstance::~CallHistoryInstance() {
+}
+
+void CallHistoryInstance::Find(const picojson::value& args, picojson::object& out) {
+
+}
+
+void CallHistoryInstance::Remove(const picojson::value& args, picojson::object& out) {
+
+}
+
+void CallHistoryInstance::RemoveBatch(const picojson::value& args, picojson::object& out) {
+
+}
+
+void CallHistoryInstance::RemoveAll(const picojson::value& args, picojson::object& out) {
+
+}
+
+void CallHistoryInstance::AddChangeListener(const picojson::value& args, picojson::object& out) {
+
+}
+
+void CallHistoryInstance::RemoveChangeListener(const picojson::value& args, picojson::object& out) {
+
+}
+
+} // namespace callhistory
+} // namespace extension
--- /dev/null
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CALLHISTORY_CALLHISTORY_INSTANCE_H_
+#define CALLHISTORY_CALLHISTORY_INSTANCE_H_
+
+#include "common/extension.h"
+#include "callhistory.h"
+
+namespace extension {
+namespace callhistory {
+
+class CallHistoryInstance : public common::ParsedInstance {
+public:
+ CallHistoryInstance();
+ virtual ~CallHistoryInstance();
+
+private:
+ void Find(const picojson::value& args, picojson::object& out);
+ void Remove(const picojson::value& args, picojson::object& out);
+ void RemoveBatch(const picojson::value& args, picojson::object& out);
+ void RemoveAll(const picojson::value& args, picojson::object& out);
+ void AddChangeListener (const picojson::value& args, picojson::object& out);
+ void RemoveChangeListener(const picojson::value& args, picojson::object& out);
+};
+
+} // namespace callhistory
+} // namespace extension
+
+#endif // CALLHISTORY_CALLHISTORY_INSTANCE_H_
--- /dev/null
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
--- /dev/null
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
'power/power.gyp:*',
'messageport/messageport.gyp:*',
#'calendar/calendar.gyp:*',
+ 'callhistory/callhistory.gyp:*',
'bookmark/bookmark.gyp:*',
#'datasync/datasync.gyp:*',
'contact/contact.gyp:*',