[Exif] Initial commit for Exif API
authorKonrad Zdunczyk <k.zdunczyk@samsung.com>
Tue, 9 Dec 2014 14:37:04 +0000 (15:37 +0100)
committerRafal Galka <r.galka@samsung.com>
Tue, 16 Dec 2014 10:02:05 +0000 (19:02 +0900)
Change-Id: I1ef9e812ff0559387aa8c51965074ba0a87cd04a
Signed-off-by: Konrad Zdunczyk <k.zdunczyk@samsung.com>
src/exif/exif.gyp [new file with mode: 0644]
src/exif/exif_api.js [new file with mode: 0644]
src/exif/exif_extension.cc [new file with mode: 0644]
src/exif/exif_extension.h [new file with mode: 0644]
src/exif/exif_instance.cc [new file with mode: 0644]
src/exif/exif_instance.h [new file with mode: 0644]
src/tizen-wrt.gyp

diff --git a/src/exif/exif.gyp b/src/exif/exif.gyp
new file mode 100644 (file)
index 0000000..e4ea5b2
--- /dev/null
@@ -0,0 +1,26 @@
+{
+  'includes':[
+    '../common/common.gypi',
+  ],
+  'targets': [
+    {
+      'target_name': 'tizen_exif',
+      'type': 'loadable_module',
+      'includes': [
+        '../common/pkg-config.gypi',
+      ],
+      'sources': [
+        'exif_api.js',
+        'exif_extension.cc',
+        'exif_extension.h',
+        'exif_instance.cc',
+        'exif_instance.h',
+      ],
+      'conditions': [
+        [ 'tizen == 1', {
+            'variables': { },
+        }],
+      ],
+    },
+  ],
+}
diff --git a/src/exif/exif_api.js b/src/exif/exif_api.js
new file mode 100644 (file)
index 0000000..5ab1245
--- /dev/null
@@ -0,0 +1,51 @@
+// 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.
+
+function _sendSyncMessage(cmd) {
+  var msg = {
+    'cmd': cmd
+  };
+  return JSON.parse(extension.internal.sendSyncMessage(JSON.stringify(msg)));
+}
+
+function ExifManager() {
+}
+
+ExifManager.prototype.getExifInfo = function(uri, successCallback, errorCallback) {
+  throw 'Not implemented';
+};
+
+ExifManager.prototype.saveExifInfo = function(exifInfo, successCallback, errorCallback) {
+  throw 'Not implemented';
+};
+
+ExifManager.prototype.getThumbnail = function(uri, successCallback, errorCallback) {
+  throw 'Not implemented';
+};
+
+tizen.ExifInformation = function(ExifInitDict) {
+  var uri_;
+  var width_;
+  var height_;
+  var deviceMaker_;
+  var deviceModel_;
+  var originalTime_;
+  var orientation_; //ImageContentOrientation
+  var fNumber_;
+  var isoSpeedRatings_;
+  var exposureTime_;
+  var exposureProgram_; //ExposureProgram
+  var flash_;
+  var focalLength_;
+  var whiteBalance_; //WhiteBalanceMode
+  var gpsLocation_; //SimpleCoordinates
+  var gpsAltitude_;
+  var gpsProcessingMethod_;
+  var gpsTime_; //TZDate
+  var userComment_;
+
+  throw 'Not implemented';
+};
+
+exports = new ExifManager();
diff --git a/src/exif/exif_extension.cc b/src/exif/exif_extension.cc
new file mode 100644 (file)
index 0000000..fa878c1
--- /dev/null
@@ -0,0 +1,35 @@
+// Copyright (c) 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 "exif/exif_extension.h"
+#include "exif/exif_instance.h"
+
+namespace {
+const char kExtensionName[] = "tizen.exif";
+const char kExifInformationEntryPoint[] = "tizen.ExifInformation";
+}
+
+common::Extension* CreateExtension() {
+  return new ExifExtension;
+}
+
+// This will be generated from exif_api.js.
+extern const char kSource_exif_api[];
+
+ExifExtension::ExifExtension() {
+  SetExtensionName(kExtensionName);
+  SetJavaScriptAPI(kSource_exif_api);
+
+  const char* entry_points[] = {
+    kExifInformationEntryPoint,
+    NULL
+  };
+  SetExtraJSEntryPoints(entry_points);
+}
+
+ExifExtension::~ExifExtension() {}
+
+common::Instance* ExifExtension::CreateInstance() {
+  return new extension::exif::ExifInstance;
+}
diff --git a/src/exif/exif_extension.h b/src/exif/exif_extension.h
new file mode 100644 (file)
index 0000000..3afc6ca
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright (c) 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 EXIF_EXIF_EXTENSION_H_
+#define EXIF_EXIF_EXTENSION_H_
+
+#include "common/extension.h"
+
+class ExifExtension : public common::Extension {
+ public:
+  ExifExtension();
+  virtual ~ExifExtension();
+
+ private:
+  // common::Extension implementation.
+  virtual common::Instance* CreateInstance();
+};
+
+#endif  // EXIF_EXIF_EXTENSION_H_
diff --git a/src/exif/exif_instance.cc b/src/exif/exif_instance.cc
new file mode 100644 (file)
index 0000000..798adee
--- /dev/null
@@ -0,0 +1,44 @@
+// Copyright (c) 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 "exif/exif_instance.h"
+
+#include <string>
+
+#include "common/logger.h"
+
+namespace extension {
+namespace exif {
+
+namespace {
+const char kGetExifInfoCmd[] = "Exif_getExifInfo";
+const char kSaveExifInfoCmd[] = "Exif_saveExifInfo";
+const char kGetThumbnailCmd[] = "Exif_getThumbnail";
+}
+
+ExifInstance::ExifInstance() {
+  using namespace std::placeholders;
+  #define REGISTER_SYNC(c,x) \
+    RegisterSyncHandler(c, std::bind(&ExifInstance::x, this, _1, _2));
+  REGISTER_SYNC(kGetExifInfoCmd, getExifInfo);
+  REGISTER_SYNC(kSaveExifInfoCmd, saveExifInfo);
+  REGISTER_SYNC(kGetThumbnailCmd, getThumbnail);
+  #undef REGISTER_SYNC
+}
+
+ExifInstance::~ExifInstance() {}
+
+void ExifInstance::getExifInfo(const picojson::value& args, picojson::object& out) {
+  LoggerE("getExifInfo is not implemented");
+}
+
+void ExifInstance::saveExifInfo(const picojson::value& args, picojson::object& out) {
+  LoggerE("saveExifInfo is not implemented");
+}
+
+void ExifInstance::getThumbnail(const picojson::value& args, picojson::object& out) {
+  LoggerE("getThumbnail is not implemented");
+}
+}  // namespace exif
+}  // namespace extension
diff --git a/src/exif/exif_instance.h b/src/exif/exif_instance.h
new file mode 100644 (file)
index 0000000..3bde59d
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright (c) 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 EXIF_EXIF_INSTANCE_H_
+#define EXIF_EXIF_INSTANCE_H_
+
+#include "common/extension.h"
+#include "common/picojson.h"
+
+namespace extension {
+namespace exif {
+class ExifInstance : public common::ParsedInstance {
+ public:
+  ExifInstance();
+  virtual ~ExifInstance();
+
+ private:
+  void getExifInfo(const picojson::value& args, picojson::object& out);
+  void saveExifInfo(const picojson::value& args, picojson::object& out);
+  void getThumbnail(const picojson::value& args, picojson::object& out);
+};
+}  // namespace exif
+}  // namespace extension
+
+#endif  // EXIF_EXIF_INSTANCE_H_
index 5775ba1c29191a26dccac68c787f4621c417df2e..effce2f7f9c32f5b03cc9cb136f85080b71eb730 100644 (file)
@@ -14,7 +14,8 @@
         'power/power.gyp:*',
         'messageport/messageport.gyp:*',
         'bookmark/bookmark.gyp:*',
-        'archive/archive.gyp:*'
+        'archive/archive.gyp:*',
+        'exif/exif.gyp:*',
       ],
       'conditions': [
         [ 'extension_host_os == "mobile"', {