[Verification] build test and check on custom web app.
Change-Id: I03e60b2feca4823f9ddeac3649874f42b2c8f913
Signed-off-by: pius.lee <pius.lee@samsung.com>
%define tizen_feature_nbs_support 0
%define tizen_feature_nfc_emulation_support 0
%define tizen_feature_nfc_support 1
-%define tizen_feature_notification_support 0
+%define tizen_feature_notification_support 1
%define tizen_feature_power_support 1
%define tizen_feature_push_support 0
%define tizen_feature_sap_support 0
BuildRequires: pkgconfig(smartcard-service-common)
%endif
+%if 0%{?tizen_feature_notification_support}
+BuildRequires: pkgconfig(notification)
+%endif
+
+
%description
Tizen Web APIs implemented.
--- /dev/null
+{
+ 'includes':[
+ '../common/common.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'tizen_notification',
+ 'type': 'loadable_module',
+ 'sources': [
+ 'notification_api.js',
+ 'notification_extension.cc',
+ 'notification_extension.h',
+ 'notification_instance.cc',
+ 'notification_instance.h'
+ ],
+ 'conditions': [
+ ['tizen == 1', {
+ 'variables': {
+ 'packages': [
+ 'capi-system-device',
+ 'notification',
+ 'vconf',
+ ]
+ },
+ }],
+ ],
+ },
+ ],
+}
--- /dev/null
+/* global tizen, xwalk, extension */
+
+// Copyright 2015 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 validator_ = xwalk.utils.validator;
+var types_ = validator_.Types;
+
+
+function SetReadOnlyProperty(obj, n, v) {
+ Object.defineProperty(obj, n, {'value': v, 'writable': false});
+}
+
+var NotificationType = {
+ 'STATUS': 'STATUS'
+};
+var StatusNotificationType = {
+ 'SIMPLE': 'SIMPLE',
+ 'THUMBNAIL': 'THUMBNAIL',
+ 'ONGOING': 'ONGOING',
+ 'PROGRESS': 'PROGRESS'
+};
+var NotificationProgressType = {
+ 'PERCENTAGE': 'PERCENTAGE',
+ 'BYTE': 'BYTE'
+};
+
+
+function NotificationManager() {
+ // constructor of NotificationManager
+
+}
+
+
+NotificationManager.prototype.post = function(notification) {
+ var args = validator_.validateArgs(arguments, [
+ {'name': 'notification', 'type': types_.PLATFORM_OBJECT, 'values': ['Notification']}
+ ]);
+
+ var nativeParam = notificationToNativeParam(notification);
+
+ var id = notification.id;
+ var type = notification.type;
+ var ptime = notification.postedTime;
+ var title = notification.title;
+ var content = notification.content;
+
+ var nativeParam = {
+ 'type': notification.type,
+ 'title' : notification.title,
+ 'content' : notification.content
+ };
+
+
+ try {
+ var syncResult = callNative('NotificationManager_post', nativeParam);
+ // if you need synchronous result from native function using 'syncResult'.
+ } catch (e) {
+ throw e;
+ }
+
+};
+
+NotificationManager.prototype.update = function(notification) {
+ var args = validator_.validateArgs(arguments, [
+ {'name': 'notification', 'type': types_.PLATFORM_OBJECT, 'values': ['Notification']}
+ ]);
+
+ var nativeParam = {
+ };
+
+
+ try {
+ var syncResult = callNative('NotificationManager_update', nativeParam);
+ // if you need synchronous result from native function using 'syncResult'.
+ } catch (e) {
+ throw e;
+ }
+
+};
+
+NotificationManager.prototype.remove = function(id) {
+ var args = validator_.validateArgs(arguments, [
+ {'name': 'id', 'type': types_.STRING}
+ ]);
+
+ var nativeParam = {
+ 'id': args.id
+ };
+
+
+ try {
+ var syncResult = callNative('NotificationManager_remove', nativeParam);
+ // if you need synchronous result from native function using 'syncResult'.
+ } catch (e) {
+ throw e;
+ }
+
+};
+
+NotificationManager.prototype.removeAll = function() {
+
+ var nativeParam = {
+ };
+
+
+ try {
+ var syncResult = callNative('NotificationManager_removeAll', nativeParam);
+ // if you need synchronous result from native function using 'syncResult'.
+ } catch (e) {
+ throw e;
+ }
+
+};
+
+NotificationManager.prototype.get = function(id) {
+ var args = validator_.validateArgs(arguments, [
+ {'name': 'id', 'type': types_.STRING}
+ ]);
+
+ var nativeParam = {
+ 'id': args.id
+ };
+
+
+ try {
+ var syncResult = callNative('NotificationManager_get', nativeParam);
+ // if you need synchronous result from native function using 'syncResult'.
+ } catch (e) {
+ throw e;
+ }
+
+ var returnObject = new Notification();
+ return returnObject;
+};
+
+NotificationManager.prototype.getAll = function() {
+
+ var nativeParam = {
+ };
+
+
+ try {
+ var syncResult = callNative('NotificationManager_getAll', nativeParam);
+ // if you need synchronous result from native function using 'syncResult'.
+ } catch (e) {
+ throw e;
+ }
+
+ var returnObject = new Notification();
+ return returnObject;
+};
+
+
+
+function Notification() {
+ // constructor of Notification
+
+ SetReadOnlyProperty(this, 'id', null); // read only property
+ SetReadOnlyProperty(this, 'type', null); // read only property
+ SetReadOnlyProperty(this, 'postedTime', null); // read only property
+ this.title = null;
+ this.content = null;
+}
+
+
+function notificationToNativeParam(n) {
+ var i;
+
+ var detailInfo = [];
+ if (n.detailInfo) {
+ for (i in n.detailInfo) {
+ detailInfo[i] = n.detailInfo[i];
+ }
+ }
+ var thumbnails = [];
+ if (n.thumbnails) {
+ for (i in n.thumbnails) {
+ thumbnails[i] = n.thumbnails[i];
+ }
+ }
+
+ var appControl = {};
+ if (n.appControl) {
+ appControl.operation = n.appControl.operation;
+ appControl.uri = n.appControl.uri;
+ appControl.mime = n.appControl.mime;
+ appControl.category = n.appControl.category;
+ appControl.data = [];
+ if (n.appControl.data) {
+ for (i in n.appControl.data) {
+ var values = n.appControl.data[i].value;
+ var key = n.appControl.data[i].key;
+ appControl.data[i] = {
+ 'key': key,
+ 'value': values
+ };
+ }
+ }
+ }
+
+ return {
+ 'statusType': args.statusType,
+ 'title': args.title,
+ 'content': n.content,
+ 'iconPath': n.iconPath,
+ 'soundPath': n.soundPath,
+ 'vibration': n.vibration,
+ 'appControl': appControl,
+ 'appId': n.appId,
+ 'progressType': n.progressType,
+ 'progressValue': n.progressValue,
+ 'number': n.number,
+ 'subIconPath': n.subIconPath,
+ 'detailInfo': detailInfo,
+ 'ledColor': n.ledColor,
+ 'ledOnPeriod': n.ledOnPeriod,
+ 'ledOffPeriod': n.ledOffPeriod,
+ 'backgroundImagePath': n.backgroundImagePath,
+ 'thumbnails': thumbnails
+ };
+}
+
+
+// private constructor
+function StatusNotification(statusType, title, notificationInitDict) {
+ // constructor of StatusNotification
+
+ SetHidedProperty(this, 'id', undefined);
+ SetReadOnlyProperty(this, 'type', 'STATUS');
+ SetHidedProperty(this, 'postedTime', undefined);
+
+ this.title = title;
+ this.content = notificationInitDict.content;
+ SetReadOnlyProperty(this, 'statusType', statusType); // read only property
+ this.iconPath = notificationInitDict.iconPath;
+ this.subIconPath = notificationInitDict.subIconPath;
+ this.number = notificationInitDict.number;
+ this.detailInfo = notificationInitDict.detailInfo;
+ this.ledColor = notificationInitDict.ledColor;
+ this.ledOnPeriod = notificationInitDict.ledOnPeriod;
+ this.ledOffPeriod = notificationInitDict.ledOffPeriod;
+ this.backgroundImagePath = notificationInitDict.backgroundImagePath;
+ this.thumbnails = notificationInitDict.thumbnails;
+ this.soundPath = notificationInitDict.soundPath;
+ this.vibration = notificationInitDict.vibration;
+ this.appControl = notificationInitDict.appControl;
+ this.appId = notificationInitDict.appId;
+ this.progressType = notificationInitDict.progressType;
+ this.progressValue = notificationInitDict.progressValue;
+}
+
+StatusNotification.prototype = new Notification();
+StatusNotification.prototype.constructor = StatusNotification;
+
+
+
+function NotificationDetailInfo(mainText, subText) {
+ // constructor of NotificationDetailInfo
+ var nativeParam = {
+ 'mainText': args.mainText,
+ 'subText': args.subText
+ };
+ var syncResult = callNative('NotificationDetailInfo_constructor', nativeParam);
+
+ this.mainText = mainText;
+ this.subText = subText;
+}
+
+
+
+
+exports = new NotificationManager();
+tizen.StatusNotification = StatusNotification;
+
--- /dev/null
+// Copyright 2015 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 "notification/notification_extension.h"
+
+#include "notification/notification_instance.h"
+
+// This will be generated from notification_api.js
+extern const char kSource_notification_api[];
+
+common::Extension* CreateExtension() {
+ return new NotificationExtension;
+}
+
+NotificationExtension::NotificationExtension() {
+ SetExtensionName("tizen.notification");
+ SetJavaScriptAPI(kSource_notification_api);
+
+ const char* entry_points[] = {
+ "tizen.NotificationManager",
+ "tizen.StatusNotification",
+ NULL
+ };
+ SetExtraJSEntryPoints(entry_points);
+}
+
+NotificationExtension::~NotificationExtension() {}
+
+common::Instance* NotificationExtension::CreateInstance() {
+ return new extension::notification::NotificationInstance;
+}
--- /dev/null
+// Copyright 2015 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 NOTIFICATION_NOTIFICATION_EXTENSION_H_
+#define NOTIFICATION_NOTIFICATION_EXTENSION_H_
+
+#include "common/extension.h"
+
+class NotificationExtension : public common::Extension {
+ public:
+ NotificationExtension();
+ virtual ~NotificationExtension();
+
+ private:
+ virtual common::Instance* CreateInstance();
+};
+
+#endif // NOTIFICATION_NOTIFICATION_EXTENSION_H_
--- /dev/null
+// Copyright 2015 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 "notification/notification_instance.h"
+
+#include <notification.h>
+
+#include <string>
+#include <functional>
+
+#include "common/picojson.h"
+#include "common/logger.h"
+#include "common/platform_exception.h"
+#include "common/typeutil.h"
+
+namespace extension {
+namespace notification {
+
+namespace {
+// The privileges that required in Notification API
+const std::string kPrivilegeNotification = "";
+
+} // namespace
+
+using common::TypeMismatchException;
+
+NotificationInstance::NotificationInstance() {
+ using std::placeholders::_1;
+ using std::placeholders::_2;
+ #define REGISTER_SYNC(c, x) \
+ RegisterSyncHandler(c, std::bind(&NotificationInstance::x, this, _1, _2));
+ REGISTER_SYNC("NotificationManager_get", NotificationManagerGet);
+ REGISTER_SYNC("NotificationManager_update", NotificationManagerUpdate);
+ REGISTER_SYNC("NotificationManager_remove", NotificationManagerRemove);
+ REGISTER_SYNC("NotificationManager_getAll", NotificationManagerGetall);
+ REGISTER_SYNC("NotificationManager_post", NotificationManagerPost);
+ REGISTER_SYNC("NotificationManager_removeAll", NotificationManagerRemoveall);
+ #undef REGISTER_SYNC
+}
+
+NotificationInstance::~NotificationInstance() {
+}
+
+
+
+#define CHECK_EXIST(args, name, out) \
+ if (!args.contains(name)) {\
+ ReportError(TypeMismatchException(name" is required argument"), out);\
+ return;\
+ }
+
+using common::WIDLTypeValidator::WIDLType;
+using common::WIDLTypeValidator::IsType;
+
+void NotificationInstance::NotificationManagerPost(
+ const picojson::value& args, picojson::object& out) {
+ CHECK_EXIST(args, "id", out)
+ CHECK_EXIST(args, "type", out)
+ CHECK_EXIST(args, "title", out)
+
+ bool check;
+ check = IsType<WIDLType::StringType>(args, "id");
+ check = IsType<WIDLType::StringType>(args, "type");
+ check = IsType<WIDLType::StringType>(args, "title");
+
+ notification_type_e noti_type = NOTIFICATION_TYPE_NOTI;
+
+ notification_h noti = notification_create(noti_type);
+}
+void NotificationInstance::NotificationManagerUpdate(
+ const picojson::value& args, picojson::object& out) {
+}
+void NotificationInstance::NotificationManagerRemove(
+ const picojson::value& args, picojson::object& out) {
+}
+void NotificationInstance::NotificationManagerRemoveall(
+ const picojson::value& args, picojson::object& out) {
+}
+void NotificationInstance::NotificationManagerGet(
+ const picojson::value& args, picojson::object& out) {
+}
+void NotificationInstance::NotificationManagerGetall(
+ const picojson::value& args, picojson::object& out) {
+}
+
+
+#undef CHECK_EXIST
+
+} // namespace notification
+} // namespace extension
--- /dev/null
+// Copyright 2015 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 NOTIFICATION_NOTIFICATION_INSTANCE_H_
+#define NOTIFICATION_NOTIFICATION_INSTANCE_H_
+
+#include "common/extension.h"
+
+namespace extension {
+namespace notification {
+
+class NotificationInstance : public common::ParsedInstance {
+ public:
+ NotificationInstance();
+ virtual ~NotificationInstance();
+
+ private:
+ void NotificationManagerGet(
+ const picojson::value& args, picojson::object& out);
+ void NotificationManagerUpdate(
+ const picojson::value& args, picojson::object& out);
+ void NotificationManagerRemove(
+ const picojson::value& args, picojson::object& out);
+ void NotificationManagerGetall(
+ const picojson::value& args, picojson::object& out);
+ void NotificationManagerPost(
+ const picojson::value& args, picojson::object& out);
+ void NotificationManagerRemoveall(
+ const picojson::value& args, picojson::object& out);
+};
+
+} // namespace notification
+} // namespace extension
+
+#endif // NOTIFICATION_NOTIFICATION_INSTANCE_H_
'systeminfo/systeminfo.gyp:*',
#'radio/radio.gyp:*',
'secureelement/secureelement.gyp:*',
+ 'notification/notification.gyp:*',
],
},
], # end mobile