*/
var _global = window || global || {};
-
+
var validator_ = xwalk.utils.validator;
var type_ = xwalk.utils.type;
var native_ = new xwalk.utils.NativeManager(extension);
function ExifManager() {}
var ImageContentOrientation = {
- NORMAL: 'NORMAL',
- FLIP_HORIZONTAL: 'FLIP_HORIZONTAL',
- ROTATE_180: 'ROTATE_180',
- FLIP_VERTICAL: 'FLIP_VERTICAL',
- TRANSPOSE: 'TRANSPOSE',
- ROTATE_90: 'ROTATE_90',
- TRANSVERSE: 'TRANSVERSE',
- ROTATE_270: 'ROTATE_270'
+ NORMAL: 'NORMAL',
+ FLIP_HORIZONTAL: 'FLIP_HORIZONTAL',
+ ROTATE_180: 'ROTATE_180',
+ FLIP_VERTICAL: 'FLIP_VERTICAL',
+ TRANSPOSE: 'TRANSPOSE',
+ ROTATE_90: 'ROTATE_90',
+ TRANSVERSE: 'TRANSVERSE',
+ ROTATE_270: 'ROTATE_270'
};
var ExposureProgram = {
- NOT_DEFINED: 'NOT_DEFINED',
- MANUAL: 'MANUAL',
- NORMAL: 'NORMAL',
- APERTURE_PRIORITY: 'APERTURE_PRIORITY',
- SHUTTER_PRIORITY: 'SHUTTER_PRIORITY',
- CREATIVE_PROGRAM: 'CREATIVE_PROGRAM',
- ACTION_PROGRAM: 'ACTION_PROGRAM',
- PORTRAIT_MODE: 'PORTRAIT_MODE',
- LANDSCAPE_MODE: 'LANDSCAPE_MODE'
+ NOT_DEFINED: 'NOT_DEFINED',
+ MANUAL: 'MANUAL',
+ NORMAL: 'NORMAL',
+ APERTURE_PRIORITY: 'APERTURE_PRIORITY',
+ SHUTTER_PRIORITY: 'SHUTTER_PRIORITY',
+ CREATIVE_PROGRAM: 'CREATIVE_PROGRAM',
+ ACTION_PROGRAM: 'ACTION_PROGRAM',
+ PORTRAIT_MODE: 'PORTRAIT_MODE',
+ LANDSCAPE_MODE: 'LANDSCAPE_MODE'
};
var WhiteBalanceMode = {
- AUTO: 'AUTO',
- MANUAL: 'MANUAL'
+ AUTO: 'AUTO',
+ MANUAL: 'MANUAL'
};
var propertiesList = {
- URI: 'uri',
- WIDTH: 'width',
- HEIGHT: 'height',
- DEVICE_MAKER: 'deviceMaker',
- DEVICE_MODEL: 'deviceModel',
- ORIGINAL_TIME: 'originalTime',
- ORIENTATION: 'orientation',
- FNUMBER: 'fNumber',
- ISO_SPEED_RATINGS: 'isoSpeedRatings',
- EXPOSURE_TIME: 'exposureTime',
- EXPOSURE_PROGRAM: 'exposureProgram',
- FLASH: 'flash',
- FOCAL_LENGTH: 'focalLength',
- WHITE_BALANCE: 'whiteBalance',
- GPS_LOCATION: 'gpsLocation',
- GPS_ALTITUDE: 'gpsAltitude',
- GPS_PROCESSING_METHOD: 'gpsProcessingMethod',
- GPS_TIME: 'gpsTime',
- USER_COMMENT: 'userComment'
+ URI: 'uri',
+ WIDTH: 'width',
+ HEIGHT: 'height',
+ DEVICE_MAKER: 'deviceMaker',
+ DEVICE_MODEL: 'deviceModel',
+ ORIGINAL_TIME: 'originalTime',
+ ORIENTATION: 'orientation',
+ FNUMBER: 'fNumber',
+ ISO_SPEED_RATINGS: 'isoSpeedRatings',
+ EXPOSURE_TIME: 'exposureTime',
+ EXPOSURE_PROGRAM: 'exposureProgram',
+ FLASH: 'flash',
+ FOCAL_LENGTH: 'focalLength',
+ WHITE_BALANCE: 'whiteBalance',
+ GPS_LOCATION: 'gpsLocation',
+ GPS_ALTITUDE: 'gpsAltitude',
+ GPS_PROCESSING_METHOD: 'gpsProcessingMethod',
+ GPS_TIME: 'gpsTime',
+ USER_COMMENT: 'userComment'
};
-var URI_ABSOLUTE_PREFIX = "file:///";
+var URI_ABSOLUTE_PREFIX = 'file:///';
function _isValidAbsoluteURI(uri) {
- return 0 === uri.indexOf(URI_ABSOLUTE_PREFIX);
+ return 0 === uri.indexOf(URI_ABSOLUTE_PREFIX);
}
function _getJsonFromExifInformation(exifInfo) {
- var json = {};
-
- for (var prop in propertiesList) {
- var propName = propertiesList[prop];
-
- if (exifInfo[propName] !== null) {
- if (propName === 'originalTime') {
- json[propName] = Math.floor(exifInfo[propName].getTime() / 1000);
- } else if (propName === 'gpsTime') {
- var str = exifInfo[propName].toLocaleString().split(', ');
- var res = str[1] + ', ' + str[2] + ', ' + str[3];
-
- json[propName] = Math.floor(Date.parse(res) / 1000);
- } else {
- json[propName] = exifInfo[propName];
- }
+ var json = {};
+
+ for (var prop in propertiesList) {
+ var propName = propertiesList[prop];
+
+ if (exifInfo[propName] !== null) {
+ if (propName === 'originalTime') {
+ json[propName] = Math.floor(exifInfo[propName].getTime() / 1000);
+ } else if (propName === 'gpsTime') {
+ var str = exifInfo[propName].toLocaleString().split(', ');
+ var res = str[1] + ', ' + str[2] + ', ' + str[3];
+
+ json[propName] = Math.floor(Date.parse(res) / 1000);
+ } else {
+ json[propName] = exifInfo[propName];
+ }
+ }
}
- }
- return json;
+ return json;
}
function _calculateDegDecimal(degrees, minutes, seconds) {
- return parseInt(degrees) + parseInt(minutes) / 60.0 + parseInt(seconds) / 3600.0;
+ return parseInt(degrees) + parseInt(minutes) / 60.0 + parseInt(seconds) / 3600.0;
}
function _calculateExifInfo(exifInfoNative) {
- // copy all properties that share name from
- // exifInfoNative to exifInfo
- var exifInfo = new tizen.ExifInformation(exifInfoNative);
-
- // copy all remaining properties that do not share name or need extra calculations
- if (exifInfoNative.originalTimeSeconds) {
- exifInfo.originalTime = new Date(exifInfoNative.originalTimeSeconds * 1000);
- }
-
- if (parseInt(exifInfoNative.whiteBalanceValue) === 0) { // 0=AUTO
- exifInfo.whiteBalance = WhiteBalanceMode.AUTO;
- } else if (parseInt(exifInfoNative.whiteBalanceValue) === 1) { // 1=MANUAL
- exifInfo.whiteBalance = WhiteBalanceMode.MANUAL;
- }
-
- // gpsLocation
- if (exifInfoNative.gpsLatitudeDegrees &&
- exifInfoNative.gpsLongitudeDegrees &&
- exifInfoNative.gpsLatitudeRef &&
- exifInfoNative.gpsLongitudeRef) {
- exifInfo.gpsLocation = new tizen.SimpleCoordinates();
- exifInfo.gpsLocation.latitude = _calculateDegDecimal(exifInfoNative.gpsLatitudeDegrees,
- exifInfoNative.gpsLatitudeMinutes, exifInfoNative.gpsLatitudeSeconds);
- exifInfo.gpsLocation.longitude = _calculateDegDecimal(exifInfoNative.gpsLongitudeDegrees,
- exifInfoNative.gpsLongitudeMinutes, exifInfoNative.gpsLongitudeSeconds);
-
- if (exifInfoNative.gpsLatitudeRef === 'SOUTH') {
- exifInfo.gpsLocation.latitude = -exifInfo.gpsLocation.latitude;
- } else if (exifInfoNative.gpsLatitudeRef !== 'NORTH') {
- exifInfo.gpsLocation.latitude = null; // invalid gpsLatitudeRef
+ // copy all properties that share name from
+ // exifInfoNative to exifInfo
+ var exifInfo = new tizen.ExifInformation(exifInfoNative);
+
+ // copy all remaining properties that do not share name or need extra calculations
+ if (exifInfoNative.originalTimeSeconds) {
+ exifInfo.originalTime = new Date(exifInfoNative.originalTimeSeconds * 1000);
+ }
+
+ if (parseInt(exifInfoNative.whiteBalanceValue) === 0) {
+ // 0=AUTO
+ exifInfo.whiteBalance = WhiteBalanceMode.AUTO;
+ } else if (parseInt(exifInfoNative.whiteBalanceValue) === 1) {
+ // 1=MANUAL
+ exifInfo.whiteBalance = WhiteBalanceMode.MANUAL;
+ }
+
+ // gpsLocation
+ if (
+ exifInfoNative.gpsLatitudeDegrees &&
+ exifInfoNative.gpsLongitudeDegrees &&
+ exifInfoNative.gpsLatitudeRef &&
+ exifInfoNative.gpsLongitudeRef
+ ) {
+ exifInfo.gpsLocation = new tizen.SimpleCoordinates();
+ exifInfo.gpsLocation.latitude = _calculateDegDecimal(
+ exifInfoNative.gpsLatitudeDegrees,
+ exifInfoNative.gpsLatitudeMinutes,
+ exifInfoNative.gpsLatitudeSeconds
+ );
+ exifInfo.gpsLocation.longitude = _calculateDegDecimal(
+ exifInfoNative.gpsLongitudeDegrees,
+ exifInfoNative.gpsLongitudeMinutes,
+ exifInfoNative.gpsLongitudeSeconds
+ );
+
+ if (exifInfoNative.gpsLatitudeRef === 'SOUTH') {
+ exifInfo.gpsLocation.latitude = -exifInfo.gpsLocation.latitude;
+ } else if (exifInfoNative.gpsLatitudeRef !== 'NORTH') {
+ exifInfo.gpsLocation.latitude = null; // invalid gpsLatitudeRef
+ }
+
+ if (exifInfoNative.gpsLongitudeRef === 'WEST') {
+ exifInfo.gpsLocation.longitude = -exifInfo.gpsLocation.longitude;
+ } else if (exifInfoNative.gpsLongitudeRef !== 'EAST') {
+ exifInfo.gpsLocation.longitude = null; // invalid gpsLongitudeRef
+ }
}
- if (exifInfoNative.gpsLongitudeRef === 'WEST') {
- exifInfo.gpsLocation.longitude = -exifInfo.gpsLocation.longitude;
- } else if (exifInfoNative.gpsLongitudeRef !== 'EAST') {
- exifInfo.gpsLocation.longitude = null; // invalid gpsLongitudeRef
+ // gpsAltitude
+ if (exifInfoNative.gpsAltitude && exifInfoNative.gpsAltitudeRef) {
+ if (parseInt(exifInfoNative.gpsAltitudeRef) === 0) {
+ // 0=ABOVE SEA LEVEL
+ exifInfo.gpsAltitude = exifInfoNative.gpsAltitude;
+ } else if (parseInt(exifInfoNative.gpsAltitudeRef) === 1) {
+ // 1=BELOW SEA LEVEL
+ exifInfo.gpsAltitude = -exifInfoNative.gpsAltitude;
+ }
}
- }
-
- // gpsAltitude
- if (exifInfoNative.gpsAltitude && exifInfoNative.gpsAltitudeRef) {
- if (parseInt(exifInfoNative.gpsAltitudeRef) === 0) { // 0=ABOVE SEA LEVEL
- exifInfo.gpsAltitude = exifInfoNative.gpsAltitude;
- } else if (parseInt(exifInfoNative.gpsAltitudeRef) === 1) { // 1=BELOW SEA LEVEL
- exifInfo.gpsAltitude = -exifInfoNative.gpsAltitude;
+
+ // gpsTime
+ if (exifInfoNative.gpsExifDate) {
+ var dateSplit = exifInfoNative.gpsExifDate.split(':');
+ exifInfo.gpsTime = new Date(
+ dateSplit[0], // year
+ dateSplit[1], // month
+ dateSplit[2], // day
+ exifInfoNative.gpsExifTimeHours,
+ exifInfoNative.gpsExifTimeMinutes,
+ exifInfoNative.gpsExifTimeSeconds
+ );
}
- }
-
- // gpsTime
- if (exifInfoNative.gpsExifDate) {
- var dateSplit = exifInfoNative.gpsExifDate.split(':');
- exifInfo.gpsTime = new Date(
- dateSplit[0], // year
- dateSplit[1], // month
- dateSplit[2], // day
- exifInfoNative.gpsExifTimeHours,
- exifInfoNative.gpsExifTimeMinutes,
- exifInfoNative.gpsExifTimeSeconds);
- }
-
- return exifInfo;
+
+ return exifInfo;
}
ExifManager.prototype.getExifInfo = function() {
- var args = validator_.validateArgs(arguments, [
- {
- name: 'uri',
- type: validator_.Types.STRING,
- optional: false,
- nullable: false
- },
- {
- name: 'successCallback',
- type: validator_.Types.FUNCTION,
- optional: false,
- nullable: false
- },
- {
- name: 'errorCallback',
- type: validator_.Types.FUNCTION,
- optional: true,
- nullable: true
+ var args = validator_.validateArgs(arguments, [
+ {
+ name: 'uri',
+ type: validator_.Types.STRING,
+ optional: false,
+ nullable: false
+ },
+ {
+ name: 'successCallback',
+ type: validator_.Types.FUNCTION,
+ optional: false,
+ nullable: false
+ },
+ {
+ name: 'errorCallback',
+ type: validator_.Types.FUNCTION,
+ optional: true,
+ nullable: true
+ }
+ ]);
+
+ if (!_isValidAbsoluteURI(args.uri)) {
+ setTimeout(function() {
+ native_.callIfPossible(
+ args.errorCallback,
+ new WebAPIException(WebAPIException.INVALID_VALUES_ERR, 'Invalid URI.')
+ );
+ }, 0);
+ return;
}
- ]);
-
- if (!_isValidAbsoluteURI(args.uri)) {
- setTimeout(function() {
- native_.callIfPossible(args.errorCallback, new WebAPIException(
- WebAPIException.INVALID_VALUES_ERR,
- 'Invalid URI.'));
- }, 0);
- return;
- }
-
- var callback = function(result) {
- if (native_.isFailure(result)) {
- native_.callIfPossible(args.errorCallback, native_.getErrorObject(result));
- } else {
- // call to c++ code. Fields that do not exist are undefined.
- var exifInfoNative = native_.getResultObject(result);
- // calculate ExifInformation struct. All fields are initially null.
- // Fields that do not exist in jpg EXIF must remain null.
- var exifInfo = _calculateExifInfo(exifInfoNative);
+ var callback = function(result) {
+ if (native_.isFailure(result)) {
+ native_.callIfPossible(args.errorCallback, native_.getErrorObject(result));
+ } else {
+ // call to c++ code. Fields that do not exist are undefined.
+ var exifInfoNative = native_.getResultObject(result);
- // make successCalback and pass exifInfo
- args.successCallback(exifInfo);
- }
- };
+ // calculate ExifInformation struct. All fields are initially null.
+ // Fields that do not exist in jpg EXIF must remain null.
+ var exifInfo = _calculateExifInfo(exifInfoNative);
+
+ // make successCalback and pass exifInfo
+ args.successCallback(exifInfo);
+ }
+ };
- var result = native_.call('ExifManager_getExifInfo', {'uri': args.uri}, callback);
+ var result = native_.call('ExifManager_getExifInfo', { uri: args.uri }, callback);
- if (native_.isFailure(result)) {
- // since tizen 5.0 the only possible error type here is SecurityError
- throw native_.getErrorObject(result);
- }
+ if (native_.isFailure(result)) {
+ // since tizen 5.0 the only possible error type here is SecurityError
+ throw native_.getErrorObject(result);
+ }
};
ExifManager.prototype.saveExifInfo = function() {
- var args = validator_.validateArgs(arguments, [
- {
- name: 'exifInfo',
- type: validator_.Types.PLATFORM_OBJECT,
- values: tizen.ExifInformation,
- optional: false,
- nullable: false
- },
- {
- name: 'successCallback',
- type: validator_.Types.FUNCTION,
- optional: true,
- nullable: true
- },
- {
- name: 'errorCallback',
- type: validator_.Types.FUNCTION,
- optional: true,
- nullable: true
- }
- ]);
-
- if (!args.exifInfo.uri || !_isValidAbsoluteURI(args.exifInfo.uri)) {
- setTimeout(function() {
- native_.callIfPossible(args.errorCallback, new WebAPIException(
- WebAPIException.INVALID_VALUES_ERR,
- 'Invalid URI.'));
- }, 0);
- return;
- }
-
- var json = _getJsonFromExifInformation(args.exifInfo);
- var callback = function(result) {
- if (native_.isFailure(result)) {
- native_.callIfPossible(args.errorCallback,
- native_.getErrorObject(result));
- } else {
- var exifInfo = native_.getResultObject(result);
- args.successCallback(exifInfo);
+ var args = validator_.validateArgs(arguments, [
+ {
+ name: 'exifInfo',
+ type: validator_.Types.PLATFORM_OBJECT,
+ values: tizen.ExifInformation,
+ optional: false,
+ nullable: false
+ },
+ {
+ name: 'successCallback',
+ type: validator_.Types.FUNCTION,
+ optional: true,
+ nullable: true
+ },
+ {
+ name: 'errorCallback',
+ type: validator_.Types.FUNCTION,
+ optional: true,
+ nullable: true
+ }
+ ]);
+
+ if (!args.exifInfo.uri || !_isValidAbsoluteURI(args.exifInfo.uri)) {
+ setTimeout(function() {
+ native_.callIfPossible(
+ args.errorCallback,
+ new WebAPIException(WebAPIException.INVALID_VALUES_ERR, 'Invalid URI.')
+ );
+ }, 0);
+ return;
}
- };
- var result = native_.call('ExifManager_saveExifInfo', json, callback);
+ var json = _getJsonFromExifInformation(args.exifInfo);
+ var callback = function(result) {
+ if (native_.isFailure(result)) {
+ native_.callIfPossible(args.errorCallback, native_.getErrorObject(result));
+ } else {
+ var exifInfo = native_.getResultObject(result);
+ args.successCallback(exifInfo);
+ }
+ };
- if (native_.isFailure(result)) {
- // since tizen 5.0 the only possible error type here is SecurityError
- throw native_.getErrorObject(result);
- }
+ var result = native_.call('ExifManager_saveExifInfo', json, callback);
+
+ if (native_.isFailure(result)) {
+ // since tizen 5.0 the only possible error type here is SecurityError
+ throw native_.getErrorObject(result);
+ }
};
ExifManager.prototype.getThumbnail = function() {
- var args = validator_.validateArgs(arguments, [
- {
- name: 'uri',
- type: validator_.Types.STRING,
- optional: false,
- nullable: false
- },
- {
- name: 'successCallback',
- type: validator_.Types.FUNCTION,
- optional: false,
- nullable: false
- },
- {
- name: 'errorCallback',
- type: validator_.Types.FUNCTION,
- optional: true,
- nullable: true
- }
- ]);
-
- if (!_isValidAbsoluteURI(args.uri)) {
- setTimeout(function() {
- native_.callIfPossible(args.errorCallback, new WebAPIException(
- WebAPIException.INVALID_VALUES_ERR,
- 'Invalid URI.'));
- }, 0);
- return;
- }
-
- var _callback = function(result) {
- if (native_.isFailure(result)) {
- native_.callIfPossible(args.errorCallback,
- native_.getErrorObject(result));
- } else {
- var thumb = native_.getResultObject(result);
- args.successCallback(thumb.src);
+ var args = validator_.validateArgs(arguments, [
+ {
+ name: 'uri',
+ type: validator_.Types.STRING,
+ optional: false,
+ nullable: false
+ },
+ {
+ name: 'successCallback',
+ type: validator_.Types.FUNCTION,
+ optional: false,
+ nullable: false
+ },
+ {
+ name: 'errorCallback',
+ type: validator_.Types.FUNCTION,
+ optional: true,
+ nullable: true
+ }
+ ]);
+
+ if (!_isValidAbsoluteURI(args.uri)) {
+ setTimeout(function() {
+ native_.callIfPossible(
+ args.errorCallback,
+ new WebAPIException(WebAPIException.INVALID_VALUES_ERR, 'Invalid URI.')
+ );
+ }, 0);
+ return;
}
- };
- var result = native_.call('ExifManager_getThumbnail', {'uri': args.uri}, _callback);
+ var _callback = function(result) {
+ if (native_.isFailure(result)) {
+ native_.callIfPossible(args.errorCallback, native_.getErrorObject(result));
+ } else {
+ var thumb = native_.getResultObject(result);
+ args.successCallback(thumb.src);
+ }
+ };
+
+ var result = native_.call('ExifManager_getThumbnail', { uri: args.uri }, _callback);
- if (native_.isFailure(result)) {
- // since tizen 5.0 the only possible error type here is SecurityError
- throw native_.getErrorObject(result);
- }
+ if (native_.isFailure(result)) {
+ // since tizen 5.0 the only possible error type here is SecurityError
+ throw native_.getErrorObject(result);
+ }
};
tizen.ExifInformation = function(exifInitDict) {
- validator_.isConstructorCall(this, tizen.ExifInformation);
-
- var uri_ = '',
- width_ = null,
- height_ = null,
- deviceMaker_ = null,
- deviceModel_ = null,
- originalTime_ = null,
- orientation_ = null,
- fNumber_ = null,
- isoSpeedRatings_ = null,
- exposureTime_ = null,
- exposureProgram_ = null,
- flash_ = null,
- focalLength_ = null,
- whiteBalance_ = null,
- gpsLocation_ = null,
- gpsAltitude_ = null,
- gpsProcessingMethod_ = null,
- gpsTime_ = null,
- userComment_ = null;
-
- Object.defineProperties(this, {
- uri: {
- get: function() {
- return uri_;
- },
- set: function(v) {
- uri_ = v ? converter_.toString(v) : uri_;
- },
- enumerable: true
- },
- width: {
- get: function() {
- return width_;
- },
- set: function(v) {
- width_ = (!type_.isUndefined(v)) ? converter_.toLong(v, true) : width_;
- },
- enumerable: true
- },
- height: {
- get: function() {
- return height_;
- },
- set: function(v) {
- height_ = (!type_.isUndefined(v)) ? converter_.toLong(v, true) : height_;
- },
- enumerable: true
- },
- deviceMaker: {
- get: function() {
- return deviceMaker_;
- },
- set: function(v) {
- deviceMaker_ = (!type_.isUndefined(v)) ?
- converter_.toString(v, true) : deviceMaker_;
- },
- enumerable: true
- },
- deviceModel: {
- get: function() {
- return deviceModel_;
- },
- set: function(v) {
- deviceModel_ = (!type_.isUndefined(v)) ?
- converter_.toString(v, true) : deviceModel_;
- },
- enumerable: true
- },
- originalTime: {
- get: function() {
- return originalTime_;
- },
- set: function(v) {
- if (!type_.isUndefined(v)) {
- if (v === null || v instanceof Date) originalTime_ = v;
- }
- },
- enumerable: true
- },
- orientation: {
- get: function() {
- return orientation_;
- },
- set: function(v) {
- orientation_ = (!type_.isUndefined(v)) ?
- converter_.toEnum(v, Object.keys(ImageContentOrientation), true) : orientation_;
- },
- enumerable: true
- },
- fNumber: {
- get: function() {
- return fNumber_;
- },
- set: function(v) {
- fNumber_ = (!type_.isUndefined(v)) ? converter_.toDouble(v, true) : fNumber_;
- },
- enumerable: true
- },
- isoSpeedRatings: {
- get: function() {
- return isoSpeedRatings_;
- },
- set: function(v) {
- if (!type_.isUndefined(v)) {
- if (v === null) {
- isoSpeedRatings_ = null;
- } else if (type_.isArray(v)) {
- for (var i = 0; i < v.length; i++) {
- v[i] = converter_.toUnsignedShort(v[i], false);
+ validator_.isConstructorCall(this, tizen.ExifInformation);
+
+ var uri_ = '',
+ width_ = null,
+ height_ = null,
+ deviceMaker_ = null,
+ deviceModel_ = null,
+ originalTime_ = null,
+ orientation_ = null,
+ fNumber_ = null,
+ isoSpeedRatings_ = null,
+ exposureTime_ = null,
+ exposureProgram_ = null,
+ flash_ = null,
+ focalLength_ = null,
+ whiteBalance_ = null,
+ gpsLocation_ = null,
+ gpsAltitude_ = null,
+ gpsProcessingMethod_ = null,
+ gpsTime_ = null,
+ userComment_ = null;
+
+ Object.defineProperties(this, {
+ uri: {
+ get: function() {
+ return uri_;
+ },
+ set: function(v) {
+ uri_ = v ? converter_.toString(v) : uri_;
+ },
+ enumerable: true
+ },
+ width: {
+ get: function() {
+ return width_;
+ },
+ set: function(v) {
+ width_ = !type_.isUndefined(v) ? converter_.toLong(v, true) : width_;
+ },
+ enumerable: true
+ },
+ height: {
+ get: function() {
+ return height_;
+ },
+ set: function(v) {
+ height_ = !type_.isUndefined(v) ? converter_.toLong(v, true) : height_;
+ },
+ enumerable: true
+ },
+ deviceMaker: {
+ get: function() {
+ return deviceMaker_;
+ },
+ set: function(v) {
+ deviceMaker_ = !type_.isUndefined(v)
+ ? converter_.toString(v, true)
+ : deviceMaker_;
+ },
+ enumerable: true
+ },
+ deviceModel: {
+ get: function() {
+ return deviceModel_;
+ },
+ set: function(v) {
+ deviceModel_ = !type_.isUndefined(v)
+ ? converter_.toString(v, true)
+ : deviceModel_;
+ },
+ enumerable: true
+ },
+ originalTime: {
+ get: function() {
+ return originalTime_;
+ },
+ set: function(v) {
+ if (!type_.isUndefined(v)) {
+ if (v === null || v instanceof Date) originalTime_ = v;
+ }
+ },
+ enumerable: true
+ },
+ orientation: {
+ get: function() {
+ return orientation_;
+ },
+ set: function(v) {
+ orientation_ = !type_.isUndefined(v)
+ ? converter_.toEnum(v, Object.keys(ImageContentOrientation), true)
+ : orientation_;
+ },
+ enumerable: true
+ },
+ fNumber: {
+ get: function() {
+ return fNumber_;
+ },
+ set: function(v) {
+ fNumber_ = !type_.isUndefined(v)
+ ? converter_.toDouble(v, true)
+ : fNumber_;
+ },
+ enumerable: true
+ },
+ isoSpeedRatings: {
+ get: function() {
+ return isoSpeedRatings_;
+ },
+ set: function(v) {
+ if (!type_.isUndefined(v)) {
+ if (v === null) {
+ isoSpeedRatings_ = null;
+ } else if (type_.isArray(v)) {
+ for (var i = 0; i < v.length; i++) {
+ v[i] = converter_.toUnsignedShort(v[i], false);
+ }
+ isoSpeedRatings_ = v;
+ }
+ }
+ },
+ enumerable: true
+ },
+ exposureTime: {
+ get: function() {
+ return exposureTime_;
+ },
+ set: function(v) {
+ exposureTime_ = !type_.isUndefined(v)
+ ? converter_.toString(v, true)
+ : exposureTime_;
+ },
+ enumerable: true
+ },
+ exposureProgram: {
+ get: function() {
+ return exposureProgram_;
+ },
+ set: function(v) {
+ exposureProgram_ = !type_.isUndefined(v)
+ ? converter_.toEnum(v, Object.keys(ExposureProgram), true)
+ : exposureProgram_;
+ },
+ enumerable: true
+ },
+ flash: {
+ get: function() {
+ return flash_;
+ },
+ set: function(v) {
+ flash_ = converter_.toBoolean(v, true);
+ },
+ enumerable: true
+ },
+ focalLength: {
+ get: function() {
+ return focalLength_;
+ },
+ set: function(v) {
+ focalLength_ = !type_.isUndefined(v)
+ ? converter_.toDouble(v, true)
+ : focalLength_;
+ },
+ enumerable: true
+ },
+ whiteBalance: {
+ get: function() {
+ return whiteBalance_;
+ },
+ set: function(v) {
+ whiteBalance_ = !type_.isUndefined(v)
+ ? converter_.toEnum(v, Object.keys(WhiteBalanceMode), true)
+ : whiteBalance_;
+ },
+ enumerable: true
+ },
+ gpsLocation: {
+ get: function() {
+ return gpsLocation_;
+ },
+ set: function(v) {
+ if (!type_.isUndefined(v)) {
+ if (v === null || v instanceof tizen.SimpleCoordinates)
+ gpsLocation_ = v;
+ }
+ },
+ enumerable: true
+ },
+ gpsAltitude: {
+ get: function() {
+ return gpsAltitude_;
+ },
+ set: function(v) {
+ gpsAltitude_ = !type_.isUndefined(v)
+ ? converter_.toDouble(v, true)
+ : gpsAltitude_;
+ },
+ enumerable: true
+ },
+ gpsProcessingMethod: {
+ get: function() {
+ return gpsProcessingMethod_;
+ },
+ set: function(v) {
+ gpsProcessingMethod_ = !type_.isUndefined(v)
+ ? converter_.toString(v, true)
+ : gpsProcessingMethod_;
+ },
+ enumerable: true
+ },
+ gpsTime: {
+ enumerable: true,
+ get: function() {
+ return gpsTime_;
+ },
+ set: function(v) {
+ if (!type_.isUndefined(v)) {
+ if (v === null || v instanceof Date || v instanceof tizen.TZDate)
+ gpsTime_ = v;
+ }
+ }
+ },
+ userComment: {
+ enumerable: true,
+ get: function() {
+ return userComment_;
+ },
+ set: function(v) {
+ userComment_ = !type_.isUndefined(v)
+ ? converter_.toString(v, true)
+ : userComment_;
}
- isoSpeedRatings_ = v;
- }
- }
- },
- enumerable: true
- },
- exposureTime: {
- get: function() {
- return exposureTime_;
- },
- set: function(v) {
- exposureTime_ = (!type_.isUndefined(v)) ?
- converter_.toString(v, true) : exposureTime_;
- },
- enumerable: true
- },
- exposureProgram: {
- get: function() {
- return exposureProgram_;
- },
- set: function(v) {
- exposureProgram_ = (!type_.isUndefined(v)) ?
- converter_.toEnum(v, Object.keys(ExposureProgram), true) : exposureProgram_;
- },
- enumerable: true
- },
- flash: {
- get: function() {
- return flash_;
- },
- set: function(v) {
- flash_ = converter_.toBoolean(v, true);
- },
- enumerable: true
- },
- focalLength: {
- get: function() {
- return focalLength_;
- },
- set: function(v) {
- focalLength_ = (!type_.isUndefined(v)) ?
- converter_.toDouble(v, true) : focalLength_;
- },
- enumerable: true
- },
- whiteBalance: {
- get: function() {
- return whiteBalance_;
- },
- set: function(v) {
- whiteBalance_ = (!type_.isUndefined(v)) ?
- converter_.toEnum(v, Object.keys(WhiteBalanceMode), true) : whiteBalance_;
- },
- enumerable: true
- },
- gpsLocation: {
- get: function() {
- return gpsLocation_;
- },
- set: function(v) {
- if (!type_.isUndefined(v)) {
- if (v === null || v instanceof tizen.SimpleCoordinates) gpsLocation_ = v;
}
- },
- enumerable: true
- },
- gpsAltitude: {
- get: function() {
- return gpsAltitude_;
- },
- set: function(v) {
- gpsAltitude_ = (!type_.isUndefined(v)) ?
- converter_.toDouble(v, true) : gpsAltitude_;
- },
- enumerable: true
- },
- gpsProcessingMethod: {
- get: function() {
- return gpsProcessingMethod_;
- },
- set: function(v) {
- gpsProcessingMethod_ = (!type_.isUndefined(v)) ?
- converter_.toString(v, true) : gpsProcessingMethod_;
- },
- enumerable: true
- },
- gpsTime: {
- enumerable: true,
- get: function() {
- return gpsTime_;
- },
- set: function(v) {
- if (!type_.isUndefined(v)) {
- if (v === null || v instanceof Date || v instanceof tizen.TZDate) gpsTime_ = v;
+ });
+
+ //--- copy values from exifInitDict using setters above.
+ if (exifInitDict instanceof _global.Object) {
+ for (var prop in exifInitDict) {
+ if (this.hasOwnProperty(prop)) {
+ this[prop] = exifInitDict[prop];
+ }
}
- }
- },
- userComment: {
- enumerable: true,
- get: function() {
- return userComment_;
- },
- set: function(v) {
- userComment_ = (!type_.isUndefined(v)) ?
- converter_.toString(v, true) : userComment_;
- }
- }
- });
-
- //--- copy values from exifInitDict using setters above.
- if (exifInitDict instanceof _global.Object) {
- for (var prop in exifInitDict) {
- if (this.hasOwnProperty(prop)) {
- this[prop] = exifInitDict[prop];
- }
}
- }
};
exports = new ExifManager();