/*!
- Ripple Mobile Environment Emulator v0.9.8 :: Built On Tue Sep 17 2013 16:10:39 GMT+0800 (CST)
+ Ripple Mobile Environment Emulator v0.9.8 :: Built On Thu Dec 05 2013 19:51:21 GMT+0800 (CST)
Apache License
Version 2.0, January 2004
"ppi": 316,
"browser": ["Generic"],
- "platforms": ["wac", "web", "phonegap", "tizen", "cordova"],
+ "platforms": ["wac", "web", "phonegap", "tizen", "cordova", "ivi"],
"userAgent": "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.7 Safari/533.2"
};
"ppi": 316,
"browser": ["Generic"],
- "platforms": ["web", "phonegap", "tizen", "cordova"],
+ "platforms": ["web", "phonegap", "tizen", "cordova", "ivi"],
"userAgent": "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.7 Safari/533.2"
};
"ppi": 316,
"browser": ["Generic"],
- "platforms": ["wac", "web", "phonegap", "tizen", "cordova"],
+ "platforms": ["wac", "web", "phonegap", "tizen", "cordova", "ivi"],
"userAgent": "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.7 Safari/533.2"
};
"ppi": 316,
"browser": ["Generic"],
- "platforms": ["web", "phonegap", "tizen", "cordova"],
+ "platforms": ["web", "phonegap", "tizen", "cordova", "ivi"],
"userAgent": "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.7 Safari/533.2"
};
};
});
-define('ripple/platform/phonegap/1.0.0/AVCodecsAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (info, id, audioCodecs, videoCodecs) {
- return {
- info: info,
- id: id,
- audioCodecs: audioCodecs,
- videoCodecs: videoCodecs
- };
-};
-
-});
-define('ripple/platform/phonegap/1.0.0/Acceleration', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (x, y, z) {
- return {
- x: x || 0,
- y: y || 0,
- z: z || 0,
- timestamp: new Date().getTime()
- };
-};
-
-});
-define('ripple/platform/phonegap/1.0.0/AudioCodecAttributes', function (require, exports, module) {
+define('ripple/platform/ivi/3.0/WebAPIError', function (require, exports, module) {
/*
- * Copyright 2011 Research In Motion Limited.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-module.exports = function (info, id, compFormats, encode, decode) {
- return {
- info: info,
- id: id,
- compFormats: compFormats,
- encode: encode,
- decode: decode
- };
-};
-});
-define('ripple/platform/phonegap/1.0.0/AudioDeviceAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (type, freqRangeLow, freqRangeHigh, volumeLevel, info) {
- return {
- type: type,
- freqRangeLow: freqRangeLow,
- freqRangeHigh: freqRangeHigh,
- volumeLevel: volumeLevel,
- info: info
- };
+var errorcode = require('ripple/platform/ivi/3.0/errorcode');
+var msg = {
+ 1: "Permission denied.",
+ 2: "Unsupported property.",
+ 3: "Timeout.",
+ 10: "Unknown."
+},
+ errType = {
+ 1: "PermissionDeniedError",
+ 2: "PropertyUnavailableError",
+ 3: "TimeoutError",
+ 10: "UnknownError"
};
-});
-define('ripple/platform/phonegap/1.0.0/BrailleDeviceAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (nbCells, info) {
- return {
- nbCells: nbCells,
- info: info
- };
+module.exports = function (code, message, name) {
+ var _code, _message, _name;
-};
+ if (typeof code !== 'number') {
+ _code = errorcode.UNKNOWN;
+ _message = msg[_code];
+ _name = errType[_code];
+ } else {
+ _code = code;
+ if (typeof message === 'string') {
+ _message = message;
+ } else {
+ _message = msg[_code];
+ }
+ if (typeof name === 'string') {
+ _name = name;
+ } else {
+ _name = errType[_code];
+ }
+ }
-});
-define('ripple/platform/phonegap/1.0.0/CPUAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (info, id, usage) {
- return {
- info: info,
- id: id,
- usage: usage
- };
+ this.__defineGetter__("code", function () {
+ return _code;
+ });
+ this.__defineGetter__("message", function () {
+ return _message;
+ });
+ this.__defineGetter__("name", function () {
+ return _name;
+ });
};
});
-define('ripple/platform/phonegap/1.0.0/CameraAttributes', function (require, exports, module) {
+define('ripple/platform/ivi/3.0/WebAPIException', function (require, exports, module) {
/*
- * Copyright 2011 Research In Motion Limited.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-module.exports = function (supportsVideo, hasFlash, sensorPixels, maxZoomFactor) {
- return {
- supportsVideo: supportsVideo,
- hasFlash: hasFlash,
- sensorPixels: sensorPixels,
- maxZoomFactor: maxZoomFactor
- };
-
-};
-});
-define('ripple/platform/phonegap/1.0.0/Connection', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = {
- UNKNOWN: "unknown",
- ETHERNET: "ethernet",
- WIFI: "wifi",
- CELL_2G: "2g",
- CELL_3G: "3g",
- CELL_4G: "4g",
- NONE: "none"
-};
+var errorcode = require('ripple/platform/ivi/3.0/errorcode');
-});
-define('ripple/platform/phonegap/1.0.0/ConnectionAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (info, id, type, currentOrientation, currentUploadBandwidth, maxDownloadBandwidth, maxUploadBandwidth, currentSignalStrength, roaming) {
- return {
- info: info,
- id: id,
- type: type,
- currentDownloadBandwidth: currentOrientation,
- currentUploadBandwidth: currentUploadBandwidth,
- maxDownloadBandwidth: maxDownloadBandwidth,
- maxUploadBandwidth: maxUploadBandwidth,
- currentSignalStrength: currentSignalStrength,
- roaming: roaming
+var msg = {
+ 1: "Permission denied.",
+ 2: "Unsupported property.",
+ 3: "Timeout.",
+ 10: "Unknown."
+ },
+ errType = {
+ 1: "PermissionDeniedError",
+ 2: "PropertyUnavailableError",
+ 3: "TimeoutError",
+ 10: "UnknownError"
};
-};
-});
-define('ripple/platform/phonegap/1.0.0/Contact', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-var utils = require('ripple/utils'),
- event = require('ripple/event');
+module.exports = function (code, message, name) {
+ var g, c, _code, _message, _name;
-function _properties(obj) {
- var prop, newObj = {};
- for (prop in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, prop)) {
- if (typeof obj[prop] !== "function") {
- newObj[prop] = utils.copy(obj[prop]);
- }
+ for (c in errorcode) {
+ g = errorcode.__lookupGetter__(c);
+ if (g) {
+ this.__defineGetter__(c, g);
}
}
- return newObj;
-}
-
-module.exports = function (
- id,
- displayName,
- name,
- nickname,
- phoneNumbers,
- emails,
- addresses,
- ims,
- organizations,
- birthday,
- note,
- photos,
- categories,
- urls
-) {
- return {
- id: id || Math.uuid(undefined, 16),
- displayName: displayName || null,
- name: name || null,
- nickname: nickname || null,
- phoneNumbers: phoneNumbers || null,
- emails: emails || null,
- addresses: addresses || null,
- ims: ims || null,
- organizations: organizations || null,
- birthday: birthday || null,
- note: note || null,
- photos: photos || null,
- categories: categories || null,
- urls: urls || null,
- save: function (success, error) {
- var _self = this,
- lastUpdated = this.updated; // hackish
-
- this.updated = new Date();
-
- if (!this.id) {
- this.id = Math.uuid(undefined, 16);
- }
-
- event.trigger("phonegap-contact-save", [_properties(this), success, function (e) {
- _self.updated = lastUpdated;
- error(e);
- }]);
- },
- remove: function (success, error) {
- event.trigger("phonegap-contact-remove", [this.id, success, error]);
- },
- clone: function () {
- var copy = utils.copy(this);
- copy.id = null;
- return copy;
+ if (typeof code !== 'number') {
+ _code = errorcode.UNKNOWN;
+ _message = msg[_code];
+ _name = errType[_code];
+ } else {
+ _code = code;
+ if (typeof message === 'string') {
+ _message = message;
+ } else {
+ _message = msg[_code];
}
- };
-};
-
-});
-define('ripple/platform/phonegap/1.0.0/ContactAccount', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (domain, username, userid) {
- return {
- domain: domain,
- username: username,
- userid: userid
- };
-};
-
-});
-define('ripple/platform/phonegap/1.0.0/ContactAddress', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (pref, type, formatted, streetAddress, locality, region, postalCode, country, id) {
- return {
- pref: pref || null,
- type: type || null,
- formatted: formatted || null,
- streetAddress: streetAddress || null,
- locality: locality || null,
- region: region || null,
- postalCode: postalCode || null,
- country: country || null,
- id: id || null
- };
-};
-
-});
-define('ripple/platform/phonegap/1.0.0/ContactError', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-function ContactError(code) {
- this.code = code || null;
-}
-
-ContactError.UNKNOWN_ERROR = 0;
-ContactError.INVALID_ARGUMENT_ERROR = 1;
-ContactError.NOT_FOUND_ERROR = 2;
-ContactError.TIMEOUT_ERROR = 3;
-ContactError.PENDING_OPERATION_ERROR = 4;
-ContactError.IO_ERROR = 5;
-ContactError.NOT_SUPPORTED_ERROR = 6;
-ContactError.PERMISSION_DENIED_ERROR = 20;
-
-module.exports = ContactError;
+ if (typeof name === 'string') {
+ _name = name;
+ } else {
+ _name = errType[_code];
+ }
+ }
-});
-define('ripple/platform/phonegap/1.0.0/ContactField', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (type, value, pref) {
- return {
- type: type,
- value: value,
- pref: pref || false
- };
+ this.__defineGetter__("code", function () {
+ return _code;
+ });
+ this.__defineGetter__("message", function () {
+ return _message;
+ });
+ this.__defineGetter__("name", function () {
+ return _name;
+ });
};
});
-define('ripple/platform/phonegap/1.0.0/ContactFindOptions', function (require, exports, module) {
+define('ripple/platform/ivi/3.0/errorcode', function (require, exports, module) {
/*
- * Copyright 2011 Research In Motion Limited.
+ * Copyright 2013 Intel Corporation.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-module.exports = function (filter, multiple, updatedSince) {
- return {
- filter: filter || "",
- multiple: multiple || false,
- updatedSince: updatedSince || ""
- };
-};
-});
-define('ripple/platform/phonegap/1.0.0/ContactName', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (formatted, familyName, givenName, middleName, honorificPrefix, honorificSuffix) {
- return {
- formatted: formatted,
- familyName: familyName,
- givenName: givenName,
- middleName: middleName,
- honorificPrefix: honorificPrefix,
- honorificSuffix: honorificSuffix
- };
-};
+var _self = {};
+_self.__defineGetter__("PERMISSION_DENIED", function () {
+ return 1;
});
-define('ripple/platform/phonegap/1.0.0/ContactOrganization', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (pref, type, name, dept, title) {
- return {
- pref: pref || null,
- type: type || null,
- name: name || null,
- department: dept || null,
- title: title || null
- };
-};
+_self.__defineGetter__("PROPERTY_UNAVAILABLE", function () {
+ return 2;
});
-define('ripple/platform/phonegap/1.0.0/DisplayDeviceAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (orientation, brightness, contrast, blanked, dotsPerInchW, dotsPerInchH, physicalWidth, physicalHeight, info) {
- return {
- orientation: orientation,
- brightness: brightness,
- contrast: contrast,
- blanked: blanked,
- dotsPerInchW: dotsPerInchW,
- dotsPerInchH: dotsPerInchH,
- physicalWidth: physicalWidth,
- physicalHeight: physicalHeight,
- info: info
- };
-};
+_self.__defineGetter__("TIMEOUT", function () {
+ return 3;
});
-define('ripple/platform/phonegap/1.0.0/InputDevicesAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (info, id, pointingDevices, activePointingDevices, keyboards, activeKeyboards, cameras, activeCameras, microphones, activeMicrophones) {
- return {
- info: info,
- id: id,
- pointingDevices: pointingDevices,
- activePointingDevices: activePointingDevices,
- keyboards: keyboards,
- activeKeyboards: activeKeyboards,
- cameras: cameras,
- activeCameras: activeCameras,
- microphones: microphones,
- activeMicrophones: activeMicrophones
- };
-
-};
+_self.__defineGetter__("UNKNOWN", function () {
+ return 10;
});
-define('ripple/platform/phonegap/1.0.0/KeyboardAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (type, isHardware, info) {
- return {
- type: type,
- isHardware: isHardware,
- info: info
- };
-};
-});
-define('ripple/platform/phonegap/1.0.0/MicrophoneAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (type, freqRangeLow, freqRangeHigh, info, name, types) {
- return {
- type: type,
- freqRangeLow: freqRangeLow,
- freqRangeHigh: freqRangeHigh,
- info: info,
- name: name,
- types: types
- };
-};
+module.exports = _self;
});
-define('ripple/platform/phonegap/1.0.0/NetworkAttributes', function (require, exports, module) {
+define('ripple/platform/ivi/3.0/spec/btdevices', function (require, exports, module) {
/*
- * Copyright 2011 Research In Motion Limited.
+ * Copyright 2012 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-module.exports = function (info, id, activeConnections) {
- return {
- info: info,
- id: id,
- activeConnections: activeConnections || []
- };
-};
-});
-define('ripple/platform/phonegap/1.0.0/NetworkStatus', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
module.exports = {
- NOT_REACHABLE: 0,
- REACHABLE_VIA_CARRIER_DATA_NETWORK: 1,
- REACHABLE_VIA_WIFI_NETWORK: 2
+ "22:33:44:12:34:56": {
+ "name": "Tizen Phone",
+ "address": "22:33:44:12:34:56",
+ "deviceClass": {
+ "major": 0x02,
+ "majorName": "PHONE",
+ "minor": 0x03,
+ "minorName": "PHONE_SMARTPHONE",
+ "services": [0x0080],
+ "servicesName": ["OBJECT_TRANSFER"]
+ },
+ "isTrusted": false,
+ "services": {
+ "5bce9431-6c75-32ab-afe0-2ec108a30860" : {
+ "name": "Data Exchange",
+ "uuid": "5bce9431-6c75-32ab-afe0-2ec108a30860",
+ "protocol": "RFCOMM"
+ },
+ "3537d485-0c1e-445a-a066-43fafcfb61d1" : {
+ "name": "Data Transfer",
+ "uuid": "3537d485-0c1e-445a-a066-43fafcfb61d1",
+ "protocol": "RFCOMM"
+ }
+ }
+ },
+ "22:33:44:12:34:88": {
+ "name": "Keyboard",
+ "address": "22:33:44:12:34:88",
+ "deviceClass": {
+ "major": 0x05,
+ "majorName": "PERIPHERAL",
+ "minor": 0x10,
+ "minorName": "PERIPHERAL_KEYBOARD",
+ "services": [0x0080],
+ "servicesName": ["OBJECT_TRANSFER"]
+ },
+ "isTrusted": true,
+ "services": {
+ "3537d485-0c1e-445a-a066-43fafcfb61d1" : {
+ "name": "Data Exchange",
+ "uuid": "3537d485-0c1e-445a-a066-43fafcfb61d1",
+ "protocol": "RFCOMM"
+ }
+ }
+ },
+ "22:33:44:88:34:58": {
+ "name": "Tizen Laptop",
+ "address": "22:33:44:88:34:58",
+ "deviceClass": {
+ "major": 0x01,
+ "majorName": "COMPUTER",
+ "minor": 0x03,
+ "minorName": "COMPUTER_LAPTOP",
+ "services": [0x0080],
+ "servicesName": ["OBJECT_TRANSFER"]
+ },
+ "isTrusted": true,
+ "services": {
+ "3537d485-0c1e-445a-a066-43fafcfb61d1" : {
+ "name": "Data Exchange",
+ "uuid": "3537d485-0c1e-445a-a066-43fafcfb61d1",
+ "protocol": "RFCOMM"
+ }
+ }
+ }
};
});
-define('ripple/platform/phonegap/1.0.0/OutputDevicesAttributes', function (require, exports, module) {
+define('ripple/platform/ivi/3.0/spec/config', function (require, exports, module) {
/*
* Copyright 2011 Research In Motion Limited.
+ * Copyright 2011 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-module.exports = function (info, id, displayDevices, activeDisplayDevices, printingDevices, activePrintingDevice, brailleDevices, activeBrailleDevice, audioDevices, activeAudioDevices) {
- return {
- info: info,
- id: id,
- displayDevices: displayDevices,
- activeDisplayDevices: activeDisplayDevices,
- printingDevices: printingDevices,
- activePrintingDevice: activePrintingDevice,
- brailleDevices: brailleDevices,
- activeBrailleDevice: activeBrailleDevice,
- audioDevices: audioDevices,
- activeAudioDevices: activeAudioDevices
- };
-};
+var utils = require('ripple/utils'),
+ db = require('ripple/db'),
+ constants = require('ripple/constants');
-});
-define('ripple/platform/phonegap/1.0.0/PhoneGap', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
module.exports = {
- available: true
-};
+ fileName: "config.xml",
+ validateVersion: function (configValidationObject) {
+ var valid = true;
+ // no xmlns:JIL in wac 2.0 spec
+ valid = !!configValidationObject.widget.validationResult[0].attributes.xmlns.valid;
-});
-define('ripple/platform/phonegap/1.0.0/PointerAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (type, supportsMultiTouch, info) {
- return {
- type: type,
- supportsMultiTouch: supportsMultiTouch,
- info: info
- };
-};
+ return valid;
+ },
+ extractInfo: function (configValidationObject) {
+ if (!configValidationObject) {
+ return null;
+ }
-});
-define('ripple/platform/phonegap/1.0.0/PowerAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (info, id, level, timeRemaining, isBattery, isCharging) {
- return {
- info: info,
- id: id,
- level: level,
- timeRemaining: timeRemaining,
- isBattery: isBattery,
- isCharging: isCharging
- };
-};
+ var widgetInfo = {},
+ configFeatures,
+ configPreferences,
+ preferenceName,
+ platform, rst, i, j,
+ settingRst = {
+ 'screen-orientation': 'portrait',
+ 'context-menu': 'enable',
+ 'background-support': 'disable',
+ encryption: 'disable',
+ 'install-location': 'auto',
+ 'hwkey-event': 'enable'
+ };
-});
-define('ripple/platform/phonegap/1.0.0/PrintingDeviceAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (type, resolution, color, info) {
- return {
- type: type,
- resolution: resolution,
- color: color,
- info: info
- };
-};
+ widgetInfo.id = configValidationObject.widget.validationResult[0].attributes.id.value || "";
+ widgetInfo.name = configValidationObject.widget.children.name.validationResult[0].value;
+ widgetInfo.icon = configValidationObject.widget.children.icon.validationResult[0].attributes.src.value;
+ widgetInfo.version = configValidationObject.widget.validationResult[0].attributes.version.value;
+ if (configValidationObject.widget.children.application.validationResult[0].valid) {
+ widgetInfo.tizenAppId = configValidationObject.widget.children.application.validationResult[0].attributes.id.value;
+ widgetInfo.tizenPackageId = configValidationObject.widget.children.application.validationResult[0].attributes.package.value;
+ }
-});
-define('ripple/platform/phonegap/1.0.0/SensorAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (value, min, max, normalizedValue) {
- return {
- value: value,
- min: min,
- max: max,
- normalizedValue: normalizedValue
- };
-};
+ widgetInfo.features = {};
-});
-define('ripple/platform/phonegap/1.0.0/StorageUnitAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (info, id, type, isWritable, capacity, availableCapacity, isRemoveable) {
- return {
- info: info,
- id: id,
- type: type,
- isWritable: isWritable,
- capacity: capacity,
- availableCapacity: availableCapacity,
- isRemoveable: isRemoveable
- };
-};
+ if (configValidationObject.widget.children.setting.hasOwnProperty('validationResult') === true) {
+ rst = configValidationObject.widget.children.setting.validationResult;
+ // the first one has higher priority per platform implementation
+ for (i = rst.length -1 ; i >= 0; i--) {
+ if (rst[i].valid === true) {
+ for (j in rst[i].attributes) {
+ if (rst[i].attributes[j].value !== undefined) {
+ settingRst[j] = rst[i].attributes[j].value;
+ }
+ }
+ }
+ }
+ db.save("layout", settingRst["screen-orientation"]);
+ }
-});
-define('ripple/platform/phonegap/1.0.0/SystemInfoOptions', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (highThreshold, lowThreshold, thresholdTarget, timeout, id) {
- return {
- highThreshold: highThreshold,
- lowThreshold: lowThreshold,
- thresholdTarget: thresholdTarget,
- timeout: timeout,
- id: id
- };
-};
+ configFeatures = configValidationObject.widget.children.feature.validationResult;
+ utils.forEach(configFeatures, function (f) {
+ if (f.valid === true) {
+ var feature = {id: f.attributes.name.value,
+ required: f.attributes.required.valid};
+ widgetInfo.features[feature.id] = feature;
+ }
+ });
-});
-define('ripple/platform/phonegap/1.0.0/ThermalAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (info, id, state) {
- return {
- info: info,
- id: id,
- state: state
- };
-};
+ widgetInfo.preferences = {};
-});
-define('ripple/platform/phonegap/1.0.0/VideoCodecAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-module.exports = function (info, id, compFormats, containerFormats, hwAccel, profiles, frameTypes, rateTypes) {
- return {
- info: info,
- id: id,
- compFormats: compFormats,
- containerFormats: containerFormats,
- hwAccel: hwAccel,
- profiles: profiles,
- frameTypes: frameTypes,
- rateTypes: rateTypes
- };
-};
+ configPreferences = configValidationObject.widget.children.preference.validationResult;
+
+ platform = require('ripple/platform');
+ utils.forEach(configPreferences, function (preference) {
+ preferenceName = preference.attributes.name.value;
+ if (preferenceName) {
+ widgetInfo.preferences[preferenceName] = {
+ "key": preferenceName,
+ "value": preference.attributes.value.value || "",
+ "readonly": preference.attributes.readonly.value === "true"
+ };
+
+ db.save(preferenceName,
+ widgetInfo.preferences[preferenceName].value,
+ platform.getPersistencePrefix(widgetInfo.id));
+ }
+ });
+
+ return widgetInfo;
+ },
+ schema: {
+ rootElement: "widget",
+ widget: {
+ nodeName: "widget",
+ required: true,
+ occurrence: 1,
+ helpText: "\"widget\" element describes widget information in configuration documents and serves as a container for other elements. It must be used in the configuration document and may have the following child elments: name,description,icon,author,license,content,feature and preference.The \"widget\" element MAY have following attributes: id,version,height,width, defaultlocale, xml:lang and dir",
+ attributes: {
+ xmlns: {
+ attributeName: "xmlns",
+ required: true,
+ type: "list",
+ listValues: ["http://www.w3.org/ns/widgets"]
+ },
+ "xmlns:tizen": {
+ attributeName: "xmlns:tizen",
+ required: false,
+ type: "list",
+ listValues: ["http://tizen.org/ns/widgets"]
+ },
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language"
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ id: {
+ attributeName: "id",
+ required: false,
+ type: "string"
+ },
+ version: {
+ attributeName: "version",
+ required: false,
+ type: "string"
+ },
+ height: {
+ attributeName: "height",
+ required: false,
+ type: "integer"
+ },
+ width: {
+ attributeName: "width",
+ required: false,
+ type: "integer"
+ },
+ viewmodes: {
+ attributeName: "viewmodes",
+ required: false,
+ type: "list",
+ listValues: ["windowed", "floating", "fullscreen", "maximized", "minimized"]
+ },
+ defaultlocale: {
+ attributeName: "defaultlocale",
+ required: false,
+ type: "iso-language"
+ }
+ },
+ children: {
+ name: {
+ nodeName: "name",
+ required: false,
+ occurrence: 0,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language",
+ unique: true
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ "short": {
+ attributeName: "short",
+ required: false,
+ type: "string"
+ }
+ },
+ children: {
+ span: {
+ nodeName: "span",
+ required: false,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language",
+ unique: true
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ }
+ }
+ }
+ }
+ },
+ description: {
+ nodeName: "description",
+ required: false,
+ occurrence: 0,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language",
+ unique: true
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ }
+ },
+ children: {
+ span: {
+ nodeName: "span",
+ required: false,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language",
+ unique: true
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ }
+ }
+ }
+ }
+ },
+ author: {
+ nodeName: "author",
+ required: false,
+ occurrence: 0,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language"
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ href: {
+ attributeName: "href",
+ required: false,
+ type: "regex",
+ regex: constants.REGEX.URL
+ },
+ email: {
+ attributeName: "email",
+ required: false,
+ type: "regex",
+ regex: constants.REGEX.EMAIL
+ }
+ },
+ children: {
+ span: {
+ nodeName: "span",
+ required: false,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language",
+ unique: true
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ }
+ }
+ }
+ }
+ },
+ license: {
+ nodeName: "license",
+ required: false,
+ occurrence: 0,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language"
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ href: {
+ attributeName: "href",
+ type: "regex",
+ required: false,
+ regex: constants.REGEX.URL
+ }
+ },
+ children: {
+ span: {
+ nodeName: "span",
+ required: false,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language",
+ unique: true
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ }
+ }
+ }
+ }
+ },
+ icon: {
+ nodeName: "icon",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language"
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ src: {
+ attributeName: "src",
+ required: true,
+ type: "string"
+ },
+ width: {
+ attributeName: "width",
+ required: false,
+ type: "integer"
+ },
+ height: {
+ attributeName: "height",
+ required: false,
+ type: "integer"
+ }
+ }
+ },
+ content: {
+ nodeName: "content",
+ required: false,
+ occurrence: 1,
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language",
+ unique: true
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ src: {
+ attributeName: "src",
+ required: true,
+ type: "string"
+ },
+ encoding: {
+ attributeName: "encoding",
+ required: false,
+ type: "string"
+ },
+ type: {
+ attributeName: "type",
+ required: false,
+ type: "string"
+ }
+ }
+ },
+ setting: {
+ nodeName: "tizen:setting",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ 'screen-orientation': {
+ attributeName: "screen-orientation",
+ required: false,
+ type: "list",
+ listValues: ['portrait', 'landscape', 'auto']
+ },
+ 'context-menu': {
+ attributeName: "context-menu",
+ required: false,
+ type: "list",
+ listValues: ['enable', 'disable']
+ },
+ 'background-support': {
+ attributeName: "background-support",
+ required: false,
+ type: "list",
+ listValues: ['enable', 'disable']
+ },
+ 'encryption': {
+ attributeName: "encryption",
+ required: false,
+ type: "list",
+ listValues: ['enable', 'disable']
+ },
+ 'install-location': {
+ attributeName: "install-location",
+ required: false,
+ type: "list",
+ listValues: ['auto', 'internal-only', 'perfer-external']
+ },
+ 'hwkey-event': {
+ attributeName: "hwkey-event",
+ required: false,
+ type: "list",
+ listValues: ['enable', 'disable']
+ }
+ }
+ },
+ application: {
+ nodeName: "tizen:application",
+ required: true,
+ occurrence: 1,
+ attributes: {
+ id: {
+ attributeName: "id",
+ required: true,
+ type: "string"
+ },
+ required_version: {
+ attributeName: "required_version",
+ required: true,
+ type: "list",
+ listValues: ['1.0', '2.0', '2.1', '2.2']
+ },
+ package: {
+ attributeName: "package",
+ required: false,
+ type: "string"
+ }
+ }
+ },
+ "tizen:content": {
+ nodeName: "tizen:content",
+ required: false,
+ occurrence: 1,
+ attributes: {
+ src: {
+ attributeName: "src",
+ required: true,
+ type: "string"
+ }
+ }
+ },
+ control: {
+ nodeName: "tizen:app-control",
+ required: false,
+ occurrence: 0,
+ children: {
+ src: {
+ nodeName: "tizen:src",
+ required: true,
+ occurence: 0,
+ attributes: {
+ name: {
+ attributeName: "name",
+ required: false,
+ type: "string"
+ }
+ }
+ },
+ operation: {
+ nodeName: "tizen:operation",
+ required: true,
+ occurence: 0,
+ attributes: {
+ name: {
+ attributeName: "name",
+ required: false,
+ type: "string"
+ }
+ }
+ },
+ uri: {
+ nodeName: "tizen:uri",
+ required: false,
+ occurence: 0,
+ attributes: {
+ name: {
+ attributeName: "name",
+ required: false,
+ type: "string"
+ }
+ }
+ },
+ mime: {
+ nodeName: "tizen:mime",
+ required: false,
+ occurence: 0,
+ attributes: {
+ name: {
+ attributeName: "name",
+ required: false,
+ type: "string"
+ }
+ }
+ }
+ }
+ },
+ "app-widget": {
+ nodeName: "tizen:app-widget",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ id: {
+ attributeName: "id",
+ required: true,
+ type: "string"
+ },
+ primary: {
+ attributeName: "primary",
+ required: true,
+ type: "list",
+ listValues: ['true', 'false']
+ },
+ "auto-launch": {
+ attributeName: "auto-launch",
+ required: false,
+ type: "list",
+ listValues: ['true', 'false']
+ },
+ "update-period": {
+ attributeName: "update-period",
+ required: false,
+ type: "integer"
+ }
+ },
+ children: {
+ "box-label": {
+ nodeName: "tizen:box-label",
+ required: true,
+ occurence: 1
+ },
+ "box-icon": {
+ nodeName: "tizen:box-icon",
+ required: true,
+ occurence: 1,
+ attributes: {
+ src: {
+ attributeName: "src",
+ required: true,
+ type: "string"
+ }
+ }
+ },
+ "box-content": {
+ nodeName: "tizen:box-content",
+ required: true,
+ occurence: 1,
+ attributes: {
+ src: {
+ attributeName: "src",
+ required: true,
+ type: "string"
+ },
+ "mouse-event": {
+ attributeName: "mouse-event",
+ required: false,
+ type: "string"
+ },
+ "touch-event": {
+ attributeName: "touch-event",
+ required: false,
+ type: "string"
+ }
+ },
+ children: {
+ "box-size": {
+ nodeName: "tizen:box-size",
+ required: false,
+ occurence: 1,
+ attributes: {
+ "preview": {
+ attributeName: "preview",
+ required: false,
+ type: "string"
+ }
+ }
+ },
+ pd: {
+ nodeName: "tizen:pd",
+ required: false,
+ occurence: 1,
+ attributes: {
+ "src": {
+ attributeName: "src",
+ required: true,
+ type: "string"
+ },
+ "width": {
+ attributeName: "width",
+ required: true,
+ type: "integer"
+ },
+ "height": {
+ attributeName: "height",
+ required: true,
+ type: "integer"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ account: {
+ nodeName: "tizen:account",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ "multiple-account-support": {
+ attributeName: "multiple-account-support",
+ required: true,
+ type: "list",
+ listValues: ['true', 'false']
+ }
+ },
+ children: {
+ icon: {
+ nodeName: "tizen:icon",
+ required: false,
+ occurence: 1,
+ attributes: {
+ section: {
+ attributeName: "section",
+ required: true,
+ type: "string"
+ }
+ }
+ },
+ "display-name": {
+ nodeName: "tizen:display-name",
+ required: false,
+ occurence: 1,
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "string"
+ }
+ }
+ },
+ capability: {
+ nodeName: "capability",
+ required: false,
+ occurence: 1
+ }
+ }
+ },
+ feature: {
+ nodeName: "tizen:privilege",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language"
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ name: {
+ attributeName: "name",
+ required: true,
+ type: "list",
+ listValues: ["http://www.w3.org/TR/battery-status/",
+ "http://www.w3.org/TR/geolocation-API/",
+ "http://www.w3.org/TR/touch-events/",
+ "http://www.w3.org/TR/vibration/",
+ "http://tizen.org/privilege/vehicle",
+ "http://tizen.org/privilege/tizen"]
+ },
+ required: {
+ attributeName: "required",
+ type: "boolean",
+ required: false
+ }
+ },
+ children: {
+ param: {
+ nodeName: "param",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language"
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ name: {
+ attributeName: "name",
+ required: true,
+ type: "string"
+ },
+ value: {
+ attributeName: "value",
+ required: true,
+ type: "string"
+ }
+ }
+ }
+ }
+ },
+ preference: {
+ nodeName: "preference",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language"
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ name: {
+ attributeName: "name",
+ required: true,
+ type: "string"
+ },
+ value: {
+ type: "string",
+ required: false,
+ attributeName: "value"
+ },
+ readonly: {
+ attributeName: "readonly",
+ type: "boolean",
+ required: false
+ }
+ }
+ }
+ }
+ }
+ }
+};
+
+});
+define('ripple/platform/ivi/3.0/spec/device', function (require, exports, module) {
+/*
+ * Copyright 2011 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+var event = require('ripple/event'),
+ utils = require('ripple/utils'),
+ StorageTypeTable = {
+ "UNKNOWN": "UNKNOWN",
+ "INTERNAL": "INTERNAL",
+ "MMC": "MMC",
+ "USB_HOST": "USB_HOST"
+ },
+ NetworkTypeTable = {
+ "NONE": "NONE",
+ "2G": "2G",
+ "2.5G": "2.5G",
+ "3G": "3G",
+ "4G": "4G",
+ "WIFI": "WIFI",
+ "ETHERNET": "ETHERNET",
+ "UNKNOWN": "UNKNOWN"
+ },
+ LocaleTable = {
+ "eng_USA": "eng_USA",
+ "eng_CAN": "eng_CAN",
+ "deu_DEU": "deu_DEU",
+ "jpn_JPN": "jpn_JPN",
+ "zho_CHN": "zho_CHN",
+ "UNKNOWN": "UNKNOWN"
+ },
+ SimStateTable = {
+ "ABSENT": "ABSENT",
+ "INITIALIZING": "INITIALIZING",
+ "READY": "READY",
+ "PIN_REQUIRED": "PIN_REQUIRED",
+ "PUK_REQUIRED":"PUK_REQUIRED",
+ "NETWORK_LOCKED": "NETWORK_LOCKED",
+ "SIM_LOCKED": "SIM_LOCKED",
+ "UNKNOWN": "UNKNOWN"
+ };
+
+function deviceStatusEventTrigger(setting) {
+ event.trigger("DeviceStatusChanged", [setting]);
+}
+
+module.exports = {
+ "Config": {
+ "vibratingMode": {
+ "name": "Vibrator",
+ "control": {
+ "type": "checkbox",
+ "value": true
+ },
+ "callback": function (setting) {
+ event.trigger("VibratingModeChanged", [setting]);
+ }
+ },
+ "lockScreen": {
+ "name": "Lock Screen",
+ "control": {
+ "type": "checkbox",
+ "value": false
+ },
+ "callback": function (setting) {
+ event.trigger("LockScreenChanged", [setting]);
+ }
+ }
+ },
+ "DEVICE_ORIENTATION": {
+ "status": {
+ "name": "Status",
+ "control": {
+ "type": "label",
+ "innertext": "PORTRAIT_PRIMARY",
+ "value": "PORTRAIT_PRIMARY"
+ },
+ "event": "LayoutChanged"
+ },
+ "isAutoRotation": {
+ "name": "Is Auto Rotation",
+ "control": {
+ "type": "label",
+ "value": false
+ }
+ }
+ },
+ "CPU": {
+ "load": {
+ "name": "Load",
+ "control": {
+ "type": "number",
+ "value": 0.1
+ },
+ "event": "CpuLoadChanged",
+ "callback": function (setting) {
+ if (setting > 1) setting = 1;
+ if (setting < 0) setting = 0;
+ event.trigger("CpuLoadChanged", [setting]);
+ }
+ }
+ },
+ "STORAGE": {
+ "type": {
+ "name": "Type",
+ "control": {
+ "type": "select",
+ "value": StorageTypeTable["INTERNAL"]
+ },
+ "options": (function () {
+ var optionList = {};
+ utils.forEach(StorageTypeTable, function (key, value) {
+ optionList[key] = StorageTypeTable[value];
+ });
+
+ return optionList;
+ }())
+ },
+ "capacity": {
+ "name": "Capacity(bytes)",
+ "control": {
+ "type": "label",
+ "value": 16000000000
+ }
+ },
+ "availableCapacity": {
+ "name": "AvailableCapacity(bytes)",
+ "control": {
+ "type": "number",
+ "value": 12000000000
+ },
+ "callback": function (setting) {
+ event.trigger("AvailCapacityChanged", [setting]);
+ }
+ },
+ "isRemovable": {
+ "name": "IsRemovable",
+ "control": {
+ "type": "checkbox",
+ "value": true
+ }
+ }
+ },
+ "BUILD": {
+ "model": {
+ "name": "Model",
+ "control": {
+ "type": "label",
+ "innertext": "tizen-2.2 build",
+ "value": "tizen-2.2 build"
+ }
+ },
+ "manufacturer": {
+ "name": "Manufacturer",
+ "control": {
+ "type": "label",
+ "innertext": "Tizen",
+ "value": "Tizen"
+ }
+ },
+ "buildVersion": {
+ "name": "Build Version",
+ "control": {
+ "type": "label",
+ "innertext": "TIZEN_WEB_SIMULATOR_000001",
+ "value": "TIZEN_WEB_SIMULATOR_000001"
+ }
+ }
+ },
+ "LOCALE": {
+ "language": {
+ "name": "Language",
+ "control": {
+ "type": "select",
+ "value": LocaleTable["eng_USA"]
+ },
+ "options": (function () {
+ var optionList = {};
+ utils.forEach(LocaleTable, function (key, value) {
+ optionList[key] = LocaleTable[value];
+ });
+
+ return optionList;
+ }())
+ },
+ "country": {
+ "name": "Country",
+ "control": {
+ "type": "select",
+ "value": LocaleTable["eng_USA"]
+ },
+ "options": (function () {
+ var optionList = {};
+ utils.forEach(LocaleTable, function (key, value) {
+ optionList[key] = LocaleTable[value];
+ });
+
+ return optionList;
+ }())
+ }
+ },
+ "DISPLAY": {
+ "resolutionWidth": {
+ "name": "Resolution Width(pixels)",
+ "control": {
+ "type": "label",
+ "value": 0
+ }
+ },
+ "resolutionHeight": {
+ "name": "Resolution Height(pixels)",
+ "control": {
+ "type": "label",
+ "value": 0
+ }
+ },
+ "dotsPerInchWidth": {
+ "name": "DPI-X",
+ "control": {
+ "type": "label",
+ "value": 0
+ }
+ },
+ "dotsPerInchHeight": {
+ "name": "DPI-Y",
+ "control": {
+ "type": "label",
+ "value": 0
+ }
+ },
+ "physicalWidth": {
+ "name": "Physical Width(millimeters)",
+ "control": {
+ "type": "label",
+ "value": 0
+ }
+ },
+ "physicalHeight": {
+ "name": "Physical Height(millimeters)",
+ "control": {
+ "type": "label",
+ "value": 0
+ }
+ },
+ "brightness": {
+ "name": "Brightness",
+ "control": {
+ "type": "number",
+ "value": 1
+ },
+ "event": "DisplayBrightnessChanged",
+ "callback": function (setting) {
+ if (setting > 1) setting = 1;
+ if (setting < 0) setting = 0;
+ event.trigger("DisplayBrightnessChanged", [setting]);
+ }
+ }
+ },
+ "NETWORK": {
+ "networkType": {
+ "name": "Network Type",
+ "control" : {
+ "type": "select",
+ "value": NetworkTypeTable["NONE"]
+ },
+ "options": (function () {
+ var optionList = {};
+ utils.forEach(NetworkTypeTable, function (key, value) {
+ optionList[key] = NetworkTypeTable[value];
+ });
+
+ return optionList;
+ }())
+ }
+ },
+ "WIFI_NETWORK": {
+ "status": {
+ "name": "Status",
+ "control": {
+ "type": "checkbox",
+ "value": false
+ },
+ "event": "WiFiNetworkStatusChanged",
+ "callback": function (setting) {
+ event.trigger("WiFiNetworkStatusChanged", [setting]);
+ }
+ },
+ "ssid": {
+ "name": "SSID",
+ "control": {
+ "type": "text",
+ "value": "Tizen WiFi"
+ }
+ },
+ "ipAddress": {
+ "name": "IP Address",
+ "control": {
+ "type": "text",
+ "value": "192.168.0.1"
+ }
+ },
+ "ipv6Address": {
+ "name": "IPv6 Address",
+ "control": {
+ "type": "text",
+ "value": "2001:db8:85a3:0:0:0:70:7334"
+ }
+ },
+ "signalStrength": {
+ "name": "Signal Strength",
+ "control": {
+ "type": "select",
+ "value": 0
+ },
+ "options": (function () {
+ var i,
+ optionList = {};
+
+ for (i = 0; i <= 10; i++) {
+ optionList[i] = i;
+ }
+
+ return optionList;
+ }())
+ }
+ },
+ "CELLULAR_NETWORK": {
+ "status": {
+ "name": "Status",
+ "control": {
+ "type": "checkbox",
+ "value": true
+ },
+ "event": "CellularNetworkStatusChanged",
+ "callback": function (setting) {
+ event.trigger("CellularNetworkStatusChanged", [setting]);
+ }
+ },
+ "apn": {
+ "name": "APN",
+ "control": {
+ "type": "text",
+ "value": "Tizen"
+ }
+ },
+ "ipAddress": {
+ "name": "IP Address",
+ "control": {
+ "type": "text",
+ "value": "10.0.2.16"
+ }
+ },
+ "ipv6Address": {
+ "name": "IPv6 Address",
+ "control": {
+ "type": "text",
+ "value": "2001:db8:85a3:0:0:0:70:7334"
+ }
+ },
+ "mcc": {
+ "name": "MCC",
+ "control": {
+ "type": "number",
+ "value": 460
+ }
+ },
+ "mnc": {
+ "name": "MNC",
+ "control": {
+ "type": "number",
+ "value": 0
+ }
+ },
+ "cellId": {
+ "name": "Cell ID",
+ "control": {
+ "type": "number",
+ "value": 0
+ }
+ },
+ "lac": {
+ "name": "LAC",
+ "control": {
+ "type": "number",
+ "value": 0
+ }
+ },
+ "isRoaming": {
+ "name": "Roaming",
+ "control": {
+ "type": "checkbox",
+ "value": true
+ }
+ },
+ "isFlightMode": {
+ "name": "Flight Mode",
+ "control": {
+ "type": "checkbox",
+ "value": false
+ },
+ "callback": function (setting) {
+ event.trigger("FlightModeChanged", [setting]);
+ }
+ },
+ "imei": {
+ "name": "IMEI",
+ "control": {
+ "type": "text",
+ "value": "012417005203000"
+ }
+ }
+ },
+ "SIM": {
+ "state": {
+ "name": "State",
+ "control": {
+ "type": "select",
+ "value": SimStateTable["READY"]
+ },
+ "options": (function () {
+ var optionList = {};
+ utils.forEach(SimStateTable, function (key, value) {
+ optionList[key] = SimStateTable[value];
+ });
+
+ return optionList;
+ }())
+ },
+ "operatorName": {
+ "name": "Operator Name",
+ "control": {
+ "type": "text",
+ "value": "Tizen"
+ }
+ },
+ "msisdn": {
+ "name": "MSISDN",
+ "control": {
+ "type": "text",
+ "value": "088123456789"
+ }
+ },
+ "iccid": {
+ "name": "ICCID",
+ "control": {
+ "type": "text",
+ "value": "123000MFSSYYGXXXXXXP"
+ }
+ },
+ "mcc": {
+ "name": "MCC",
+ "control": {
+ "type": "number",
+ "value": 460
+ }
+ },
+ "mnc": {
+ "name": "MNC",
+ "control": {
+ "type": "number",
+ "value": 0
+ }
+ },
+ "msin": {
+ "name": "MSIN",
+ "control": {
+ "type": "text",
+ "value": "H1 H2 H3 S 12345"
+ }
+ },
+ "spn": {
+ "name": "SPN",
+ "control": {
+ "type": "text",
+ "value": "TizenSPN"
+ }
+ }
+ },
+ "PERIPHERAL": {
+ "isVideoOutputOn": {
+ "name": "Video Output",
+ "control": {
+ "type": "checkbox",
+ "value": false
+ }
+ }
+ }
+};
+
+});
+define('ripple/platform/ivi/3.0/spec/sensor', function (require, exports, module) {
+/*
+ * Copyright 2012 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+var event = require('ripple/event');
+
+function sensorStatusEventTrigger(setting) {
+ event.trigger("SensorStatusChanged", [setting]);
+}
+
+module.exports = {
+ "Accelerometer": {
+ "resolution": 0.039239998906850815,
+ "minDelay": 20,
+ "range": 20.051639556884766,
+ "name": "Accelerometer",
+ "type": "Accelerometer"
+ },
+ "MagneticField": {
+ "x": {
+ "name": "X",
+ "control": {
+ "type": "range",
+ "value": 100.0000000000000000,
+ "min": 0.0000000000000000,
+ "max": 200.0000000000000000,
+ "step": 0.0000000000000001
+ },
+ "callback": function (setting) {
+ event.trigger("MagneticField-xChanged", [setting]);
+ }
+ },
+
+ "y": {
+ "name": "Y",
+ "control": {
+ "type": "range",
+ "value": 100.0000000000000000,
+ "min": 0.0000000000000000,
+ "max": 200.0000000000000000,
+ "step": 0.0000000000000001
+ },
+ "callback": function (setting) {
+ event.trigger("MagneticField-yChanged", [setting]);
+ }
+ },
+
+ "z": {
+ "name": "Z",
+ "control": {
+ "type": "range",
+ "value": 100.0000000000000000,
+ "min": 0.0000000000000000,
+ "max": 200.0000000000000000,
+ "step": 0.0000000000000001
+ },
+ "callback": function (setting) {
+ event.trigger("MagneticField-zChanged", [setting]);
+ }
+ },
+
+ "resolution": 1,
+ "minDelay": 20,
+ "range": 359,
+ "name": "MagneticField",
+ "type": "MagneticField"
+ },
+ "Rotation": {
+ "resolution": 1,
+ "minDelay": 20,
+ "range": 359,
+ "name": "Rotation",
+ "type": "Rotation"
+ },
+ "Orientation": {
+ "resolution": 1,
+ "minDelay": 20,
+ "range": 359,
+ "name": "Orientation",
+ "type": "Orientation"
+ }
+};
+
+});
+define('ripple/platform/ivi/3.0/spec/ui', function (require, exports, module) {
+/*
+ * Copyright 2011 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = {
+ plugins: [
+ "vehicle"
+ ]
+};
+
+});
+define('ripple/platform/ivi/3.0/spec/vehicledb', function (require, exports, module) {
+/*
+ * Copyright 2013 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+module.exports = {
+ supported: ["VehicleSpeed", "EngineSpeed", "VehiclePowerMode", "TripMeter",
+ "Acceleration", "Transmission", "CruiseControlStatus", "WheelBrake",
+ "LightStatus", "InteriorLightStatus", "Horn", "Fuel", "EngineOil",
+ "Location", "ExteriorBrightness", "Temperature", "RainSensor",
+ "WindshieldWiper", "HVAC", "WindowStatus", "Sunroof", "ConvertibleRoof",
+ "VehicleId", "Size", "FuelInfo", "VehicleType", "Doors",
+ "TransmissionGearType", "WheelInformation", "Odometer", "Fluid", "Battery",
+ "TirePressure", "TireTemperature", "SecurityAlert", "ParkingBrake",
+ "ParkingLight", "HazardLight", "AntilockBrakingSystem", "TractionControlSystem",
+ "VehicleTopSpeedLimit", "AirbagStatus", "DoorStatus", "SeatBeltStatus",
+ "OccupantStatus", "ObstacleDistance"],
+ config: {
+ "current": "Car1",
+ "Car1": {
+ "VehicleId": {
+ "WMI": "AFA",
+ "VIN": "21D1M2883N342FFG7"
+ },
+ "Size": {
+ "width": 2096,
+ "height": 1860,
+ "length": 4779
+ },
+ "FuelInfo": {
+ "type": 0,
+ "refuelPosition": 0
+ },
+ "VehicleType": {
+ "type": 0
+ },
+ "Doors": {
+ "doorsPerRow": [2,2]
+ },
+ "TransmissionGearType": {
+ "transmissionGearType": 0
+ },
+ "WheelInformation": {
+ "frontWheelRadius": 1953,
+ "rearWheelRadius": 2000,
+ "wheelTrack": 1465,
+ "ABS": true
+ }
+ },
+ "Car2": {
+ "VehicleId": {
+ "WMI": "KMH",
+ "VIN": "21D1M2888N342FFL7"
+ },
+ "Size": {
+ "width": 2125,
+ "height": 1961,
+ "length": 4901
+ },
+ "FuelInfo": {
+ "type": 4,
+ "refuelPosition": 3
+ },
+ "VehicleType": {
+ "type": 4
+ },
+ "Doors": {
+ "doorsPerRow": [2,2]
+ },
+ "TransmissionGearType": {
+ "transmissionGearType": 2
+ },
+ "WheelInformation": {
+ "frontWheelRadius": 1964,
+ "rearWheelRadius": 2000,
+ "wheelTrack": 1470,
+ "ABS": true
+ }
+ }
+ },
+ stopSet: {
+ "Fluid": {
+ "transmission": {
+ "type": "text",
+ "title": "unsigned short (0-100 percentage)",
+ "default": 100
+ },
+ "brake": {
+ "type": "text",
+ "title": "unsigned short (0-100 percentage)",
+ "default": 100
+ },
+ "washer": {
+ "type": "text",
+ "title": "unsigned short (0-100 percentage)",
+ "default": 100
+ }
+ },
+ "Battery": {
+ "voltage": {
+ "type": "text",
+ "title": "double",
+ "default": 11.5
+ },
+ "current": {
+ "type": "text",
+ "title": "double",
+ "default": 10.4
+ }
+ },
+ "TirePressure": {
+ "leftFront": {
+ "type": "text",
+ "title": "double (kpa)",
+ "default": 100.5
+ },
+ "rightFront": {
+ "type": "text",
+ "title": "double (kpa)",
+ "default": 120.3
+ },
+ "leftRear": {
+ "type": "text",
+ "title": "double (kpa)",
+ "default": 200.6
+ },
+ "rightRear": {
+ "type": "text",
+ "title": "double (kpa)",
+ "default": 600.5
+ }
+ },
+ "TireTemperature": {
+ "leftFront": {
+ "type": "text",
+ "title": "double (celcius)",
+ "default": 88.5
+ },
+ "rightFront": {
+ "type": "text",
+ "title": "double (celcius)",
+ "default": 52.1
+ },
+ "leftRear": {
+ "type": "text",
+ "title": "double (celcius)",
+ "default": 70.6
+ },
+ "rightRear": {
+ "type": "text",
+ "title": "double (celcius)",
+ "default": 96.5
+ }
+ }
+ },
+ enabledSet: {
+ "Transmission": {
+ "gearPosition": {
+ "type": "select",
+ "options": [{"NEUTRAL":0},{"FIRST":1},{"SECOND":2},{"THIRD":3},
+ {"FORTH":4},{"FIFTH":5},{"SIXTH":6},{"SEVENTH":7},
+ {"EIGHTH":8},{"NINTH":9},{"TENTH":10},{"CVT":64},
+ {"REVERSE":128},{"PARK":255}],
+ "default": 255
+ },
+ "mode": {
+ "type": "select",
+ "options": [{"NORMAL":0},{"SPORT":1},{"ECONOMY":2},
+ {"OEMCUSTOM1":3},{"OEMCUSTOM2":4}],
+ "default": 0
+ }
+ },
+ "CruiseControlStatus": {
+ "activated": {
+ "type": "radio",
+ "options": ["active","inactive"],
+ "default": true
+ },
+ "speed": {
+ "type": "text",
+ "title": "unsigned short (kph)",
+ "default": 100
+ }
+ },
+ "WheelBrake": {
+ "engaged": {
+ "type": "radio",
+ "options": ["engaged","disengaged"],
+ "default": true
+ }
+ },
+ "LightStatus": {
+ "head": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ },
+ "rightTurn": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ },
+ "leftTurn": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ },
+ "brake": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ },
+ "fog": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ },
+ "hazard": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ },
+ "parking": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ },
+ "highBeam": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ }
+ },
+ "InteriorLightStatus": {
+ "passenger": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ },
+ "driver": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ },
+ "center": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ }
+ },
+ "Horn": {
+ "horn": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ }
+ },
+ "WindshieldWiper": {
+ "windshieldWiper": {
+ "type": "select",
+ "options": [{"OFF":0},{"SLOWEST":1},{"FASTEST":5},{"AUTO":10}],
+ "default": 0
+ }
+ },
+ "HVAC": {
+ "airflowDirection": {
+ "type": "select",
+ "options": [{"FRONTPANEL":0},{"FLOORDUCT":1},{"FRONT":0x02},
+ {"DEFROSTER":0x04}],
+ "default": 0
+ },
+ "fanSpeed": {
+ "type": "select",
+ "options": [{"0":0},{"1":1},{"2":2},{"3":3},{"4":4},{"5":5},
+ {"6":6},{"7":7}],
+ "default": 1
+ },
+ "targetTemperature": {
+ "type": "text",
+ "title": "unsigned short (celcius)",
+ "default": 21
+ },
+ "airConditioning": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ },
+ "airRecirculation": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ },
+ "heater": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ },
+ "defrost-window": {
+ "type": "text",
+ "title": "unsigned short",
+ "default": 1
+ },
+ "defrost-defrost": {
+ "type": "radio",
+ "options": ["yes","no"],
+ "default": true
+ },
+ "steeringWheelHeater": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ },
+ "seatHeater": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ },
+ "seatCooler": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": false
+ }
+ },
+ "Sunroof": {
+ "openness": {
+ "type": "text",
+ "title": "unsigned short (percentage)",
+ "default": 50
+ },
+ "tilt": {
+ "type": "text",
+ "title": "unsigned short (percentage)",
+ "default": 50
+ }
+ },
+ "ConvertibleRoof": {
+ "openness": {
+ "type": "text",
+ "title": "unsigned short (percentage)",
+ "default": 50
+ }
+ },
+ "SecurityAlert": {
+ "securityAlert": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": true
+ }
+ },
+ "ParkingBrake": {
+ "parkingBrake": {
+ "type": "radio",
+ "options": ["engaged","disengaged"],
+ "default": true
+ }
+ },
+ "ParkingLight": {
+ "parkingLight": {
+ "type": "radio",
+ "options": ["engaged","disengaged"],
+ "default": true
+ }
+ },
+ "HazardLight": {
+ "hazardLight": {
+ "type": "radio",
+ "options": ["engaged","disengaged"],
+ "default": true
+ }
+ },
+ "AntilockBrakingSystem": {
+ "securityAlert": {
+ "type": "radio",
+ "options": ["engaged","idle"],
+ "default": true
+ }
+ },
+ "TractionControlSystem": {
+ "tractionControlSystem": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": true
+ }
+ },
+ "VehicleTopSpeedLimit": {
+ "vehicleTopSpeedLimit": {
+ "type": "text",
+ "title": "unsigned short (km/h)",
+ "default": 150
+ }
+ },
+ "WindowStatus": {
+ "WindowStatus": {
+ "type": "text",
+ "title": "dictionary",
+ "default": null
+ }
+ },
+ "AirbagStatus": {
+ "airbagStatus": {
+ "type": "text",
+ "title": "dictionary",
+ "default": null
+ }
+ },
+ "DoorStatus": {
+ "airbagStatus": {
+ "type": "text",
+ "title": "dictionary",
+ "default": null
+ }
+ },
+ "SeatBeltStatus": {
+ "doorStatus": {
+ "type": "text",
+ "title": "dictionary",
+ "default": null
+ },
+ "doorLockStatus": {
+ "type": "text",
+ "title": "dictionary",
+ "default": null
+ },
+ "childLockStatus": {
+ "type": "radio",
+ "options": ["on","off"],
+ "default": true
+ }
+ },
+ "OccupantStatus": {
+ "occupantStatus": {
+ "type": "text",
+ "title": "dictionary",
+ "default": null
+ }
+ },
+ "ObstacleDistance": {
+ "obstacleDistance": {
+ "type": "text",
+ "title": "dictionary",
+ "default": null
+ }
+ }
+ },
+ properties: ["VehicleSpeed", "EngineSpeed", "VehiclePowerMode", "TripMeter",
+ "Acceleration", "Transmission", "CruiseControlStatus", "WheelBrake",
+ "LightStatus", "InteriorLightStatus", "Horn", "Fuel", "EngineOil",
+ "Location", "ExteriorBrightness", "Temperature", "RainSensor",
+ "WindshieldWiper", "HVAC", "WindowStatus", "Sunroof", "ConvertibleRoof",
+ "VehicleId", "Size", "FuelInfo", "VehicleType", "Doors",
+ "TransmissionGearType", "WheelInformation", "Odometer", "Fluid", "Battery",
+ "TirePressure", "TireTemperature", "SecurityAlert", "ParkingBrake",
+ "ParkingLight", "HazardLight", "AntilockBrakingSystem", "TractionControlSystem",
+ "VehicleTopSpeedLimit", "AirbagStatus", "DoorStatus", "SeatBeltStatus",
+ "OccupantStatus", "ObstacleDistance"],
+ dataCount: 9,
+ now: "1384408800000",
+ historyCount: 0,
+ history: {
+ },
+ zone: {
+ "ZONE_None": 0,
+ "ZONE_Front": 1,
+ "ZONE_Middle": 0x10,
+ "ZONE_Right": 0x100,
+ "ZONE_Left": 0x1000,
+ "ZONE_Rear": 0x10000,
+ "ZONE_Center": 0x10000
+ },
+ data: {
+ "1384408800000": { //2013-11-14 14:00:00
+ "VehicleSpeed" : {
+ "vehicleSpeed": 0
+ },
+ "EngineSpeed" : {
+ "engineSpeed": 0
+ },
+ "VehiclePowerMode": {
+ "vehiclePowerMode": 1
+ },
+ "TripMeter": {
+ "tripMeters": [23, 7876, 124, 4577]
+ },
+ "Acceleration": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "Fuel": {
+ "level": 87,
+ "range": 251,
+ "instantConsumption": 250,
+ "instantEconomy": 85,
+ "averageEconomy": 15
+ },
+ "EngineOil": {
+ "remaining": 0,
+ "temperature": 0,
+ "pressure": 0
+ },
+ "Location": {
+ "latitude": 0,
+ "longitude": 0,
+ "altitude": 0,
+ "direction": 0
+ },
+ "ExteriorBrightness": {
+ "exteriorBrightness": 0
+ },
+ "Temperature": {
+ "interior": 0,
+ "exterior": 0
+ },
+ "RainSensor": {
+ "rainSensor": 2
+ },
+ "Odometer": {
+ "odometer": 333
+ }
+ },
+ "1384401600000": { //2013-11-14 12:00:00
+ "VehicleSpeed" : {
+ "vehicleSpeed": 60
+ },
+ "EngineSpeed" : {
+ "engineSpeed": 2500
+ },
+ "VehiclePowerMode": {
+ "vehiclePowerMode": 0
+ },
+ "TripMeter": {
+ "tripMeters": [100, 1000, 1500]
+ },
+ "Acceleration": {
+ "x": 10,
+ "y": 10,
+ "z": 10
+ },
+ "Fuel": {
+ "level": 100,
+ "range": 105,
+ "instantConsumption": 59,
+ "instantEconomy": 87,
+ "averageEconomy": 15
+ },
+ "EngineOil": {
+ "remaining": 150,
+ "temperature": 560,
+ "pressure": 59
+ },
+ "Location": {
+ "latitude": -15,
+ "longitude": -89,
+ "altitude": 16,
+ "direction": 69
+ },
+ "ExteriorBrightness": {
+ "exteriorBrightness": 456
+ },
+ "Temperature": {
+ "interior": 45,
+ "exterior": 45
+ },
+ "RainSensor": {
+ "rainSensor": 10
+ },
+ "Odometer": {
+ "odometer": 1213
+ }
+ },
+ "1384402500000": { //2013-11-14 12:15:00
+ "VehicleSpeed" : {
+ "vehicleSpeed": 120
+ },
+ "EngineSpeed" : {
+ "engineSpeed": 2800
+ },
+ "VehiclePowerMode": {
+ "vehiclePowerMode": 1
+ },
+ "TripMeter": {
+ "tripMeters": [100, 1000]
+ },
+ "Acceleration": {
+ "x": 1002,
+ "y": 1045,
+ "z": 1036
+ },
+ "Fuel": {
+ "level": 100,
+ "range": 254,
+ "instantConsumption": 59,
+ "instantEconomy": 87,
+ "averageEconomy": 15
+ },
+ "EngineOil": {
+ "remaining": 78,
+ "temperature": 546,
+ "pressure": 54
+ },
+ "Location": {
+ "latitude": -97,
+ "longitude": -54,
+ "altitude": 124,
+ "direction": 65
+ },
+ "ExteriorBrightness": {
+ "exteriorBrightness": 45
+ },
+ "Temperature": {
+ "interior": 67,
+ "exterior": 45
+ },
+ "RainSensor": {
+ "rainSensor": 9
+ },
+ "Odometer": {
+ "odometer": 250
+ }
+ },
+ "1384403400000": { //2013-11-14 12:30:00
+ "VehicleSpeed" : {
+ "vehicleSpeed": 180
+ },
+ "EngineSpeed" : {
+ "engineSpeed": 3100
+ },
+ "VehiclePowerMode": {
+ "vehiclePowerMode": 2
+ },
+ "TripMeter": {
+ "tripMeters": [100, 1000, 1500]
+ },
+ "Acceleration": {
+ "x": 1234,
+ "y": 45,
+ "z": 67
+ },
+ "Fuel": {
+ "level": 34,
+ "range": 67,
+ "instantConsumption": 97,
+ "instantEconomy": 123,
+ "averageEconomy": 56
+ },
+ "EngineOil": {
+ "remaining": 155,
+ "temperature": 960,
+ "pressure": 78
+ },
+ "Location": {
+ "latitude": 58,
+ "longitude": -89,
+ "altitude": 123,
+ "direction": 69
+ },
+ "ExteriorBrightness": {
+ "exteriorBrightness": 768
+ },
+ "Temperature": {
+ "interior": 45,
+ "exterior": 98
+ },
+ "RainSensor": {
+ "rainSensor": 8
+ },
+ "Odometer": {
+ "odometer": 360
+ }
+ },
+ "1384404300000": { //2013-11-14 12:45:00
+ "VehicleSpeed" : {
+ "vehicleSpeed": 240
+ },
+ "EngineSpeed" : {
+ "engineSpeed": 3400
+ },
+ "VehiclePowerMode": {
+ "vehiclePowerMode": 3
+ },
+ "TripMeter": {
+ "tripMeters": [100, 15]
+ },
+ "Acceleration": {
+ "x": 789,
+ "y": 234,
+ "z": 1200
+ },
+ "Fuel": {
+ "level": 58,
+ "range": 78,
+ "instantConsumption": 123,
+ "instantEconomy": 56,
+ "averageEconomy": 31
+ },
+ "EngineOil": {
+ "remaining": 54,
+ "temperature": 963,
+ "pressure": 210
+ },
+ "Location": {
+ "latitude": -15,
+ "longitude": 32,
+ "altitude": 16,
+ "direction": 23
+ },
+ "ExteriorBrightness": {
+ "exteriorBrightness": 234
+ },
+ "Temperature": {
+ "interior": 76,
+ "exterior": 45
+ },
+ "RainSensor": {
+ "rainSensor": 7
+ },
+ "Odometer": {
+ "odometer": 38
+ }
+ },
+ "1384405200000": { //2013-11-14 13:00:00
+ "VehicleSpeed" : {
+ "vehicleSpeed": 280
+ },
+ "EngineSpeed" : {
+ "engineSpeed": 3700
+ },
+ "VehiclePowerMode": {
+ "vehiclePowerMode": 0
+ },
+ "TripMeter": {
+ "tripMeters": [1245, 1000]
+ },
+ "Acceleration": {
+ "x": 400,
+ "y": 10,
+ "z": 600
+ },
+ "Fuel": {
+ "level": 120,
+ "range": 130,
+ "instantConsumption": 140,
+ "instantEconomy": 145,
+ "averageEconomy": 47
+ },
+ "EngineOil": {
+ "remaining": 56,
+ "temperature": 78,
+ "pressure": 54
+ },
+ "Location": {
+ "latitude": -15,
+ "longitude": 12,
+ "altitude": 16,
+ "direction": 69
+ },
+ "ExteriorBrightness": {
+ "exteriorBrightness": 45
+ },
+ "Temperature": {
+ "interior": 45,
+ "exterior": 58
+ },
+ "RainSensor": {
+ "rainSensor": 6
+ },
+ "Odometer": {
+ "odometer": 1314
+ }
+ },
+ "1384406100000": { //2013-11-14 13:15:00
+ "VehicleSpeed" : {
+ "vehicleSpeed": 320
+ },
+ "EngineSpeed" : {
+ "engineSpeed": 4000
+ },
+ "VehiclePowerMode": {
+ "vehiclePowerMode": 1
+ },
+ "TripMeter": {
+ "tripMeters": [90, 100, 1000]
+ },
+ "Acceleration": {
+ "x": 850,
+ "y": 853,
+ "z": 956
+ },
+ "Fuel": {
+ "level": 78,
+ "range": 99,
+ "instantConsumption": 98,
+ "instantEconomy": 125,
+ "averageEconomy": 157
+ },
+ "EngineOil": {
+ "remaining": 89,
+ "temperature": 1001,
+ "pressure": 12
+ },
+ "Location": {
+ "latitude": 46,
+ "longitude": -89,
+ "altitude": 16,
+ "direction": 69
+ },
+ "ExteriorBrightness": {
+ "exteriorBrightness": 432
+ },
+ "Temperature": {
+ "interior": 45,
+ "exterior": 21
+ },
+ "RainSensor": {
+ "rainSensor": 5
+ },
+ "Odometer": {
+ "odometer": 521
+ }
+ },
+ "1384407000000": { //2013-11-14 13:30:00
+ "VehicleSpeed" : {
+ "vehicleSpeed": 220
+ },
+ "EngineSpeed" : {
+ "engineSpeed": 3200
+ },
+ "VehiclePowerMode": {
+ "vehiclePowerMode": 3
+ },
+ "TripMeter": {
+ "tripMeters": [55]
+ },
+ "Acceleration": {
+ "x": 777,
+ "y": 7878,
+ "z": 521
+ },
+ "Fuel": {
+ "level": 58,
+ "range": 96,
+ "instantConsumption": 230,
+ "instantEconomy": 237,
+ "averageEconomy": 245
+ },
+ "EngineOil": {
+ "remaining": 12,
+ "temperature": 521,
+ "pressure": 16
+ },
+ "Location": {
+ "latitude": -15,
+ "longitude": -89,
+ "altitude": 16,
+ "direction": 86
+ },
+ "ExteriorBrightness": {
+ "exteriorBrightness": 123
+ },
+ "Temperature": {
+ "interior": 45,
+ "exterior": 12
+ },
+ "RainSensor": {
+ "rainSensor": 4
+ },
+ "Odometer": {
+ "odometer": 2
+ }
+ },
+ "1384407900000": { //2013-11-14 13:45:00
+ "VehicleSpeed" : {
+ "vehicleSpeed": 100
+ },
+ "EngineSpeed" : {
+ "engineSpeed": 2600
+ },
+ "VehiclePowerMode": {
+ "vehiclePowerMode": 2
+ },
+ "TripMeter": {
+ "tripMeters": [1030, 1012]
+ },
+ "Acceleration": {
+ "x": 888,
+ "y": 666,
+ "z": 444
+ },
+ "Fuel": {
+ "level": 132,
+ "range": 145,
+ "instantConsumption": 87,
+ "instantEconomy": 169,
+ "averageEconomy": 91
+ },
+ "EngineOil": {
+ "remaining": 66,
+ "temperature": 1314,
+ "pressure": 88
+ },
+ "Location": {
+ "latitude": -15,
+ "longitude": -89,
+ "altitude": 789,
+ "direction": 69
+ },
+ "ExteriorBrightness": {
+ "exteriorBrightness": 768
+ },
+ "Temperature": {
+ "interior": 0,
+ "exterior": 45
+ },
+ "RainSensor": {
+ "rainSensor": 3
+ },
+ "Odometer": {
+ "odometer": 66
+ }
+ }
+ }
+};
+
+});
+define('ripple/platform/ivi/3.0/spec', function (require, exports, module) {
+/*
+ * Copyright 2012 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+module.exports = {
+
+ id: "ivi",
+ version: "3.0",
+ name: "IVI",
+
+ persistencePrefix: "ivi3-",
+
+ config: require('ripple/platform/ivi/3.0/spec/config'),
+ ui: require('ripple/platform/ivi/3.0/spec/ui'),
+ device: require('ripple/platform/ivi/3.0/spec/device'),
+ sensor: require('ripple/platform/ivi/3.0/spec/sensor'),
+ DeviceMotionEvent: require('ripple/platform/tizen/2.0/DeviceMotionEvent'),
+ DeviceOrientationEvent: require('ripple/platform/tizen/2.0/DeviceOrientationEvent'),
+
+ objects: {
+ Coordinates: {
+ path: "w3c/1.0/Coordinates"
+ },
+ Position: {
+ path: "w3c/1.0/Position"
+ },
+ PositionError: {
+ path: "w3c/1.0/PositionError"
+ },
+ SensorConnection: {
+ path: "w3c/1.0/SensorConnection"
+ },
+ navigator: {
+ path: "tizen/2.0/navigator",
+ children: {
+ geolocation: {
+ path: "wac/2.0/geolocation"
+ }
+ }
+ },
+ tizen: {
+ children: {
+ vehicle: {
+ path: "ivi/3.0/vehicle",
+ feature: "http://tizen.org/privilege/vehicle",
+ handleSubfeatures: true
+ }
+ }
+ }
+ }
+};
+
+});
+define('ripple/platform/ivi/3.0/typecast', function (require, exports, module) {
+/*
+ * Copyright 2013 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+var typedef = require('ripple/platform/ivi/3.0/typedef'),
+ errorcode = require('ripple/platform/ivi/3.0/errorcode'),
+ WebAPIException = require('ripple/platform/ivi/3.0/WebAPIException'),
+ TypeCoerce = require('ripple/platform/ivi/3.0/typecoerce'),
+ _self = {};
+
+function _cast(pattern, obj, isDuplicate) {
+ var tc, tcFunc;
+
+ if (pattern === null)
+ return;
+
+ tc = new TypeCoerce(pattern);
+ tcFunc = isDuplicate ? tc.copy : tc.cast;
+
+ if ((obj = tcFunc(obj)) === null) {
+ throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ }
+
+ return obj;
+}
+
+function _castType(pattern) {
+ /*
+ * Type cast for each known type. The function name is the exact name of the
+ * corresponding type.
+ *
+ * obj
+ * Variable to be casted
+ *
+ * aux
+ * Auxiliary descriptor of obj. It can be any one or combination of below
+ * strings, or ignored in most cases.
+ *
+ * "?" Nullable types
+ * "[]" Array
+ * "+" Deep copy
+ *
+ * Return
+ * Casted or duplicated object.
+ */
+
+ return function (obj, aux) {
+ var type, isNullable, isDuplicate;
+
+ aux = aux ? String(aux) : "";
+ type = (aux.indexOf("[]") !== -1) ? [pattern] : pattern;
+ isNullable = (aux.indexOf("?") !== -1);
+ isDuplicate = (aux.indexOf("+") !== -1);
+
+ if (isNullable && ((obj === null) || (obj === undefined))) {
+ return obj;
+ }
+
+ return _cast(type, obj, isDuplicate);
+ };
+}
+
+function _castConstructor(name) {
+ var constructors, hook, vtc, isOverloaded, castConstructor;
+
+ /*
+ * Type cast for constructor. The function name is the exact name of the
+ * object type.
+ *
+ * argv
+ * arguments. The keyword 'arguments' will always be passed in.
+ */
+
+ function castUnique(argv) {
+ _cast(constructors, argv, false);
+ }
+
+ /*
+ * Type cast for overloaded constructors. The function name is the exact
+ * name of the object type.
+ *
+ * argv
+ * arguments. The keyword 'arguments' will always be passed in.
+ *
+ * scope
+ * 'this' of the original constructor.
+ *
+ * voc
+ * Array of overloaded constructors callback
+ */
+
+ function castOverload(argv, scope, voc) {
+ var iOverload;
+
+ if (!vtc) {
+ vtc = [];
+ constructors.forEach(function (c) {
+ vtc.push((c === null) ? null : new TypeCoerce(c));
+ });
+ }
+
+ vtc.some(function (tc, index) {
+ if (tc && (tc.cast(argv) === null))
+ return false;
+
+ iOverload = index;
+ return true;
+ });
+
+ if (iOverload === undefined) {
+ throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ }
+
+ return (voc && voc[iOverload].apply(scope, argv));
+ }
+
+ constructors = typedef.constructor[name];
+
+ if (name in _self) {
+ hook = _self[name];
+ }
+
+ isOverloaded = (Object.prototype.toString.call(constructors) ===
+ "[object Array]");
+ castConstructor = isOverloaded ? castOverload : castUnique;
+
+ return function (argv, scope) {
+ if (Object.prototype.toString.call(argv) !== "[object Arguments]") {
+ return (hook && hook.apply(this, arguments));
+ }
+
+ if (!(scope instanceof argv.callee)) {
+ throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR, null, "TypeError");
+ }
+
+ castConstructor.apply(this, arguments);
+ };
+}
+
+function _castInterface(name) {
+ var interface, hook;
+
+ interface = typedef.interface[name];
+
+ if (name in _self) {
+ hook = _self[name];
+ }
+
+ /*
+ * Type cast for each known method of interface. The function name is the
+ * exact name of the corresponding interface.
+ *
+ * method
+ * String of method name
+ *
+ * argv
+ * arguments. The keyword 'arguments' will always be passed in.
+ *
+ * isDuplicate
+ * A boolean value to indicate whether arguments will be copied or not.
+ */
+
+ return function (method, argv, isDuplicate) {
+ if ((typeof method !== "string") || (typeof argv !== "object")) {
+ return (hook && hook.apply(this, arguments));
+ }
+
+ _cast(interface[method], argv, isDuplicate);
+ };
+}
+
+(function () {
+ var i;
+
+ for (i in typedef) {
+ _self[i] = _castType(typedef[i]);
+ }
+
+ for (i in typedef.constructor) {
+ _self[i] = _castConstructor(i);
+ typedef[i]._constructor = i;
+ }
+
+ for (i in typedef.interface) {
+ _self[i] = _castInterface(i);
+ }
+}());
+
+module.exports = _self;
+
+});
+define('ripple/platform/ivi/3.0/typecoerce', function (require, exports, module) {
+/*
+ * Copyright 2013 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+var t = require('ripple/platform/ivi/3.0/typedef'),
+ _self;
+
+_self = function (pattern) {
+ var typeCoerce, typeOfPattern;
+
+ // private
+ function getExtendedType(val) {
+ var type = Object.prototype.toString.call(val), attr;
+
+ switch (type) {
+ case "[object Array]":
+ if ((typeof val[0] === "string") && (val[0].length > 0)) {
+ type = "enum";
+ } else {
+ type = "Union";
+ }
+ return type;
+
+ case "[object Object]":
+ if ("_dictionary" in val) {
+ return "dictionary";
+ }
+
+ type = "Object";
+
+ for (attr in val) {
+ if (attr === "0") {
+ type = "Arguments";
+ } else if (val[attr] === "Callback") {
+ type = "Callback";
+ }
+ break;
+ }
+
+ return type;
+ }
+
+ switch (val) {
+ case "Callback":
+ type = "Function";
+ break;
+
+ case "TZDate":
+ case "any":
+ case "byte":
+ case "float":
+ case "long":
+ case "long long":
+ case "octet":
+ case "short":
+ case "unsigned long":
+ case "unsigned long long":
+ case "unsigned short":
+ type = val;
+ break;
+
+ case "double":
+ type = "float";
+ break;
+
+ default: // Derivative type name: e.g., "AbstractFilter"
+ type = "";
+ break;
+ }
+
+ return type;
+ }
+
+ function getType(val, isPattern) {
+ var type = Object.prototype.toString.call(val);
+
+ switch (type) {
+ case "[object Array]":
+ type = (isPattern && (val.length > 1)) ? getExtendedType(val) :
+ "Array";
+ break;
+
+ case "[object Arguments]":
+ type = "Arguments";
+ break;
+
+ case "[object Boolean]":
+ type = "boolean";
+ break;
+
+ case "[object Date]":
+ type = "Date";
+ break;
+
+ case "[object Function]":
+ type = "Function";
+ break;
+
+ case "[object Number]":
+ type = "Number";
+ break;
+
+ case "[object Object]":
+ type = isPattern ? getExtendedType(val) : "Object";
+ break;
+
+ case "[object String]":
+ type = (isPattern && !!val) ? getExtendedType(val) : "DOMString";
+ break;
+ }
+
+ return type;
+ }
+
+ function isConstructed(obj) {
+ if (!("_constructor" in pattern))
+ return true;
+
+ if (obj instanceof window.tizen[pattern._constructor])
+ return true;
+
+ return false;
+ }
+
+ function toInteger(x) {
+ return (x < 0) ? Math.ceil(x) : Math.floor(x);
+ }
+
+ function modulo(a, b) {
+ return (a - Math.floor(a / b) * b);
+ }
+
+ function toInt(x, bits) {
+ var p;
+
+ x = Number(x);
+
+ if (isNaN(x) || !isFinite(x))
+ return null;
+
+ p = Math.pow(2, bits);
+ x = modulo(toInteger(x), p);
+
+ return (x >= Math.pow(2, bits - 1)) ? (x - p) : x;
+ }
+
+ function toUInt(x, bits) {
+ x = Number(x);
+
+ if (isNaN(x) || !isFinite(x))
+ return null;
+
+ return modulo(toInteger(x), Math.pow(2, bits));
+ }
+
+ function toInt8(x) {
+ return toInt(x, 8);
+ }
+
+ function toInt16(x) {
+ return toInt(x, 16);
+ }
+
+ function toInt32(x) {
+ return toInt(x, 32);
+ }
+
+ function toInt64(x) {
+ return toInt(x, 64);
+ }
+
+ function toUInt8(x) {
+ return toUInt(x, 8);
+ }
+
+ function toUInt16(x) {
+ return toUInt(x, 16);
+ }
+
+ function toUInt32(x) {
+ return toUInt(x, 32);
+ }
+
+ function toUInt64(x) {
+ return toUInt(x, 64);
+ }
+
+ // public
+ function cast(obj) {
+ var typeMap,
+ typeOfObj = getType(obj, false);
+
+ typeMap = {
+ "Arguments": function () {
+ var i, isNullable, ret;
+
+ for (i in pattern) {
+ if (i === "_optional")
+ continue;
+
+ isNullable = !!(pattern._optional && pattern._optional[i]);
+
+ if (i > obj.length - 1) {
+ if (!isNullable) {
+ return null;
+ }
+ break;
+ }
+
+ if (!isNullable || (obj[i] !== null)) {
+ ret = _self(pattern[i]).cast(obj[i]);
+ if (ret === null) {
+ return null;
+ }
+ obj[i] = ret;
+ }
+ }
+
+ return obj;
+ },
+
+ "Array": function () {
+ var elementType, i, ret;
+
+ if (typeOfObj !== typeOfPattern) {
+ return null;
+ }
+
+ elementType = _self(pattern[0]);
+ for (i in obj) {
+ ret = elementType.cast(obj[i]);
+ if (ret === null) {
+ return null;
+ }
+ obj[i] = ret;
+ }
+
+ return obj;
+ },
+
+ "Callback": function () {
+ var attr;
+
+ if (typeOfObj !== "Object") {
+ return null;
+ }
+
+ for (attr in pattern) {
+ if (attr in obj) {
+ obj[attr] = _self(pattern[attr]).cast(obj[attr]);
+ if (obj[attr] === null) {
+ return null;
+ }
+ }
+ }
+
+ return obj;
+ },
+
+ "DOMString": function () {
+ switch (typeOfObj) {
+ case "DOMString":
+ case "Date":
+ case "Number":
+ case "boolean":
+ obj = String(obj);
+ break;
+
+ default:
+ if ((obj === null) || (obj === undefined)) {
+ obj = String(obj);
+ } else {
+ obj = null;
+ }
+ break;
+ }
+
+ return obj;
+ },
+
+ "Date": function () {
+ return (typeOfObj === typeOfPattern) ? obj : null;
+ },
+
+ "Function": function () {
+ return (typeOfObj === typeOfPattern) ? obj : null;
+ },
+
+ "Object": function () {
+ var ret, attr, i;
+
+ if (typeOfObj !== typeOfPattern) {
+ if ((obj === null) || (obj === undefined)) {
+ return null;
+ }
+ if (!("_derived" in pattern)) {
+ return null;
+ }
+ }
+
+ if (!isConstructed(obj)) {
+ return null;
+ }
+
+ for (attr in pattern) {
+ switch (attr) {
+ case "_optional":
+ case "_constructor":
+ break;
+
+ case "_derived":
+ for (i in pattern._derived) {
+ ret = _self(pattern._derived[i]).cast(obj);
+ if (ret !== null)
+ break;
+ }
+ if (ret === null) {
+ return null;
+ }
+ break;
+
+ default:
+ if (!pattern._optional || !pattern._optional[attr] ||
+ (obj[attr] !== undefined) &&
+ (obj[attr] !== null)) {
+ ret = _self(pattern[attr]).cast(obj[attr]);
+ if (ret === null) {
+ return null;
+ }
+ obj[attr] = ret;
+ }
+ break;
+ }
+ }
+
+ return obj;
+ },
+
+ "TZDate": function () {
+ if (typeOfObj !== "Object") {
+ return null;
+ }
+ return (obj instanceof window.tizen.TZDate) ? obj : null;
+ },
+
+ "Union": function () {
+ var ret, i;
+
+ for (i in pattern) {
+ ret = _self(pattern[i]).cast(obj);
+ if (ret !== null)
+ break;
+ }
+
+ return ret;
+ },
+
+ "any": function () {
+ return obj;
+ },
+
+ "boolean": function () {
+ return (typeOfObj === typeOfPattern) ? obj : null;
+ },
+
+ "byte": function () {
+ return toInt8(obj);
+ },
+
+ "dictionary": function () {
+ var attr, ret;
+
+ if (typeOfObj !== "Object") {
+ return null;
+ }
+
+ for (attr in pattern) {
+ switch (attr) {
+ case "_dictionary":
+ if (pattern._dictionary !== null) {
+ ret = _self(pattern._dictionary).cast(obj);
+ if (ret === null) {
+ return null;
+ }
+ }
+ break;
+
+ default:
+ if ((attr in obj) && (obj[attr] !== null) &&
+ (obj[attr] !== undefined)) {
+ ret = _self(pattern[attr]).cast(obj[attr]);
+ if (ret === null) {
+ return null;
+ }
+ obj[attr] = ret;
+ }
+ break;
+ }
+ }
+
+ return obj;
+ },
+
+ "enum": function () {
+ var i;
+
+ obj = String(obj).trim();
+ for (i in pattern) {
+ if (obj === pattern[i]) {
+ return obj;
+ }
+ }
+
+ return null;
+ },
+
+ "float": function () {
+ var f = parseFloat(obj, 10);
+
+ return (isNaN(f) ? null : f);
+ },
+
+ "long": function () {
+ return toInt32(obj);
+ },
+
+ "long long": function () {
+ return toInt64(obj);
+ },
+
+ "octet": function () {
+ return toUInt8(obj);
+ },
+
+ "short": function () {
+ return toInt16(obj);
+ },
+
+ "unsigned long": function () {
+ return toUInt32(obj);
+ },
+
+ "unsigned long long": function () {
+ return toUInt64(obj);
+ },
+
+ "unsigned short": function () {
+ return toUInt16(obj);
+ },
+
+ "": function () {
+ return _self(t[pattern]).cast(obj);
+ }
+ };
+
+ return typeMap[typeOfPattern]();
+ }
+
+ function copy(obj) {
+ var typeMap,
+ typeOfObj = getType(obj, false);
+
+ typeMap = {
+ "Arguments": function () {
+ var i, isNullable, ret = [];
+
+ for (i in pattern) {
+ if (i === "_optional")
+ continue;
+
+ isNullable = !!(pattern._optional && pattern._optional[i]);
+
+ if (i > obj.length - 1) {
+ if (!isNullable) {
+ return null;
+ }
+ break;
+ }
+
+ if (!isNullable || (obj[i] !== null)) {
+ ret[i] = _self(pattern[i]).copy(obj[i]);
+ if (ret[i] === null) {
+ return null;
+ }
+ }
+ }
+
+ for (i in ret) {
+ obj[i] = ret[i];
+ }
+
+ return obj;
+ },
+
+ "Array": function () {
+ var arr = [], elementType, i;
+
+ if (typeOfObj !== typeOfPattern) {
+ return null;
+ }
+
+ elementType = _self(pattern[0]);
+ for (i in obj) {
+ if (obj[i]) {
+ arr[i] = elementType.copy(obj[i]);
+ if (arr[i] === null)
+ return null;
+ }
+ }
+
+ return arr;
+ },
+
+ "Callback": function () {
+ var ret = {}, attr;
+
+ if (typeOfObj !== "Object") {
+ return null;
+ }
+
+ for (attr in pattern) {
+ if (attr in obj) {
+ ret[attr] = _self(pattern[attr]).copy(obj[attr]);
+ if (ret[attr] === null) {
+ return null;
+ }
+ }
+ }
+
+ return ret;
+ },
+
+ "Object": function () {
+ var ret = {}, attr, i, derived;
+
+ if (typeOfObj !== typeOfPattern) {
+ if ((obj === null) || (obj === undefined)) {
+ return null;
+ }
+ if (!("_derived" in pattern)) {
+ return null;
+ }
+ }
+
+ if (!isConstructed(obj)) {
+ return null;
+ }
+ if ("_constructor" in pattern) {
+ ret.__proto__ = window.tizen[pattern._constructor].prototype;
+ }
+
+ for (attr in pattern) {
+ switch (attr) {
+ case "_optional":
+ case "_constructor":
+ break;
+
+ case "_derived":
+ for (i in pattern._derived) {
+ derived = _self(pattern._derived[i]).copy(obj);
+ if (derived !== null)
+ break;
+ }
+ if (derived === null) {
+ return null;
+ }
+ for (attr in derived) {
+ ret[attr] = derived[attr];
+ }
+ break;
+
+ default:
+ if (!pattern._optional || !pattern._optional[attr] ||
+ (obj[attr] !== undefined) &&
+ (obj[attr] !== null)) {
+ ret[attr] = _self(pattern[attr]).copy(obj[attr]);
+ if (ret[attr] === null) {
+ return null;
+ }
+ }
+ break;
+ }
+ }
+
+ return ret;
+ },
+
+ "Union": function () {
+ var ret, i;
+
+ for (i in pattern) {
+ ret = _self(pattern[i]).copy(obj);
+ if (ret !== null)
+ break;
+ }
+
+ return ret;
+ },
+
+ "dictionary": function () {
+ var ret = {}, attr, base, i;
+
+ if (typeOfObj !== "Object") {
+ return null;
+ }
+
+ for (attr in pattern) {
+ switch (attr) {
+ case "_dictionary":
+ if (pattern._dictionary !== null) {
+ base = _self(pattern._dictionary).copy(obj);
+ if (base === null) {
+ return null;
+ }
+ for (i in base) {
+ ret[i] = base[i];
+ }
+ }
+ break;
+
+ default:
+ if ((attr in obj) && (obj[attr] !== null) &&
+ (obj[attr] !== undefined)) {
+ ret[attr] = _self(pattern[attr]).copy(obj[attr]);
+ if (ret[attr] === null) {
+ return null;
+ }
+ }
+ break;
+ }
+ }
+
+ return ret;
+ },
+
+ "": function () {
+ return _self(t[pattern]).copy(obj);
+ }
+ };
+
+ return (typeOfPattern in typeMap) ? typeMap[typeOfPattern]() :
+ cast(obj);
+ }
+
+ function match(obj) {
+ var typeMap,
+ typeOfObj = getType(obj, false);
+
+ typeMap = {
+ "Array": function () {
+ var elementType, i;
+
+ if (typeOfObj !== typeOfPattern)
+ return false;
+
+ elementType = _self(pattern[0]);
+ for (i in obj) {
+ if (!elementType.match(obj[i])) {
+ return false;
+ }
+ }
+
+ return true;
+ },
+
+ "Callback": function () {
+ var attr, isMatched = true;
+
+ if (typeOfObj !== "Object") {
+ return false;
+ }
+
+ for (attr in pattern) {
+ if (attr in obj) {
+ isMatched = _self(pattern[attr]).match(obj[attr]);
+ if (!isMatched) {
+ break;
+ }
+ }
+ }
+
+ return isMatched;
+ },
+
+ "DOMString": function () {
+ return (typeOfObj === typeOfPattern);
+ },
+
+ "Date": function () {
+ return (typeOfObj === typeOfPattern);
+ },
+
+ "Function": function () {
+ return (typeOfObj === typeOfPattern);
+ },
+
+ "Object": function () {
+ var attr, isMatched = false, i;
+
+ if (typeOfObj !== typeOfPattern) {
+ if ((obj === null) || (obj === undefined)) {
+ return false;
+ }
+ if (!("_derived" in pattern)) {
+ return false;
+ }
+ return false;
+ }
+
+ if (!isConstructed(obj)) {
+ return false;
+ }
+
+ for (attr in pattern) {
+ switch (attr) {
+ case "_optional":
+ case "_constructor":
+ break;
+
+ case "_derived":
+ for (i in pattern._derived) {
+ isMatched = _self(pattern._derived[i]).match(obj);
+ if (isMatched)
+ break;
+ }
+ break;
+
+ default:
+ if (pattern._optional && pattern._optional[attr]) {
+ isMatched = ((obj[attr] === null) ||
+ (obj[attr] === undefined) ||
+ _self(pattern[attr]).match(obj[attr]));
+ } else {
+ isMatched = (obj[attr] !== undefined) &&
+ _self(pattern[attr]).match(obj[attr]);
+ }
+ break;
+ }
+
+ if (!isMatched)
+ break;
+ }
+
+ /*// Check if verbose attributes are present
+ if (isMatched) {
+ for (attr in obj) {
+ if (pattern[attr] === undefined) {
+ isMatched = false;
+ break;
+ }
+ }
+ }*/
+
+ return isMatched;
+ },
+
+ "Union": function () {
+ var isMatched, i;
+
+ for (i in pattern) {
+ isMatched = _self(pattern[i]).match(obj);
+ if (isMatched)
+ break;
+ }
+
+ return isMatched;
+ },
+
+ "any": function () {
+ return true;
+ },
+
+ "boolean": function () {
+ return (typeOfObj === typeOfPattern);
+ },
+
+ "byte": function () {
+ return (obj === toInt8(obj));
+ },
+
+ "dictionary": function () {
+ var attr, isMatched = true;
+
+ if (typeOfObj !== "Object") {
+ return false;
+ }
+
+ for (attr in pattern) {
+ switch (attr) {
+ case "_dictionary":
+ if (pattern._dictionary !== null) {
+ isMatched = _self(pattern._dictionary).match(obj);
+ if (!isMatched)
+ break;
+ }
+ break;
+
+ default:
+ if ((attr in obj) && (obj[attr] !== null) &&
+ (obj[attr] !== undefined)) {
+ isMatched = _self(pattern[attr]).match(obj[attr]);
+ if (!isMatched)
+ break;
+ }
+ break;
+ }
+ }
+
+ return isMatched;
+ },
+
+ "enum": function () {
+ for (var i in pattern) {
+ if (obj === pattern[i]) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ "float": function () {
+ return (typeOfObj === "Number");
+ },
+
+ "long": function () {
+ return (obj === toInt32(obj));
+ },
+
+ "long long": function () {
+ return (obj === toInt64(obj));
+ },
+
+ "octet": function () {
+ return (obj === toUInt8(obj));
+ },
+
+ "short": function () {
+ return (obj === toInt16(obj));
+ },
+
+ "unsigned long": function () {
+ return (obj === toUInt32(obj));
+ },
+
+ "unsigned long long": function () {
+ return (obj === toUInt64(obj));
+ },
+
+ "unsigned short": function () {
+ return (obj === toUInt16(obj));
+ },
+
+ "Arguments": function () {
+ return true;
+ },
+
+ "": function () {
+ return _self(t[pattern]).match(obj);
+ }
+ };
+
+ return typeMap[typeOfPattern]();
+ }
+
+ typeOfPattern = getType(pattern, true);
+
+ typeCoerce = {
+ cast: cast,
+ copy: copy,
+ match: match
+ };
+
+ return typeCoerce;
+};
+
+module.exports = _self;
+
+});
+define('ripple/platform/ivi/3.0/typedef', function (require, exports, module) {
+/*
+ * Copyright 2013 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+var _t, _c, _i;
+
+/*
+ * Primitive type definition
+ */
+
+_t = {
+ // Basic
+ Callback: "Callback",
+ DOMString: "",
+ Date: new Date(),
+ Function: function () {},
+ TZDate: "TZDate",
+ any: "any",
+ boolean: false,
+ byte: "byte",
+ double: "double",
+ float: "float",
+ long: "long",
+ octet: "octet",
+ short: "short",
+ "long_long": "long long",
+ "unsigned_long": "unsigned long",
+ "unsigned_long_long": "unsigned long long",
+ "unsigned_short": "unsigned short"
+};
+
+/*
+ * Derivative type definition
+ */
+
+/*
+ * Object attributes
+ * Contruct a prototype of an object. Specify a primitive type for each attribute.
+ *
+ * _optional
+ * Optional attributes table, which consists of two types of attributes,
+ *
+ * nullable
+ * Nullable attributes, marked as '?' in IDL.
+ *
+ * undefined
+ * Array type attributes, that not definitely specified to be
+ * initialized as an empty array, i.e., undefined-initialized array.
+ *
+ * _derived
+ * Derived types, which used in two cases of definition,
+ *
+ * Subtype list
+ * An array consists of derived subtypes. It exists in the definition of
+ * a base type.
+ *
+ * Union types
+ * An array consists of member types. It exists in the definition of
+ * a union type.
+ *
+ * _dictionary
+ * Dictionary type, which indicates that the object is a dictionary type.
+ */
+
+/*
+ * Vehicle
+ */
+_t.SupportedPropertiesSuccessCallback = _t.Function;
+
+_t.VehiclePropertyErrorCallback = _t.Function;
+
+_t.VehiclePropertyCallback = _t.Function;
+
+_t.VehiclePropertyListCallback = _t.Function;
+
+/*
+ * VehicleSpeed
+ */
+_t.VehicleSpeed = {
+ vehicleSpeed: _t.unsigned_long
+};
+
+/*
+ * EngineSpeed
+ */
+_t.EngineSpeed = {
+ engineSpeed: _t.unsigned_long
+};
+
+/*
+ * VehiclePowerMode
+ */
+_t.VehiclePowerMode = {
+ vehiclePowerMode: _t.octet
+};
+
+/*
+ * TripMeters
+ */
+_t.TripMeter = {
+ tripMeters: [_t.unsigned_long]
+};
+
+/*
+ * Acceleration
+ */
+_t.Acceleration = {
+ x: _t.unsigned_long,
+ y: _t.unsigned_long,
+ z: _t.unsigned_long
+};
+
+/*
+ * Transmission
+ */
+_t.Transmission = {
+ gearPosition: _t.octet,
+ mode: _t.octet
+};
+
+/*
+ * CruiseControlStatus
+ */
+_t.CruiseControlStatus = {
+ activated: _t.boolean,
+ speed: _t.unsigned_short
+};
+/*
+ * WheelBrake
+ */
+_t.WheelBrake = {
+ engaged: _t.boolean
+};
+
+/*
+ * LightStatus
+ */
+_t.LightStatus = {
+ head: _t.boolean,
+ rightTurn: _t.boolean,
+ leftTurn: _t.boolean,
+ brake: _t.boolean,
+ fog: _t.boolean,
+ hazard: _t.boolean,
+ parking: _t.boolean,
+ highBeam: _t.boolean
+};
+
+/*
+ * InteriorLightStatus
+ */
+_t.InteriorLightStatus = {
+ passenger: _t.boolean,
+ driver: _t.boolean,
+ center: _t.boolean
+};
+
+/*
+ * Horn
+ */
+_t.Horn = {
+ on: _t.boolean
+};
+
+/*
+ * Fuel
+ */
+_t.Fuel = {
+ level: _t.unsigned_short,
+ range: _t.unsigned_short,
+ instantConsumption: _t.unsigned_short,
+ instantEconomy: _t.unsigned_short,
+ averageEconomy: _t.unsigned_short
+};
+
+/*
+ * EngineOil
+ */
+_t.EngineOil = {
+ remaining: _t.unsigned_short,
+ temperature: _t.long,
+ pressure: _t.unsigned_short
+};
+
+/*
+ * Location
+ */
+_t.Location = {
+ latitude: _t.double,
+ longitude: _t.double,
+ altitude: _t.double,
+ direction: _t.unsigned_short
+};
+
+/*
+ * ExteriorBrightness
+ */
+_t.ExteriorBrightness = {
+ exteriorBrightness: _t.unsigned_long
+};
+
+/*
+ * Temperature
+ */
+_t.Temperature = {
+ interior: _t.short,
+ exterior: _t.short
+};
+
+/*
+ * RainSensor
+ */
+_t.RainSensor = {
+ rainSensor: _t.unsigned_short
+};
+
+/*
+ * WindshieldWiper
+ */
+_t.WindshieldWiper = {
+ windshieldWiper: _t.unsigned_short
+};
+
+/*
+ * DefrostDictionary
+ */
+_t.DefrostDictionary = {
+ window: _t.unsigned_short,
+ defrost: _t.boolean,
+
+ _dictionary: true
+};
+
+/*
+ * HVAC
+ */
+_t.HVAC = {
+ airflowDirection: _t.unsigned_short,
+ fanSpeed: _t.unsigned_short,
+ targetTemperature: _t.unsigned_short,
+ airConditioning: _t.boolean,
+ airRecirculation: _t.boolean,
+ heater: _t.boolean,
+ defrost: _t.DefrostDictionary,
+ steeringWheelHeater: _t.boolean,
+ seatHeater: _t.boolean,
+ seatCooler: _t.boolean
+};
+
+/*
+ * WindowStatus
+ */
+_t.WindowStatus = {
+ WindowStatus: _t.any
+};
+
+/*
+ * Sunroof
+ */
+_t.Sunroof = {
+ openness: _t.unsigned_short,
+ tilt: _t.unsigned_short
+};
+
+/*
+ * ConvertibleRoof
+ */
+_t.ConvertibleRoof = {
+ openness: _t.unsigned_short
+};
+
+/*
+ * VehicleId
+ */
+_t.VehicleId = {
+ WMI: _t.DOMString,
+ VIN: _t.DOMString
+};
+
+/*
+ * Size
+ */
+_t.Size = {
+ width: _t.unsigned_long,
+ height: _t.unsigned_long,
+ length: _t.unsigned_long
+};
+
+/*
+ * FuelInfo
+ */
+_t.FuelInfo = {
+ type: _t.unsigned_short,
+ refuelPosition: _t.unsigned_short
+};
+
+/*
+ * VehicleType
+ */
+_t.VehicleType = {
+ type: _t.unsigned_short
+};
+
+/*
+ * Doors
+ */
+_t.Doors = {
+ doorsPerRow: [_t.unsigned_short]
+};
+
+/*
+ * TransmissionGearType
+ */
+_t.TransmissionGearType = {
+ transmissionGearType: _t.unsigned_short
+};
+
+/*
+ * WheelInformation
+ */
+_t.WheelInformation = {
+ frontWheelRadius: _t.unsigned_short,
+ rearWheelRadius: _t.unsigned_short,
+ wheelTrack: _t.unsigned_long,
+ ABS: _t.boolean
+};
+
+/*
+ * Odometer
+ */
+_t.Odometer = {
+ odometer: _t.unsigned_long
+};
+
+/*
+ * Fluid
+ */
+_t.Fluid = {
+ transmission: _t.unsigned_short,
+ brake: _t.unsigned_short,
+ washer: _t.unsigned_short
+};
+
+/*
+ * Battery
+ */
+_t.Battery = {
+ voltage: _t.double,
+ current: _t.double
+};
+
+/*
+ * TirePressure
+ */
+_t.TirePressure = {
+ leftFront: _t.double,
+ rightFront: _t.double,
+ leftRear: _t.double,
+ rightRear: _t.double
+};
+
+/*
+ * TireTemperature
+ */
+_t.TireTemperature = {
+ leftFront: _t.double,
+ rightFront: _t.double,
+ leftRear: _t.double,
+ rightRear: _t.double
+};
+
+/*
+ * SecurityAlert
+ */
+_t.SecurityAlert = {
+ securityAlert: _t.boolean
+};
+
+/*
+ * ParkingBrake
+ */
+_t.ParkingBrake = {
+ parkingBrake: _t.boolean
+};
+
+/*
+ * ParkingLight
+ */
+_t.ParkingLight = {
+ parkingLight: _t.boolean
+};
+
+/*
+ * HazardLight
+ */
+_t.HazardLight = {
+ hazardLight: _t.boolean
+};
+
+/*
+ * AntilockBrakingSystem
+ */
+_t.AntilockBrakingSystem = {
+ antilockBrakingSystem: _t.boolean
+};
+
+/*
+ * TractionControlSystem
+ */
+_t.TractionControlSystem = {
+ tractionControlSystem: _t.boolean
+};
+
+/*
+ * VehicleTopSpeedLimit
+ */
+_t.VehicleTopSpeedLimit = {
+ vehicleTopSpeedLimit: _t.unsigned_short
+};
+
+/*
+ * AirbagStatus
+ */
+_t.AirbagStatus = {
+ airbagStatus: _t.any
+};
+
+/*
+ * DoorStatus
+ */
+_t.DoorStatus = {
+ doorStatus: _t.any,
+ doorLockStatus: _t.any,
+ childLockStatus: _t.boolean
+};
+
+/*
+ * SeatBeltStatus
+ */
+_t.SeatBeltStatus = {
+ seatBeltStatus: _t.any
+};
+
+/*
+ * OccupantStatus
+ */
+_t.OccupantStatus = {
+ occupantStatus: _t.any
+};
+
+/*
+ * ObstacleDistance
+ */
+_t.ObstacleDistance = {
+ obstacleDistance: _t.any
+};
+
+/*
+ * VehiclePropertyType
+ */
+_t.VehiclePropertyType = {
+ time: _t.unsigned_long_long,
+ zone: _t.short,
+ source: _t.DOMString,
+
+ _derived: [_t.VehicleSpeed, _t.EngineSpeed, _t.VehiclePowerMode,
+ _t.TripMeter, _t.Acceleration, _t.Transmission,
+ _t.CruiseControlStatus, _t.WheelBrake, _t.LightStatus,
+ _t.InteriorLightStatus, _t.Horn, _t.Fuel, _t.EngineOil, _t.Location,
+ _t.ExteriorBrightness, _t.Temperature, _t.RainSensor,
+ _t.WindshieldWiper, _t.HVAC, _t.WindowStatus, _t.Sunroof,
+ _t.ConvertibleRoof, _t.VehicleId, _t.Size, _t.FuelInfo, _t.VehicleType,
+ _t.Doors, _t.TransmissionGearType, _t.WheelInformation, _t.Odometer,
+ _t.Fluid, _t.Battery, _t.TirePressure, _t.TireTemperature,
+ _t.SecurityAlert, _t.ParkingBrake, _t.ParkingLight, _t.HazardLight,
+ _t.AntilockBrakingSystem, _t.TractionControlSystem,
+ _t.VehicleTopSpeedLimit, _t.AirbagStatus, _t.DoorStatus,
+ _t.SeatBeltStatus, _t.OccupantStatus, _t.ObstacleDistance]
+};
+
+/*
+ * Constructor list definition
+ */
+
+/*
+ * Generic constructor
+ * Construct a prototype of constructor. A fake array of arguments type is
+ * specified for constructor.
+ *
+ * Overloaded constructors
+ * Construct an array of prototype of constructor. Each array element is
+ * specified for one of constructors. The constructor with extra arguments
+ * are recommended to be defined ahead of the one with fewer same arguments
+ * for exact match.
+ */
+
+_c = {};
+
+/*
+ * Interface prototype definition
+ */
+
+_i = {
+ // Vehicle
+ Vehicle: {}
+};
+
+_i.Vehicle.get = {
+ 0: _t.DOMString,
+ 1: _t.short,
+
+ _optional: {
+ // nullable
+ 1: true
+ }
+};
+
+_i.Vehicle.subscribe = {
+ 0: _t.DOMString,
+ 1: _t.VehiclePropertyCallback,
+ 2: _t.short,
+ 3: _t.VehiclePropertyErrorCallback,
+
+ _optional: {
+ // nullable
+ 2: true,
+ 3: true
+ }
+};
+
+_i.Vehicle.set = {
+ 0: _t.DOMString,
+ 1: _t.VehiclePropertyType,
+ 2: _t.VehiclePropertyErrorCallback,
+
+ _optional: {
+ // nullable
+ 2: true
+ }
+};
+
+_i.Vehicle.getHistory = {
+ 0: _t.DOMString,
+ 1: _t.short,
+ 2: _t.Date,
+ 3: _t.Date,
+ 4: _t.VehiclePropertyListCallback,
+ 5: _t.VehiclePropertyErrorCallback,
+
+ _optional: {
+ // nullable
+ 5: true
+ }
+};
+
+_i.Vehicle.listZones = {
+ 0: _t.DOMString
+};
+
+// Exports
+_t.constructor = _c;
+_t.interface = _i;
+
+module.exports = _t;
+
+});
+define('ripple/platform/ivi/3.0/vehicle', function (require, exports, module) {
+/*
+ * Copyright 2013 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+var utils = require('ripple/utils'),
+ db = require('ripple/db'),
+ event = require('ripple/event'),
+ t = require('ripple/platform/ivi/3.0/typecast'),
+ errorcode = require('ripple/platform/ivi/3.0/errorcode'),
+ WebAPIError = require('ripple/platform/ivi/3.0/WebAPIError'),
+ WebAPIException = require('ripple/platform/ivi/3.0/WebAPIException'),
+ _self,
+ _vehicleStack = {
+ supported: [],
+ now: 0,
+ dataCount: 0,
+ data: {}
+ },
+ _security = {
+ "http://tizen.org/privilege/vehicle": ["supported", "get", "set",
+ "getHistory", "subscribe", "listZones"]
+ },
+ _vehicleEvent = {subscribe: {}},
+ VehiclePropertyType,
+ VehicleSpeed,
+ EngineSpeed,
+ VehiclePowerMode,
+ TripMeter,
+ Acceleration,
+ Transmission,
+ CruiseControlStatus,
+ WheelBrake,
+ LightStatus,
+ InteriorLightStatus,
+ Horn,
+ Fuel,
+ EngineOil,
+ Location,
+ ExteriorBrightness,
+ Temperature,
+ RainSensor,
+ WindshieldWiper,
+ DefrostDictionary,
+ HVAC,
+ WindowStatus,
+ Sunroof,
+ ConvertibleRoof,
+ VehicleId,
+ Size,
+ FuelInfo,
+ VehicleType,
+ Doors,
+ TransmissionGearType,
+ WheelInformation,
+ Odometer,
+ Fluid,
+ Battery,
+ TirePressure,
+ TireTemperature,
+ SecurityAlert,
+ ParkingBrake,
+ ParkingLight,
+ HazardLight,
+ AntilockBrakingSystem,
+ TractionControlSystem,
+ VehicleTopSpeedLimit,
+ AirbagStatus,
+ DoorStatus,
+ SeatBeltStatus,
+ OccupantStatus,
+ ObstacleDistance,
+ VehicleFactory;
+
+_self = function () {
+ var vehicle;
+
+ function supported () {
+ if (!_security.supported) {
+ throw new WebAPIException(errorcode.PERMISSION_DENIED);
+ }
+
+ return _vehicleStack.supported;
+ }
+
+ function get (property, zone) {
+ var data;
+
+ if (!_security.get) {
+ throw new WebAPIException(errorcode.PERMISSION_DENIED);
+ }
+
+ t.Vehicle("get", arguments);
+
+ if (_vehicleStack.supported.indexOf(property) === -1) {
+ throw new WebAPIException(errorcode.PROPERTY_UNAVAILABLE);
+ }
+
+ if (!zone) zone = 0;
+
+ data = _vehicleStack.history[_vehicleStack.now];
+ if (data && data[property]) {
+ return data[property];
+ }
+ else {
+ data = _vehicleStack.data[_vehicleStack.now];
+ return data[property];
+ }
+ }
+
+ function subscribe (property, successCallback, zone, errorCallback) {
+ if (!_security.subscribe) {
+ throw new WebAPIException(errorcode.PERMISSION_DENIED);
+ }
+
+ t.Vehicle("subscribe", arguments);
+
+ _vehicleEvent.subscribe[property] = {
+ successCallback: successCallback,
+ errorCallback: errorCallback
+ };
+
+ window.setTimeout(function () {
+ if (! _vehicleEvent["vehicle-subscribe-response"]) {
+ event.on("vehicle-subscribe-response", function (propertyObj) {
+ var propertySub = _vehicleEvent.subscribe[propertyObj.type],
+ success = propertySub.successCallback,
+ error = propertySub.errorCallback;
+
+ if (propertyObj.supported) {
+ success(new VehicleFactory(propertyObj.type, propertyObj.val));
+ }
+ else {
+ if (error) {
+ error(new WebAPIError(errorcode.PROPERTY_UNAVAILABLE));
+ }
+ else {
+ throw new WebAPIException(errorcode.PROPERTY_UNAVAILABLE);
+ }
+ }
+ });
+ _vehicleEvent["vehicle-subscribe-response"] = true;
+ }
+ event.trigger("vehicle-subscribe-request", [property, true, zone]);
+ }, 1);
+ }
+
+ function set (property, value, errorCallback) {
+ var type, val = utils.copy(value), data;
+
+ if (!_security.set) {
+ throw new WebAPIException(errorcode.PERMISSION_DENIED);
+ }
+
+ t.Vehicle("set", arguments);
+
+ if (_vehicleStack.supported.indexOf(property) === -1) {
+ if (errorCallback) {
+ errorCallback(new WebAPIException(errorcode.PROPERTY_UNAVAILABLE));
+ }
+ else {
+ throw new WebAPIException(errorcode.PROPERTY_UNAVAILABLE);
+ }
+ }
+
+ if (_vehicleStack.history[_vehicleStack.now]) {
+ data = _vehicleStack.history[_vehicleStack.now];
+ }
+ else {
+ data = _vehicleStack.data[_vehicleStack.now];
+ }
+ _vehicleStack.history[_vehicleStack.now] = utils.copy(data);
+
+ for (type in val) {
+ _vehicleStack.history[_vehicleStack.now][property][type] = val[type];
+ }
+
+ _vehicleStack.historyCount++;
+ db.saveObject("ivi-vehicle-db", _vehicleStack);
+ event.trigger("vehicle-subscribe-request", [property]);
+ }
+
+ function getHistory (property, zone, startTime, endTime, successCallback, errorCallback) {
+ var properties = [], i;
+
+ if (!_security.getHistory) {
+ throw new WebAPIException(errorcode.PERMISSION_DENIED);
+ }
+
+ t.Vehicle("getHistory", arguments);
+
+ startTime = startTime.getTime();
+ endTime = endTime.getTime();
+
+ window.setTimeout(function () {
+ event.once("vehicle-history-response", function (values, status) {
+ if (status) {
+ for (i = 0; i < values.length; i++) {
+ properties.push(new VehicleFactory(property, values[i]));
+ }
+ successCallback(properties);
+ }
+ else {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.PROPERTY_UNAVAILABLE));
+ }
+ else {
+ throw new WebAPIException(errorcode.PROPERTY_UNAVAILABLE);
+ }
+ }
+ });
+ event.trigger("vehicle-history-request", [property, zone, startTime, endTime]);
+ }, 1);
+ }
+
+ function listZones (property) {
+ if (!_security.listZones) {
+ throw new WebAPIException(errorcode.PERMISSION_DENIED);
+ }
+
+ t.Vehicle("listZones", arguments);
+
+ return [0];
+ }
+
+ function handleSubFeatures (subFeatures) {
+ var i, subFeature;
+
+ for (subFeature in subFeatures) {
+ for (i in _security[subFeature]) {
+ _security[_security[subFeature][i]] = true;
+ }
+ }
+ }
+
+ vehicle = {
+ supported: supported,
+ get: get,
+ subscribe: subscribe,
+ set: set,
+ getHistory: getHistory,
+ listZones: listZones,
+ handleSubFeatures: handleSubFeatures
+ };
+
+ vehicle.__defineGetter__("ZONE_None", function () {
+ return 0;
+ });
+
+ vehicle.__defineGetter__("ZONE_Front", function () {
+ return 1;
+ });
+
+ vehicle.__defineGetter__("ZONE_Middle", function () {
+ return 0x10;
+ });
+
+ vehicle.__defineGetter__("ZONE_Right", function () {
+ return 0x100;
+ });
+
+ vehicle.__defineGetter__("ZONE_Left", function () {
+ return 0x1000;
+ });
+
+ vehicle.__defineGetter__("ZONE_Rear", function () {
+ return 0x10000;
+ });
+
+ vehicle.__defineGetter__("ZONE_Center", function () {
+ return 0x10000;
+ });
+
+ return vehicle;
+};
+
+VehicleFactory = function (vehicleType, value) {
+ var instanceType;
+
+ switch (vehicleType) {
+ case "VehicleSpeed":
+ instanceType = new VehicleSpeed(value);
+ break;
+ case "EngineSpeed":
+ instanceType = new EngineSpeed(value);
+ break;
+ case "VehiclePowerMode":
+ instanceType = new VehiclePowerMode(value);
+ break;
+ case "TripMeter":
+ instanceType = new TripMeter(value);
+ break;
+ case "Acceleration":
+ instanceType = new Acceleration(value);
+ break;
+ case "Transmission":
+ instanceType = new Transmission(value);
+ break;
+ case "CruiseControlStatus":
+ instanceType = new CruiseControlStatus(value);
+ break;
+ case "WheelBrake":
+ instanceType = new WheelBrake(value);
+ break;
+ case "LightStatus":
+ instanceType = new LightStatus(value);
+ break;
+ case "InteriorLightStatus":
+ instanceType = new InteriorLightStatus(value);
+ break;
+ case "Horn":
+ instanceType = new Horn(value);
+ break;
+ case "Fuel":
+ instanceType = new Fuel(value);
+ break;
+ case "EngineOil":
+ instanceType = new EngineOil(value);
+ break;
+ case "Location":
+ instanceType = new Location(value);
+ break;
+ case "ExteriorBrightness":
+ instanceType = new ExteriorBrightness(value);
+ break;
+ case "Temperature":
+ instanceType = new Temperature(value);
+ break;
+ case "RainSensor":
+ instanceType = new RainSensor(value);
+ break;
+ case "WindshieldWiper":
+ instanceType = new WindshieldWiper(value);
+ break;
+ case "HVAC":
+ instanceType = new HVAC(value);
+ break;
+ case "WindowStatus":
+ instanceType = new WindowStatus(value);
+ break;
+ case "Sunroof":
+ instanceType = new Sunroof(value);
+ break;
+ case "ConvertibleRoof":
+ instanceType = new ConvertibleRoof(value);
+ break;
+ case "VehicleId":
+ instanceType = new VehicleId(value);
+ break;
+ case "Size":
+ instanceType = new Size(value);
+ break;
+ case "FuelInfo":
+ instanceType = new FuelInfo(value);
+ break;
+ case "VehicleType":
+ instanceType = new VehicleType(value);
+ break;
+ case "Doors":
+ instanceType = new Doors(value);
+ break;
+ case "TransmissionGearType":
+ instanceType = new TransmissionGearType(value);
+ break;
+ case "WheelInformation":
+ instanceType = new WheelInformation(value);
+ break;
+ case "Odometer":
+ instanceType = new Odometer(value);
+ break;
+ case "Fluid":
+ instanceType = new Fluid(value);
+ break;
+ case "Battery":
+ instanceType = new Battery(value);
+ break;
+ case "TirePressure":
+ instanceType = new TirePressure(value);
+ break;
+ case "TireTemperature":
+ instanceType = new TireTemperature(value);
+ break;
+ case "SecurityAlert":
+ instanceType = new SecurityAlert(value);
+ break;
+ case "ParkingBrake":
+ instanceType = new ParkingBrake(value);
+ break;
+ case "ParkingLight":
+ instanceType = new ParkingLight(value);
+ break;
+ case "HazardLight":
+ instanceType = new HazardLight(value);
+ break;
+ case "AntilockBrakingSystem":
+ instanceType = new AntilockBrakingSystem(value);
+ break;
+ case "TractionControlSystem":
+ instanceType = new TractionControlSystem(value);
+ break;
+ case "VehicleTopSpeedLimit":
+ instanceType = new VehicleTopSpeedLimit(value);
+ break;
+ case "AirbagStatus":
+ instanceType = new AirbagStatus(value);
+ break;
+ case "DoorStatus":
+ instanceType = new DoorStatus(value);
+ break;
+ case "SeatBeltStatus":
+ instanceType = new SeatBeltStatus(value);
+ break;
+ case "OccupantStatus":
+ instanceType = new OccupantStatus(value);
+ break;
+ case "ObstacleDistance":
+ instanceType = new ObstacleDistance(value);
+ break;
+ }
+
+ return instanceType;
+};
+
+function _initialize() {
+ var vehicleDB = db.retrieveObject("ivi-vehicle-db"),
+ time, data, property;
+
+ _vehicleStack = vehicleDB;
+
+ for (time in vehicleDB.data) {
+ data = vehicleDB.data[time];
+ _vehicleStack.data[time] = {};
+
+ for (property in data) {
+ _vehicleStack.data[time][property] = new VehicleFactory(property, data[property]);
+ }
+ }
+}
+
+event.on("vehicle-db-refresh", function () {
+ _initialize();
+});
+
+VehiclePropertyType = function (propertyTypes) {
+ var vehiclePropertyType = {};
+
+ vehiclePropertyType.time = propertyTypes.time || undefined;
+ vehiclePropertyType.zone = propertyTypes.zone || 0;
+ vehiclePropertyType.source = propertyTypes.source || "";
+
+ this.__defineGetter__("time", function () {
+ return vehiclePropertyType.time;
+ });
+
+ this.__defineSetter__("time", function (val) {
+ try {
+ vehiclePropertyType.time = t.unsigned_long_long(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("zone", function () {
+ return vehiclePropertyType.zone;
+ });
+
+ this.__defineSetter__("zone", function (val) {
+ try {
+ vehiclePropertyType.zone = t.short(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("source", function () {
+ return vehiclePropertyType.source;
+ });
+
+ this.__defineSetter__("source", function (val) {
+ try {
+ vehiclePropertyType.source = t.DOMString(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+VehicleSpeed = function (propertyTypes) {
+ var vehicleSpeed = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ vehicleSpeed.time = propertyTypes.time || undefined;
+ vehicleSpeed.vehicleSpeed = propertyTypes.vehicleSpeed || 0;
+
+ this.__defineGetter__("time", function () {
+ return vehicleSpeed.time;
+ });
+
+ this.__defineGetter__("vehicleSpeed", function () {
+ return vehicleSpeed.vehicleSpeed;
+ });
+
+ this.__defineSetter__("vehicleSpeed", function (val) {
+ try {
+ vehicleSpeed.vehicleSpeed = t.unsigned_long(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+EngineSpeed = function (propertyTypes) {
+ var engineSpeed = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ engineSpeed.time = propertyTypes.time || undefined;
+ engineSpeed.engineSpeed = propertyTypes.engineSpeed || 0;
+
+ this.__defineGetter__("time", function () {
+ return engineSpeed.time;
+ });
+
+ this.__defineGetter__("engineSpeed", function () {
+ return engineSpeed.engineSpeed;
+ });
+
+ this.__defineSetter__("engineSpeed", function (val) {
+ try {
+ engineSpeed.engineSpeed = t.unsigned_long(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+VehiclePowerMode = function (propertyTypes) {
+ var vehiclePowerMode = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ vehiclePowerMode.time = propertyTypes.time || undefined;
+ vehiclePowerMode.vehiclePowerMode = propertyTypes.vehiclePowerMode || 0;
+
+ this.__defineGetter__("time", function () {
+ return vehiclePowerMode.time;
+ });
+
+ this.__defineGetter__("VEHICLEPOWERMODE_OFF", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("VEHICLEPOWERMODE_ACCESSORY1", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("VEHICLEPOWERMODE_ACCESSORY2", function () {
+ return 2;
+ });
+
+ this.__defineGetter__("VEHICLEPOWERMODE_RUN", function () {
+ return 3;
+ });
+
+ this.__defineGetter__("vehiclePowerMode", function () {
+ return vehiclePowerMode.vehiclePowerMode;
+ });
+
+ this.__defineSetter__("vehiclePowerMode", function (val) {
+ try {
+ val = t.octet(val);
+ if (val < 0 || val > 3) {
+ return;
+ }
+ vehiclePowerMode.vehiclePowerMode = val;
+ }
+ catch (err) {
+ }
+ });
+};
+
+TripMeter = function (propertyTypes) {
+ var tripMeter = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ tripMeter.time = propertyTypes.time || undefined;
+ tripMeter.tripMeters = propertyTypes.tripMeters || [];
+
+ this.__defineGetter__("time", function () {
+ return tripMeter.time;
+ });
+
+ this.__defineGetter__("tripMeters", function () {
+ return tripMeter.tripMeters;
+ });
+
+ this.__defineSetter__("tripMeters", function (val) {
+ try {
+ //Changing any items in the array will reset the item's value to '0';
+ tripMeter.tripMeters = t.unsigned_long(val, "[]");
+ }
+ catch (err) {
+ }
+ });
+};
+
+Acceleration = function (propertyTypes) {
+ var acceleration = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ acceleration.time = propertyTypes.time || undefined;
+ acceleration.x = propertyTypes.x || 0;
+ acceleration.y = propertyTypes.y || 0;
+ acceleration.z = propertyTypes.z || 0;
+
+ this.__defineGetter__("time", function () {
+ return acceleration.time;
+ });
+
+ this.__defineGetter__("x", function () {
+ return acceleration.x;
+ });
+
+ this.__defineSetter__("x", function (val) {
+ try {
+ acceleration.x = t.unsigned_long(val, "[]");
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("y", function () {
+ return acceleration.y;
+ });
+
+ this.__defineSetter__("y", function (val) {
+ try {
+ acceleration.y = t.unsigned_long(val, "[]");
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("z", function () {
+ return acceleration.z;
+ });
+
+ this.__defineSetter__("z", function (val) {
+ try {
+ acceleration.z = t.unsigned_long(val, "[]");
+ }
+ catch (err) {
+ }
+ });
+};
+
+Transmission = function (propertyTypes) {
+ var transmission = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ transmission.time = propertyTypes.time || undefined;
+ transmission.gearPosition = propertyTypes.gearPosition || 0;
+ transmission.mode = propertyTypes.mode || 0;
+
+ this.__defineGetter__("time", function () {
+ return transmission.time;
+ });
+
+ this.__defineGetter__("TRANSMISSIONPOSITION_NEUTRAL", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("TRANSMISSIONPOSITION_FIRST", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("TRANSMISSIONPOSITION_SECOND", function () {
+ return 2;
+ });
+
+ this.__defineGetter__("TRANSMISSIONPOSITION_THIRD", function () {
+ return 3;
+ });
+
+ this.__defineGetter__("TRANSMISSIONPOSITION_FORTH", function () {
+ return 4;
+ });
+
+ this.__defineGetter__("TRANSMISSIONPOSITION_FIFTH", function () {
+ return 5;
+ });
+
+ this.__defineGetter__("TRANSMISSIONPOSITION_SIXTH", function () {
+ return 6;
+ });
+
+ this.__defineGetter__("TRANSMISSIONPOSITION_SEVENTH", function () {
+ return 7;
+ });
+
+ this.__defineGetter__("TRANSMISSIONPOSITION_EIGHTH", function () {
+ return 8;
+ });
+
+ this.__defineGetter__("TRANSMISSIONPOSITION_NINTH", function () {
+ return 9;
+ });
+
+ this.__defineGetter__("TRANSMISSIONPOSITION_TENTH", function () {
+ return 10;
+ });
+
+ this.__defineGetter__("TRANSMISSIONPOSITION_CVT", function () {
+ return 64;
+ });
+
+ this.__defineGetter__("TRANSMISSIONPOSITION_REVERSE", function () {
+ return 128;
+ });
+
+ this.__defineGetter__("TRANSMISSIONPOSITION_PARK", function () {
+ return 255;
+ });
+
+ this.__defineGetter__("TRANSMISSIONMODE_NORMAL", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("TRANSMISSIONMODE_SPORT", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("TRANSMISSIONMODE_ECONOMY", function () {
+ return 2;
+ });
+
+ this.__defineGetter__("TRANSMISSIONMODE_OEMCUSTOM1", function () {
+ return 3;
+ });
+
+ this.__defineGetter__("TRANSMISSIONMODE_OEMCUSTOM2", function () {
+ return 4;
+ });
+
+ this.__defineGetter__("gearPosition", function () {
+ return transmission.gearPosition;
+ });
+
+ this.__defineSetter__("gearPosition", function (val) {
+ try {
+ val = t.octet(val);
+ if ((val >= 0 && val <= 10) || val === 64 || val === 128 ||
+ val === 255) {
+ transmission.gearPosition = val;
+ }
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("mode", function () {
+ return transmission.mode;
+ });
+
+ this.__defineSetter__("mode", function (val) {
+ try {
+ val = t.octet(val);
+ if (val < 0 || val > 4) {
+ return;
+ }
+ transmission.mode = val;
+ }
+ catch (err) {
+ }
+ });
+};
+
+CruiseControlStatus = function (propertyTypes) {
+ var cruiseControlStatus = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ cruiseControlStatus.time = propertyTypes.time || undefined;
+ cruiseControlStatus.activated = propertyTypes.activated || false;
+ cruiseControlStatus.speed = propertyTypes.speed || 0;
+
+ this.__defineGetter__("time", function () {
+ return cruiseControlStatus.time;
+ });
+
+ this.__defineGetter__("activated", function () {
+ return cruiseControlStatus.activated;
+ });
+
+ this.__defineSetter__("activated", function (val) {
+ try {
+ cruiseControlStatus.activated = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("speed", function () {
+ return cruiseControlStatus.speed;
+ });
+
+ this.__defineSetter__("speed", function (val) {
+ try {
+ cruiseControlStatus.speed = t.unsigned_short(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+WheelBrake = function (propertyTypes) {
+ var wheelBrake = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ wheelBrake.time = propertyTypes.time || undefined;
+ wheelBrake.engaged = propertyTypes.engaged || false;
+
+ this.__defineGetter__("time", function () {
+ return wheelBrake.time;
+ });
+
+ this.__defineGetter__("engaged", function () {
+ return wheelBrake.engaged;
+ });
+
+ this.__defineSetter__("engaged", function (val) {
+ try {
+ wheelBrake.engaged = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+LightStatus = function (propertyTypes) {
+ var lightStatus = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ lightStatus.time = propertyTypes.time || undefined;
+ lightStatus.head = propertyTypes.head || false;
+ lightStatus.rightTurn = propertyTypes.rightTurn || false;
+ lightStatus.leftTurn = propertyTypes.leftTurn || false;
+ lightStatus.brake = propertyTypes.brake || false;
+ lightStatus.fog = propertyTypes.fog || false;
+ lightStatus.hazard = propertyTypes.hazard || false;
+ lightStatus.parking = propertyTypes.parking || false;
+ lightStatus.highBeam = propertyTypes.highBeam || false;
+
+ this.__defineGetter__("time", function () {
+ return lightStatus.time;
+ });
+
+ this.__defineGetter__("head", function () {
+ return lightStatus.head;
+ });
+
+ this.__defineSetter__("head", function (val) {
+ try {
+ lightStatus.head = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("rightTurn", function () {
+ return lightStatus.rightTurn;
+ });
+
+ this.__defineSetter__("rightTurn", function (val) {
+ try {
+ lightStatus.rightTurn = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("leftTurn", function () {
+ return lightStatus.leftTurn;
+ });
+
+ this.__defineSetter__("leftTurn", function (val) {
+ try {
+ lightStatus.leftTurn = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("brake", function () {
+ return lightStatus.brake;
+ });
+
+ this.__defineSetter__("brake", function (val) {
+ try {
+ lightStatus.brake = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("fog", function () {
+ return lightStatus.fog;
+ });
+
+ this.__defineSetter__("fog", function (val) {
+ try {
+ lightStatus.fog = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("hazard", function () {
+ return lightStatus.hazard;
+ });
+
+ this.__defineSetter__("hazard", function (val) {
+ try {
+ lightStatus.hazard = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("parking", function () {
+ return lightStatus.parking;
+ });
+
+ this.__defineSetter__("parking", function (val) {
+ try {
+ lightStatus.parking = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("highBeam", function () {
+ return lightStatus.highBeam;
+ });
+
+ this.__defineSetter__("highBeam", function (val) {
+ try {
+ lightStatus.highBeam = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+InteriorLightStatus = function (propertyTypes) {
+ var interiorLightStatus = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ interiorLightStatus.time = propertyTypes.time || undefined;
+ interiorLightStatus.passenger = propertyTypes.passenger || false;
+ interiorLightStatus.driver = propertyTypes.driver || false;
+ interiorLightStatus.center = propertyTypes.center || false;
+
+ this.__defineGetter__("time", function () {
+ return interiorLightStatus.time;
+ });
+
+ this.__defineGetter__("passenger", function () {
+ return interiorLightStatus.passenger;
+ });
+
+ this.__defineSetter__("passenger", function (val) {
+ try {
+ interiorLightStatus.passenger = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("driver", function () {
+ return interiorLightStatus.driver;
+ });
+
+ this.__defineSetter__("driver", function (val) {
+ try {
+ interiorLightStatus.driver = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("center", function () {
+ return interiorLightStatus.center;
+ });
+
+ this.__defineSetter__("center", function (val) {
+ try {
+ interiorLightStatus.center = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+Horn = function (propertyTypes) {
+ var horn = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ horn.time = propertyTypes.time || undefined;
+ horn.on = propertyTypes.on || false;
+
+ this.__defineGetter__("time", function () {
+ return horn.time;
+ });
+
+ this.__defineGetter__("on", function () {
+ return horn.on;
+ });
+
+ this.__defineSetter__("on", function (val) {
+ try {
+ horn.on = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+Fuel = function (propertyTypes) {
+ var fuel = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ fuel.time = propertyTypes.time || undefined;
+ fuel.level = propertyTypes.level || 0;
+ fuel.range = propertyTypes.range || 0;
+ fuel.instantConsumption = propertyTypes.instantConsumption || 0;
+ fuel.instantEconomy = propertyTypes.instantEconomy || 0;
+ fuel.averageEconomy = propertyTypes.averageEconomy || 0;
+
+ this.__defineGetter__("time", function () {
+ return fuel.time;
+ });
+
+ this.__defineGetter__("level", function () {
+ return fuel.level;
+ });
+
+ this.__defineSetter__("level", function (val) {
+ try {
+ fuel.level = t.unsigned_short(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("range", function () {
+ return fuel.range;
+ });
+
+ this.__defineSetter__("range", function (val) {
+ try {
+ fuel.range = t.unsigned_short(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("instantConsumption", function () {
+ return fuel.instantConsumption;
+ });
+
+ this.__defineSetter__("instantConsumption", function (val) {
+ try {
+ fuel.instantConsumption = t.unsigned_short(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("instantEconomy", function () {
+ return fuel.instantEconomy;
+ });
+
+ this.__defineSetter__("instantEconomy", function (val) {
+ try {
+ fuel.instantEconomy = t.unsigned_short(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("averageEconomy", function () {
+ return fuel.averageEconomy;
+ });
+
+ this.__defineSetter__("averageEconomy", function (val) {
+ try {
+ //Setting this to any value should reset the counter to '0'
+ fuel.averageEconomy = t.unsigned_short(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+EngineOil = function (propertyTypes) {
+ var engineOil = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ engineOil.time = propertyTypes.time || undefined;
+ engineOil.remaining = propertyTypes.remaining || 0;
+ engineOil.temperature = propertyTypes.temperature || 0;
+ engineOil.pressure = propertyTypes.Pressure || 0;
+
+ this.__defineGetter__("time", function () {
+ return engineOil.time;
+ });
+
+ this.__defineGetter__("remaining", function () {
+ return engineOil.remaining;
+ });
+
+ this.__defineSetter__("remaining", function (val) {
+ try {
+ engineOil.remaining = t.unsigned_short(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("temperature", function () {
+ return engineOil.temperature;
+ });
+
+ this.__defineSetter__("temperature", function (val) {
+ try {
+ engineOil.temperature = t.long(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("pressure", function () {
+ return engineOil.pressure;
+ });
+
+ this.__defineSetter__("pressure", function (val) {
+ try {
+ engineOil.pressure = t.unsigned_short(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+Location = function (propertyTypes) {
+ var location = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ location.time = propertyTypes.time || undefined;
+ location.latitude = propertyTypes.latitude || 0;
+ location.longitude = propertyTypes.longitude || 0;
+ location.altitude = propertyTypes.altitude || 0;
+ location.direction = propertyTypes.direction || 0;
+
+ this.__defineGetter__("time", function () {
+ return location.time;
+ });
+
+ this.__defineGetter__("latitude", function () {
+ return location.latitude;
+ });
+
+ this.__defineSetter__("latitude", function (val) {
+ try {
+ val = t.double(val);
+ if (val >= -180 && val <= 180) {
+ location.latitude = val;
+ }
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("longitude", function () {
+ return location.longitude;
+ });
+
+ this.__defineSetter__("longitude", function (val) {
+ try {
+ val = t.double(val);
+ if (val >= -90 && val <= 90) {
+ location.longitude = val;
+ }
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("altitude", function () {
+ return location.altitude;
+ });
+
+ this.__defineSetter__("altitude", function (val) {
+ try {
+ val = t.double(val);
+ if (val >= 0) {
+ location.altitude = val;
+ }
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("direction", function () {
+ return location.direction;
+ });
+
+ this.__defineSetter__("direction", function (val) {
+ try {
+ val = t.unsigned_short(val);
+ if (val >= 0 && val < 360) {
+ location.direction = val;
+ }
+ }
+ catch (err) {
+ }
+ });
+};
+
+ExteriorBrightness = function (propertyTypes) {
+ var eb = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ eb.time = propertyTypes.time || undefined;
+ eb.exteriorBrightness = propertyTypes.exteriorBrightness || 0;
+
+ this.__defineGetter__("time", function () {
+ return eb.time;
+ });
+
+ this.__defineGetter__("exteriorBrightness", function () {
+ return eb.exteriorBrightness;
+ });
+
+ this.__defineSetter__("exteriorBrightness", function (val) {
+ try {
+ eb.exteriorBrightness = t.unsigned_long(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+Temperature = function (propertyTypes) {
+ var temperature = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ temperature.time = propertyTypes.time || undefined;
+ temperature.interior = propertyTypes.interior || 0;
+ temperature.exterior = propertyTypes.exterior || 0;
+
+ this.__defineGetter__("time", function () {
+ return temperature.time;
+ });
+
+ this.__defineGetter__("interior", function () {
+ return temperature.interior;
+ });
+
+ this.__defineSetter__("interior", function (val) {
+ try {
+ temperature.interior = t.short(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("exterior", function () {
+ return temperature.exterior;
+ });
+
+ this.__defineSetter__("exterior", function (val) {
+ try {
+ temperature.exterior = t.short(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+RainSensor = function (propertyTypes) {
+ var rainSensor = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ rainSensor.time = propertyTypes.time || undefined;
+ rainSensor.rainSensor = propertyTypes.rainSensor || 0;
+
+ this.__defineGetter__("time", function () {
+ return rainSensor.time;
+ });
+
+ this.__defineGetter__("rainSensor", function () {
+ return rainSensor.rainSensor;
+ });
+
+ this.__defineSetter__("rainSensor", function (val) {
+ try {
+ val = t.unsigned_short(val);
+ if (val >= 0 && val <= 10) {
+ rainSensor.rainSensor = val;
+ }
+ }
+ catch (err) {
+ }
+ });
+};
+
+WindshieldWiper = function (propertyTypes) {
+ var windshieldWiper = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ windshieldWiper.time = propertyTypes.time || undefined;
+ windshieldWiper.windshieldWiper = propertyTypes.windshieldWiper || 0;
+
+ this.__defineGetter__("time", function () {
+ return windshieldWiper.time;
+ });
+
+ this.__defineGetter__("WIPERSPEED_OFF", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("WIPERSPEED_SLOWEST", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("WIPERSPEED_FASTEST", function () {
+ return 5;
+ });
+
+ this.__defineGetter__("WIPERSPEED_AUTO", function () {
+ return 10;
+ });
+
+ this.__defineGetter__("windshieldWiper", function () {
+ return windshieldWiper.windshieldWiper;
+ });
+
+ this.__defineSetter__("windshieldWiper", function (val) {
+ try {
+ val = t.unsigned_short(val);
+ if (val === 0 || val === 1 || val === 5 || val === 10) {
+ windshieldWiper.windshieldWiper = val;
+ }
+ }
+ catch (err) {
+ }
+ });
+};
+
+DefrostDictionary = function (defrostDictionary) {
+ this.window = defrostDictionary ? defrostDictionary.window || 0 : 0;
+ this.defrost = defrostDictionary ? defrostDictionary.defrost || false : false;
+};
+
+HVAC = function (propertyTypes) {
+ var hvac = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ hvac.time = propertyTypes.time || undefined;
+ hvac.airflowDirection = propertyTypes.airflowDirection || 0;
+ hvac.fanSpeed = propertyTypes.fanSpeed || 0;
+ hvac.targetTemperature = propertyTypes.targetTemperature || 0;
+ hvac.airConditioning = propertyTypes.airConditioning || false;
+ hvac.airRecirculation = propertyTypes.airRecirculation || false;
+ hvac.heater = propertyTypes.heater || false;
+ hvac.defrost = new DefrostDictionary(propertyTypes.defrost);
+ hvac.steeringWheelHeater = propertyTypes.steeringWheelHeater || false;
+ hvac.seatHeater = propertyTypes.seatHeater || false;
+ hvac.seatCooler = propertyTypes.seatCooler || false;
+
+ this.__defineGetter__("time", function () {
+ return hvac.time;
+ });
+
+ this.__defineGetter__("AIRFLOWDIRECTION_DEFROSTER", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("AIRFLOWDIRECTION_FLOORDUCT", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("AIRFLOWDIRECTION_FRONT", function () {
+ return 0x02;
+ });
+
+ this.__defineGetter__("AIRFLOWDIRECTION_DEFROSTER", function () {
+ return 0x04;
+ });
+
+ this.__defineGetter__("airflowDirection", function () {
+ return hvac.airflowDirection;
+ });
+
+ this.__defineSetter__("airflowDirection", function (val) {
+ try {
+ val = t.unsigned_short(val);
+ if (val === 0 || val === 1 || val === 0x02 || val === 0x04) {
+ hvac.airflowDirection = val;
+ }
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("fanSpeed", function () {
+ return hvac.fanSpeed;
+ });
+
+ this.__defineSetter__("fanSpeed", function (val) {
+ try {
+ val = t.unsigned_short(val);
+ if (val >= 0 && val <= 7) {
+ hvac.fanSpeed = val;
+ }
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("targetTemperature", function () {
+ return hvac.targetTemperature;
+ });
+
+ this.__defineSetter__("targetTemperature", function (val) {
+ try {
+ hvac.targetTemperature = t.unsigned_short(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("airConditioning", function () {
+ return hvac.airConditioning;
+ });
+
+ this.__defineSetter__("airConditioning", function (val) {
+ try {
+ hvac.airConditioning = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("airRecirculation", function () {
+ return hvac.airRecirculation;
+ });
+
+ this.__defineSetter__("airRecirculation", function (val) {
+ try {
+ hvac.airRecirculation = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("heater", function () {
+ return hvac.heater;
+ });
+
+ this.__defineSetter__("heater", function (val) {
+ try {
+ hvac.heater = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("defrost", function () {
+ return hvac.defrost;
+ });
+
+ this.__defineSetter__("defrost", function (val) {
+ try {
+ hvac.defrost = t.DefrostDictionary(val, "?");
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("steeringWheelHeater", function () {
+ return hvac.steeringWheelHeater;
+ });
+
+ this.__defineSetter__("steeringWheelHeater", function (val) {
+ try {
+ hvac.steeringWheelHeater = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("seatHeater", function () {
+ return hvac.seatHeater;
+ });
+
+ this.__defineSetter__("seatHeater", function (val) {
+ try {
+ hvac.seatHeater = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("seatCooler", function () {
+ return hvac.seatCooler;
+ });
+
+ this.__defineSetter__("seatCooler", function (val) {
+ try {
+ hvac.seatCooler = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+WindowStatus = function (propertyTypes) {
+ var windowStatus = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ windowStatus.time = propertyTypes.time || undefined;
+ windowStatus.WindowStatus = propertyTypes.WindowStatus || null;
+
+ this.__defineGetter__("time", function () {
+ return windowStatus.time;
+ });
+
+ this.__defineGetter__("WINDOWLOCATION_DRIVER", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("WINDOWLOCATION_PASSENGER", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("WINDOWLOCATION_LEFTREAR", function () {
+ return 2;
+ });
+
+ this.__defineGetter__("WINDOWLOCATION_RIGHTREAR", function () {
+ return 3;
+ });
+
+ this.__defineGetter__("WINDOWLOCATION_REAR", function () {
+ return 4;
+ });
+
+ this.__defineGetter__("WindowStatus", function () {
+ return windowStatus.WindowStatus;
+ });
+
+ this.__defineSetter__("WindowStatus", function (val) {
+ try {
+ windowStatus.WindowStatus = t.any(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+Sunroof = function (propertyTypes) {
+ var sunroof = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ sunroof.time = propertyTypes.time || undefined;
+ sunroof.openness = propertyTypes.openness || 0;
+ sunroof.tilt = propertyTypes.tilt || 0;
+
+ this.__defineGetter__("time", function () {
+ return sunroof.time;
+ });
+
+ this.__defineGetter__("openness", function () {
+ return sunroof.openness;
+ });
+
+ this.__defineSetter__("openness", function (val) {
+ try {
+ sunroof.openness = t.unsigned_short(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("tilt", function () {
+ return sunroof.tilt;
+ });
+
+ this.__defineSetter__("tilt", function (val) {
+ try {
+ sunroof.tilt = t.unsigned_short(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+ConvertibleRoof = function (propertyTypes) {
+ var convertibleRoof = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ convertibleRoof.time = propertyTypes.time || undefined;
+ convertibleRoof.openness = propertyTypes.openness || 0;
+
+ this.__defineGetter__("time", function () {
+ return convertibleRoof.time;
+ });
+
+ this.__defineGetter__("openness", function () {
+ return convertibleRoof.openness;
+ });
+
+ this.__defineSetter__("openness", function (val) {
+ try {
+ convertibleRoof.openness = t.unsigned_short(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+VehicleId = function (propertyTypes) {
+ var vehicleId = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ vehicleId.time = propertyTypes.time || undefined;
+ vehicleId.WMI = propertyTypes.WMI || "";
+ vehicleId.VIN = propertyTypes.VIN || "";
+
+ this.__defineGetter__("time", function () {
+ return vehicleId.time;
+ });
+
+ this.__defineGetter__("WMI", function () {
+ return vehicleId.WMI;
+ });
+
+ this.__defineSetter__("WMI", function (val) {
+ try {
+ //?
+ vehicleId.WMI = t.DOMString(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("VIN", function () {
+ return vehicleId.VIN;
+ });
+
+ this.__defineSetter__("VIN", function (val) {
+ try {
+ //?
+ vehicleId.VIN = t.DOMString(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+Size = function (propertyTypes) {
+ var size = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ size.time = propertyTypes.time || undefined;
+ size.width = propertyTypes.width || 0;
+ size.height = propertyTypes.height || 0;
+ size.length = propertyTypes.length || 0;
+
+ this.__defineGetter__("time", function () {
+ return size.time;
+ });
+
+ this.__defineGetter__("width", function () {
+ return size.width;
+ });
+
+ this.__defineSetter__("width", function (val) {
+ try {
+ size.width = t.unsigned_long(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("height", function () {
+ return size.height;
+ });
+
+ this.__defineSetter__("height", function (val) {
+ try {
+ size.height = t.unsigned_long(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("length", function () {
+ return size.length;
+ });
+
+ this.__defineSetter__("length", function (val) {
+ try {
+ size.length = t.unsigned_long(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+FuelInfo = function (propertyTypes) {
+ var fuelInfo = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ fuelInfo.time = propertyTypes.time || undefined;
+ fuelInfo.type = propertyTypes.type || 0;
+ fuelInfo.refuelPosition = propertyTypes.refuelPosition || 0;
+
+ this.__defineGetter__("time", function () {
+ return fuelInfo.time;
+ });
+
+ this.__defineGetter__("FUELTYPE_GASOLINE", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("FUELTYPE_HIGH_OCTANE", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("FUELTYPE_DIESEL", function () {
+ return 2;
+ });
+
+ this.__defineGetter__("FUELTYPE_ELECTRIC", function () {
+ return 3;
+ });
+
+ this.__defineGetter__("FUELTYPE_HYDROGEN", function () {
+ return 4;
+ });
+
+ this.__defineGetter__("REFUELPOSITION_LEFT", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("REFUELPOSITION_RIGHT", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("REFUELPOSITION_FRONT", function () {
+ return 2;
+ });
+
+ this.__defineGetter__("REFUELPOSITION_REAR", function () {
+ return 3;
+ });
+
+ this.__defineGetter__("type", function () {
+ return fuelInfo.type;
+ });
+
+ this.__defineSetter__("type", function (val) {
+ try {
+ val = t.unsigned_short(val);
+ if (val >= 0 && val <= 4) {
+ fuelInfo.type = val;
+ }
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("refuelPosition", function () {
+ return fuelInfo.refuelPosition;
+ });
+
+ this.__defineSetter__("refuelPosition", function (val) {
+ try {
+ val = t.unsigned_short(val);
+ if (val >= 0 && val <= 3) {
+ fuelInfo.refuelPosition = val;
+ }
+ }
+ catch (err) {
+ }
+ });
+};
+
+VehicleType = function (propertyTypes) {
+ var vehicleType = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ vehicleType.time = propertyTypes.time || undefined;
+ vehicleType.type = propertyTypes.type || 0;
+
+ this.__defineGetter__("time", function () {
+ return vehicleType.time;
+ });
+
+ this.__defineGetter__("VEHICLETYPE_SEDAN", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("VEHICLETYPE_COUPE", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("VEHICLETYPE_CABRIOLE", function () {
+ return 2;
+ });
+
+ this.__defineGetter__("VEHICLETYPE_ROADSTER", function () {
+ return 3;
+ });
+
+ this.__defineGetter__("VEHICLETYPE_SUV", function () {
+ return 4;
+ });
+
+ this.__defineGetter__("VEHICLETYPE_TRUCK", function () {
+ return 5;
+ });
+
+ this.__defineGetter__("type", function () {
+ return vehicleType.type;
+ });
+
+ this.__defineSetter__("type", function (val) {
+ try {
+ val = t.unsigned_short(val);
+ if (val >= 0 && val <= 5) {
+ vehicleType.type = val;
+ }
+ }
+ catch (err) {
+ }
+ });
+};
+
+Doors = function (propertyTypes) {
+ var doors = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ doors.time = propertyTypes.time || undefined;
+ doors.doorsPerRow = propertyTypes.doorsPerRow || [];
+
+ this.__defineGetter__("time", function () {
+ return doors.time;
+ });
+
+ this.__defineGetter__("doorsPerRow", function () {
+ return doors.doorsPerRow;
+ });
+
+ this.__defineSetter__("doorsPerRow", function (val) {
+ try {
+ doors.doorsPerRow = t.unsigned_short(val, "[]");
+ }
+ catch (err) {
+ }
+ });
+};
+
+TransmissionGearType = function (propertyTypes) {
+ var trans = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ trans.time = propertyTypes.time || undefined;
+ trans.transmissionGearType = propertyTypes.transmissionGearType || 0;
+
+ this.__defineGetter__("time", function () {
+ return trans.time;
+ });
+
+ this.__defineGetter__("TRANSMISSIONGEARTYPE_AUTO", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("TRANSMISSIONGEARTYPE_MANUAL", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("TRANSMISSIONGEARTYPE_CV", function () {
+ return 2;
+ });
+
+ this.__defineGetter__("transmissionGearType", function () {
+ return trans.transmissionGearType;
+ });
+
+ this.__defineSetter__("transmissionGearType", function (val) {
+ try {
+ val = t.unsigned_short(val);
+ if (val >= 0 && val <= 2) {
+ trans.transmissionGearType = val;
+ }
+ }
+ catch (err) {
+ }
+ });
+};
+
+WheelInformation = function (propertyTypes) {
+ var wheelInfo = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ wheelInfo.time = propertyTypes.time || undefined;
+ wheelInfo.frontWheelRadius = propertyTypes.frontWheelRadius || 0;
+ wheelInfo.rearWheelRadius = propertyTypes.rearWheelRadius || 0;
+ wheelInfo.wheelTrack = propertyTypes.wheelTrack || 0;
+ wheelInfo.ABS = propertyTypes.ABS || false;
+
+ this.__defineGetter__("time", function () {
+ return wheelInfo.time;
+ });
+
+ this.__defineGetter__("frontWheelRadius", function () {
+ return wheelInfo.frontWheelRadius;
+ });
+
+ this.__defineSetter__("frontWheelRadius", function (val) {
+ try {
+ wheelInfo.frontWheelRadius =t.unsigned_short(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("rearWheelRadius", function () {
+ return wheelInfo.rearWheelRadius;
+ });
+
+ this.__defineSetter__("rearWheelRadius", function (val) {
+ try {
+ wheelInfo.rearWheelRadius =t.unsigned_short(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("wheelTrack", function () {
+ return wheelInfo.wheelTrack;
+ });
+
+ this.__defineSetter__("wheelTrack", function (val) {
+ try {
+ wheelInfo.wheelTrack =t.unsigned_long(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("ABS", function () {
+ return wheelInfo.ABS;
+ });
+
+ this.__defineSetter__("ABS", function (val) {
+ try {
+ wheelInfo.ABS =t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+Odometer = function (propertyTypes) {
+ var odm = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ odm.time = propertyTypes.time || undefined;
+ odm.odometer = propertyTypes.odometer || 0;
+
+ this.__defineGetter__("time", function () {
+ return odm.time;
+ });
+
+ this.__defineGetter__("odometer", function () {
+ return odm.odometer;
+ });
+
+ this.__defineSetter__("odometer", function (val) {
+ try {
+ odm.odometer = t.unsigned_long(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+Fluid = function (propertyTypes) {
+ var fluid = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ fluid.time = propertyTypes.time || undefined;
+ fluid.transmission = propertyTypes.transmission || 0;
+ fluid.brake = propertyTypes.brake || 0;
+ fluid.nightMode = propertyTypes.transmission || 0;
+
+ this.__defineGetter__("time", function () {
+ return fluid.time;
+ });
+
+ this.__defineGetter__("transmission", function () {
+ return fluid.transmission;
+ });
+
+ this.__defineSetter__("transmission", function (val) {
+ try {
+ val = t.unsigned_short(val);
+ if (val >= 0 && val <= 100) {
+ fluid.transmission = val;
+ }
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("brake", function () {
+ return fluid.brake;
+ });
+
+ this.__defineSetter__("brake", function (val) {
+ try {
+ val = t.unsigned_short(val);
+ if (val >= 0 && val <= 100) {
+ fluid.brake = val;
+ }
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("washer", function () {
+ return fluid.washer;
+ });
+
+ this.__defineSetter__("washer", function (val) {
+ try {
+ val = t.unsigned_short(val);
+ if (val >= 0 && val <= 100) {
+ fluid.washer = val;
+ }
+ }
+ catch (err) {
+ }
+ });
+};
+
+Battery = function (propertyTypes) {
+ var battery = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ battery.time = propertyTypes.time || undefined;
+ battery.voltage = propertyTypes.voltage || 0;
+ battery.current = propertyTypes.current || 0;
+
+ this.__defineGetter__("time", function () {
+ return battery.time;
+ });
+
+ this.__defineGetter__("voltage", function () {
+ return battery.voltage;
+ });
+
+ this.__defineSetter__("voltage", function (val) {
+ try {
+ battery.voltage = t.double(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("current", function () {
+ return battery.current;
+ });
+
+ this.__defineSetter__("current", function (val) {
+ try {
+ battery.current = t.double(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+TirePressure = function (propertyTypes) {
+ var tirePressure = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ tirePressure.time = propertyTypes.time || undefined;
+ tirePressure.leftFront = propertyTypes.leftFront || 0;
+ tirePressure.rightFront = propertyTypes.rightFront || 0;
+ tirePressure.leftRear = propertyTypes.leftRear || 0;
+ tirePressure.rightRear = propertyTypes.rightRear || 0;
+
+ this.__defineGetter__("time", function () {
+ return tirePressure.time;
+ });
+
+ this.__defineGetter__("leftFront", function () {
+ return tirePressure.leftFront;
+ });
+
+ this.__defineSetter__("leftFront", function (val) {
+ try {
+ tirePressure.leftFront = t.double(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("rightFront", function () {
+ return tirePressure.rightFront;
+ });
+
+ this.__defineSetter__("rightFront", function (val) {
+ try {
+ tirePressure.rightFront = t.double(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("leftRear", function () {
+ return tirePressure.leftRear;
+ });
+
+ this.__defineSetter__("leftRear", function (val) {
+ try {
+ tirePressure.leftRear = t.double(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("rightRear", function () {
+ return tirePressure.rightRear;
+ });
+
+ this.__defineSetter__("rightRear", function (val) {
+ try {
+ tirePressure.rightRear = t.double(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+TireTemperature = function (propertyTypes) {
+ var tireTemperature = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ tireTemperature.time = propertyTypes.time || undefined;
+ tireTemperature.leftFront = propertyTypes.leftFront || 0;
+ tireTemperature.rightFront = propertyTypes.rightFront || 0;
+ tireTemperature.leftRear = propertyTypes.leftRear || 0;
+ tireTemperature.rightRear = propertyTypes.rightRear || 0;
+
+ this.__defineGetter__("time", function () {
+ return tireTemperature.time;
+ });
+
+ this.__defineGetter__("leftFront", function () {
+ return tireTemperature.leftFront;
+ });
+
+ this.__defineSetter__("leftFront", function (val) {
+ try {
+ tireTemperature.leftFront = t.double(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("rightFront", function () {
+ return tireTemperature.rightFront;
+ });
+
+ this.__defineSetter__("rightFront", function (val) {
+ try {
+ tireTemperature.rightFront = t.double(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("leftRear", function () {
+ return tireTemperature.leftRear;
+ });
+
+ this.__defineSetter__("leftRear", function (val) {
+ try {
+ tireTemperature.leftRear = t.double(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("rightRear", function () {
+ return tireTemperature.rightRear;
+ });
+
+ this.__defineSetter__("rightRear", function (val) {
+ try {
+ tireTemperature.rightRear = t.double(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+SecurityAlert = function (propertyTypes) {
+ var securityAlert = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ securityAlert.time = propertyTypes.time || undefined;
+ securityAlert.securityAlert = propertyTypes.securityAlert || false;
+
+ this.__defineGetter__("time", function () {
+ return securityAlert.time;
+ });
+
+ this.__defineGetter__("securityAlert", function () {
+ return securityAlert.securityAlert;
+ });
+
+ this.__defineSetter__("securityAlert", function (val) {
+ try {
+ securityAlert.securityAlert = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+ParkingBrake = function (propertyTypes) {
+ var parkingBrake = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ parkingBrake.time = propertyTypes.time || undefined;
+ parkingBrake.parkingBrake = propertyTypes.parkingBrake || false;
+
+ this.__defineGetter__("time", function () {
+ return parkingBrake.time;
+ });
+
+ this.__defineGetter__("parkingBrake", function () {
+ return parkingBrake.parkingBrake;
+ });
+
+ this.__defineSetter__("parkingBrake", function (val) {
+ try {
+ parkingBrake.parkingBrake = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+ParkingLight = function (propertyTypes) {
+ var parkingLight = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ parkingLight.time = propertyTypes.time || undefined;
+ parkingLight.parkingLight = propertyTypes.parkingLight || false;
+
+ this.__defineGetter__("time", function () {
+ return parkingLight.time;
+ });
+
+ this.__defineGetter__("parkingLight", function () {
+ return parkingLight.parkingLight;
+ });
+
+ this.__defineSetter__("parkingLight", function (val) {
+ try {
+ parkingLight.parkingLight = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+HazardLight = function (propertyTypes) {
+ var hazardLight = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ hazardLight.time = propertyTypes.time || undefined;
+ hazardLight.hazardLight = propertyTypes.hazardLight || false;
+
+ this.__defineGetter__("time", function () {
+ return hazardLight.time;
+ });
+
+ this.__defineGetter__("hazardLight", function () {
+ return hazardLight.hazardLight;
+ });
+
+ this.__defineSetter__("hazardLight", function (val) {
+ try {
+ hazardLight.hazardLight = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+AntilockBrakingSystem = function (propertyTypes) {
+ var abs = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ abs.time = propertyTypes.time || undefined;
+ abs.antilockBrakingSystem = propertyTypes.antilockBrakingSystem || false;
+
+ this.__defineGetter__("time", function () {
+ return abs.time;
+ });
+
+ this.__defineGetter__("antilockBrakingSystem", function () {
+ return abs.antilockBrakingSystem;
+ });
+
+ this.__defineSetter__("antilockBrakingSystem", function (val) {
+ try {
+ abs.antilockBrakingSystem = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+TractionControlSystem = function (propertyTypes) {
+ var tcs = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ tcs.time = propertyTypes.time || undefined;
+ tcs.tractionControlSystem = propertyTypes.tractionControlSystem || false;
+
+ this.__defineGetter__("time", function () {
+ return tcs.time;
+ });
+
+ this.__defineGetter__("tractionControlSystem", function () {
+ return tcs.tractionControlSystem;
+ });
+
+ this.__defineSetter__("tractionControlSystem", function (val) {
+ try {
+ tcs.tractionControlSystem = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+VehicleTopSpeedLimit = function (propertyTypes) {
+ var vtl = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ vtl.time = propertyTypes.time || undefined;
+ vtl.vehicleTopSpeedLimit = propertyTypes.vehicleTopSpeedLimit || false;
+
+ this.__defineGetter__("time", function () {
+ return vtl.time;
+ });
+
+ this.__defineGetter__("vehicleTopSpeedLimit", function () {
+ return vtl.vehicleTopSpeedLimit;
+ });
+
+ this.__defineSetter__("vehicleTopSpeedLimit", function (val) {
+ try {
+ vtl.vehicleTopSpeedLimit = t.unsigned_short(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+AirbagStatus = function (propertyTypes) {
+ var airbagStatus = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ airbagStatus.time = propertyTypes.time || undefined;
+ airbagStatus.airbagStatus = propertyTypes.airbagStatus || null;
+
+ this.__defineGetter__("time", function () {
+ return airbagStatus.time;
+ });
+
+ this.__defineGetter__("AIRBAGLOCATION_DRIVER", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("AIRBAGLOCATION_PASSENGER", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("AIRBAGLOCATION_LEFTSIDE", function () {
+ return 2;
+ });
+
+ this.__defineGetter__("AIRBAGLOCATION_RIGHTSIDE", function () {
+ return 3;
+ });
+
+ this.__defineGetter__("AIRBAGSTATUS_INACTIVE", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("AIRBAGSTATUS_ACTIVE", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("AIRBAGSTATUS_DEPLOYED", function () {
+ return 2;
+ });
+
+ this.__defineGetter__("airbagStatus", function () {
+ return airbagStatus.airbagStatus;
+ });
+
+ this.__defineSetter__("airbagStatus", function (val) {
+ try {
+ airbagStatus.airbagStatus = t.any(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+DoorStatus = function (propertyTypes) {
+ var doorStatus = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ doorStatus.time = propertyTypes.time || undefined;
+ doorStatus.doorStatus = propertyTypes.doorStatus || null;
+ doorStatus.doorLockStatus = propertyTypes.doorLockStatus || null;
+ doorStatus.childLockStatus = propertyTypes.childLockStatus || false;
+
+ this.__defineGetter__("time", function () {
+ return doorStatus.time;
+ });
+
+ this.__defineGetter__("DOORLOCATION_DRIVER", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("DOORLOCATION_PASSENGER", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("DOORLOCATION_LEFTREAR", function () {
+ return 2;
+ });
+
+ this.__defineGetter__("DOORLOCATION_RIGHTREAR", function () {
+ return 3;
+ });
+
+ this.__defineGetter__("DOORLOCATION_TRUNK", function () {
+ return 4;
+ });
+
+ this.__defineGetter__("DOORLOCATION_FUELCAP", function () {
+ return 5;
+ });
+
+ this.__defineGetter__("DOORLOCATION_HOOD", function () {
+ return 6;
+ });
+
+ this.__defineGetter__("DOORSTATUS_CLOSED", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("DOORSTATUS_OPEN", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("DOORSTATUS_AJAR", function () {
+ return 2;
+ });
+
+ this.__defineGetter__("doorStatus", function () {
+ return doorStatus.doorStatus;
+ });
+
+ this.__defineSetter__("doorStatus", function (val) {
+ try {
+ doorStatus.doorStatus = t.any(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("doorLockStatus", function () {
+ return doorStatus.doorLockStatus;
+ });
+
+ this.__defineSetter__("doorLockStatus", function (val) {
+ try {
+ doorStatus.doorLockStatus = t.any(val);
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("childLockStatus", function () {
+ return doorStatus.childLockStatus;
+ });
+
+ this.__defineSetter__("childLockStatus", function (val) {
+ try {
+ doorStatus.childLockStatus = t.boolean(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+SeatBeltStatus = function (propertyTypes) {
+ var seatBeltStatus = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ seatBeltStatus.time = propertyTypes.time || undefined;
+ seatBeltStatus.seatBeltStatus = propertyTypes.seatBeltStatus || null;
+
+ this.__defineGetter__("time", function () {
+ return seatBeltStatus.time;
+ });
+
+ this.__defineGetter__("SEATBELTLOCATION_DRIVER", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("SEATBELTLOCATION_MIDDLEFRONT", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("SEATBELTLOCATION_PASSENGER", function () {
+ return 2;
+ });
+
+ this.__defineGetter__("SEATBELTLOCATION_LEFTREAR", function () {
+ return 3;
+ });
+
+ this.__defineGetter__("SEATBELTLOCATION_MIDDLEREAR", function () {
+ return 4;
+ });
+
+ this.__defineGetter__("SEATBELTLOCATION_RIGHTREAR", function () {
+ return 5;
+ });
+
+ this.__defineGetter__("seatBeltStatus", function () {
+ return seatBeltStatus.seatBeltStatus;
+ });
+
+ this.__defineSetter__("seatBeltStatus", function (val) {
+ try {
+ seatBeltStatus.seatBeltStatus = t.any(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+OccupantStatus = function (propertyTypes) {
+ var occupantStatus = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ occupantStatus.time = propertyTypes.time || undefined;
+ occupantStatus.occupantStatus = propertyTypes.occupantStatus || null;
+
+ this.__defineGetter__("time", function () {
+ return occupantStatus.time;
+ });
+
+ this.__defineGetter__("OCCUPANTLOCATION_DRIVER", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("OCCUPANTLOCATION_FRONTMIDDLE", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("OCCUPANTLOCATION_PASSENGER", function () {
+ return 2;
+ });
+
+ this.__defineGetter__("OCCUPANTLOCATION_LEFTREAR", function () {
+ return 3;
+ });
+
+ this.__defineGetter__("OCCUPANTLOCATION_MIDDLEREAR", function () {
+ return 4;
+ });
+
+ this.__defineGetter__("OCCUPANTLOCATION_RIGHTREAR", function () {
+ return 5;
+ });
+
+ this.__defineGetter__("OCCUPANTSTATUS_VACANT", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("OCCUPANTSTATUS_CHILD", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("OCCUPANTSTATUS_ADULT", function () {
+ return 2;
+ });
+
+ this.__defineGetter__("occupantStatus", function () {
+ return occupantStatus.occupantStatus;
+ });
+
+ this.__defineSetter__("occupantStatus", function (val) {
+ try {
+ occupantStatus.occupantStatus = t.any(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+ObstacleDistance = function (propertyTypes) {
+ var obstacleDistance = {};
+
+ VehiclePropertyType.call(this, propertyTypes);
+
+ obstacleDistance.time = propertyTypes.time || undefined;
+ obstacleDistance.obstacleDistance = propertyTypes.obstacleDistance || null;
+
+ this.__defineGetter__("time", function () {
+ return obstacleDistance.time;
+ });
+
+ this.__defineGetter__("DISTANCESENSORLOCATION_LEFTFRONT", function () {
+ return 0;
+ });
+
+ this.__defineGetter__("DISTANCESENSORLOCATION_RIGHTFRONT", function () {
+ return 1;
+ });
+
+ this.__defineGetter__("DISTANCESENSORLOCATION_LEFTREAR", function () {
+ return 2;
+ });
+
+ this.__defineGetter__("DISTANCESENSORLOCATION_RIGHTREAR", function () {
+ return 3;
+ });
+
+ this.__defineGetter__("DISTANCESENSORLOCATION_LEFTBLINDSPOT", function () {
+ return 4;
+ });
+
+ this.__defineGetter__("DISTANCESENSORLOCATION_RIGHTBLINDSPOT", function () {
+ return 5;
+ });
+
+ this.__defineGetter__("obstacleDistance", function () {
+ return obstacleDistance.obstacleDistance;
+ });
+
+ this.__defineSetter__("obstacleDistance", function (val) {
+ try {
+ obstacleDistance.obstacleDistance = t.any(val);
+ }
+ catch (err) {
+ }
+ });
+};
+
+_initialize();
+
+module.exports = _self;
+
+});
+define('ripple/platform/phonegap/1.0.0/AVCodecsAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (info, id, audioCodecs, videoCodecs) {
+ return {
+ info: info,
+ id: id,
+ audioCodecs: audioCodecs,
+ videoCodecs: videoCodecs
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/Acceleration', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (x, y, z) {
+ return {
+ x: x || 0,
+ y: y || 0,
+ z: z || 0,
+ timestamp: new Date().getTime()
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/AudioCodecAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (info, id, compFormats, encode, decode) {
+ return {
+ info: info,
+ id: id,
+ compFormats: compFormats,
+ encode: encode,
+ decode: decode
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/AudioDeviceAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (type, freqRangeLow, freqRangeHigh, volumeLevel, info) {
+ return {
+ type: type,
+ freqRangeLow: freqRangeLow,
+ freqRangeHigh: freqRangeHigh,
+ volumeLevel: volumeLevel,
+ info: info
+ };
+
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/BrailleDeviceAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (nbCells, info) {
+ return {
+ nbCells: nbCells,
+ info: info
+ };
+
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/CPUAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (info, id, usage) {
+ return {
+ info: info,
+ id: id,
+ usage: usage
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/CameraAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (supportsVideo, hasFlash, sensorPixels, maxZoomFactor) {
+ return {
+ supportsVideo: supportsVideo,
+ hasFlash: hasFlash,
+ sensorPixels: sensorPixels,
+ maxZoomFactor: maxZoomFactor
+ };
+
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/Connection', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = {
+ UNKNOWN: "unknown",
+ ETHERNET: "ethernet",
+ WIFI: "wifi",
+ CELL_2G: "2g",
+ CELL_3G: "3g",
+ CELL_4G: "4g",
+ NONE: "none"
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/ConnectionAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (info, id, type, currentOrientation, currentUploadBandwidth, maxDownloadBandwidth, maxUploadBandwidth, currentSignalStrength, roaming) {
+ return {
+ info: info,
+ id: id,
+ type: type,
+ currentDownloadBandwidth: currentOrientation,
+ currentUploadBandwidth: currentUploadBandwidth,
+ maxDownloadBandwidth: maxDownloadBandwidth,
+ maxUploadBandwidth: maxUploadBandwidth,
+ currentSignalStrength: currentSignalStrength,
+ roaming: roaming
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/Contact', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+var utils = require('ripple/utils'),
+ event = require('ripple/event');
+
+function _properties(obj) {
+ var prop, newObj = {};
+ for (prop in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, prop)) {
+ if (typeof obj[prop] !== "function") {
+ newObj[prop] = utils.copy(obj[prop]);
+ }
+ }
+ }
+ return newObj;
+}
+
+module.exports = function (
+ id,
+ displayName,
+ name,
+ nickname,
+ phoneNumbers,
+ emails,
+ addresses,
+ ims,
+ organizations,
+ birthday,
+ note,
+ photos,
+ categories,
+ urls
+) {
+
+ return {
+ id: id || Math.uuid(undefined, 16),
+ displayName: displayName || null,
+ name: name || null,
+ nickname: nickname || null,
+ phoneNumbers: phoneNumbers || null,
+ emails: emails || null,
+ addresses: addresses || null,
+ ims: ims || null,
+ organizations: organizations || null,
+ birthday: birthday || null,
+ note: note || null,
+ photos: photos || null,
+ categories: categories || null,
+ urls: urls || null,
+ save: function (success, error) {
+ var _self = this,
+ lastUpdated = this.updated; // hackish
+
+ this.updated = new Date();
+
+ if (!this.id) {
+ this.id = Math.uuid(undefined, 16);
+ }
+
+ event.trigger("phonegap-contact-save", [_properties(this), success, function (e) {
+ _self.updated = lastUpdated;
+ error(e);
+ }]);
+ },
+ remove: function (success, error) {
+ event.trigger("phonegap-contact-remove", [this.id, success, error]);
+ },
+ clone: function () {
+ var copy = utils.copy(this);
+ copy.id = null;
+ return copy;
+ }
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/ContactAccount', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (domain, username, userid) {
+ return {
+ domain: domain,
+ username: username,
+ userid: userid
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/ContactAddress', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (pref, type, formatted, streetAddress, locality, region, postalCode, country, id) {
+ return {
+ pref: pref || null,
+ type: type || null,
+ formatted: formatted || null,
+ streetAddress: streetAddress || null,
+ locality: locality || null,
+ region: region || null,
+ postalCode: postalCode || null,
+ country: country || null,
+ id: id || null
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/ContactError', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+function ContactError(code) {
+ this.code = code || null;
+}
+
+ContactError.UNKNOWN_ERROR = 0;
+ContactError.INVALID_ARGUMENT_ERROR = 1;
+ContactError.NOT_FOUND_ERROR = 2;
+ContactError.TIMEOUT_ERROR = 3;
+ContactError.PENDING_OPERATION_ERROR = 4;
+ContactError.IO_ERROR = 5;
+ContactError.NOT_SUPPORTED_ERROR = 6;
+ContactError.PERMISSION_DENIED_ERROR = 20;
+
+module.exports = ContactError;
+
+});
+define('ripple/platform/phonegap/1.0.0/ContactField', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (type, value, pref) {
+ return {
+ type: type,
+ value: value,
+ pref: pref || false
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/ContactFindOptions', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (filter, multiple, updatedSince) {
+ return {
+ filter: filter || "",
+ multiple: multiple || false,
+ updatedSince: updatedSince || ""
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/ContactName', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (formatted, familyName, givenName, middleName, honorificPrefix, honorificSuffix) {
+ return {
+ formatted: formatted,
+ familyName: familyName,
+ givenName: givenName,
+ middleName: middleName,
+ honorificPrefix: honorificPrefix,
+ honorificSuffix: honorificSuffix
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/ContactOrganization', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (pref, type, name, dept, title) {
+ return {
+ pref: pref || null,
+ type: type || null,
+ name: name || null,
+ department: dept || null,
+ title: title || null
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/DisplayDeviceAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (orientation, brightness, contrast, blanked, dotsPerInchW, dotsPerInchH, physicalWidth, physicalHeight, info) {
+ return {
+ orientation: orientation,
+ brightness: brightness,
+ contrast: contrast,
+ blanked: blanked,
+ dotsPerInchW: dotsPerInchW,
+ dotsPerInchH: dotsPerInchH,
+ physicalWidth: physicalWidth,
+ physicalHeight: physicalHeight,
+ info: info
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/InputDevicesAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (info, id, pointingDevices, activePointingDevices, keyboards, activeKeyboards, cameras, activeCameras, microphones, activeMicrophones) {
+ return {
+ info: info,
+ id: id,
+ pointingDevices: pointingDevices,
+ activePointingDevices: activePointingDevices,
+ keyboards: keyboards,
+ activeKeyboards: activeKeyboards,
+ cameras: cameras,
+ activeCameras: activeCameras,
+ microphones: microphones,
+ activeMicrophones: activeMicrophones
+ };
+
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/KeyboardAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (type, isHardware, info) {
+ return {
+ type: type,
+ isHardware: isHardware,
+ info: info
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/MicrophoneAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (type, freqRangeLow, freqRangeHigh, info, name, types) {
+ return {
+ type: type,
+ freqRangeLow: freqRangeLow,
+ freqRangeHigh: freqRangeHigh,
+ info: info,
+ name: name,
+ types: types
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/NetworkAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (info, id, activeConnections) {
+ return {
+ info: info,
+ id: id,
+ activeConnections: activeConnections || []
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/NetworkStatus', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = {
+ NOT_REACHABLE: 0,
+ REACHABLE_VIA_CARRIER_DATA_NETWORK: 1,
+ REACHABLE_VIA_WIFI_NETWORK: 2
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/OutputDevicesAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (info, id, displayDevices, activeDisplayDevices, printingDevices, activePrintingDevice, brailleDevices, activeBrailleDevice, audioDevices, activeAudioDevices) {
+ return {
+ info: info,
+ id: id,
+ displayDevices: displayDevices,
+ activeDisplayDevices: activeDisplayDevices,
+ printingDevices: printingDevices,
+ activePrintingDevice: activePrintingDevice,
+ brailleDevices: brailleDevices,
+ activeBrailleDevice: activeBrailleDevice,
+ audioDevices: audioDevices,
+ activeAudioDevices: activeAudioDevices
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/PhoneGap', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = {
+ available: true
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/PointerAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (type, supportsMultiTouch, info) {
+ return {
+ type: type,
+ supportsMultiTouch: supportsMultiTouch,
+ info: info
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/PowerAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (info, id, level, timeRemaining, isBattery, isCharging) {
+ return {
+ info: info,
+ id: id,
+ level: level,
+ timeRemaining: timeRemaining,
+ isBattery: isBattery,
+ isCharging: isCharging
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/PrintingDeviceAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (type, resolution, color, info) {
+ return {
+ type: type,
+ resolution: resolution,
+ color: color,
+ info: info
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/SensorAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (value, min, max, normalizedValue) {
+ return {
+ value: value,
+ min: min,
+ max: max,
+ normalizedValue: normalizedValue
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/StorageUnitAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (info, id, type, isWritable, capacity, availableCapacity, isRemoveable) {
+ return {
+ info: info,
+ id: id,
+ type: type,
+ isWritable: isWritable,
+ capacity: capacity,
+ availableCapacity: availableCapacity,
+ isRemoveable: isRemoveable
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/SystemInfoOptions', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (highThreshold, lowThreshold, thresholdTarget, timeout, id) {
+ return {
+ highThreshold: highThreshold,
+ lowThreshold: lowThreshold,
+ thresholdTarget: thresholdTarget,
+ timeout: timeout,
+ id: id
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/ThermalAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (info, id, state) {
+ return {
+ info: info,
+ id: id,
+ state: state
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/VideoCodecAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+module.exports = function (info, id, compFormats, containerFormats, hwAccel, profiles, frameTypes, rateTypes) {
+ return {
+ info: info,
+ id: id,
+ compFormats: compFormats,
+ containerFormats: containerFormats,
+ hwAccel: hwAccel,
+ profiles: profiles,
+ frameTypes: frameTypes,
+ rateTypes: rateTypes
+ };
+};
});
define('ripple/platform/phonegap/1.0.0/accelerometer', function (require, exports, module) {
module.exports = {
//"phonegap": {"1.0.0": require('ripple/platform/phonegap/1.0.0/spec')},
"tizen": {"2.0": require('ripple/platform/tizen/2.0/spec')},
- //"cordova": {"2.0.0": require('ripple/platform/cordova/2.0.0/spec')},
+ "ivi": {"3.0": require('ripple/platform/ivi/3.0/spec')},
+ "cordova": {"2.0.0": require('ripple/platform/cordova/2.0.0/spec')},
//"webworks.bb10": {"1.0.0": require('ripple/platform/webworks.bb10/1.0.0/spec')},
//"webworks.handset": {"2.0.0": require('ripple/platform/webworks.handset/2.0.0/spec')},
//"webworks.tablet": {"2.0.0": require('ripple/platform/webworks.tablet/2.0.0/spec')},
module.exports = AlarmRelative;
});
-define('ripple/platform/tizen/2.0/ApplicationBase', function (require, exports, module) {
+define('ripple/platform/tizen/2.0/ApplicationControl', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-var event = require('ripple/event'),
- ApplicationControl = require('ripple/platform/tizen/2.0/ApplicationControl'),
- RequestedApplicationControl = require('ripple/platform/tizen/2.0/RequestedApplicationControl');
-
-module.exports = function (appInfo, contextId, metaData) {
- var _self, request = null, _metaData = metaData;
-
- _self = {
- appInfo : appInfo,
- contextId : contextId,
- exit : function () {
- event.trigger("tizen-application-exit", [contextId]);
- },
- hide : function () {
- event.trigger("tizen-application-hide", [contextId]);
- },
- getRequestedAppControl : function () {
- request = new RequestedApplicationControl(
- new ApplicationControl(
- _metaData.operation,
- _metaData.appControl.uri,
- _metaData.appControl.mime,
- _metaData.appControl.category,
- _metaData.appControl.data));
- return request;
- }
- };
- _self.__defineGetter__("appInfo", function () {
- return appInfo;
- });
- _self.__defineGetter__("contextId", function () {
- return contextId;
- });
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ ApplicationControlData = require('ripple/platform/tizen/2.0/ApplicationControlData');
- return _self;
-};
+var ApplicationControl = function (operation, uri, mime, category, data) {
+ var applicationControl = {}, i;
-});
-define('ripple/platform/tizen/2.0/ApplicationCertificate', function (require, exports, module) {
-/*
- * Copyright 2012 Intel Corporation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
+ t.ApplicationControl(arguments, this);
-module.exports = function (type, value) {
- var _self;
+ applicationControl.operation = operation;
+ applicationControl.uri = uri || null;
+ applicationControl.mime = mime || null;
+ applicationControl.category = category || null;
+ applicationControl.data = [];
- _self = {
- type : type,
- value : value
- };
+ if (data) {
+ for (i in data) {
+ applicationControl.data[i] = new ApplicationControlData(data[i].key,
+ data[i].value);
+ }
+ }
- _self.__defineGetter__("type", function () {
- return type;
+ this.__defineGetter__("operation", function () {
+ return applicationControl.operation;
});
- _self.__defineGetter__("value", function () {
- return value;
+ this.__defineSetter__("operation", function (val) {
+ try {
+ applicationControl.operation = t.DOMString(val);
+ } catch (e) {
+ }
});
- return _self;
-};
-
-});
-define('ripple/platform/tizen/2.0/ApplicationContext', function (require, exports, module) {
-/*
- * Copyright 2012 Intel Corporation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-
-module.exports = function (id, appId) {
- var _self;
-
- _self = {
- id : id,
- appId: appId
- };
-
- _self.__defineGetter__("id", function () {
- return id;
+ this.__defineGetter__("uri", function () {
+ return applicationControl.uri;
});
- _self.__defineGetter__("appId", function () {
- return appId;
+ this.__defineSetter__("uri", function (val) {
+ try {
+ applicationControl.uri = t.DOMString(val, "?");
+ } catch (e) {
+ }
});
- return _self;
-};
-
-});
-define('ripple/platform/tizen/2.0/ApplicationControl', function (require, exports, module) {
-/*
- * Copyright 2012 Intel Corporation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-
-var t = require('ripple/platform/tizen/2.0/typecast'),
- ApplicationControlData = require('ripple/platform/tizen/2.0/ApplicationControlData');
-
-var ApplicationControl = function (operation, uri, mime, category, data) {
- var i, _data = [];
-
- t.ApplicationControl(arguments, this);
-
- this.operation = operation;
- this.uri = uri || null;
- this.mime = mime || null;
- this.category = category || null;
+ this.__defineGetter__("mime", function () {
+ return applicationControl.mime;
+ });
+ this.__defineSetter__("mime", function (val) {
+ try {
+ applicationControl.mime = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
- if (data) {
- for (i in data) {
- _data[i] = new ApplicationControlData(data[i].key,
- data[i].value);
+ this.__defineGetter__("category", function () {
+ return applicationControl.category;
+ });
+ this.__defineSetter__("category", function (val) {
+ try {
+ applicationControl.category = t.DOMString(val, "?");
+ } catch (e) {
}
- }
+ });
this.__defineGetter__("data", function () {
- return _data;
+ return applicationControl.data;
});
-
- this.__defineSetter__("data", function (data) {
+ this.__defineSetter__("data", function (val) {
var i;
- data = data || [];
- data = t.ApplicationControlData(data, "[]");
-
- for (i in data) {
- _data[i] = new ApplicationControlData(data[i].key,
- data[i].value);
+ try {
+ t.ApplicationControlData(val, "[]");
+ for (i in val) {
+ applicationControl.data[i] = new ApplicationControlData(
+ val[i].key, val[i].value);
+ }
+ } catch (e) {
}
});
};
});
define('ripple/platform/tizen/2.0/ApplicationControlData', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-var t = require('ripple/platform/tizen/2.0/typecast');
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ ApplicationControlData;
-var ApplicationControlData = function (key, value) {
- var val;
+ApplicationControlData = function (key, value) {
+ var applicationControlData = {};
t.ApplicationControlData(arguments, this);
- this.key = key;
- val = value || [];
+ applicationControlData.key = key;
+ applicationControlData.value = value;
- this.__defineGetter__("value", function () {
- return val;
+ this.__defineGetter__("key", function () {
+ return applicationControlData.key;
+ });
+ this.__defineSetter__("key", function (val) {
+ try {
+ applicationControlData.key = t.DOMString(val);
+ } catch (e) {
+ }
});
- this.__defineSetter__("value", function (value) {
- value = value || [];
- val = t.DOMString(value, '[]');
+ this.__defineGetter__("value", function () {
+ return applicationControlData.value;
+ });
+ this.__defineSetter__("value", function (val) {
+ try {
+ applicationControlData.value = t.DOMString(val, '[]');
+ } catch (e) {
+ }
});
};
module.exports = ApplicationControlData;
});
-define('ripple/platform/tizen/2.0/ApplicationInformation', function (require, exports, module) {
+define('ripple/platform/tizen/2.0/AttributeFilter', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-module.exports = function (id, name, iconPath, version, show, categories, installDate, size, packageId) {
- var _self = this;
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ AttributeFilter;
- _self.__defineGetter__("id", function () {
- return id;
- });
- _self.__defineGetter__("name", function () {
- return name;
- });
- _self.__defineGetter__("iconPath", function () {
- return iconPath;
- });
- _self.__defineGetter__("version", function () {
- return version;
+AttributeFilter = function (attributeName, matchFlag, matchValue) {
+ var attributeFilter = {};
+
+ t.AttributeFilter(arguments, this);
+
+ attributeFilter.attributeName = attributeName;
+ attributeFilter.matchFlag = matchFlag || "EXACTLY";
+ attributeFilter.matchValue = (matchFlag === "EXISTS") ? null :
+ matchValue || null;
+
+ this.__defineGetter__("attributeName", function () {
+ return attributeFilter.attributeName;
});
- _self.__defineGetter__("show", function () {
- return show;
+ this.__defineSetter__("attributeName", function (val) {
+ try {
+ attributeFilter.attributeName = t.DOMString(val);
+ } catch (e) {
+ }
});
- _self.__defineGetter__("categories", function () {
- return categories;
+
+ this.__defineGetter__("matchFlag", function () {
+ return attributeFilter.matchFlag;
});
- _self.__defineGetter__("installDate", function () {
- return installDate;
+ this.__defineSetter__("matchFlag", function (val) {
+ try {
+ attributeFilter.matchFlag = t.FilterMatchFlag(val);
+ } catch (e) {
+ }
});
- _self.__defineGetter__("size", function () {
- return size;
+
+ this.__defineGetter__("matchValue", function () {
+ return attributeFilter.matchValue;
});
- _self.__defineGetter__("packageId", function () {
- return packageId;
+ this.__defineSetter__("matchValue", function (val) {
+ try {
+ if (attributeFilter.matchFlag === "EXISTS") {
+ return;
+ }
+ attributeFilter.matchValue = t.any(val);
+ } catch (e) {
+ }
});
-
- return _self;
};
-});
-define('ripple/platform/tizen/2.0/AttributeFilter', function (require, exports, module) {
-/*
- * Copyright 2012 Intel Corporation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-
-module.exports = function (_attributeName, _matchFlag, _matchValue) {
- return {
- attributeName: _attributeName,
- matchFlag: _matchFlag,
- matchValue: _matchValue
- };
-};
+module.exports = AttributeFilter;
});
define('ripple/platform/tizen/2.0/AttributeRangeFilter', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-module.exports = function (_attributeName, _initialValue, _endValue) {
- return {
- attributeName: _attributeName,
- initialValue: _initialValue,
- endValue: _endValue
- };
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ AttributeRangeFilter;
+
+AttributeRangeFilter = function (attributeName, initialValue, endValue) {
+ var attributeRangeFilter = {};
+
+ t.AttributeRangeFilter(arguments, this);
+
+ this.__defineGetter__("attributeName", function () {
+ return attributeRangeFilter.attributeName;
+ });
+ this.__defineSetter__("attributeName", function (val) {
+ try {
+ attributeRangeFilter.attributeName = t.DOMString(val);
+ } catch (e) {
+ }
+ });
+
+ attributeRangeFilter.attributeName = attributeName;
+
+ this.initialValue = initialValue || null;
+ this.endValue = endValue || null;
};
+module.exports = AttributeRangeFilter;
+
});
define('ripple/platform/tizen/2.0/BluetoothClass', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use _self file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
var errorcode = require('ripple/platform/tizen/2.0/errorcode'),
- WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError');
+ t = require('ripple/platform/tizen/2.0/typecast'),
+ WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
+ BluetoothClass,
+ _security;
-module.exports = function (prop, metaData) {
- var _self,
- _major = prop.major || 0,
- _minor = prop.minor || 0,
- _security = metaData,
- _services = prop.services || [];
+BluetoothClass = function (prop, metaData) {
+ var bluetoothClass = {};
- _self = {
- hasService: function (service) {
- if (!_security.all && !_security.hasService) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
- }
- if (typeof service !== "number") {
- throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
- }
- return (_services.join(",").indexOf(service) !== -1);
- }
- };
+ _security = metaData;
+
+ bluetoothClass.major = prop.major || 0;
+ bluetoothClass.minor = prop.minor || 0;
+ bluetoothClass.services = prop.services || [];
+
+ this.__defineGetter__("major", function () {
+ return bluetoothClass.major;
+ });
- _self.__defineGetter__("major", function () {
- return _major;
+ this.__defineGetter__("minor", function () {
+ return bluetoothClass.minor;
});
- _self.__defineGetter__("minor", function () {
- return _minor;
+
+ this.__defineGetter__("services", function () {
+ return bluetoothClass.services;
});
- _self.__defineGetter__("services", function () {
- return _services;
+
+ bluetoothClass.services.forEach(function (service, i) {
+ bluetoothClass.services.__defineGetter__(i, function () {
+ return service;
+ });
});
- return _self;
+
+ this.hasService = function (service) {
+ if (!_security.hasService) {
+ throw new WebAPIException(errorcode.SECURITY_ERR);
+ }
+
+ t.BluetoothClass("hasService", arguments);
+
+ return (bluetoothClass.services.join(",").indexOf(service) !== -1);
+ };
};
+module.exports = BluetoothClass;
+
});
define('ripple/platform/tizen/2.0/BluetoothClassDeviceMajor', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use _self file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* limitations under the License.
*/
-module.exports = function () {
- var _self = {};
-
- _self.__defineGetter__("MISC", function () {
+var BluetoothClassDeviceMajor = function () {
+ this.__defineGetter__("MISC", function () {
return 0x00;
});
- _self.__defineGetter__("COMPUTER", function () {
+
+ this.__defineGetter__("COMPUTER", function () {
return 0x01;
});
- _self.__defineGetter__("PHONE", function () {
+
+ this.__defineGetter__("PHONE", function () {
return 0x02;
});
- _self.__defineGetter__("NETWORK", function () {
+
+ this.__defineGetter__("NETWORK", function () {
return 0x03;
});
- _self.__defineGetter__("AUDIO_VIDEO", function () {
+
+ this.__defineGetter__("AUDIO_VIDEO", function () {
return 0x04;
});
- _self.__defineGetter__("PERIPHERAL", function () {
+
+ this.__defineGetter__("PERIPHERAL", function () {
return 0x05;
});
- _self.__defineGetter__("IMAGING", function () {
+
+ this.__defineGetter__("IMAGING", function () {
return 0x06;
});
- _self.__defineGetter__("WEARABLE", function () {
+
+ this.__defineGetter__("WEARABLE", function () {
return 0x07;
});
- _self.__defineGetter__("TOY", function () {
+
+ this.__defineGetter__("TOY", function () {
return 0x08;
});
- _self.__defineGetter__("HEALTH", function () {
+
+ this.__defineGetter__("HEALTH", function () {
return 0x09;
});
- _self.__defineGetter__("UNCATEGORIZED", function () {
+
+ this.__defineGetter__("UNCATEGORIZED", function () {
return 0x1F;
});
-
- return _self;
};
+module.exports = BluetoothClassDeviceMajor;
+
});
define('ripple/platform/tizen/2.0/BluetoothClassDeviceMinor', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use _self file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* limitations under the License.
*/
-module.exports = function () {
- var _self = {};
-
- _self.__defineGetter__("COMPUTER_UNCATEGORIZED", function () {
+var BluetoothClassDeviceMinor = function () {
+ // COMPUTER
+ this.__defineGetter__("COMPUTER_UNCATEGORIZED", function () {
return 0x00;
});
- _self.__defineGetter__("COMPUTER_DESKTOP", function () {
+
+ this.__defineGetter__("COMPUTER_DESKTOP", function () {
return 0x01;
});
- _self.__defineGetter__("COMPUTER_SERVER", function () {
+
+ this.__defineGetter__("COMPUTER_SERVER", function () {
return 0x02;
});
- _self.__defineGetter__("COMPUTER_LAPTOP", function () {
+
+ this.__defineGetter__("COMPUTER_LAPTOP", function () {
return 0x03;
});
- _self.__defineGetter__("COMPUTER_HANDHELD_PC_OR_PDA", function () {
+
+ this.__defineGetter__("COMPUTER_HANDHELD_PC_OR_PDA", function () {
return 0x04;
});
- _self.__defineGetter__("COMPUTER_PALM_PC_OR_PDA", function () {
+
+ this.__defineGetter__("COMPUTER_PALM_PC_OR_PDA", function () {
return 0x05;
});
- _self.__defineGetter__("COMPUTER_WEARABLE", function () {
+
+ this.__defineGetter__("COMPUTER_WEARABLE", function () {
return 0x06;
});
- _self.__defineGetter__("PHONE_UNCATEGORIZED", function () {
+ // PHONE
+ this.__defineGetter__("PHONE_UNCATEGORIZED", function () {
return 0x00;
});
- _self.__defineGetter__("PHONE_CELLULAR", function () {
+
+ this.__defineGetter__("PHONE_CELLULAR", function () {
return 0x01;
});
- _self.__defineGetter__("PHONE_CORDLESS", function () {
+
+ this.__defineGetter__("PHONE_CORDLESS", function () {
return 0x02;
});
- _self.__defineGetter__("PHONE_SMARTPHONE", function () {
+
+ this.__defineGetter__("PHONE_SMARTPHONE", function () {
return 0x03;
});
- _self.__defineGetter__("PHONE_MODEM_OR_GATEWAY", function () {
+
+ this.__defineGetter__("PHONE_MODEM_OR_GATEWAY", function () {
return 0x04;
});
- _self.__defineGetter__("PHONE_ISDN", function () {
+
+ this.__defineGetter__("PHONE_ISDN", function () {
return 0x05;
});
- _self.__defineGetter__("AV_UNRECOGNIZED", function () {
+ // AUDIO_VIDEO
+ this.__defineGetter__("AV_UNRECOGNIZED", function () {
return 0x00;
});
- _self.__defineGetter__("AV_WEARABLE_HEADSET", function () {
+
+ this.__defineGetter__("AV_WEARABLE_HEADSET", function () {
return 0x01;
});
- _self.__defineGetter__("AV_HANDSFREE", function () {
+
+ this.__defineGetter__("AV_HANDSFREE", function () {
return 0x02;
});
- _self.__defineGetter__("AV_MICROPHONE", function () {
+
+ this.__defineGetter__("AV_MICROPHONE", function () {
return 0x04;
});
- _self.__defineGetter__("AV_LOUDSPEAKER", function () {
+
+ this.__defineGetter__("AV_LOUDSPEAKER", function () {
return 0x05;
});
- _self.__defineGetter__("AV_HEADPHONES", function () {
+
+ this.__defineGetter__("AV_HEADPHONES", function () {
return 0x06;
});
- _self.__defineGetter__("AV_PORTABLE_AUDIO", function () {
+
+ this.__defineGetter__("AV_PORTABLE_AUDIO", function () {
return 0x07;
});
- _self.__defineGetter__("AV_CAR_AUDIO", function () {
+
+ this.__defineGetter__("AV_CAR_AUDIO", function () {
return 0x08;
});
- _self.__defineGetter__("AV_SETTOP_BOX", function () {
+
+ this.__defineGetter__("AV_SETTOP_BOX", function () {
return 0x09;
});
- _self.__defineGetter__("AV_HIFI", function () {
+
+ this.__defineGetter__("AV_HIFI", function () {
return 0x0a;
});
- _self.__defineGetter__("AV_VCR", function () {
+
+ this.__defineGetter__("AV_VCR", function () {
return 0x0b;
});
- _self.__defineGetter__("AV_VIDEO_CAMERA", function () {
+
+ this.__defineGetter__("AV_VIDEO_CAMERA", function () {
return 0x0c;
});
- _self.__defineGetter__("AV_CAMCORDER", function () {
+
+ this.__defineGetter__("AV_CAMCORDER", function () {
return 0x0d;
});
- _self.__defineGetter__("AV_MONITOR", function () {
+
+ this.__defineGetter__("AV_MONITOR", function () {
return 0x0e;
});
- _self.__defineGetter__("AV_DISPLAY_AND_LOUDSPEAKER", function () {
+
+ this.__defineGetter__("AV_DISPLAY_AND_LOUDSPEAKER", function () {
return 0x0f;
});
- _self.__defineGetter__("AV_VIDEO_CONFERENCING", function () {
+
+ this.__defineGetter__("AV_VIDEO_CONFERENCING", function () {
return 0x10;
});
- _self.__defineGetter__("AV_GAMING_TOY", function () {
+
+ this.__defineGetter__("AV_GAMING_TOY", function () {
return 0x12;
});
- _self.__defineGetter__("PERIPHERAL_UNCATEGORIZED", function () {
+ // PERIPHERAL
+ this.__defineGetter__("PERIPHERAL_UNCATEGORIZED", function () {
return 0;
});
- _self.__defineGetter__("PERIPHERAL_KEYBOARD", function () {
+
+ this.__defineGetter__("PERIPHERAL_KEYBOARD", function () {
return 0x10;
});
- _self.__defineGetter__("PERIPHERAL_POINTING_DEVICE", function () {
+
+ this.__defineGetter__("PERIPHERAL_POINTING_DEVICE", function () {
return 0x20;
});
- _self.__defineGetter__("PERIPHERAL_KEYBOARD_AND_POINTING_DEVICE", function () {
+
+ this.__defineGetter__("PERIPHERAL_KEYBOARD_AND_POINTING_DEVICE", function () {
return 0x30;
});
- _self.__defineGetter__("PERIPHERAL_JOYSTICK", function () {
+
+ this.__defineGetter__("PERIPHERAL_JOYSTICK", function () {
return 0x01;
});
- _self.__defineGetter__("PERIPHERAL_GAMEPAD", function () {
+
+ this.__defineGetter__("PERIPHERAL_GAMEPAD", function () {
return 0x02;
});
- _self.__defineGetter__("PERIPHERAL_REMOTE_CONTROL", function () {
+
+ this.__defineGetter__("PERIPHERAL_REMOTE_CONTROL", function () {
return 0x03;
});
- _self.__defineGetter__("PERIPHERAL_SENSING_DEVICE", function () {
+
+ this.__defineGetter__("PERIPHERAL_SENSING_DEVICE", function () {
return 0x04;
});
- _self.__defineGetter__("PERIPHERAL_DEGITIZER_TABLET", function () {
+
+ this.__defineGetter__("PERIPHERAL_DEGITIZER_TABLET", function () {
return 0x05;
});
- _self.__defineGetter__("PERIPHERAL_CARD_READER", function () {
+
+ this.__defineGetter__("PERIPHERAL_CARD_READER", function () {
return 0x06;
});
- _self.__defineGetter__("PERIPHERAL_DIGITAL_PEN", function () {
+
+ this.__defineGetter__("PERIPHERAL_DIGITAL_PEN", function () {
return 0x07;
});
- _self.__defineGetter__("PERIPHERAL_HANDHELD_SCANNER", function () {
+
+ this.__defineGetter__("PERIPHERAL_HANDHELD_SCANNER", function () {
return 0x08;
});
- _self.__defineGetter__("PERIPHERAL_HANDHELD_INPUT_DEVICE", function () {
+
+ this.__defineGetter__("PERIPHERAL_HANDHELD_INPUT_DEVICE", function () {
return 0x09;
});
- _self.__defineGetter__("IMAGING_UNCATEGORIZED", function () {
+ // IMAGING
+ this.__defineGetter__("IMAGING_UNCATEGORIZED", function () {
return 0x00;
});
- _self.__defineGetter__("IMAGING_DISPLAY", function () {
+
+ this.__defineGetter__("IMAGING_DISPLAY", function () {
return 0x04;
});
- _self.__defineGetter__("IMAGING_CAMERA", function () {
+
+ this.__defineGetter__("IMAGING_CAMERA", function () {
return 0x08;
});
- _self.__defineGetter__("IMAGING_SCANNER", function () {
+
+ this.__defineGetter__("IMAGING_SCANNER", function () {
return 0x10;
});
- _self.__defineGetter__("IMAGING_PRINTER", function () {
+
+ this.__defineGetter__("IMAGING_PRINTER", function () {
return 0x20;
});
- _self.__defineGetter__("WEARABLE_WRITST_WATCH", function () {
+ // WEARABLE
+ this.__defineGetter__("WEARABLE_WRITST_WATCH", function () {
return 0x01;
});
- _self.__defineGetter__("WEARABLE_PAGER", function () {
+
+ this.__defineGetter__("WEARABLE_PAGER", function () {
return 0x02;
});
- _self.__defineGetter__("WEARABLE_JACKET", function () {
+
+ this.__defineGetter__("WEARABLE_JACKET", function () {
return 0x03;
});
- _self.__defineGetter__("WEARABLE_HELMET", function () {
+
+ this.__defineGetter__("WEARABLE_HELMET", function () {
return 0x04;
});
- _self.__defineGetter__("WEARABLE_GLASSES", function () {
+
+ this.__defineGetter__("WEARABLE_GLASSES", function () {
return 0x05;
});
- _self.__defineGetter__("TOY_ROBOT", function () {
+ // TOY
+ this.__defineGetter__("TOY_ROBOT", function () {
return 0x01;
});
- _self.__defineGetter__("TOY_VEHICLE", function () {
+
+ this.__defineGetter__("TOY_VEHICLE", function () {
return 0x02;
});
- _self.__defineGetter__("TOY_DOLL", function () {
+
+ this.__defineGetter__("TOY_DOLL", function () {
return 0x03;
});
- _self.__defineGetter__("TOY_CONTROLLER", function () {
+
+ this.__defineGetter__("TOY_CONTROLLER", function () {
return 0x04;
});
- _self.__defineGetter__("TOY_GAME", function () {
+
+ this.__defineGetter__("TOY_GAME", function () {
return 0x05;
});
- _self.__defineGetter__("HEALTH_UNDEFINED", function () {
+ // HEALTH
+ this.__defineGetter__("HEALTH_UNDEFINED", function () {
return 0x00;
});
- _self.__defineGetter__("HEALTH_BLOOD_PRESSURE_MONITOR", function () {
+
+ this.__defineGetter__("HEALTH_BLOOD_PRESSURE_MONITOR", function () {
return 0x01;
});
- _self.__defineGetter__("HEALTH_THERMOMETER", function () {
+
+ this.__defineGetter__("HEALTH_THERMOMETER", function () {
return 0x02;
});
- _self.__defineGetter__("HEALTH_WEIGHING_SCALE", function () {
+
+ this.__defineGetter__("HEALTH_WEIGHING_SCALE", function () {
return 0x03;
});
- _self.__defineGetter__("HEALTH_GLUCOSE_METER", function () {
+
+ this.__defineGetter__("HEALTH_GLUCOSE_METER", function () {
return 0x04;
});
- _self.__defineGetter__("HEALTH_PULSE_OXIMETER", function () {
+
+ this.__defineGetter__("HEALTH_PULSE_OXIMETER", function () {
return 0x05;
});
- _self.__defineGetter__("HEALTH_PULSE_RATE_MONITOR", function () {
+
+ this.__defineGetter__("HEALTH_PULSE_RATE_MONITOR", function () {
return 0x06;
});
- _self.__defineGetter__("HEALTH_DATA_DISPLAY", function () {
+
+ this.__defineGetter__("HEALTH_DATA_DISPLAY", function () {
return 0x07;
});
- _self.__defineGetter__("HEALTH_STEP_COUNTER", function () {
+
+ this.__defineGetter__("HEALTH_STEP_COUNTER", function () {
return 0x08;
});
- _self.__defineGetter__("HEALTH_BODY_COMPOSITION_ANALYZER", function () {
+
+ this.__defineGetter__("HEALTH_BODY_COMPOSITION_ANALYZER", function () {
return 0x09;
});
- _self.__defineGetter__("HEALTH_PEAK_FLOW_MONITOR", function () {
+
+ this.__defineGetter__("HEALTH_PEAK_FLOW_MONITOR", function () {
return 0x0a;
});
- _self.__defineGetter__("HEALTH_MEDICATION_MONITOR", function () {
+
+ this.__defineGetter__("HEALTH_MEDICATION_MONITOR", function () {
return 0x0b;
});
- _self.__defineGetter__("HEALTH_KNEE_PROSTHESIS", function () {
+
+ this.__defineGetter__("HEALTH_KNEE_PROSTHESIS", function () {
return 0x0c;
});
- _self.__defineGetter__("HEALTH_ANKLE_PROSTHESIS", function () {
+
+ this.__defineGetter__("HEALTH_ANKLE_PROSTHESIS", function () {
return 0x0d;
});
-
- return _self;
};
+module.exports = BluetoothClassDeviceMinor;
+
});
define('ripple/platform/tizen/2.0/BluetoothClassDeviceService', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation
+ * Copyright 2013 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use _self file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* limitations under the License.
*/
-module.exports = function () {
- var _self = {};
-
- _self.__defineGetter__("LIMITED_DISCOVERABILITY", function () {
+var BluetoothClassDeviceService = function () {
+ this.__defineGetter__("LIMITED_DISCOVERABILITY", function () {
return 0x0001;
});
- _self.__defineGetter__("POSITIONING", function () {
+
+ this.__defineGetter__("POSITIONING", function () {
return 0x0008;
});
- _self.__defineGetter__("NETWORKING", function () {
+
+ this.__defineGetter__("NETWORKING", function () {
return 0x0010;
});
- _self.__defineGetter__("RENDERING", function () {
+
+ this.__defineGetter__("RENDERING", function () {
return 0x0020;
});
- _self.__defineGetter__("CAPTURING", function () {
+
+ this.__defineGetter__("CAPTURING", function () {
return 0x0040;
});
- _self.__defineGetter__("OBJECT_TRANSFER", function () {
+
+ this.__defineGetter__("OBJECT_TRANSFER", function () {
return 0x0080;
});
- _self.__defineGetter__("AUDIO", function () {
+
+ this.__defineGetter__("AUDIO", function () {
return 0x0100;
});
- _self.__defineGetter__("TELEPHONY", function () {
+
+ this.__defineGetter__("TELEPHONY", function () {
return 0x0200;
});
- _self.__defineGetter__("INFORMATION", function () {
+
+ this.__defineGetter__("INFORMATION", function () {
return 0x0400;
});
-
- return _self;
};
+module.exports = BluetoothClassDeviceService;
+
});
define('ripple/platform/tizen/2.0/BluetoothDevice', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use _self file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
var utils = require('ripple/utils'),
event = require('ripple/event'),
- tizen1_utils = require('ripple/platform/tizen/2.0/tizen1_utils'),
errorcode = require('ripple/platform/tizen/2.0/errorcode'),
+ t = require('ripple/platform/tizen/2.0/typecast'),
WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError'),
+ WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
BluetoothClass = require('ripple/platform/tizen/2.0/BluetoothClass'),
- BluetoothSocket = require('ripple/platform/tizen/2.0/BluetoothSocket');
-
-module.exports = function (prop) {
- var _self,
- _name = prop.name || "",
- _address = prop.address || "",
- _deviceClass = new BluetoothClass(prop.deviceClass, prop.metaData) || {},
- _isBonded = prop.isBonded || false,
- _isTrusted = prop.isTrusted || false,
- _isConnected = prop.isConnected || false,
- _services = prop.services,
- _security = prop.metaData,
- _uuids = [],
- _sockets = {};
-
- _self = {
- connectToServiceByUUID: function (uuid, successCallback, errorCallback, protocol) {
- if (!_security.all && !_security.connectToServiceByUUID) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
- }
-
- if (typeof uuid !== "string") {
- throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
- }
+ BluetoothSocket = require('ripple/platform/tizen/2.0/BluetoothSocket'),
+ BluetoothDevice,
+ _security;
- tizen1_utils.validateArgumentType(successCallback, "function",
- new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
+BluetoothDevice = function (prop) {
+ var bluetoothDevice = {}, sockets = {}, self;
- if (errorCallback) {
- tizen1_utils.validateArgumentType(errorCallback, "function",
- new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
- }
+ bluetoothDevice.name = prop.name || "";
+ bluetoothDevice.address = prop.address || "";
+ bluetoothDevice.deviceClass = new BluetoothClass(prop.deviceClass,
+ prop.metaData) || {};
+ bluetoothDevice.isBonded = prop.isBonded || false;
+ bluetoothDevice.isTrusted = prop.isTrusted || false;
+ bluetoothDevice.isConnected = prop.isConnected || false;
+ bluetoothDevice.services = prop.services;
+ bluetoothDevice.uuids = [];
- if (protocol) {
- if (protocol !== "RFCOMM" && protocol !== "L2CAP") {
- new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
- }
- }
+ _security = prop.metaData;
+ self = this;
- if (_uuids.join(",").indexOf(uuid) === -1) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
- }
- return;
- }
- _isConnected = true;
- event.trigger("bt-device-connected-changed", [_address, true]);
- Object.defineProperty(_sockets[uuid], "state", {value: "OPEN", writable: false});
- event.trigger("bt-service-state-changed", [_address, uuid, true]);
- successCallback(_sockets[uuid]);
+ event.on("bt-device-connected-update", function (addr, isConnected) {
+ if (addr === bluetoothDevice.address) {
+ bluetoothDevice.isConnected = isConnected;
+ event.trigger("bt-device-connected-changed",
+ [bluetoothDevice.address, bluetoothDevice.isConnected]);
}
- };
-
- event.on("bt-device-connected-update", function (addr, isConnected) {
- if (addr === _address) {
- _isConnected = isConnected;
- event.trigger("bt-device-connected-changed", [_address, _isConnected]);
- }
- });
+ });
- utils.forEach(_services, function (service) {
- _uuids.push(service.uuid);
- _sockets[service.uuid] = new BluetoothSocket({
+ utils.forEach(bluetoothDevice.services, function (service) {
+ bluetoothDevice.uuids.push(service.uuid);
+ sockets[service.uuid] = new BluetoothSocket({
uuid: service.uuid,
protocol: service.protocol,
state: "CLOSED",
- peer: _self,
+ peer: self,
metaData: _security
});
});
- _self.__defineGetter__("name", function () {
- return _name;
+ this.__defineGetter__("name", function () {
+ return bluetoothDevice.name;
});
- _self.__defineGetter__("address", function () {
- return _address;
+
+ this.__defineGetter__("address", function () {
+ return bluetoothDevice.address;
});
- _self.__defineGetter__("deviceClass", function () {
- return _deviceClass;
+
+ this.__defineGetter__("deviceClass", function () {
+ return bluetoothDevice.deviceClass;
});
- _self.__defineGetter__("isBonded", function () {
- return _isBonded;
+
+ this.__defineGetter__("isBonded", function () {
+ return bluetoothDevice.isBonded;
});
- _self.__defineGetter__("isTrusted", function () {
- return _isTrusted;
+
+ this.__defineGetter__("isTrusted", function () {
+ return bluetoothDevice.isTrusted;
});
- _self.__defineGetter__("isConnected", function () {
- return _isConnected;
+
+ this.__defineGetter__("isConnected", function () {
+ return bluetoothDevice.isConnected;
});
- _self.__defineGetter__("uuids", function () {
- return _uuids;
+
+ this.__defineGetter__("uuids", function () {
+ return bluetoothDevice.uuids;
});
- return _self;
+ this.connectToServiceByUUID = function (uuid, successCallback,
+ errorCallback) {
+ if (!_security.all && !_security.connectToServiceByUUID) {
+ throw new WebAPIException(errorcode.SECURITY_ERR);
+ }
+
+ t.BluetoothDevice("connectToServiceByUUID", arguments);
+
+ window.setTimeout(function () {
+ if (bluetoothDevice.uuids.join(",").indexOf(uuid) === -1) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
+ }
+ return;
+ }
+
+ bluetoothDevice.isConnected = true;
+ event.trigger("bt-device-connected-changed", [bluetoothDevice.address,
+ true]);
+ sockets[uuid].__defineGetter__("state", function () {
+ return "OPEN";
+ });
+ event.trigger("bt-service-state-changed", [bluetoothDevice.address,
+ uuid, true]);
+
+ successCallback(sockets[uuid]);
+ }, 1);
+ };
};
+module.exports = BluetoothDevice;
+
});
define('ripple/platform/tizen/2.0/BluetoothServiceHandler', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation
+ * Copyright 2013 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use _self file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* limitations under the License.
*/
-var tizen1_utils = require('ripple/platform/tizen/2.0/tizen1_utils'),
+var event = require('ripple/event'),
errorcode = require('ripple/platform/tizen/2.0/errorcode'),
- event = require('ripple/event'),
- WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError');
+ t = require('ripple/platform/tizen/2.0/typecast'),
+ WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
+ BluetoothServiceHandler,
+ _security;
-module.exports = function (prop) {
- var _self,
- _uuid = prop.uuid || "",
- _name = prop.name || "",
- _isConnected = prop.isConnected || false,
- _security = prop.metaData || {};
+BluetoothServiceHandler = function (prop) {
+ var bluetoothServiceHandler = {};
- _self = {
- onconnect : null,
- unregister : function (successCallback, errorCallback) {
- if (!_security.all && !_security.unregister) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
- }
+ _security = prop.metaData;
- tizen1_utils.validateCallbackType(successCallback, errorCallback);
- event.trigger("bt-unregister-service", [_uuid, successCallback, errorCallback]);
- }
- };
+ bluetoothServiceHandler.uuid = prop.uuid || "";
+ bluetoothServiceHandler.name = prop.name || "";
+ bluetoothServiceHandler.isConnected = prop.isConnected || false;
+ bluetoothServiceHandler.onconnect = null;
- _self.__defineGetter__("uuid", function () {
- return _uuid;
+ this.__defineGetter__("uuid", function () {
+ return bluetoothServiceHandler.uuid;
});
- _self.__defineGetter__("name", function () {
- return _name;
+
+ this.__defineGetter__("name", function () {
+ return bluetoothServiceHandler.name;
});
- _self.__defineGetter__("isConnected", function () {
- return _isConnected;
+
+ this.__defineGetter__("isConnected", function () {
+ return bluetoothServiceHandler.isConnected;
});
- return _self;
+ this.__defineGetter__("onconnect", function () {
+ return bluetoothServiceHandler.onconnect;
+ });
+ this.__defineSetter__("onconnect", function (val) {
+ try {
+ bluetoothServiceHandler.onconnect =
+ t.BluetoothSocketSuccessCallback(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.unregister = function (successCallback, errorCallback) {
+ if (!_security.unregister) {
+ throw new WebAPIException(errorcode.SECURITY_ERR);
+ }
+
+ t.BluetoothServiceHandler("unregister", arguments);
+
+ event.trigger("bt-unregister-service", [bluetoothServiceHandler.uuid,
+ successCallback, errorCallback]);
+ };
};
+module.exports = BluetoothServiceHandler;
+
});
define('ripple/platform/tizen/2.0/BluetoothSocket', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use _self file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
var utils = require('ripple/utils'),
- tizen1_utils = require('ripple/platform/tizen/2.0/tizen1_utils'),
event = require('ripple/event'),
errorcode = require('ripple/platform/tizen/2.0/errorcode'),
- WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError');
+ t = require('ripple/platform/tizen/2.0/typecast'),
+ WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
+ BluetoothSocket,
+ _security;
-module.exports = function (prop) {
- var _self,
- _uuid = prop.uuid,
- _protocol = prop.protocol,
- state = prop.state,
- _peer = prop.peer,
- _security = prop.metaData,
- _buf = [];
+BluetoothSocket = function (prop) {
+ var bluetoothSocket = {}, buffer = [], that = this;
- _self = {
- onmessage : null,
- onclose : null,
- onerror : null,
- writeData : function (data) {
- if (!_security.all && !_security.writeData) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
- }
- if (!tizen1_utils.isValidArray(data)) {
- throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
- }
- if (this.state === "CLOSED") {
- return;
- }
+ _security = prop.metaData;
- event.trigger("bt-service-write-msg", [_peer.address, _uuid, data]);
- return data.length;
- },
- readData : function () {
- var data;
- if (!_security.all && !_security.readData) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
- }
- if (this.state === "CLOSED") {
- return;
- }
+ bluetoothSocket.uuid = prop.uuid;
+ bluetoothSocket.state = prop.state;
+ bluetoothSocket.peer = prop.peer;
+ bluetoothSocket.onmessage = null;
+ bluetoothSocket.onclose = null;
- data = utils.copy(_buf);
- _buf = [];
- return data;
- },
- close : function () {
- if (!_security.all && !_security.close) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
- }
+ this.__defineGetter__("uuid", function () {
+ return bluetoothSocket.uuid;
+ });
- Object.defineProperty(this, "state", {value: "CLOSED", writable: false});
- event.trigger("bt-service-state-changed", [_peer.address, _uuid, false]);
- event.trigger("bt-device-connected-update", [_peer.address, false]);
+ this.__defineGetter__("state", function () {
+ return bluetoothSocket.state;
+ });
- if (this.onclose) {
- this.onclose();
- }
+ this.__defineGetter__("peer", function () {
+ return bluetoothSocket.peer;
+ });
+
+ this.__defineGetter__("onmessage", function () {
+ return bluetoothSocket.onmessage;
+ });
+ this.__defineSetter__("onmessage", function (val) {
+ try {
+ bluetoothSocket.onmessage = t.SuccessCallback(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("onclose", function () {
+ return bluetoothSocket.onclose;
+ });
+ this.__defineSetter__("onclose", function (val) {
+ try {
+ bluetoothSocket.onclose = t.SuccessCallback(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.writeData = function (data) {
+ if (!_security.writeData) {
+ throw new WebAPIException(errorcode.SECURITY_ERR);
+ }
+
+ t.BluetoothSocket("writeData", arguments);
+
+ if (this.state === "CLOSED") {
+ return;
+ }
+
+ event.trigger("bt-service-write-msg", [bluetoothSocket.peer.address,
+ bluetoothSocket.uuid, data]);
+
+ return data.length;
+ };
+
+ this.readData = function () {
+ var data;
+
+ if (!_security.readData) {
+ throw new WebAPIException(errorcode.SECURITY_ERR);
+ }
+
+ if (this.state === "CLOSED") {
+ return;
+ }
+
+ data = utils.copy(buffer);
+ buffer = [];
+
+ return data;
+ };
+
+ this.close = function () {
+ if (!_security.close) {
+ throw new WebAPIException(errorcode.SECURITY_ERR);
+ }
+
+ this.__defineGetter__("state", function () {
+ return "CLOSED";
+ });
+
+ event.trigger("bt-service-state-changed", [bluetoothSocket.peer.address,
+ bluetoothSocket.uuid, false]);
+ event.trigger("bt-device-connected-update",
+ [bluetoothSocket.peer.address, false]);
+
+ if (bluetoothSocket.onclose) {
+ bluetoothSocket.onclose();
}
};
event.on("bt-service-state-update", function (addr, state) {
var stateStr = "CLOSED";
- if (addr === _peer.address) {
- if (state) {
- stateStr = "OPEN";
- }
- Object.defineProperty(this, "state", {value: stateStr, writable: false});
- event.trigger("bt-service-state-changed", [_peer.address, _uuid, state]);
- event.trigger("bt-device-connected-update", [_peer.address, state]);
+
+ if (addr !== bluetoothSocket.peer.address) {
+ return;
}
+ if (state) {
+ stateStr = "OPEN";
+ }
+
+ that.__defineGetter__("state", function () {
+ return stateStr;
+ });
+
+ event.trigger("bt-service-state-changed",
+ [bluetoothSocket.peer.address, bluetoothSocket.uuid,
+ state]);
+ event.trigger("bt-device-connected-update",
+ [bluetoothSocket.peer.address, state]);
});
event.on("bt-service-rawdata-received", function (addr, uuid, msg) {
var i;
- if (addr === _peer.address && uuid === _uuid) {
- _buf = [];
- for (i = 0; i < msg.length; i++) {
- _buf.push(msg.charCodeAt(i));
- }
- if (_self.onmessage) {
- _self.onmessage();
- }
- }
- });
- _self.__defineGetter__("uuid", function () {
- return _uuid;
- });
- _self.__defineGetter__("protocol", function () {
- return _protocol;
- });
- _self.__defineGetter__("state", function () {
- return state;
- });
- _self.__defineGetter__("peer", function () {
- return _peer;
+ if ((addr !== bluetoothSocket.peer.address) ||
+ (uuid !== bluetoothSocket.uuid)) {
+ return;
+ }
+ buffer = [];
+ for (i = 0; i < msg.length; i++) {
+ buffer.push(msg.charCodeAt(i));
+ }
+ if (bluetoothSocket.onmessage) {
+ bluetoothSocket.onmessage();
+ }
});
-
- return _self;
};
+module.exports = BluetoothSocket;
+
});
define('ripple/platform/tizen/2.0/BookmarkFolder', function (require, exports, module) {
/*
});
define('ripple/platform/tizen/2.0/CalendarAlarm', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-var utils = require('ripple/utils'),
- TZDate = require('ripple/platform/tizen/2.0/TZDate'),
- TimeDuration = require('ripple/platform/tizen/2.0/TimeDuration'),
- errorcode = require('ripple/platform/tizen/2.0/errorcode'),
- WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError'),
- _alarmMethods = ["SOUND", "DISPLAY"];
-
-function CalendarAlarm (triggerTime, method, description) {
- var absoluteDate = null,
- before = null,
- isValid = false,
- _self = this;
-
- if (triggerTime instanceof TZDate) {
- absoluteDate = triggerTime;
- } else if (triggerTime instanceof TimeDuration) {
- before = triggerTime;
- } else {
- throw (new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ CalendarAlarm;
+
+CalendarAlarm = function () {
+ var voc, calendarAlarm = {};
+
+ // private
+ function construct() {
+ this.__defineGetter__("absoluteDate", function () {
+ return calendarAlarm.absoluteDate;
+ });
+ this.__defineSetter__("absoluteDate", function (val) {
+ try {
+ calendarAlarm.absoluteDate = t.TZDate(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("before", function () {
+ return calendarAlarm.before;
+ });
+ this.__defineSetter__("before", function (val) {
+ try {
+ calendarAlarm.before = t.TimeDuration(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("method", function () {
+ return calendarAlarm.method;
+ });
+ this.__defineSetter__("method", function (val) {
+ try {
+ calendarAlarm.method = t.AlarmMethod(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("description", function () {
+ return calendarAlarm.description;
+ });
+ this.__defineSetter__("description", function (val) {
+ try {
+ calendarAlarm.description = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
}
- isValid = utils.arrayContains(_alarmMethods, method);
- if (!isValid)
- throw (new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
+ // Constructor
+ function CalendarAlarm_TZDate_AlarmMethod_DOMString(absoluteDate, method,
+ description) {
+ construct.call(this);
- _self.absoluteDate = absoluteDate;
- _self.before = before;
- _self.method = method;
- _self.description = description || "";
+ calendarAlarm.absoluteDate = absoluteDate;
+ calendarAlarm.before = null;
+ calendarAlarm.method = method;
+ calendarAlarm.description = description || "";
+ }
- return _self;
-}
+ function CalendarAlarm_TimeDuration_AlarmMethod_DOMString(before, method,
+ description) {
+ construct.call(this);
+
+ calendarAlarm.absoluteDate = null;
+ calendarAlarm.before = before;
+ calendarAlarm.method = method;
+ calendarAlarm.description = description || "";
+ }
+
+ voc = [CalendarAlarm_TZDate_AlarmMethod_DOMString,
+ CalendarAlarm_TimeDuration_AlarmMethod_DOMString];
+ t.CalendarAlarm(arguments, this, voc);
+};
module.exports = CalendarAlarm;
});
define('ripple/platform/tizen/2.0/CalendarAttendee', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-module.exports = function (uri, attendeeInitDict) {
- var _self = this;
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ CalendarAttendee;
+
+CalendarAttendee = function (uri, attendeeInitDict) {
+ var calendarAttendee = {}, attr;
+
+ t.CalendarAttendee(arguments, this);
+
+ calendarAttendee.uri = uri;
+ calendarAttendee.name = undefined;
+ calendarAttendee.role = "REQ_PARTICIPANT";
+ calendarAttendee.status = "PENDING";
+ calendarAttendee.RSVP = false;
+ calendarAttendee.type = "INDIVIDUAL";
+ calendarAttendee.group = undefined;
+ calendarAttendee.delegatorURI = undefined;
+ calendarAttendee.delegateURI = undefined;
+ calendarAttendee.contactRef = null;
- _self.uri = uri;
if (attendeeInitDict) {
- _self.name = (attendeeInitDict.name) ? attendeeInitDict.name : "";
- _self.role = (attendeeInitDict.role) ? attendeeInitDict.role : "";
- _self.status = (attendeeInitDict.status) ? attendeeInitDict.status : "";
- _self.RSVP = (attendeeInitDict.RSVP) ? attendeeInitDict.RSVP : "";
- _self.type = (attendeeInitDict.type) ? attendeeInitDict.type : "";
- _self.group = (attendeeInitDict.group) ? attendeeInitDict.group : "";
- _self.delegatorURI = (attendeeInitDict.delegatorURI) ? attendeeInitDict.delegatorURI : "";
- _self.delegateURI = (attendeeInitDict.delegateURI) ? attendeeInitDict.delegateURI : "";
- _self.contactRef = (attendeeInitDict.contactRef) ? attendeeInitDict.contactRef : "";
- } else {
- _self.name = "";
- _self.role = "";
- _self.status = "";
- _self.RSVP = "";
- _self.type = "";
- _self.group = "";
- _self.delegatorURI = "";
- _self.delegateURI = "";
- _self.contactRef = "";
+ for (attr in attendeeInitDict) {
+ calendarAttendee[attr] = attendeeInitDict[attr];
+ }
}
- return _self;
+ this.__defineGetter__("uri", function () {
+ return calendarAttendee.uri;
+ });
+ this.__defineSetter__("uri", function (val) {
+ try {
+ calendarAttendee.uri = t.DOMString(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("name", function () {
+ return calendarAttendee.name;
+ });
+ this.__defineSetter__("name", function (val) {
+ try {
+ calendarAttendee.name = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("role", function () {
+ return calendarAttendee.role;
+ });
+ this.__defineSetter__("role", function (val) {
+ try {
+ calendarAttendee.role = t.AttendeeRole(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("status", function () {
+ return calendarAttendee.status;
+ });
+ this.__defineSetter__("status", function (val) {
+ try {
+ calendarAttendee.status = t.AttendeeStatus(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("RSVP", function () {
+ return calendarAttendee.RSVP;
+ });
+ this.__defineSetter__("RSVP", function (val) {
+ try {
+ calendarAttendee.RSVP = t.boolean(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("type", function () {
+ return calendarAttendee.type;
+ });
+ this.__defineSetter__("type", function (val) {
+ try {
+ calendarAttendee.type = t.AttendeeType(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("group", function () {
+ return calendarAttendee.group;
+ });
+ this.__defineSetter__("group", function (val) {
+ try {
+ calendarAttendee.group = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("delegatorURI", function () {
+ return calendarAttendee.delegatorURI;
+ });
+ this.__defineSetter__("delegatorURI", function (val) {
+ try {
+ calendarAttendee.delegatorURI = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("delegateURI", function () {
+ return calendarAttendee.delegateURI;
+ });
+ this.__defineSetter__("delegateURI", function (val) {
+ try {
+ calendarAttendee.delegateURI = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("contactRef", function () {
+ return calendarAttendee.contactRef;
+ });
+ this.__defineSetter__("contactRef", function (val) {
+ try {
+ calendarAttendee.contactRef = t.ContactRef(val, "?");
+ } catch (e) {
+ }
+ });
};
+module.exports = CalendarAttendee;
+
});
define('ripple/platform/tizen/2.0/CalendarEvent', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-var utils = require('ripple/utils'),
- errorcode = require('ripple/platform/tizen/2.0/errorcode'),
- TZDate = require('ripple/platform/tizen/2.0/TZDate'),
- TDur = require('ripple/platform/tizen/2.0/TimeDuration'),
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ typedef = require('ripple/platform/tizen/2.0/typedef'),
CalendarItem = require('ripple/platform/tizen/2.0/CalendarItem'),
- tizen1_utils = require('ripple/platform/tizen/2.0/tizen1_utils'),
- WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError'),
- SimpleCoordinates = require('ripple/platform/tizen/2.0/SimpleCoordinates'),
- CalendarRecurrenceRule = require('ripple/platform/tizen/2.0/CalendarRecurrenceRule');
+ CalendarEvent;
-module.exports = function (eventInitDict) {
- var _self, isDetached = false, isInvalid = false;
+CalendarEvent = function () {
+ var voc, calendarEvent = {};
- _self = new CalendarItem("EVENT");
+ // private
+ function construct(eventInitDict) {
+ CalendarItem.call(this, eventInitDict);
- if ((eventInitDict !== undefined) && (eventInitDict !== null)) {
- _self.endDate = tizen1_utils.isValidTZDate(eventInitDict.endDate) ? eventInitDict.endDate.addDuration(new TDur(0, "MSECS")) : null;
- _self.availability = (eventInitDict.availability) ? String(eventInitDict.availability) : "BUSY";
- _self.recurrenceRule = utils.copy(eventInitDict.recurrenceRule);
- if (eventInitDict.description) {
- _self.description = String(eventInitDict.description);
- }
- if (eventInitDict.summary) {
- _self.summary = String(eventInitDict.summary);
- }
- if (eventInitDict.isAllDay && (typeof eventInitDict.isAllDay === "boolean")) {
- _self.isAllDay = eventInitDict.isAllDay;
- }
- if (eventInitDict.startDate && tizen1_utils.isValidTZDate(eventInitDict.startDate)) {
- _self.startDate = eventInitDict.startDate;
- }
- if (eventInitDict.duration && (typeof eventInitDict.duration === "object")) {
- _self.duration = eventInitDict.duration;
- }
- if (eventInitDict.location) {
- _self.location = String(eventInitDict.location);
- }
- if (eventInitDict.geolocation && eventInitDict.geolocation.latitude && eventInitDict.geolocation.longitude) {
- _self.geolocation = new SimpleCoordinates(eventInitDict.geolocation.latitude, eventInitDict.geolocation.longitude);
- }
- if (eventInitDict.organizer) {
- _self.organizer = String(eventInitDict.organizer);
- }
- if (eventInitDict.visibility) {
- _self.visibility = String(eventInitDict.visibility);
- }
- if (eventInitDict.status) {
- _self.status = String(eventInitDict.status);
- }
- if (eventInitDict.priority) {
- _self.priority = String(eventInitDict.priority);
- }
- if (eventInitDict.alarms && tizen1_utils.isValidArray(eventInitDict.alarms)) {
- isInvalid = false;
- eventInitDict.alarms.some(function (alarm) {
- if (!alarm || alarm.method === undefined) {// 'method' is CalendarAlarm's property.
- isInvalid = true;
- return;
- }
- });
- if (!isInvalid) {
- _self.alarms = eventInitDict.alarms;
+ this.status = "CONFIRMED";
+
+ calendarEvent.convertToString = this.convertToString;
+ calendarEvent.isDetached = false;
+ calendarEvent.endDate = null;
+ calendarEvent.availability = "BUSY";
+ calendarEvent.recurrenceRule = null;
+
+ this.__defineGetter__("isDetached", function () {
+ return calendarEvent.isDetached;
+ });
+
+ this.__defineGetter__("endDate", function () {
+ return calendarEvent.endDate;
+ });
+ this.__defineSetter__("endDate", function (val) {
+ try {
+ calendarEvent.endDate = t.TZDate(val, "?");
+ } catch (e) {
}
- }
- if (eventInitDict.categories && tizen1_utils.isValidArray(eventInitDict.categories)) {
- isInvalid = false;
- eventInitDict.categories.some(function (categorie) {
- if (!categorie || typeof categorie !== "string") {
- isInvalid = true;
- return;
- }
- });
- if (!isInvalid) {
- _self.categories = eventInitDict.categories;
+ });
+
+ this.__defineGetter__("availability", function () {
+ return calendarEvent.availability;
+ });
+ this.__defineSetter__("availability", function (val) {
+ try {
+ calendarEvent.availability = t.EventAvailability(val);
+ } catch (e) {
}
- }
- if (eventInitDict.attendees && tizen1_utils.isValidArray(eventInitDict.attendees)) {
- isInvalid = false;
- eventInitDict.attendees.some(function (attendee) {
- if (!attendee || attendee.uri === undefined) {// 'uri' is CalendarAttendee's property.
- isInvalid = true;
- return;
+ });
+
+ this.__defineGetter__("recurrenceRule", function () {
+ return calendarEvent.recurrenceRule;
+ });
+ this.__defineSetter__("recurrenceRule", function (val) {
+ try {
+ calendarEvent.recurrenceRule = t.CalendarRecurrenceRule(val,
+ "?");
+ } catch (e) {
+ }
+ });
+
+ this.convertToString = convertToString;
+ this.clone = clone(this);
+ this.expandRecurrence = expandRecurrence;
+ }
+
+ function clone(self) {
+ return function () {
+ return new CalendarEvent(self);
+ };
+ }
+
+ // public
+ function convertToString(format) {
+ var str;
+
+ str = calendarEvent.convertToString.call(this, format);
+ str = str.replace(/#TYPE#/g, "VEVENT");
+
+ // TODO: endDate is not supported
+ // TODO: recurrenceRule is not supported
+ str = str.replace(/#AVAILABILITY#/g, "FREEBUSY;FBTYPE=" +
+ calendarEvent.availability);
+
+ str = str.replace(/#[^#]*#/g, "");
+
+ return str;
+ }
+
+ function expandRecurrence(startDate, endDate, successCallback,
+ errorCallback) {
+ }
+
+ // Constructor
+ function CalendarEvent_CalendarEventInit(eventInitDict) {
+ var attr;
+
+ construct.call(this, eventInitDict);
+
+ if (eventInitDict) {
+ for (attr in eventInitDict) {
+ if (attr in typedef.CalendarEventInit) {
+ calendarEvent[attr] = eventInitDict[attr];
}
- });
- if (!isInvalid) {
- _self.attendees = eventInitDict.attendees;
}
}
- } else {
- _self.endDate = null;
- _self.availability = "BUSY";
- _self.recurrenceRule = new CalendarRecurrenceRule();
}
- _self.expandRecurrence = function (startDate, endDate, successCallback, errorCallback) {
- _self.startDate = startDate;
- _self.endDate = endDate;
- if (errorCallback) {
- window.setTimeout(function () {
- errorCallback(new WebAPIError(errorcode.NOT_SUPPORTED_ERR));
- }, 1);
- }
- };
- _self.__defineGetter__("isDetached", function () {
- return isDetached;
- });
- return _self;
+ function CalendarEvent_DOMString_CalendarTextFormat(stringRepresentation,
+ format) {
+ }
+
+ voc = [CalendarEvent_CalendarEventInit,
+ CalendarEvent_DOMString_CalendarTextFormat];
+ t.CalendarEvent(arguments, this, voc);
};
+module.exports = CalendarEvent;
+
});
define('ripple/platform/tizen/2.0/CalendarEventId', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-module.exports = function (uid, rid) {
- var _self = {};
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ CalendarEventId;
- _self.uid = (uid) ? String(uid) : "";
- _self.rid = (rid) ? String(rid) : "";
+CalendarEventId = function (uid, rid) {
+ var calendarEventId = {};
- return _self;
+ t.CalendarEventId(arguments, this);
+
+ calendarEventId.uid = uid;
+ calendarEventId.rid = rid || null;
+
+ this.__defineGetter__("uid", function () {
+ return calendarEventId.uid;
+ });
+ this.__defineSetter__("uid", function (val) {
+ try {
+ calendarEventId.uid = t.DOMString(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("rid", function () {
+ return calendarEventId.rid;
+ });
+ this.__defineSetter__("rid", function (val) {
+ try {
+ calendarEventId.rid = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
};
+module.exports = CalendarEventId;
+
});
define('ripple/platform/tizen/2.0/CalendarItem', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-var utils = require('ripple/utils'),
+var t = require('ripple/platform/tizen/2.0/typecast'),
tizen1_utils = require('ripple/platform/tizen/2.0/tizen1_utils'),
- errorcode = require('ripple/platform/tizen/2.0/errorcode'),
- WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError'),
- WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
- TZDate = require('ripple/platform/tizen/2.0/TZDate'),
- TDur = require('ripple/platform/tizen/2.0/TimeDuration'),
- SimpleCoordinates = require('ripple/platform/tizen/2.0/SimpleCoordinates'),
- CalendarItemInit,
- CalendarEventInit,
- CalendarTaskInit,
+ typedef = require('ripple/platform/tizen/2.0/typedef'),
CalendarItem;
-CalendarItem = function (type, id, lastModificationDate, _security) {
- var _self, _id;
-
- function _2digital(number) {
- return ((number >= 10) ? '' : '0') + number;
- }
-
- if ((type !== "EVENT") && (type !== "TASK"))
- throw new WebAPIError(errorcode.NOT_FOUND_ERR);
+CalendarItem = function (itemInitDict) {
+ var calendarItem = {}, attr;
- if (type === "EVENT") {
- _self = new CalendarEventInit();
- _id = id ? {uid: id, rid: null} : null;
- } else {
- _self = new CalendarTaskInit();
- _id = id || null;
+ // private
+ function toDigit(number) {
+ return ((number >= 10) ? "" : "0") + number;
}
- lastModificationDate = tizen1_utils.isValidTZDate(lastModificationDate) ? lastModificationDate.addDuration(new TDur(0, 'MSECS')): null;
- _self.status = (type === "EVENT") ? "CONFIRMED" : "NEEDS_ACTION";
-
- _self.__defineGetter__("calendarId", function () {
- return null;
- });
-
- _self.__defineGetter__("id", function () {
- return _id;
- });
-
- _self.__defineGetter__("lastModificationDate", function () {
- return lastModificationDate;
- });
-
- _self.clone = function () {
- var item = new CalendarItem(type);
-
- if (_security instanceof Object && !_security.clone) {
- throw new WebAPIException(errorcode.SECURITY_ERR);
- }
-
- item.id = Math.uuid(null, 16);
- item.calendarId = _self.calendarId;
- item.lastModificationDate = new TZDate();
- item.description = _self.description;
- item.summary = _self.summary;
- item.isAllDay = _self.isAllDay;
- item.startDate = _self.startDate;
- item.duration = _self.duration;
- item.location = _self.location;
- item.geolocation = _self.geolocation;
- item.organizer = _self.organizer;
- item.visibility = _self.visibility;
- item.status = _self.status;
- item.priority = _self.priority;
- item.alarms = _self.alarms;
- item.categories = _self.categories;
- item.attendees = _self.attendees;
-
- if (type === "EVENT") {
- item.endDate = _self.endDate;
- item.availability = _self.availability;
- item.recurrenceRule = _self.recurrenceRule;
- } else {
- item.dueDate = _self.dueDate;
- item.completedDate = _self.completedDate;
- item.progress = _self.progress;
- }
-
- return item;
- };
-
- _self.convertToString = function (format) {
- var str = "", pri, i, date, before, y, m, d, hh, mm, ss, dateStart = "", dateEnd = "",
- header = "BEGIN:VCALENDAR\r\nPRODID:-//Tizen.org//Tizen Calendar//EN\r\nVERSION:2.0\r\n",
- end = "END:VCALENDAR\r\n";
+ // public
+ function convertToString(format) {
+ var header = "BEGIN:VCALENDAR\r\nPRODID:-//Tizen.org//Tizen Calendar//EN\r\nVERSION:2.0\r\n",
+ end = "END:VCALENDAR\r\n", str = "", pri, i, date, before, y, m, d,
+ hh, mm, ss, dateStart = "", dateEnd = "";
- if (_security instanceof Object && !_security.convertToString) {
- throw new WebAPIException(errorcode.SECURITY_ERR);
- }
- if (format !== "ICALENDAR_20" && format !== "VCALENDAR_10") {
- throw new WebAPIError(errorcode.TYPE_MISMATCH_ERROR);
- }
+ t.CalendarItem("convertToString", arguments);
//TODO: vcalendar 1.0 doesn't support yet
if (format === "VCALENDAR_10") {
return;
}
- str = header;
- if (type === "EVENT") {
- str += "BEGIN:VEVENT\r\n";
- } else if (type === "TASK") {
- str += "BEGIN:VTODO\r\n";
- }
+ str = header + "BEGIN:#TYPE#\r\n";
if (this.isAllDay) {
if (this.startDate) {
date = this.startDate;
y = date.getFullYear();
- m = _2digital(date.getMonth() + 1);
- d = _2digital(date.getDate());
+ m = toDigit(date.getMonth() + 1);
+ d = toDigit(date.getDate());
str += "DTSTART;VALUE=DATE:" + y + m + d + "\r\n";
dateStart = "" + y + m + d + "T000000Z";
if (this.duration) {
date = date.addDuration(this.duration);
y = date.getFullYear();
- m = _2digital(date.getMonth() + 1);
- d = _2digital(date.getDate());
+ m = toDigit(date.getMonth() + 1);
+ d = toDigit(date.getDate());
str += "DTEND;VALUE=DATE:" + y + m + d + "\r\n";
dateEnd = "" + y + m + d + "T000000Z";
}
if (this.startDate) {
date = this.startDate;
y = date.getFullYear();
- m = _2digital(date.getMonth() + 1);
- d = _2digital(date.getDate());
- hh = _2digital(date.getHours());
- mm = _2digital(date.getMinutes());
- ss = _2digital(date.getSeconds());
+ m = toDigit(date.getMonth() + 1);
+ d = toDigit(date.getDate());
+ hh = toDigit(date.getHours());
+ mm = toDigit(date.getMinutes());
+ ss = toDigit(date.getSeconds());
str += "DTSTART:" + y + m + d + "T" + hh + mm + ss + "Z" + "\r\n";
dateStart = "" + y + m + d + "T" + hh + mm + ss + "Z";
if (this.duration && this.duration.length && this.duration.unit) {
date = date.addDuration(this.duration);
y = date.getFullYear();
- m = _2digital(date.getMonth() + 1);
- d = _2digital(date.getDate());
- hh = _2digital(date.getHours());
- mm = _2digital(date.getMinutes());
- ss = _2digital(date.getSeconds());
+ m = toDigit(date.getMonth() + 1);
+ d = toDigit(date.getDate());
+ hh = toDigit(date.getHours());
+ mm = toDigit(date.getMinutes());
+ ss = toDigit(date.getSeconds());
str += "DTEND:" + y + m + d + "T" + hh + mm + ss + "Z" + "\r\n";
dateEnd = "" + y + m + d + "T" + hh + mm + ss + "Z";
}
if (this.alarms[i].absoluteDate) {
date = this.alarms[i].absoluteDate;
y = date.getFullYear();
- m = _2digital(date.getMonth() + 1);
- d = _2digital(date.getDate());
- hh = _2digital(date.getHours());
- mm = _2digital(date.getMinutes());
- ss = _2digital(date.getSeconds());
+ m = toDigit(date.getMonth() + 1);
+ d = toDigit(date.getDate());
+ hh = toDigit(date.getHours());
+ mm = toDigit(date.getMinutes());
+ ss = toDigit(date.getSeconds());
str += "TRIGGER;VALUE=DATE-TIME:" + y + m + d + "T" + hh + mm + ss + "Z" + "\r\n";
} else {
//it must be included before attribute
}
}
- if (type === "EVENT" && this.availability && dateStart !== "" && dateEnd !== "") {
- switch (this.availability) {
- case "BUSY":
- str += "FREEBUSY;FBTYPE=BUSY:";
+ if ((dateStart !== "") && (dateEnd !== "")) {
+ str += "#AVAILABILITY#:" + dateStart + "/" + dateEnd + "\r\n";
+ }
+
+ str += "#ENDDATE##RECURRENCERULE#";
+ str += "#DUEDATE##COMPLETEDDATE##PROGRESS#";
+ str += "END:#TYPE#\r\n" + end;
+
+ return str;
+ }
+
+ calendarItem.description = "";
+ calendarItem.summary = "";
+ calendarItem.isAllDay = false;
+ calendarItem.startDate = null;
+ calendarItem.duration = null;
+ calendarItem.location = "";
+ calendarItem.geolocation = null;
+ calendarItem.organizer = "";
+ calendarItem.visibility = "PUBLIC";
+ calendarItem.status = "TENTATIVE";
+ calendarItem.priority = "LOW";
+ calendarItem.alarms = [];
+ calendarItem.categories = [];
+ calendarItem.attendees = [];
+
+ if (itemInitDict) {
+ for (attr in itemInitDict) {
+ if (!(attr in typedef.CalendarItemInit))
+ continue;
+
+ switch (attr) {
+ case "alarms":
+ calendarItem.alarms = t.CalendarAlarm(itemInitDict.alarms,
+ "[]+");
+ break;
+
+ case "categories":
+ calendarItem.categories = t.DOMString(itemInitDict.categories,
+ "[]+");
+ break;
+
+ case "attendees":
+ calendarItem.attendees = t.CalendarAttendee(
+ itemInitDict.attendees, "[]+");
break;
- case "FREE":
- str += "FREEBUSY;FBTYPE=FREE:";
+
+ default:
+ calendarItem[attr] = itemInitDict[attr];
break;
}
- str += dateStart + "/" + dateEnd + "\r\n";
}
- //TODO: endDate doesn't support (CalendarEvent specific property)
- //TODO: recurrenceRule doesn't support (CalendarEvent specific property)
- //TODO: dueDate doesn't support (CalendarTask specific property)
- //TODO: completeDate doesn't support (CalendarTask specific property)
- if (type === "TASK" && this.progress) {
- str += "PERCENT-COMPLETE:" + this.progress + "\r\n";
+ }
+
+ this.__defineGetter__("id", function () {
+ return null;
+ });
+
+ this.__defineGetter__("calendarId", function () {
+ return null;
+ });
+
+ this.__defineGetter__("lastModificationDate", function () {
+ return null;
+ });
+
+ this.__defineGetter__("description", function () {
+ return calendarItem.description;
+ });
+ this.__defineSetter__("description", function (val) {
+ try {
+ calendarItem.description = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("summary", function () {
+ return calendarItem.summary;
+ });
+ this.__defineSetter__("summary", function (val) {
+ try {
+ calendarItem.summary = t.DOMString(val, "?");
+ } catch (e) {
}
+ });
- if (type === "EVENT") {
- str += "END:VEVENT\r\n";
- } else if (type === "TASK") {
- str += "END:VTODO\r\n";
+ this.__defineGetter__("isAllDay", function () {
+ return calendarItem.isAllDay;
+ });
+ this.__defineSetter__("isAllDay", function (val) {
+ try {
+ calendarItem.isAllDay = t.boolean(val);
+ } catch (e) {
}
- str += end;
+ });
- return str;
- };
+ this.__defineGetter__("startDate", function () {
+ return calendarItem.startDate;
+ });
+ this.__defineSetter__("startDate", function (val) {
+ try {
+ calendarItem.startDate = t.TZDate(val, "?");
+ } catch (e) {
+ }
+ });
- return _self;
-};
+ this.__defineGetter__("duration", function () {
+ return calendarItem.duration;
+ });
+ this.__defineSetter__("duration", function (val) {
+ try {
+ calendarItem.duration = t.TimeDuration(val, "?");
+ } catch (e) {
+ }
+ });
-CalendarItemInit = function () {
- return {
- description: "",
- summary: "",
- isAllDay: false,
- startDate: undefined,
- duration: null,
- location: "",
- geolocation: new SimpleCoordinates(),
- organizer: "",
- visibility: "PUBLIC",
- status: "",
- priority: "LOW",
- alarms: [],
- categories: [],
- attendees: []
- };
-};
-
-CalendarEventInit = function () {
- var _self = new CalendarItemInit();
-
- _self.endDate = undefined;
- _self.availability = undefined;
- _self.recurrenceRule = undefined;
+ this.__defineGetter__("location", function () {
+ return calendarItem.location;
+ });
+ this.__defineSetter__("location", function (val) {
+ try {
+ calendarItem.location = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
- return _self;
-};
+ this.__defineGetter__("geolocation", function () {
+ return calendarItem.geolocation;
+ });
+ this.__defineSetter__("geolocation", function (val) {
+ try {
+ calendarItem.geolocation = t.SimpleCoordinates(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("organizer", function () {
+ return calendarItem.organizer;
+ });
+ this.__defineSetter__("organizer", function (val) {
+ try {
+ calendarItem.organizer = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
-CalendarTaskInit = function () {
- var _self = new CalendarItemInit();
+ this.__defineGetter__("visibility", function () {
+ return calendarItem.visibility;
+ });
+ this.__defineSetter__("visibility", function (val) {
+ try {
+ calendarItem.visibility = t.CalendarItemVisibility(val);
+ } catch (e) {
+ }
+ });
- _self.dueDate = undefined;
- _self.completedDate = undefined;
- _self.progress = undefined;
+ this.__defineGetter__("status", function () {
+ return calendarItem.status;
+ });
+ this.__defineSetter__("status", function (val) {
+ try {
+ calendarItem.status = t.CalendarItemStatus(val);
+ } catch (e) {
+ }
+ });
- return _self;
+ this.__defineGetter__("priority", function () {
+ return calendarItem.priority;
+ });
+ this.__defineSetter__("priority", function (val) {
+ try {
+ calendarItem.priority = t.CalendarItemPriority(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("alarms", function () {
+ return calendarItem.alarms;
+ });
+ this.__defineSetter__("alarms", function (val) {
+ try {
+ calendarItem.alarms = t.CalendarAlarm(val, "[]");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("categories", function () {
+ return calendarItem.categories;
+ });
+ this.__defineSetter__("categories", function (val) {
+ try {
+ calendarItem.categories = t.DOMString(val, "[]");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("attendees", function () {
+ return calendarItem.attendees;
+ });
+ this.__defineSetter__("attendees", function (val) {
+ try {
+ calendarItem.attendees = t.CalendarAttendee(val, "[]");
+ } catch (e) {
+ }
+ });
+
+ this.convertToString = convertToString;
};
module.exports = CalendarItem;
});
define('ripple/platform/tizen/2.0/CalendarRecurrenceRule', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-var utils = require('ripple/utils'),
- tizen1_utils = require('ripple/platform/tizen/2.0/tizen1_utils'),
- TDur = require('ripple/platform/tizen/2.0/TimeDuration'),
- TZDate = require('ripple/platform/tizen/2.0/TZDate');
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ CalendarRecurrenceRule;
-module.exports = function (frequency, ruleInitDict) {
- var _self = {};
+CalendarRecurrenceRule = function (frequency, ruleInitDict) {
+ var calendarRecurrenceRule = {}, attr;
- _self.frequency = (frequency) ? frequency : 0;
+ t.CalendarRecurrenceRule(arguments, this);
- if ((ruleInitDict !== undefined) && (ruleInitDict !== null)) {
- _self.interval = ((ruleInitDict.interval > 0) && (ruleInitDict.interval === parseInt(ruleInitDict.interval, 10))) ? Number(ruleInitDict.interval) : 1;
- _self.untilDate = tizen1_utils.isValidTZDate(ruleInitDict.untilDate) ? (ruleInitDict.untilDate.addDuration(new TDur(0, 'MSECS'))) : null;
- _self.occurrenceCount = (ruleInitDict.occurrenceCount === parseInt(ruleInitDict.occurrenceCount, 10)) ? Number(ruleInitDict.occurrenceCount) : -1;
- _self.daysOfTheWeek = tizen1_utils.isValidArray(ruleInitDict.daysOfTheWeek) ? utils.copy(ruleInitDict.daysOfTheWeek) : [];
- _self.setPositions = tizen1_utils.isValidArray(ruleInitDict.setPositions) ? utils.copy(ruleInitDict.setPositions) : [];
- _self.exceptions = tizen1_utils.isValidArray(ruleInitDict.exceptions) ? utils.copy(ruleInitDict.exceptions) : [];
- } else {
- _self.interval = 1;
- _self.untilDate = null;
- _self.occurrenceCount = -1;
- _self.daysOfTheWeek = [];
- _self.setPositions = [];
- _self.exceptions = [];
+ calendarRecurrenceRule.frequency = frequency;
+ calendarRecurrenceRule.interval = 1;
+ calendarRecurrenceRule.untilDate = null;
+ calendarRecurrenceRule.occurrenceCount = -1;
+ calendarRecurrenceRule.daysOfTheWeek = [];
+ calendarRecurrenceRule.setPositions = [];
+ calendarRecurrenceRule.exceptions = [];
+
+ if (ruleInitDict) {
+ for (attr in ruleInitDict) {
+ switch (attr) {
+ case "daysOfTheWeek":
+ calendarRecurrenceRule.daysOfTheWeek = t.ByDayValue(
+ ruleInitDict.daysOfTheWeek, "[]+");
+ break;
+
+ case "setPositions":
+ calendarRecurrenceRule.setPositions = t.short(
+ ruleInitDict.setPositions, "[]+");
+ break;
+
+ case "exceptions":
+ calendarRecurrenceRule.exceptions = t.TZDate(
+ ruleInitDict.exceptions, "[]+");
+ break;
+
+ default:
+ calendarRecurrenceRule[attr] = ruleInitDict[attr];
+ break;
+ }
+ }
}
- return _self;
+ this.__defineGetter__("frequency", function () {
+ return calendarRecurrenceRule.frequency;
+ });
+ this.__defineSetter__("frequency", function (val) {
+ try {
+ calendarRecurrenceRule.frequency = t.RecurrenceRuleFrequency(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("interval", function () {
+ return calendarRecurrenceRule.interval;
+ });
+ this.__defineSetter__("interval", function (val) {
+ try {
+ calendarRecurrenceRule.interval = t.unsigned_short(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("untilDate", function () {
+ return calendarRecurrenceRule.untilDate;
+ });
+ this.__defineSetter__("untilDate", function (val) {
+ try {
+ calendarRecurrenceRule.untilDate = t.TZDate(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("occurrenceCount", function () {
+ return calendarRecurrenceRule.occurrenceCount;
+ });
+ this.__defineSetter__("occurrenceCount", function (val) {
+ try {
+ calendarRecurrenceRule.occurrenceCount = t.long(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("daysOfTheWeek", function () {
+ return calendarRecurrenceRule.daysOfTheWeek;
+ });
+ this.__defineSetter__("daysOfTheWeek", function (val) {
+ try {
+ calendarRecurrenceRule.daysOfTheWeek = t.ByDayValue(val, "[]");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("setPositions", function () {
+ return calendarRecurrenceRule.setPositions;
+ });
+ this.__defineSetter__("setPositions", function (val) {
+ try {
+ calendarRecurrenceRule.setPositions = t.short(val, "[]");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("exceptions", function () {
+ return calendarRecurrenceRule.exceptions;
+ });
+ this.__defineSetter__("exceptions", function (val) {
+ try {
+ calendarRecurrenceRule.exceptions = t.TZDate(val, "[]");
+ } catch (e) {
+ }
+ });
};
+module.exports = CalendarRecurrenceRule;
+
});
define('ripple/platform/tizen/2.0/CalendarTask', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-var TZDate = require('ripple/platform/tizen/2.0/TZDate'),
- TDur = require('ripple/platform/tizen/2.0/TimeDuration'),
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ typedef = require('ripple/platform/tizen/2.0/typedef'),
CalendarItem = require('ripple/platform/tizen/2.0/CalendarItem'),
- tizen1_utils = require('ripple/platform/tizen/2.0/tizen1_utils'),
- SimpleCoordinates = require('ripple/platform/tizen/2.0/SimpleCoordinates');
+ CalendarTask;
-module.exports = function (taskInitDict) {
- var _self, isInvalid = false;
+CalendarTask = function () {
+ var voc, calendarTask = {};
- _self = new CalendarItem("TASK");
+ // private
+ function construct(taskInitDict) {
+ CalendarItem.call(this, taskInitDict);
- if ((taskInitDict !== undefined) && (taskInitDict !== null)) {
- _self.dueDate = tizen1_utils.isValidTZDate(taskInitDict.dueDate) ? taskInitDict.dueDate.addDuration(new TDur(0, 'MSECS')) : undefined;
- _self.completedDate = tizen1_utils.isValidTZDate(taskInitDict.completedDate) ? taskInitDict.completedDate.addDuration(new TDur(0, 'MSECS')) : undefined;
- _self.progress = ((0 <= taskInitDict.progress) && (taskInitDict.progress <= 100)) ? Number(taskInitDict.progress) : 0;
+ this.status = "NEEDS_ACTION";
- if (taskInitDict.description) {
- _self.description = String(taskInitDict.description);
- }
- if (taskInitDict.summary) {
- _self.summary = String(taskInitDict.summary);
- }
- if (taskInitDict.isAllDay && (typeof taskInitDict.isAllDay === "boolean")) {
- _self.isAllDay = taskInitDict.isAllDay;
- }
- if (taskInitDict.startDate && tizen1_utils.isValidTZDate(taskInitDict.startDate)) {
- _self.startDate = taskInitDict.startDate;
- }
- if (taskInitDict.duration instanceof tizen.TimeDuration) {
- _self.duration = taskInitDict.duration;
- }
- if (taskInitDict.location) {
- _self.location = String(taskInitDict.location);
- }
- if (taskInitDict.geolocation && taskInitDict.geolocation.latitude && taskInitDict.geolocation.longitude) {
- _self.geolocation = new SimpleCoordinates(taskInitDict.geolocation.latitude, taskInitDict.geolocation.longitude);
- }
- if (taskInitDict.organizer) {
- _self.organizer = String(taskInitDict.organizer);
- }
- if (taskInitDict.visibility) {
- _self.visibility = String(taskInitDict.visibility);
- }
- if (taskInitDict.status) {
- _self.status = String(taskInitDict.status);
- }
- if (taskInitDict.priority) {
- _self.priority = String(taskInitDict.priority);
- }
- if (taskInitDict.alarms && tizen1_utils.isValidArray(taskInitDict.alarms)) {
- isInvalid = false;
- taskInitDict.alarms.some(function (alarm) {
- if (!alarm || alarm.method === undefined) {// 'method' is CalendarAlarm's property.
- isInvalid = true;
- return;
- }
- });
- if (!isInvalid) {
- _self.alarms = taskInitDict.alarms;
+ calendarTask.convertToString = this.convertToString;
+ calendarTask.dueDate = null;
+ calendarTask.completedDate = null;
+ calendarTask.progress = 0;
+
+ this.__defineGetter__("dueDate", function () {
+ return calendarTask.dueDate;
+ });
+ this.__defineSetter__("dueDate", function (val) {
+ try {
+ calendarTask.dueDate = t.TZDate(val, "?");
+ } catch (e) {
}
- }
- if (taskInitDict.categories && tizen1_utils.isValidArray(taskInitDict.categories)) {
- isInvalid = false;
- taskInitDict.categories.every(function (categorie) {
- if (!categorie || typeof categorie !== "string") {
- isInvalid = true;
- return;
- }
- });
- if (!isInvalid) {
- _self.categories = taskInitDict.categories;
+ });
+
+ this.__defineGetter__("completedDate", function () {
+ return calendarTask.completedDate;
+ });
+ this.__defineSetter__("completedDate", function (val) {
+ try {
+ calendarTask.completedDate = t.TZDate(val, "?");
+ } catch (e) {
}
+ });
+
+ this.__defineGetter__("progress", function () {
+ return calendarTask.progress;
+ });
+ this.__defineSetter__("progress", function (val) {
+ try {
+ calendarTask.progress = t.unsigned_short(val);
+ } catch (e) {
+ }
+ });
+
+ this.convertToString = convertToString;
+ this.clone = clone(this);
+ }
+
+ function clone(self) {
+ return function () {
+ return new CalendarTask(self);
+ };
+ }
+
+ // public
+ function convertToString(format) {
+ var str;
+
+ str = calendarTask.convertToString.call(this, format);
+ str = str.replace(/#TYPE#/g, "VTASK");
+
+ // TODO: dueDate is not supported
+ // TODO: completedDate is not supported
+ if (this.progress) {
+ str = str.replace(/#PROGRESS#/g, "PERCENT-COMPLETE:" +
+ this.progress + "\r\n");
}
- if (taskInitDict.attendees && tizen1_utils.isValidArray(taskInitDict.attendees)) {
- isInvalid = false;
- taskInitDict.attendees.some(function (attendee) {
- if (!attendee || attendee.uri === undefined) {// 'uri' is CalendarAttendee's property.
- isInvalid = true;
- return;
+
+ str = str.replace(/#AVAILABILITY#.*\r\n/g, "");
+ str = str.replace(/#[^#]*#/g, "");
+
+ return str;
+ }
+
+ // Constructor
+ function CalendarTask_CalendarTaskInit(taskInitDict) {
+ var attr;
+
+ construct.call(this, taskInitDict);
+
+ if (taskInitDict) {
+ for (attr in taskInitDict) {
+ if (attr in typedef.CalendarTaskInit) {
+ calendarTask[attr] = taskInitDict[attr];
}
- });
- if (!isInvalid) {
- _self.attendees = taskInitDict.attendees;
}
}
- } else {
- _self.dueDate = undefined;
- _self.completedDate = undefined;
- _self.progress = 0;
}
- return _self;
+ function CalendarTask_DOMString_CalendarTextFormat(stringRepresentation,
+ format) {
+ }
+
+ voc = [CalendarTask_CalendarTaskInit,
+ CalendarTask_DOMString_CalendarTextFormat];
+ t.CalendarTask(arguments, this, voc);
};
+module.exports = CalendarTask;
+
});
define('ripple/platform/tizen/2.0/CompositeFilter', function (require, exports, module) {
-/*
- * Copyright 2012 Intel Corporation.
- *
+/*
+ * Copyright 2013 Intel Corporation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* 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.
* limitations under the License.
*/
-module.exports = function (_type, _filters) {
- return {
- type: _type,
- filters: _filters
- };
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ CompositeFilter;
+
+CompositeFilter = function (type, filters) {
+ var compositeFilter = {};
+
+ t.CompositeFilter(arguments, this);
+
+ this.__defineGetter__("type", function () {
+ return compositeFilter.type;
+ });
+ this.__defineSetter__("type", function (val) {
+ try {
+ compositeFilter.type = t.CompositeFilterType(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("filters", function () {
+ return compositeFilter.filters;
+ });
+ this.__defineSetter__("filters", function (val) {
+ try {
+ compositeFilter.filters = t.AbstractFilter(val, "[]");
+ } catch (e) {
+ }
+ });
+
+ compositeFilter.type = type;
+ compositeFilter.filters = filters || [];
};
+module.exports = CompositeFilter;
});
define('ripple/platform/tizen/2.0/ContactAddress', function (require, exports, module) {
ContactAddress;
ContactAddress = function (addressInitDict) {
- var i;
+ var contactAddress = {}, attr, arr, i;
t.ContactAddress(arguments, this);
- this.country = null;
- this.region = null;
- this.city = null;
- this.streetAddress = null;
- this.additionalInformation = null;
- this.postalCode = null;
- this.isDefault = false;
- this.types = ["HOME"];
+ contactAddress.country = null;
+ contactAddress.region = null;
+ contactAddress.city = null;
+ contactAddress.streetAddress = null;
+ contactAddress.additionalInformation = null;
+ contactAddress.postalCode = null;
+ contactAddress.isDefault = false;
+ contactAddress.types = ["HOME"];
+
+ this.__defineGetter__("country", function () {
+ return contactAddress.country;
+ });
+ this.__defineSetter__("country", function (val) {
+ try {
+ contactAddress.country = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("region", function () {
+ return contactAddress.region;
+ });
+ this.__defineSetter__("region", function (val) {
+ try {
+ contactAddress.region = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("city", function () {
+ return contactAddress.city;
+ });
+ this.__defineSetter__("city", function (val) {
+ try {
+ contactAddress.city = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("streetAddress", function () {
+ return contactAddress.streetAddress;
+ });
+ this.__defineSetter__("streetAddress", function (val) {
+ try {
+ contactAddress.streetAddress = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("additionalInformation", function () {
+ return contactAddress.additionalInformation;
+ });
+ this.__defineSetter__("additionalInformation", function (val) {
+ try {
+ contactAddress.additionalInformation = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("postalCode", function () {
+ return contactAddress.postalCode;
+ });
+ this.__defineSetter__("postalCode", function (val) {
+ try {
+ contactAddress.postalCode = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("isDefault", function () {
+ return contactAddress.isDefault;
+ });
+ this.__defineSetter__("isDefault", function (val) {
+ try {
+ contactAddress.isDefault = t.boolean(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("types", function () {
+ return contactAddress.types;
+ });
+ this.__defineSetter__("types", function (val) {
+ try {
+ contactAddress.types = t.DOMString(val, "[]");
+ } catch (e) {
+ }
+ });
if (addressInitDict) {
- for (i in addressInitDict) {
- this[i] = addressInitDict[i];
+ for (attr in addressInitDict) {
+ switch (attr) {
+ case "types":
+ arr = addressInitDict[attr];
+ if (arr) {
+ for (i in arr) {
+ contactAddress[attr][i] = arr[i];
+ }
+ }
+ break;
+
+ default:
+ contactAddress[attr] = addressInitDict[attr];
+ break;
+ }
}
}
};
ContactAnniversary;
ContactAnniversary = function (date, label) {
+ var contactAnniversary = {};
+
t.ContactAnniversary(arguments, this);
- this.date = date;
- this.label = label || null;
+ contactAnniversary.date = date;
+ contactAnniversary.label = label || null;
+
+ this.__defineGetter__("date", function () {
+ return contactAnniversary.date;
+ });
+ this.__defineSetter__("date", function (val) {
+ try {
+ contactAnniversary.date = t.Date(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("label", function () {
+ return contactAnniversary.label;
+ });
+ this.__defineSetter__("label", function (val) {
+ try {
+ contactAnniversary.label = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
};
module.exports = ContactAnniversary;
ContactEmailAddress;
ContactEmailAddress = function (email, types, isDefault) {
+ var contactEmailAddress = {};
+
t.ContactEmailAddress(arguments, this);
- this.email = email;
- this.isDefault = isDefault || false;
- this.types = (types && types[0]) ? types : ["WORK"];
+ contactEmailAddress.email = email;
+ contactEmailAddress.isDefault = isDefault || false;
+ contactEmailAddress.types = (types && types[0]) ? types : ["WORK"];
+
+ this.__defineGetter__("email", function () {
+ return contactEmailAddress.email;
+ });
+ this.__defineSetter__("email", function (val) {
+ try {
+ contactEmailAddress.email = t.DOMString(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("isDefault", function () {
+ return contactEmailAddress.isDefault;
+ });
+ this.__defineSetter__("isDefault", function (val) {
+ try {
+ contactEmailAddress.isDefault = t.boolean(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("types", function () {
+ return contactEmailAddress.types;
+ });
+ this.__defineSetter__("types", function (val) {
+ try {
+ contactEmailAddress.types = t.DOMString(val, "[]");
+ } catch (e) {
+ }
+ });
};
module.exports = ContactEmailAddress;
ContactGroup;
ContactGroup = function (name, ringtoneURI, photoURI) {
+ var contactGroup = {};
+
t.ContactGroup(arguments, this);
+ contactGroup.name = name;
+ contactGroup.ringtoneURI = ringtoneURI || null;
+ contactGroup.photoURI = photoURI || null;
+
this.__defineGetter__("id", function () {
return null;
});
return null;
});
+ this.__defineGetter__("name", function () {
+ return contactGroup.name;
+ });
+ this.__defineSetter__("name", function (val) {
+ try {
+ contactGroup.name = t.DOMString(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("ringtoneURI", function () {
+ return contactGroup.ringtoneURI;
+ });
+ this.__defineSetter__("ringtoneURI", function (val) {
+ try {
+ contactGroup.ringtoneURI = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("photoURI", function () {
+ return contactGroup.photoURI;
+ });
+ this.__defineSetter__("photoURI", function (val) {
+ try {
+ contactGroup.photoURI = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
this.__defineGetter__("readOnly", function () {
return false;
});
-
- this.name = name;
- this.ringtoneURI = ringtoneURI || null;
- this.photoURI = photoURI || null;
};
module.exports = ContactGroup;
ContactName;
ContactName = function (nameInitDict) {
- var i;
+ var contactName = {}, attr;
t.ContactName(arguments, this);
- this.prefix = null;
- this.suffix = null;
- this.firstName = null;
- this.middleName = null;
- this.lastName = null;
- this.nicknames = [];
- this.phoneticFirstName = null;
- this.phoneticLastName = null;
+ contactName.prefix = null;
+ contactName.suffix = null;
+ contactName.firstName = null;
+ contactName.middleName = null;
+ contactName.lastName = null;
+ contactName.nicknames = [];
+ contactName.phoneticFirstName = null;
+ contactName.phoneticLastName = null;
+
+ this.__defineGetter__("prefix", function () {
+ return contactName.prefix;
+ });
+ this.__defineSetter__("prefix", function (val) {
+ try {
+ contactName.prefix = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("suffix", function () {
+ return contactName.suffix;
+ });
+ this.__defineSetter__("suffix", function (val) {
+ try {
+ contactName.suffix = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("firstName", function () {
+ return contactName.firstName;
+ });
+ this.__defineSetter__("firstName", function (val) {
+ try {
+ contactName.firstName = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("middleName", function () {
+ return contactName.middleName;
+ });
+ this.__defineSetter__("middleName", function (val) {
+ try {
+ contactName.middleName = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("lastName", function () {
+ return contactName.lastName;
+ });
+ this.__defineSetter__("lastName", function (val) {
+ try {
+ contactName.lastName = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("nicknames", function () {
+ return contactName.nicknames;
+ });
+ this.__defineSetter__("nicknames", function (val) {
+ try {
+ contactName.nicknames = t.DOMString(val, "[]");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("phoneticFirstName", function () {
+ return contactName.phoneticFirstName;
+ });
+ this.__defineSetter__("phoneticFirstName", function (val) {
+ try {
+ contactName.phoneticFirstName = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("phoneticLastName", function () {
+ return contactName.phoneticLastName;
+ });
+ this.__defineSetter__("phoneticLastName", function (val) {
+ try {
+ contactName.phoneticLastName = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
this.__defineGetter__("displayName", function () {
return null;
});
if (nameInitDict) {
- for (i in nameInitDict) {
- this[i] = nameInitDict[i];
+ for (attr in nameInitDict) {
+ contactName[attr] = nameInitDict[attr];
}
}
};
ContactOrganization;
ContactOrganization = function (orgInitDict) {
- var i;
+ var contactOrganization = {}, attr;
t.ContactOrganization(arguments, this);
- this.name = null;
- this.department = null;
- this.title = null;
- this.role = null;
- this.logoURI = null;
+ contactOrganization.name = null;
+ contactOrganization.department = null;
+ contactOrganization.title = null;
+ contactOrganization.role = null;
+ contactOrganization.logoURI = null;
+
+ this.__defineGetter__("name", function () {
+ return contactOrganization.name;
+ });
+ this.__defineSetter__("name", function (val) {
+ try {
+ contactOrganization.name = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("department", function () {
+ return contactOrganization.department;
+ });
+ this.__defineSetter__("department", function (val) {
+ try {
+ contactOrganization.department = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("title", function () {
+ return contactOrganization.title;
+ });
+ this.__defineSetter__("title", function (val) {
+ try {
+ contactOrganization.title = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("role", function () {
+ return contactOrganization.role;
+ });
+ this.__defineSetter__("role", function (val) {
+ try {
+ contactOrganization.role = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("logoURI", function () {
+ return contactOrganization.logoURI;
+ });
+ this.__defineSetter__("logoURI", function (val) {
+ try {
+ contactOrganization.logoURI = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
if (orgInitDict) {
- for (i in orgInitDict) {
- this[i] = orgInitDict[i];
+ for (attr in orgInitDict) {
+ contactOrganization[attr] = orgInitDict[attr];
}
}
};
ContactPhoneNumber;
ContactPhoneNumber = function (number, types, isDefault) {
+ var contactPhoneNumber = {};
+
t.ContactPhoneNumber(arguments, this);
- this.number = number;
- this.isDefault = isDefault || false;
- this.types = (types && types[0]) ? types : ["VOICE"];
+ contactPhoneNumber.number = number;
+ contactPhoneNumber.isDefault = isDefault || false;
+ contactPhoneNumber.types = (types && types[0]) ? types : ["VOICE"];
+
+ this.__defineGetter__("number", function () {
+ return contactPhoneNumber.number;
+ });
+ this.__defineSetter__("number", function (val) {
+ try {
+ contactPhoneNumber.number = t.DOMString(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("isDefault", function () {
+ return contactPhoneNumber.isDefault;
+ });
+ this.__defineSetter__("isDefault", function (val) {
+ try {
+ contactPhoneNumber.isDefault = t.boolean(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("types", function () {
+ return contactPhoneNumber.types;
+ });
+ this.__defineSetter__("types", function (val) {
+ try {
+ contactPhoneNumber.types = t.DOMString(val, "[]");
+ } catch (e) {
+ }
+ });
};
module.exports = ContactPhoneNumber;
ContactRef;
ContactRef = function (addressBookId, contactId) {
+ var contactRef = {};
+
t.ContactRef(arguments, this);
- this.addressBookId = addressBookId;
- this.contactId = contactId;
+ contactRef.addressBookId = addressBookId;
+ contactRef.contactId = contactId;
+
+ this.__defineGetter__("addressBookId", function () {
+ return contactRef.addressBookId;
+ });
+ this.__defineSetter__("addressBookId", function (val) {
+ try {
+ contactRef.addressBookId = t.AddressBookId(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("contactId", function () {
+ return contactRef.contactId;
+ });
+ this.__defineSetter__("contactId", function (val) {
+ try {
+ contactRef.contactId = t.ContactId(val);
+ } catch (e) {
+ }
+ });
};
module.exports = ContactRef;
ContactWebSite;
ContactWebSite = function (url, type) {
+ var contactWebSite = {};
+
t.ContactWebSite(arguments, this);
- this.url = url;
- this.type = type || "HOMEPAGE";
+ contactWebSite.url = url;
+ contactWebSite.type = type || "HOMEPAGE";
+
+ this.__defineGetter__("url", function () {
+ return contactWebSite.url;
+ });
+ this.__defineSetter__("url", function (val) {
+ try {
+ contactWebSite.url = t.DOMString(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("type", function () {
+ return contactWebSite.type;
+ });
+ this.__defineSetter__("type", function (val) {
+ try {
+ contactWebSite.type = t.DOMString(val);
+ } catch (e) {
+ }
+ });
};
module.exports = ContactWebSite;
});
define('ripple/platform/tizen/2.0/DownloadRequest', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-module.exports = function (url, destination, fileName, networkType, httpHeader) {
- var _self = this;
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ DownloadRequest;
- _self.url = url || null;
- _self.destination = destination || "";
- _self.fileName = fileName || "";
- _self.networkType = networkType || null;
- _self.httpHeader = httpHeader || null;
+DownloadRequest = function (url, destination, fileName, networkType,
+ httpHeader) {
+ var downloadRequest = {};
- return _self;
+ t.DownloadRequest(arguments, this);
+
+ this.__defineGetter__("url", function () {
+ return downloadRequest.url;
+ });
+ this.__defineSetter__("url", function (val) {
+ try {
+ downloadRequest.url = t.DOMString(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("networkType", function () {
+ return downloadRequest.networkType;
+ });
+ this.__defineSetter__("networkType", function (val) {
+ try {
+ downloadRequest.networkType = t.DownloadNetworkType(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.destination = destination || "";
+ this.fileName = fileName || "";
+ this.httpHeader = httpHeader || {};
+
+ downloadRequest.url = url;
+ downloadRequest.networkType = networkType || "ALL";
};
+module.exports = DownloadRequest;
+
});
define('ripple/platform/tizen/2.0/EventBase', function (require, exports, module) {
/*
if (_security_check.read === false) {
throw (new WebAPIException(errorcode.SECURITY_ERR));
}
- if (!(new TypeCoerce(t.long)).match(watchid)) {
- throw (new WebAPIException(errorcode.TYPE_MISMATCH_ERR));
- }
if (_msgListeners[watchid] !== undefined) {
delete _msgListeners[watchid];
return;
delete _folderListeners[watchid];
return;
}
- throw (new WebAPIException(errorcode.NOT_FOUND_ERR));
}
};
});
define('ripple/platform/tizen/2.0/NotificationBase', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-var t = require('ripple/platform/tizen/2.0/typedef'),
- TypeCoerce = require('ripple/platform/tizen/2.0/typecoerce');
-module.exports = function (_title) {
- var id = undefined,
- type = "STATUS",
- postedTime = null,
- title = _title,
- content = null,
- _self = this;
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ Notification;
- _self.__defineGetter__("id", function () {
- return id;
+Notification = function (title, content) {
+ var notification = {};
+
+ notification.title = title;
+ notification.content = content || null;
+
+ this.__defineGetter__("id", function () {
+ return undefined;
});
- _self.__defineGetter__("type", function () {
- return type;
+
+ this.__defineGetter__("type", function () {
+ return "STATUS";
});
- _self.__defineGetter__("postedTime", function () {
- return postedTime;
+
+ this.__defineGetter__("postedTime", function () {
+ return undefined;
});
- _self.__defineGetter__("title", function () {
- return title;
+
+ this.__defineGetter__("title", function () {
+ return notification.title;
});
- _self.__defineSetter__("title", function (_title) {
- if (!(new TypeCoerce(t.DOMString)).match(_title))
- return;
- title = _title;
+ this.__defineSetter__("title", function (val) {
+ try {
+ notification.title = t.DOMString(val);
+ } catch (e) {
+ }
});
- _self.__defineGetter__("content", function () {
- return content;
+
+ this.__defineGetter__("content", function () {
+ return notification.content;
});
- _self.__defineSetter__("content", function (_content) {
- content = _content;
+ this.__defineSetter__("content", function (val) {
+ try {
+ notification.content = t.DOMString(val, "?");
+ } catch (e) {
+ }
});
-
- return _self;
};
+module.exports = Notification;
+
});
define('ripple/platform/tizen/2.0/NotificationDetailInfo', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-var t = require('ripple/platform/tizen/2.0/typedef'),
- TypeCoerce = require('ripple/platform/tizen/2.0/typecoerce');
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ NotificationDetailInfo;
-module.exports = function (mainText, subText) {
- var _self = this, _mainText = undefined;
+NotificationDetailInfo = function (mainText, subText) {
+ var notificationDetailInfo = {};
- _self.__defineGetter__("mainText", function () {
- return _mainText;
- });
+ t.NotificationDetailInfo(arguments, this);
- _self.__defineSetter__("mainText", function (mainText) {
- if (!(new TypeCoerce(t.DOMString)).match(mainText))
- return;
+ notificationDetailInfo.mainText = mainText;
+ notificationDetailInfo.subText = subText || null;
- _mainText = mainText;
+ this.__defineGetter__("mainText", function () {
+ return notificationDetailInfo.mainText;
+ });
+ this.__defineSetter__("mainText", function (val) {
+ try {
+ notificationDetailInfo.mainText = t.DOMString(val);
+ } catch (e) {
+ }
});
- _self.mainText = mainText;
- _self.subText = subText || undefined;
-
- return _self;
+ this.__defineGetter__("subText", function () {
+ return notificationDetailInfo.subText;
+ });
+ this.__defineSetter__("subText", function (val) {
+ try {
+ notificationDetailInfo.subText = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
};
+module.exports = NotificationDetailInfo;
+
});
define('ripple/platform/tizen/2.0/POIBase', function (require, exports, module) {
/*
};
});
-define('ripple/platform/tizen/2.0/RequestedApplicationControl', function (require, exports, module) {
-/*
- * Copyright 2012 Intel Corporation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-
-var event = require('ripple/event'),
- t = require('ripple/platform/tizen/2.0/typecast');
-
-module.exports = function (appControl) {
- var _self, _appControl = appControl;
-
- _self = {
- replyResult: function (data) {
- t.RequestedApplicationControl("replyResult", arguments);
-
- event.trigger("appServiceReplied", "Result: " + data);
- },
- replyFailure: function () {
- event.trigger("appServiceReplied", "Failure");
- }
- };
-
- _self.__defineGetter__("appControl", function () {
- return _appControl;
- });
-
- return _self;
-};
-
-});
define('ripple/platform/tizen/2.0/ReverseGeocodeOptions', function (require, exports, module) {
/*
* Copyright 2012 Intel Corporation.
});
define('ripple/platform/tizen/2.0/SimpleCoordinates', function (require, exports, module) {
-/*
- * Copyright 2012 Intel Corporation.
- *
+/*
+ * Copyright 2013 Intel Corporation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* 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.
* limitations under the License.
*/
-function SimpleCoordinates (_latitude, _longitude) {
- this.latitude = _latitude || 0;
- this.longitude = _longitude || 0;
- return this;
-}
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ SimpleCoordinates;
+
+SimpleCoordinates = function (latitude, longitude) {
+ var simpleCoordinates = {};
+
+ t.SimpleCoordinates(arguments, this);
+
+ this.__defineGetter__("latitude", function () {
+ return simpleCoordinates.latitude;
+ });
+ this.__defineSetter__("latitude", function (val) {
+ try {
+ simpleCoordinates.latitude = t.double(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("longitude", function () {
+ return simpleCoordinates.longitude;
+ });
+ this.__defineSetter__("longitude", function (val) {
+ try {
+ simpleCoordinates.longitude = t.double(val);
+ } catch (e) {
+ }
+ });
+
+ simpleCoordinates.latitude = latitude;
+ simpleCoordinates.longitude = longitude;
+};
module.exports = SimpleCoordinates;
});
define('ripple/platform/tizen/2.0/SortMode', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
SortMode;
SortMode = function (attributeName, order) {
+ var sortMode = {};
+
t.SortMode(arguments, this);
- this.attributeName = attributeName;
- this.order = order;
+ this.__defineGetter__("attributeName", function () {
+ return sortMode.attributeName;
+ });
+ this.__defineSetter__("attributeName", function (val) {
+ try {
+ sortMode.attributeName = t.DOMString(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("order", function () {
+ return sortMode.order;
+ });
+ this.__defineSetter__("order", function (val) {
+ try {
+ sortMode.order = t.SortModeOrder(val);
+ } catch (e) {
+ }
+ });
+
+ sortMode.attributeName = attributeName;
+ sortMode.order = order || "ASC";
};
module.exports = SortMode;
});
define('ripple/platform/tizen/2.0/StatusNotification', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-var utils = require('ripple/utils'),
- tizen1_utils = require('ripple/platform/tizen/2.0/tizen1_utils'),
- errorcode = require('ripple/platform/tizen/2.0/errorcode'),
- WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError'),
- t = require('ripple/platform/tizen/2.0/typedef'),
- TypeCoerce = require('ripple/platform/tizen/2.0/typecoerce'),
- NotificationBase = require('ripple/platform/tizen/2.0/NotificationBase'),
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ ApplicationControl = require('ripple/platform/tizen/2.0/ApplicationControl'),
+ Notification = require('ripple/platform/tizen/2.0/NotificationBase'),
NotificationDetailInfo = require('ripple/platform/tizen/2.0/NotificationDetailInfo'),
+ StatusNotification;
+
+StatusNotification = function (statusType, title, notificationInitDict) {
+ var statusNotification = {}, attr, i, info;
+
+ t.StatusNotification(arguments, this);
+
+ Notification.call(this, title, notificationInitDict ?
+ notificationInitDict.content : null);
+
+ statusNotification.statusType = statusType;
+ statusNotification.iconPath = null;
+ statusNotification.subIconPath = null;
+ statusNotification.number = null;
+ statusNotification.detailInfo = [];
+ statusNotification.ledColor = null;
+ statusNotification.ledOnPeriod = 0;
+ statusNotification.ledOffPeriod = 0;
+ statusNotification.backgroundImagePath = null;
+ statusNotification.thumbnails = [];
+ statusNotification.soundPath = null;
+ statusNotification.vibration = false;
+ statusNotification.appControl = null;
+ statusNotification.appId = null;
+ statusNotification.progressType = "PERCENTAGE";
+ statusNotification.progressValue = null;
+
+ for (attr in notificationInitDict) {
+ switch (attr) {
+ case "appControl":
+ statusNotification.appControl = new ApplicationControl(
+ notificationInitDict.appControl.operation,
+ notificationInitDict.appControl.uri || null,
+ notificationInitDict.appControl.mime || null,
+ notificationInitDict.appControl.category || null,
+ notificationInitDict.appControl.data || null);
+ break;
- _self;
-
-function _checkServiceProperties(service) {
- if (typeof service !== "object") {
- return false;
- }
-
- if (typeof service.operation !== "string") {
- return false;
- }
-
- if (service.uri && typeof service.uri !== "string") {
- return false;
- }
-
- if (service.mime && typeof service.mime !== "string") {
- return false;
- }
-
- if (service.data && !tizen1_utils.isValidArray(service.data)) {
- return false;
- }
-
- return true;
-}
-
-function _checkNotificationDetailInfo(info) {
- if (typeof info !== "object") {
- return false;
- }
-
- if (typeof info.mainText !== "string") {
- return false;
- }
-
- if (info.subText && typeof info.subText !== "string") {
- return false;
- }
-
- return true;
-}
-
-function _checkDictProperties(dict) {
- var flag = false;
- if (dict) {
- if (typeof dict !== "object") {
- return false;
- }
-
- if (dict.content && typeof dict.content !== "string") {
- return false;
- }
-
- if (dict.iconPath && typeof dict.iconPath !== "string") {
- return false;
- }
-
- if (dict.soundPath && typeof dict.soundPath !== "string") {
- return false;
- }
+ case "detailInfo":
+ for (i in notificationInitDict.detailInfo) {
+ info = notificationInitDict.detailInfo[i];
+ info = new NotificationDetailInfo(info.mainText,
+ info.subText);
- if (dict.vibration && typeof dict.vibration !== "boolean") {
- return false;
- }
+ statusNotification.detailInfo.push(info);
+ }
+ break;
- if (dict.appControl && !_checkServiceProperties(dict.appControl)) {
- return false;
+ default:
+ statusNotification[attr] = notificationInitDict[attr];
+ break;
}
+ }
- if (dict.appId && typeof dict.appId !== "string") {
- return false;
- }
+ this.__defineGetter__("statusType", function () {
+ return statusNotification.statusType;
+ });
- if (dict.progressType && !(dict.progressType === "PERCENTAGE" || dict.progressType === "BYTE")) {
- return false;
+ this.__defineGetter__("iconPath", function () {
+ return statusNotification.iconPath;
+ });
+ this.__defineSetter__("iconPath", function (val) {
+ try {
+ statusNotification.iconPath = t.DOMString(val, "?");
+ } catch (e) {
}
+ });
- if (dict.progressValue && typeof dict.progressValue !== "number") {
- return false;
+ this.__defineGetter__("subIconPath", function () {
+ return statusNotification.subIconPath;
+ });
+ this.__defineSetter__("subIconPath", function (val) {
+ try {
+ statusNotification.subIconPath = t.DOMString(val, "?");
+ } catch (e) {
}
+ });
- if (dict.number && typeof dict.number !== "number") {
- return false;
+ this.__defineGetter__("number", function () {
+ return statusNotification.number;
+ });
+ this.__defineSetter__("number", function (val) {
+ try {
+ statusNotification.number = t.long(val, "?");
+ } catch (e) {
}
+ });
- if (dict.subIconPath && typeof dict.subIconPath !== "string") {
- return false;
+ this.__defineGetter__("detailInfo", function () {
+ return statusNotification.detailInfo;
+ });
+ this.__defineSetter__("detailInfo", function (val) {
+ try {
+ statusNotification.detailInfo = t.NotificationDetailInfo(val, "[]?");
+ } catch (e) {
}
+ });
- if (dict.detailInfo) {
- if (!tizen1_utils.isValidArray(dict.detailInfo)) {
- return false;
- }
- flag = false;
- utils.forEach(dict.detailInfo, function (info) {
- if (!_checkNotificationDetailInfo(info)) {
- flag = true;
- }
- });
- if (flag === true) {
- return false;
- }
+ this.__defineGetter__("ledColor", function () {
+ return statusNotification.ledColor;
+ });
+ this.__defineSetter__("ledColor", function (val) {
+ try {
+ statusNotification.ledColor = t.DOMString(val, "?");
+ } catch (e) {
}
+ });
- if (dict.ledColor && typeof dict.ledColor !== "string") {
- return false;
+ this.__defineGetter__("ledOnPeriod", function () {
+ return statusNotification.ledOnPeriod;
+ });
+ this.__defineSetter__("ledOnPeriod", function (val) {
+ try {
+ statusNotification.ledOnPeriod = t.unsigned_long(val);
+ } catch (e) {
}
+ });
- if (dict.ledOnPeriod && typeof dict.ledOnPeriod !== "number") {
- return false;
+ this.__defineGetter__("ledOffPeriod", function () {
+ return statusNotification.ledOffPeriod;
+ });
+ this.__defineSetter__("ledOffPeriod", function (val) {
+ try {
+ statusNotification.ledOffPeriod = t.unsigned_long(val);
+ } catch (e) {
}
+ });
- if (dict.ledOffPeriod && typeof dict.ledOffPeriod !== "number") {
- return false;
+ this.__defineGetter__("backgroundImagePath", function () {
+ return statusNotification.backgroundImagePath;
+ });
+ this.__defineSetter__("backgroundImagePath", function (val) {
+ try {
+ statusNotification.backgroundImagePath = t.DOMString(val, "?");
+ } catch (e) {
}
+ });
- if (dict.backgroundImagePath && typeof dict.backgroundImagePath !== "string") {
- return false;
+ this.__defineGetter__("thumbnails", function () {
+ return statusNotification.thumbnails;
+ });
+ this.__defineSetter__("thumbnails", function (val) {
+ try {
+ statusNotification.thumbnails = t.DOMString(val, "[]?");
+ } catch (e) {
}
+ });
- if (dict.thumbnails) {
- if (!tizen1_utils.isValidArray(dict.thumbnails)) {
- return false;
- }
-
- flag = false;
- utils.forEach(dict.thumbnails, function (thumbnail) {
- if (typeof thumbnail !== "string") {
- flag = true;
- }
- });
- if (flag === true) {
- return false;
- }
+ this.__defineGetter__("soundPath", function () {
+ return statusNotification.soundPath;
+ });
+ this.__defineSetter__("soundPath", function (val) {
+ try {
+ statusNotification.soundPath = t.DOMString(val, "?");
+ } catch (e) {
}
- }
- return true;
-}
-
-_self = function (_statusType, title, notificationInitDict) {
- var statusType, _progressType, _progressValue, _vibrationG, _ledOnPeriod, _ledOffPeriod, _info,
- notification = this;
-
- if (typeof _statusType !== "string" || !(_statusType === "SIMPLE" || _statusType === "THUMBNAIL" || _statusType === "ONGOING" || _statusType === "PROGRESS")
- || typeof title !== "string" || !_checkDictProperties(notificationInitDict)) {
- throw (new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
- }
-
- if (notificationInitDict && _statusType === "PROGRESS" && "progressValue" in notificationInitDict && notificationInitDict.progressType === "PERCENTAGE" &&
- (notificationInitDict.progressValue < 0 || notificationInitDict.progressValue > 100)) {
- throw (new WebAPIError(errorcode.INVALID_VALUES_ERR));
- }
-
- statusType = _statusType;
- notification = NotificationBase.call(notification, title);
- notification.__defineGetter__("statusType", function () {
- return statusType;
});
- notification.__defineGetter__("vibration", function () {
- return _vibration;
+ this.__defineGetter__("vibration", function () {
+ return statusNotification.vibration;
});
-
- notification.__defineSetter__("vibration", function (vibration) {
- if (!(new TypeCoerce(t.boolean)).match(vibration))
- return;
-
- _vibration = vibration;
+ this.__defineSetter__("vibration", function (val) {
+ try {
+ statusNotification.vibration = t.boolean(val);
+ } catch (e) {
+ }
});
- notification.__defineGetter__("ledOnPeriod", function () {
- return _ledOnPeriod;
+ this.__defineGetter__("appControl", function () {
+ return statusNotification.appControl;
});
-
- notification.__defineSetter__("ledOnPeriod", function (ledOnPeriod) {
- if (!(new TypeCoerce(t["unsigned long"])).match(ledOnPeriod))
- return;
-
- _ledOnPeriod = ledOnPeriod;
+ this.__defineSetter__("appControl", function (val) {
+ try {
+ statusNotification.appControl = t.ApplicationControl(val, "?");
+ } catch (e) {
+ }
});
- notification.__defineGetter__("ledOffPeriod", function () {
- return _ledOffPeriod;
+ this.__defineGetter__("appId", function () {
+ return statusNotification.appId;
});
-
- notification.__defineSetter__("ledOffPeriod", function (ledOffPeriod) {
- if (!(new TypeCoerce(t["unsigned long"])).match(ledOffPeriod))
- return;
-
- _ledOffPeriod = ledOffPeriod;
+ this.__defineSetter__("appId", function (val) {
+ try {
+ statusNotification.appId = t.ApplicationId(val, "?");
+ } catch (e) {
+ }
});
- notification.__defineGetter__("progressType", function () {
- return _progressType;
+ this.__defineGetter__("progressType", function () {
+ return statusNotification.progressType;
});
-
- notification.__defineSetter__("progressType", function (progressType) {
- if (!(new TypeCoerce(t.NotificationProgressType)).match(progressType))
- return;
-
- _progressType = progressType;
+ this.__defineSetter__("progressType", function (val) {
+ try {
+ statusNotification.progressType = t.NotificationProgressType(val);
+ } catch (e) {
+ }
});
- notification.__defineGetter__("progressValue", function () {
- return _progressValue;
+ this.__defineGetter__("progressValue", function () {
+ return statusNotification.progressValue;
});
+ this.__defineSetter__("progressValue", function (val) {
+ try {
+ val = t.unsigned_long(val, '?');
- notification.__defineSetter__("progressValue", function (progressValue) {
- if (!(new TypeCoerce(t["unsigned long"])).match(progressValue))
- return;
-
- progressValue = (new TypeCoerce(t["unsigned long"])).copy(progressValue);
- if ((_progressType === "PERCENTAGE") && (progressValue > 100))
- return;
-
- _progressValue = progressValue;
- });
-
- notification.content = null;
- notification.iconPath = null;
- notification.subIconPath = null;
- notification.number = null;
- notification.detailInfo = [];
- notification.ledColor = null;
- notification.ledOnPeriod = 0;
- notification.ledOffPeriod = 0;
- notification.backgroundImagePath = null;
- notification.thumbnails = [];
- notification.soundPath = null;
- notification.appControl = null;
- notification.appId = null;
- _progressType = "PERCENTAGE";
- _progressValue = null;
- _vibration = false;
-
- if (notificationInitDict) {
- notification.content = notificationInitDict.content ? notificationInitDict.content : null;
- notification.iconPath = notificationInitDict.iconPath ? notificationInitDict.iconPath : null;
- notification.subIconPath = notificationInitDict.subIconPath ? notificationInitDict.subIconPath : null;
- notification.number = notificationInitDict.number ? notificationInitDict.number: null;
- if (notificationInitDict.detailInfo) {
- utils.forEach(notificationInitDict.detailInfo, function (info) {
- if(info.subText) {
- _info = new NotificationDetailInfo(info.mainText, info.subText);
- } else {
- _info = new NotificationDetailInfo(info.mainText, info.subText);
- }
- notification.detailInfo.push(_info);
+ if ((statusNotification.progressType === "PERCENTAGE") &&
+ (val > 100))
+ return;
- });
- }
- notification.ledColor = "ledColor" in notificationInitDict ? notificationInitDict.ledColor : null;
- notification.ledOnPeriod = "ledOnPeriod" in notificationInitDict ? notificationInitDict.ledOnPeriod : 0;
- notification.ledOffPeriod = "ledOffPeriod" in notificationInitDict ? notificationInitDict.ledOffPeriod : 0;
- notification.backgroundImagePath = "backgroundImagePath" in notificationInitDict ? notificationInitDict.backgroundImagePath : null;
- notification.thumbnails = "thumbnails" in notificationInitDict ? notificationInitDict.thumbnails : [];
- notification.soundPath = "soundPath" in notificationInitDict ? notificationInitDict.soundPath : null;
- notification.appControl = "appControl" in notificationInitDict ? notificationInitDict.appControl : null;
- notification.appId = "appId" in notificationInitDict ? notificationInitDict.appId : null;
- _progressType = "progressType" in notificationInitDict ? notificationInitDict.progressType : "PERCENTAGE";
- if("progressValue" in notificationInitDict) {
- _progressValue = (new TypeCoerce(t["unsigned long"])).copy(notificationInitDict.progressValue);
+ statusNotification.progressValue = val;
+ } catch (e) {
}
- _vibration = "vibration" in notificationInitDict ? notificationInitDict.vibration : false;
- }
- return notification;
+ });
};
-module.exports = _self;
+module.exports = StatusNotification;
});
define('ripple/platform/tizen/2.0/SyncInfo', function (require, exports, module) {
this.toTimezone = function (new_tzid) {
var diff,
Tzdate = require('ripple/platform/tizen/2.0/TZDate');
- if (typeof new_tzid !== 'string') {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (tz.isValidTimezone(new_tzid) === true) {
+ if (tz.isValidTimezone(String(new_tzid)) === true) {
diff = tz.getTimezoneDiff(new_tzid) - UTC_diff;
return new Tzdate(new Date(d.valueOf() + (diff * 1000 * 60 * 60)), new_tzid);
} else {
* limitations under the License.
*/
-var errorcode = require('ripple/platform/tizen/2.0/errorcode'),
- WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException');
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ errorcode = require('ripple/platform/tizen/2.0/errorcode'),
+ WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
+ TimeDuration;
-function TimeDuration(l, u) {
- var _length, _unit,
+TimeDuration = function (_length, _unit) {
+ var timeDuration = {},
TimeDurationUnit = {"MSECS": 1,
"SECS": 1000,
"MINS": 60 * 1000,
}
};
- _length = l || 0;
- if ((u !== undefined) && (u !== null)) {
- if (TimeDurationUnit[u] === undefined) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- } else {
- _unit = u;
- }
- } else {
- _unit = "MSECS";
- }
+ t.TimeDuration(arguments, this);
- this.length = _length;
- this.unit = _unit;
- this.difference = function (o) {
- if (typeof o !== 'object' || o === null || o === undefined) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (o.length === undefined || o.length === null ||
- o.unit === undefined || o.unit === null) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if ((typeof o.length) !== 'number') {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ this.__defineGetter__("length", function () {
+ return timeDuration.length;
+ });
+ this.__defineSetter__("length", function (val) {
+ try {
+ timeDuration.length = t.double(val);
+ } catch (e) {
}
- if (TimeDurationUnit[o.unit] === undefined) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ });
+
+ this.__defineGetter__("unit", function () {
+ return timeDuration.unit;
+ });
+ this.__defineSetter__("unit", function (val) {
+ try {
+ timeDuration.unit = t.TimeDurationUnit(val);
+ } catch (e) {
}
+ });
- var thisMS = _length * _toMSECS(_unit),
+ timeDuration.length = _length;
+ timeDuration.unit = _unit || "MSECS";
+
+ this.difference = function (o) {
+
+ t.TimeDuration("difference", arguments);
+
+ var thisMS = timeDuration.length * _toMSECS(timeDuration.unit),
otherMS = o.length * _toMSECS(o.unit);
return _simplifyDuration(thisMS - otherMS);
};
this.equalsTo = function (o) {
- if (typeof o !== 'object' || o === null || o === undefined) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (o.length === undefined || o.length === null ||
- o.unit === undefined || o.unit === null) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if ((typeof o.length) !== 'number') {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (TimeDurationUnit[o.unit] === undefined) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- var thisMS = _length * _toMSECS(_unit),
+ t.TimeDuration("equalsTo", arguments);
+
+ var thisMS = timeDuration.length * _toMSECS(timeDuration.unit),
otherMS = o.length * _toMSECS(o.unit);
return (thisMS === otherMS);
};
this.lessThan = function (o) {
- if (typeof o !== 'object' || o === null || o === undefined) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (o.length === undefined || o.length === null ||
- o.unit === undefined || o.unit === null) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if ((typeof o.length) !== 'number') {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (TimeDurationUnit[o.unit] === undefined) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- var thisMS = _length * _toMSECS(_unit),
+ t.TimeDuration("lessThan", arguments);
+
+ var thisMS = timeDuration.length * _toMSECS(timeDuration.unit),
otherMS = o.length * _toMSECS(o.unit);
return (thisMS < otherMS);
};
this.greaterThan = function (o) {
- if (typeof o !== 'object' || o === null || o === undefined) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (o.length === undefined || o.length === null ||
- o.unit === undefined || o.unit === null) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if ((typeof o.length) !== 'number') {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (TimeDurationUnit[o.unit] === undefined) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- var thisMS = _length * _toMSECS(_unit),
+ t.TimeDuration("greaterThan", arguments);
+
+ var thisMS = timeDuration.length * _toMSECS(timeDuration.unit),
otherMS = o.length * _toMSECS(o.unit);
return (thisMS > otherMS);
};
- return this;
-}
+};
module.exports = TimeDuration;
});
define('ripple/platform/tizen/2.0/application', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
errorcode = require('ripple/platform/tizen/2.0/errorcode'),
WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError'),
WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
- Application = require('ripple/platform/tizen/2.0/ApplicationBase'),
- ApplicationInformation = require('ripple/platform/tizen/2.0/ApplicationInformation'),
- ApplicationContext = require('ripple/platform/tizen/2.0/ApplicationContext'),
- ApplicationCertificate = require('ripple/platform/tizen/2.0/ApplicationCertificate'),
+ ApplicationControl = require('ripple/platform/tizen/2.0/ApplicationControl'),
+ Application,
+ ApplicationInformation,
+ ApplicationContext,
+ ApplicationCertificate,
+ RequestedApplicationControl,
_DB_APPLICATION_KEY = "tizen1-db-application",
PSEUDO_PACKAGE_ID = "pseudopack00",
PSEUDO_APP_ID = "pseudoapp00",
uri: "",
mime: "",
category: "",
- data: ""
+ data: []
},
type: "AUTHOR_ROOT",
value: ""
});
}
-_initialize();
-
_self = function () {
// private
function getHandle() {
var handle;
do {
- handle = Math.uuid(10, 10);
+ handle = Math.uuid(8, 10);
} while (handle.toString().indexOf('0') === 0);
return parseInt(handle, 10);
t.ApplicationManager("kill", arguments);
- if (!_data.applicationContexts[contextId]) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
+ window.setTimeout(function () {
+ if (!_data.applicationContexts[contextId]) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
+ }
+ return;
}
- return;
- }
- if (_data.activeApp && _data.activeApp.id === contextId) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.INVALID_VALUES_ERR));
+ if (_data.activeApp && (_data.activeApp.id === contextId)) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.INVALID_VALUES_ERR));
+ }
+ return;
}
- return;
- }
- delete _data.applicationContexts[contextId];
- if (successCallback) {
- successCallback();
- }
+ delete _data.applicationContexts[contextId];
+ if (successCallback) {
+ successCallback();
+ }
+ }, 1);
}
function launch(id, successCallback, errorCallback) {
- var htmlContent;
-
if (!_security.launch) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
t.ApplicationManager("launch", arguments);
- if (!_data.applications[id]) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
- }
- return;
- }
- htmlContent = _appDialogTemplate_short.replace(/#application-name/, _data.applications[id].name)
- .replace(/#application-id/, id);
- jQuery("#app-dialog-box").html(htmlContent);
- $("#app-dialog").dialog("open");
-
- if (successCallback) {
- successCallback();
- }
- }
-
- function launchAppControl(appControl, id, successCallback, errorCallback, replyCallback) {
- var isFound, appId, htmlContent;
-
- if (!_security.launchAppControl) {
- throw new WebAPIException(errorcode.SECURITY_ERR);
- }
-
- t.ApplicationManager("launchAppControl", arguments);
+ window.setTimeout(function () {
+ var htmlContent;
- if (id) {
if (!_data.applications[id]) {
if (errorCallback) {
errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
}
return;
}
- htmlContent = _appDialogTemplate.replace(/#application-name/, _data.applications[appId].name)
- .replace(/#appControl-operation/, _data.applications[appId].operation)
- .replace(/#appControl-uri/, _data.applications[appId].appControl.uri)
- .replace(/#appControl-mime/, _data.applications[appId].appControl.mime)
- .replace(/#appControl-category/, _data.applications[appId].appControl.category)
- .replace(/#appControl-data/, JSON.stringify(_data.applications[appId].appControl.data));
+
+ htmlContent = _appDialogTemplate_short.replace(/#application-name/, _data.applications[id].name)
+ .replace(/#application-id/, id);
jQuery("#app-dialog-box").html(htmlContent);
$("#app-dialog").dialog("open");
- _data.activeApp.replyCallback = replyCallback;
-
if (successCallback) {
successCallback();
}
- } else {
- isFound = false;
- utils.forEach(_data.applications, function (application) {
- if (application.operation === appControl.operation) {
- if (appControl.mime && (typeof appControl.mime === "string")) {
- if (!reasonable_mimetype[appControl.mime.split("/")[0]]) {
- return;
- }
+ }, 1);
+ }
+
+ function launchAppControl(appControl, id, successCallback, errorCallback, replyCallback) {
+ if (!_security.launchAppControl) {
+ throw new WebAPIException(errorcode.SECURITY_ERR);
+ }
+
+ t.ApplicationManager("launchAppControl", arguments, true);
+
+ window.setTimeout(function () {
+ var isFound = false, appId, htmlContent;
+
+ if (id) {
+ if (!_data.applications[id]) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
}
- appId = application.id;
- isFound = true;
+ return;
}
- });
- if (isFound) {
htmlContent = _appDialogTemplate.replace(/#application-name/, _data.applications[appId].name)
.replace(/#appControl-operation/, _data.applications[appId].operation)
.replace(/#appControl-uri/, _data.applications[appId].appControl.uri)
successCallback();
}
} else {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
+ utils.forEach(_data.applications, function (application) {
+ if (application.operation === appControl.operation) {
+ if (appControl.mime && (typeof appControl.mime === "string")) {
+ if (!reasonable_mimetype[appControl.mime.split("/")[0]]) {
+ return;
+ }
+ }
+ appId = application.id;
+ isFound = true;
+ }
+ });
+
+ if (!isFound) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
+ }
+ return;
+ }
+
+ htmlContent = _appDialogTemplate.replace(/#application-name/,
+ _data.applications[appId].name)
+ .replace(/#appControl-operation/, _data.applications[appId].operation)
+ .replace(/#appControl-uri/, _data.applications[appId].appControl.uri)
+ .replace(/#appControl-mime/, _data.applications[appId].appControl.mime)
+ .replace(/#appControl-category/, _data.applications[appId].appControl.category)
+ .replace(/#appControl-data/, JSON.stringify(_data.applications[appId].appControl.data));
+ jQuery("#app-dialog-box").html(htmlContent);
+ $("#app-dialog").dialog("open");
+
+ _data.activeApp.replyCallback = replyCallback;
+
+ if (successCallback) {
+ successCallback();
}
}
- }
+ }, 1);
}
function findAppControl(appControl, successCallback, errorCallback) {
- var informationArray = [];
+ var appControlExternal = appControl;
- t.ApplicationManager("findAppControl", arguments);
+ t.ApplicationManager("findAppControl", arguments, true);
- utils.forEach(_data.applications, function (application) {
- if (application.operation === appControl.operation) {
- informationArray.push(new ApplicationInformation(
- application.id,
- application.name,
- application.iconPath,
- application.version,
- application.show,
- application.categories,
- application.installDate,
- application.size,
- application.packageId));
- }
- });
- setTimeout(successCallback(informationArray, appControl), 1);
+ window.setTimeout(function () {
+ var informationArray = [];
+
+ utils.forEach(_data.applications, function (application) {
+ if (application.operation === appControl.operation) {
+ informationArray.push(new ApplicationInformation(
+ application.id,
+ application.name,
+ application.iconPath,
+ application.version,
+ application.show,
+ application.categories,
+ application.installDate,
+ application.size,
+ application.packageId));
+ }
+ });
+
+ successCallback(informationArray, appControlExternal);
+ }, 1);
}
function getAppsContext(successCallback, errorCallback) {
- var array = [];
-
t.ApplicationManager("getAppsContext", arguments);
- utils.forEach(_data.applicationContexts, function (context) {
- array.push(new ApplicationContext(context.id, context.appId));
- });
+ window.setTimeout(function () {
+ var contexts = [];
+
+ utils.forEach(_data.applicationContexts, function (context) {
+ contexts.push(new ApplicationContext(context.id, context.appId));
+ });
- setTimeout(successCallback(array), 1);
+ successCallback(contexts);
+ }, 1);
}
function getAppContext(contextId) {
- var appContext;
+ var appContext;
if (contextId === null || contextId === undefined) {
appContext = new ApplicationContext(_data.activeApp.id, _data.activeApp.appId);
}
function getAppsInfo(successCallback, errorCallback) {
- var appsInfo = [];
-
t.ApplicationManager("getAppsInfo", arguments);
- utils.forEach(_data.applications, function (application) {
- appsInfo.push(new ApplicationInformation(
- application.id,
- application.name,
- application.iconPath,
- application.version,
- application.show,
- application.categories,
- application.installDate,
- application.size,
- application.packageId));
- });
- setTimeout(successCallback(appsInfo), 1);
+ window.setTimeout(function () {
+ var applications = [];
+
+ utils.forEach(_data.applications, function (application) {
+ applications.push(new ApplicationInformation(
+ application.id,
+ application.name,
+ application.iconPath,
+ application.version,
+ application.show,
+ application.categories,
+ application.installDate,
+ application.size,
+ application.packageId));
+ });
+
+ successCallback(applications);
+ }, 1);
}
function getAppInfo(id) {
}
function removeAppInfoEventListener(listenerID) {
- t.ApplicationManager("removeAppInfoEventListener", arguments);
-
- if (!_data.listeners[listenerID]) {
- throw new WebAPIException(errorcode.NOT_FOUND_ERR);
- }
+ if (!_data.listeners[listenerID])
+ return;
delete _data.listeners[listenerID];
}
return application;
};
+Application = function (appInfo, contextId, metaData) {
+ var application = {}, requestedAppControl;
+
+ application.appInfo = appInfo;
+ application.contextId = contextId;
+
+ requestedAppControl = new RequestedApplicationControl(
+ new ApplicationControl(metaData.operation, metaData.appControl.uri,
+ metaData.appControl.mime, metaData.appControl.category,
+ metaData.appControl.data), application.appInfo.id);
+
+ this.__defineGetter__("appInfo", function () {
+ return application.appInfo;
+ });
+
+ this.__defineGetter__("contextId", function () {
+ return application.contextId;
+ });
+
+ this.exit = function () {
+ event.trigger("tizen-application-exit", [contextId]);
+ };
+
+ this.hide = function () {
+ event.trigger("tizen-application-hide", [contextId]);
+ };
+
+ this.getRequestedAppControl = function () {
+ return requestedAppControl;
+ };
+};
+
+ApplicationInformation = function (id, name, iconPath, version, show,
+ categories, installDate, size, packageId) {
+ this.__defineGetter__("id", function () {
+ return id;
+ });
+
+ this.__defineGetter__("name", function () {
+ return name;
+ });
+
+ this.__defineGetter__("iconPath", function () {
+ return iconPath;
+ });
+
+ this.__defineGetter__("version", function () {
+ return version;
+ });
+
+ this.__defineGetter__("show", function () {
+ return show;
+ });
+
+ this.__defineGetter__("categories", function () {
+ return categories;
+ });
+
+ this.__defineGetter__("installDate", function () {
+ return installDate;
+ });
+
+ this.__defineGetter__("size", function () {
+ return size;
+ });
+
+ this.__defineGetter__("packageId", function () {
+ return packageId;
+ });
+};
+
+ApplicationContext = function (id, appId) {
+ this.__defineGetter__("id", function () {
+ return id;
+ });
+
+ this.__defineGetter__("appId", function () {
+ return appId;
+ });
+};
+
+RequestedApplicationControl = function (appControl, callerAppId) {
+ this.__defineGetter__("appControl", function () {
+ return appControl;
+ });
+
+ this.__defineGetter__("callerAppId", function () {
+ return callerAppId;
+ });
+
+ this.replyResult = function (data) {
+ t.RequestedApplicationControl("replyResult", arguments);
+
+ event.trigger("appServiceReplied", "Result: " + data);
+ };
+
+ this.replyFailure = function () {
+ event.trigger("appServiceReplied", "Failure");
+ };
+};
+
+ApplicationCertificate = function (type, value) {
+ this.__defineGetter__("type", function () {
+ return type;
+ });
+
+ this.__defineGetter__("value", function () {
+ return value;
+ });
+};
+
+jQuery("#app-dialog-return-btn").live("click", function () {
+ $("#app-dialog").dialog("close");
+});
+
+jQuery("#app-dialog-reload-btn").live("click", function () {
+ $("#app-dialog").dialog("close");
+ window.tinyHipposReload = true;
+ location.reload();
+});
+
+jQuery("#app-dialog-generate-reply").live("click", function () {
+ var type, data, ret = [];
+ type = jQuery('input:radio[name="app-dialog-reply-type"]:checked').val();
+ data = jQuery("#app-dialog-reply-json").val();
+ $("#app-dialog").dialog("close");
+ if (_data.activeApp.replyCallback) {
+ switch (type) {
+ case "replyResult":
+ if (_data.activeApp.replyCallback.onsuccess) {
+ if (data === "") {
+ _data.activeApp.replyCallback.onsuccess();
+ } else {
+ try {
+ ret = JSON.parse(data);
+ _data.activeApp.replyCallback.onsuccess(ret);
+ } catch (e) {
+ console.log("replyResult: JSON parsing error: " + e.message);
+ _data.activeApp.replyCallback.onsuccess();
+ }
+ }
+ }
+ break;
+ case "replyFailure":
+ if (_data.activeApp.replyCallback.onfailure) {
+ _data.activeApp.replyCallback.onfailure();
+ }
+ break;
+ }
+ }
+});
+
+event.on("ApplicationLoad", function () {
+ _initialize();
+});
+
event.on("tizen-application-exit", function () {
var htmlContent;
htmlContent = _appDialogTemplate_exit_hide.replace(/#application-name/, _data.applications[_data.activeApp.appId].name)
});
});
-jQuery("#app-dialog-return-btn").live("click", function () {
- $("#app-dialog").dialog("close");
-});
-
-jQuery("#app-dialog-reload-btn").live("click", function () {
- $("#app-dialog").dialog("close");
- window.tinyHipposReload = true;
- location.reload();
-});
-
-jQuery("#app-dialog-generate-reply").live("click", function () {
- var type, data, ret = [];
- type = jQuery('input:radio[name="app-dialog-reply-type"]:checked').val();
- data = jQuery("#app-dialog-reply-json").val();
- $("#app-dialog").dialog("close");
- if (_data.activeApp.replyCallback) {
- switch (type) {
- case "replyResult":
- if (_data.activeApp.replyCallback.onsuccess) {
- if (data === "") {
- _data.activeApp.replyCallback.onsuccess();
- } else {
- try {
- ret = JSON.parse(data);
- _data.activeApp.replyCallback.onsuccess(ret);
- } catch (e) {
- console.log("replyResult: JSON parsing error: " + e.message);
- _data.activeApp.replyCallback.onsuccess();
- }
- }
- }
- break;
- case "replyFailure":
- if (_data.activeApp.replyCallback.onfailure) {
- _data.activeApp.replyCallback.onfailure();
- }
- break;
- }
- }
-});
-
-event.on("ApplicationLoad", function () {
- _initialize();
-});
+_initialize();
module.exports = _self;
});
define('ripple/platform/tizen/2.0/bluetooth', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
db = require('ripple/db'),
event = require('ripple/event'),
errorcode = require('ripple/platform/tizen/2.0/errorcode'),
+ t = require('ripple/platform/tizen/2.0/typecast'),
WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError'),
- tizen1_utils = require('ripple/platform/tizen/2.0/tizen1_utils'),
+ WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
BluetoothDevice = require('ripple/platform/tizen/2.0/BluetoothDevice'),
BluetoothClassDeviceMajor = require('ripple/platform/tizen/2.0/BluetoothClassDeviceMajor'),
BluetoothClassDeviceMinor = require('ripple/platform/tizen/2.0/BluetoothClassDeviceMinor'),
BluetoothServiceHandler = require('ripple/platform/tizen/2.0/BluetoothServiceHandler'),
BluetoothAdapter,
_data = {
- DB_BLUETOOTH_KEY : "tizen1-db-bluetooth_adapter-name",
+ DB_BLUETOOTH_KEY: "tizen1-db-bluetooth_adapter-name",
DEFAULT_ADAPTER_NAME: "Tizen BT Adapter",
DEFAULT_ADAPTER_ADDRESS: "12:34:56:78:90:AB",
- availableDevsChanging : false,
- DEFAULT_VISIBLE_TIME : 180000,
- DISCOVER_TIME : 10000,
- DISCOVER_INTERVAL : 1000,
- bluetoothClassDeviceMajor : {},
- bluetoothClassDeviceMinor : {},
- bluetoothClassDeviceService : {},
- adapter : {},
- historyDevs : {},
- availableDevs : {},
- localServices : {},
+ availableDevsChanging: false,
+ DEFAULT_VISIBLE_TIME: 180000,
+ DISCOVER_TIME: 10000,
+ DISCOVER_INTERVAL: 1000,
+ bluetoothClassDeviceMajor: {},
+ bluetoothClassDeviceMinor: {},
+ bluetoothClassDeviceService: {},
+ adapter: {},
+ historyDevs: {},
+ availableDevs: {},
+ localServices: {}
},
_security = {
"http://tizen.org/privilege/bluetoothmanager": ["setVisible"],
"http://tizen.org/privilege/bluetooth.admin": ["setName", "setPowered"],
- "http://tizen.org/privilege/bluetooth.gap": ["getDefaultAdapter", "discoverDevices", "stopDiscovery", "getKnownDevices", "getDevice", "createBonding", "destroyBonding", "hasService"],
- "http://tizen.org/privilege/bluetooth.spp": ["registerRFCOMMServiceByUUID", "connectToServiceByUUID", "writeData", "readData", "close", "unregister"]
+ "http://tizen.org/privilege/bluetooth.gap": ["getDefaultAdapter",
+ "discoverDevices", "stopDiscovery", "getKnownDevices",
+ "getDevice", "createBonding", "destroyBonding", "hasService"],
+ "http://tizen.org/privilege/bluetooth.spp":
+ ["registerRFCOMMServiceByUUID", "connectToServiceByUUID",
+ "writeData", "readData", "close", "unregister"]
},
_self;
_data.bluetoothClassDeviceMajor = new BluetoothClassDeviceMajor();
_data.bluetoothClassDeviceMinor = new BluetoothClassDeviceMinor();
_data.bluetoothClassDeviceService = new BluetoothClassDeviceService();
- adapterName = db.retrieveObject(_data.DB_BLUETOOTH_KEY) || _data.DEFAULT_ADAPTER_NAME;
- _data.adapter = new BluetoothAdapter(adapterName, _data.DEFAULT_ADAPTER_ADDRESS);
+ adapterName = db.retrieveObject(_data.DB_BLUETOOTH_KEY) ||
+ _data.DEFAULT_ADAPTER_NAME;
+ _data.adapter = new BluetoothAdapter(adapterName,
+ _data.DEFAULT_ADAPTER_ADDRESS);
- //get defalt nearby devices
+ // get defalt nearby devices
devs = db.retrieveObject("bt-simulated-devices");
utils.forEach(devs, function (item) {
if (!_data.availableDevs[item.address]) {
});
}
-function _validateDiscoverDevicesType(onSuccess, onError) {
- if (typeof onSuccess !== "object") {
- throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
- }
- if (onError) {
- tizen1_utils.validateArgumentType(onError, "function",
- new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
- }
- tizen1_utils.validateArgumentType(onSuccess.onstarted, "function",
- new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
- tizen1_utils.validateArgumentType(onSuccess.ondevicefound, "function",
- new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
- tizen1_utils.validateArgumentType(onSuccess.ondevicedisappeared, "function",
- new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
- tizen1_utils.validateArgumentType(onSuccess.onfinished, "function",
- new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
-}
-
BluetoothAdapter = function (devName, devAddress) {
var adapter,
timeoutVar,
discoverInterval;
// private
- function _updatePowerStatus(status) {
+ function updateVisibleStatus(status, time) {
+ if (!_devPowered)
+ return;
+
+ _devVisible = status;
+ event.trigger("bt-adapter-visible-changed", [_devVisible]);
+ if (_devVisible) {
+ if (time > 0) {
+ timeoutVar = window.setTimeout(function () {
+ _devVisible = false;
+ event.trigger("bt-adapter-visible-changed", [_devVisible]);
+ }, time);
+ }
+ } else {
+ window.clearTimeout(timeoutVar);
+ }
+ }
+
+ function updatePowerStatus(status) {
if (_devPowered === status) {
return;
}
if (!status) {
- _updateVisibleStatus(false);
+ updateVisibleStatus(false);
utils.forEach(_data.historyDevs, function (dev) {
event.trigger("bt-service-state-update", [dev.address, false]);
- Object.defineProperty(dev, "isBonded", {value: false, writable: false});
+ dev.__defineGetter__("isBonded", function () {
+ return false;
+ });
event.trigger("bt-device-bonded-changed", [dev.address, false]);
jQuery("#service-transfer-textarea-" + dev.address.replace(/:/g, "")).val("");
jQuery("#service-receive-textarea-" + dev.address.replace(/:/g, "")).html("");
event.trigger("bt-adapter-power-changed", [_devPowered]);
}
- function _updateVisibleStatus(status, time) {
- if (!_devPowered)
- return;
- _devVisible = status;
- event.trigger("bt-adapter-visible-changed", [_devVisible]);
- if (_devVisible) {
- if (time > 0) {
- timeoutVar = setTimeout(function () {
- _devVisible = false;
- event.trigger("bt-adapter-visible-changed", [_devVisible]);
- }, time);
- }
- } else {
- clearTimeout(timeoutVar);
- }
- }
-
// public
function setName(name, successCallback, errorCallback) {
if (!_security.setName) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
- tizen1_utils.validateCallbackType(successCallback, errorCallback);
-
- if (typeof name !== "string") {
- throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
- }
+ t.BluetoothAdapter("setName", arguments);
- if (!_devPowered) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ window.setTimeout(function () {
+ if (!_devPowered) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(
+ errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ }
+ return;
}
- return;
- }
- _devName = name;
- db.saveObject(_data.DB_BLUETOOTH_KEY, _devName);
- event.trigger("bt-adapter-name-changed", [_devName]);
- if (successCallback) {
- successCallback();
- }
+ _devName = name;
+ db.saveObject(_data.DB_BLUETOOTH_KEY, _devName);
+ event.trigger("bt-adapter-name-changed", [_devName]);
+ if (successCallback) {
+ successCallback();
+ }
+ }, 1);
}
function setPowered(state, successCallback, errorCallback) {
if (!_security.setPowered) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
- tizen1_utils.validateCallbackType(successCallback, errorCallback);
-
- if (typeof state !== "boolean") {
- throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
- }
+ t.BluetoothAdapter("setPowered", arguments);
- _updatePowerStatus(state);
- if (successCallback) {
- successCallback();
- }
+ window.setTimeout(function () {
+ updatePowerStatus(state);
+ if (successCallback) {
+ successCallback();
+ }
+ }, 1);
}
function setVisible(mode, successCallback, errorCallback, timeout) {
- var time;
-
if (!_security.setVisible) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
- tizen1_utils.validateCallbackType(successCallback, errorCallback);
+ t.BluetoothAdapter("setVisible", arguments);
- if (typeof mode !== "boolean") {
- throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
- }
+ window.setTimeout(function () {
+ var time;
- if (!_devPowered) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ if (!_devPowered) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(
+ errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ }
+ return;
}
- return;
- }
- if (typeof timeout === "number") {
- if (timeout < 0) {
- time = _data.DEFAULT_VISIBLE_TIME;
+ if (typeof timeout === "number") {
+ if (timeout < 0) {
+ time = _data.DEFAULT_VISIBLE_TIME;
+ } else {
+ time = timeout * 1000;
+ }
} else {
- time = timeout * 1000;
+ time = _data.DEFAULT_VISIBLE_TIME;
}
- } else {
- time = _data.DEFAULT_VISIBLE_TIME;
- }
- _updateVisibleStatus(mode, time);
- if (successCallback) {
- successCallback();
- }
+ updateVisibleStatus(mode, time);
+
+ if (successCallback) {
+ successCallback();
+ }
+ }, 1);
}
function discoverDevices(successCallback, errorCallback) {
- var interval;
-
if (!_security.discoverDevices) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
- _validateDiscoverDevicesType(successCallback, errorCallback);
+ t.BluetoothAdapter("discoverDevices", arguments);
- if (!_devPowered) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ window.setTimeout(function () {
+ var interval;
+
+ if (!_devPowered) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(
+ errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ }
+ return;
}
- return;
- }
- // already discovering
- if (_isDiscovering) {
- return;
- }
- _isDiscovering = true;
- _data.historyDevs = {};
+ // already discovering
+ if (_isDiscovering) {
+ return;
+ }
- successCallback.onstarted();
- _data.availableDevsChanging = false;
- utils.forEach(_data.availableDevs, function (item) {
- _data.historyDevs[item.address] = item;
- successCallback.ondevicefound(utils.copy(item));
- });
+ _isDiscovering = true;
+ _data.historyDevs = {};
- discoverInterval = setTimeout(function () {
- var devs = [];
- clearInterval(interval);
- utils.forEach(_data.historyDevs, function (item) {
- devs.push(utils.copy(item));
+ successCallback.onstarted();
+
+ _data.availableDevsChanging = false;
+ utils.forEach(_data.availableDevs, function (item) {
+ _data.historyDevs[item.address] = item;
+ successCallback.ondevicefound(item);
});
- successCallback.onfinished(devs);
- _isDiscovering = false;
- }, _data.DISCOVER_TIME);
- interval = setInterval(function () {
- var removeList = [], i;
- if (!_isDiscovering) {
- clearInterval(interval);
- return;
- }
+ discoverInterval = window.setTimeout(function () {
+ var devs = [];
- if (_data.availableDevsChanging === true) {
- _data.availableDevsChanging = false;
+ window.clearInterval(interval);
utils.forEach(_data.historyDevs, function (item) {
- if (!_data.availableDevs[item.address]) {
- removeList.push(item.address);
- }
+ devs.push(item);
});
- for (i in removeList) {
- successCallback.ondevicedisappeared(removeList[i]);
- delete _data.historyDevs[removeList[i]];
+ successCallback.onfinished(devs);
+ _isDiscovering = false;
+ }, _data.DISCOVER_TIME);
+
+ interval = window.setInterval(function () {
+ var removeList = [], i;
+
+ if (!_isDiscovering) {
+ window.clearInterval(interval);
+ return;
}
- utils.forEach(_data.availableDevs, function (item) {
- if (!_data.historyDevs[item.address]) {
- _data.historyDevs[item.address] = item;
- successCallback.ondevicefound(utils.copy(item));
+
+ if (_data.availableDevsChanging) {
+ _data.availableDevsChanging = false;
+ utils.forEach(_data.historyDevs, function (item) {
+ if (!_data.availableDevs[item.address]) {
+ removeList.push(item.address);
+ }
+ });
+ for (i in removeList) {
+ successCallback.ondevicedisappeared(removeList[i]);
+ delete _data.historyDevs[removeList[i]];
}
- });
- }
- }, _data.DISCOVER_INTERVAL);
+ utils.forEach(_data.availableDevs, function (item) {
+ if (!_data.historyDevs[item.address]) {
+ _data.historyDevs[item.address] = item;
+ successCallback.ondevicefound(item);
+ }
+ });
+ }
+ }, _data.DISCOVER_INTERVAL);
+ }, 1);
}
function stopDiscovery(successCallback, errorCallback) {
if (!_security.stopDiscovery) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
- tizen1_utils.validateCallbackType(successCallback, errorCallback);
+ t.BluetoothAdapter("stopDiscovery", arguments);
- if (!_devPowered) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ window.setTimeout(function () {
+ if (!_devPowered) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(
+ errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ }
+ return;
}
- return;
- }
- if (_isDiscovering) {
- clearTimeout(discoverInterval);
- }
- _isDiscovering = false;
- if (successCallback) {
- successCallback();
- }
+ if (_isDiscovering) {
+ window.clearTimeout(discoverInterval);
+ }
+ _isDiscovering = false;
+ if (successCallback) {
+ successCallback();
+ }
+ }, 1);
}
function getKnownDevices(successCallback, errorCallback) {
- var devs = [];
-
if (!_security.getKnownDevices) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
- tizen1_utils.validateArgumentType(successCallback, "function",
- new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
+ t.BluetoothAdapter("getKnownDevices", arguments);
- if (errorCallback) {
- tizen1_utils.validateArgumentType(errorCallback, "function",
- new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
- }
+ window.setTimeout(function () {
+ var devs = [];
- if (!_devPowered) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ if (!_devPowered) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(
+ errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ }
+ return;
}
- return;
- }
- utils.forEach(_data.historyDevs, function (item) {
- devs.push(new BluetoothDevice({
- name: item.name,
- address: item.address,
- deviceClass: item.deviceClass,
- isBonded: false,
- isTrusted: item.isTrusted,
- isConnected: false,
- services: item.services,
- metaData: _security
- }));
- });
- successCallback(devs);
+ utils.forEach(_data.historyDevs, function (item) {
+ devs.push(new BluetoothDevice({
+ name: item.name,
+ address: item.address,
+ deviceClass: item.deviceClass,
+ isBonded: false,
+ isTrusted: item.isTrusted,
+ isConnected: false,
+ services: item.services,
+ metaData: _security
+ }));
+ });
+ successCallback(devs);
+ }, 1);
}
function getDevice(address, successCallback, errorCallback) {
if (!_security.getDevice) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
- }
-
- if (typeof address !== "string") {
- throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
- tizen1_utils.validateArgumentType(successCallback, "function",
- new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
+ t.BluetoothAdapter("getDevice", arguments);
- if (errorCallback) {
- tizen1_utils.validateArgumentType(errorCallback, "function",
- new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
- }
+ window.setTimeout(function () {
+ if (!_devPowered) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(
+ errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ }
+ return;
+ }
- if (!_devPowered) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ if (!_data.historyDevs[address]) {
+ if (!_data.availableDevs[address]) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
+ }
+ return;
+ }
+ _data.historyDevs[address] = _data.availableDevs[address];
}
- return;
- }
- if (_data.historyDevs[address]) {
- successCallback(utils.copy(_data.historyDevs[address]));
- } else {
- errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
- }
+ successCallback(_data.historyDevs[address]);
+ }, 1);
}
function createBonding(address, successCallback, errorCallback) {
if (!_security.createBonding) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
- }
-
- if (typeof address !== "string") {
- throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
- tizen1_utils.validateArgumentType(successCallback, "function",
- new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
+ t.BluetoothAdapter("createBonding", arguments);
- if (errorCallback) {
- tizen1_utils.validateArgumentType(errorCallback, "function",
- new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
- }
+ window.setTimeout(function () {
+ if (!_devPowered) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(
+ errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ }
+ return;
+ }
- if (!_devPowered) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ if (!_data.historyDevs[address]) {
+ if (!_data.availableDevs[address]) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
+ }
+ return;
+ }
+ _data.historyDevs[address] = _data.availableDevs[address];
}
- return;
- }
- if (_data.historyDevs[address]) {
- Object.defineProperty(_data.historyDevs[address], "isBonded", {value: true, writable: false});
+ _data.historyDevs[address].__defineGetter__("isBonded", function () {
+ return true;
+ });
event.trigger("bt-device-bonded-changed", [address, true]);
- successCallback(utils.copy(_data.historyDevs[address]));
- } else if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
- }
+ successCallback(_data.historyDevs[address]);
+ }, 1);
}
function destroyBonding(address, successCallback, errorCallback) {
if (!_security.destroyBonding) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
- if (typeof address !== "string") {
- throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
- }
+ t.BluetoothAdapter("destroyBonding", arguments);
- tizen1_utils.validateCallbackType(successCallback, errorCallback);
+ window.setTimeout(function () {
+ if (!_devPowered) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(
+ errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ }
+ return;
+ }
- if (!_devPowered) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ if (!_data.historyDevs[address]) {
+ if (!_data.availableDevs[address]) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
+ }
+ return;
+ }
+ _data.historyDevs[address] = _data.availableDevs[address];
}
- return;
- }
- if (_data.historyDevs[address]) {
event.trigger("bt-service-state-update", [address, false]);
- Object.defineProperty(_data.historyDevs[address], "isBonded", {value: false, writable: false});
+ _data.historyDevs[address].__defineGetter__("isBonded", function () {
+ return false;
+ });
event.trigger("bt-device-bonded-changed", [address, false]);
if (successCallback) {
successCallback();
}
- } else if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
- }
+ }, 1);
}
- function registerRFCOMMServiceByUUID(uuid, name, successCallback, errorCallback, securityLevel) {
+ function registerRFCOMMServiceByUUID(uuid, name, successCallback,
+ errorCallback, securityLevel) {
if (!_security.registerRFCOMMServiceByUUID) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
- }
-
- if (typeof name !== "string" || typeof uuid !== "string") {
- throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
- }
-
- tizen1_utils.validateArgumentType(successCallback, "function",
- new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
-
- if (errorCallback) {
- tizen1_utils.validateArgumentType(errorCallback, "function",
- new WebAPIError(errorcode.TYPE_MISMATCH_ERR));
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
- if (securityLevel) {
- if (securityLevel !== "LOW" && securityLevel !== "MEDIUM" && securityLevel !== "HIGH") {
- throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
- }
- }
+ t.BluetoothAdapter("registerRFCOMMServiceByUUID", arguments);
- if (!_devPowered) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ window.setTimeout(function () {
+ if (!_devPowered) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(
+ errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ }
+ return;
}
- return;
- }
- _data.localServices[uuid] = new BluetoothServiceHandler({uuid: uuid, name: name, isConnected: false, metaData: _security});
- successCallback(_data.localServices[uuid]);
+ _data.localServices[uuid] = new BluetoothServiceHandler({
+ uuid: uuid,
+ name: name,
+ isConnected: false,
+ metaData: _security
+ });
+ successCallback(_data.localServices[uuid]);
+ }, 1);
}
event.on("bt-simulated-devices-changed", function () {
});
utils.forEach(devs, function (item) {
if (!_data.availableDevs[item.address]) {
-
_data.availableDevs[item.address] = new BluetoothDevice({
name: item.name,
address: item.address,
});
event.on("bt-power-setting", function (status) {
- _updatePowerStatus(status);
+ updatePowerStatus(status);
});
adapter = {
- setName : setName,
- setPowered : setPowered,
- setVisible : setVisible,
- discoverDevices : discoverDevices,
- stopDiscovery : stopDiscovery,
- getKnownDevices : getKnownDevices,
- getDevice : getDevice,
- createBonding : createBonding,
- destroyBonding : destroyBonding,
- registerRFCOMMServiceByUUID : registerRFCOMMServiceByUUID
+ setName: setName,
+ setPowered: setPowered,
+ setVisible: setVisible,
+ discoverDevices: discoverDevices,
+ stopDiscovery: stopDiscovery,
+ getKnownDevices: getKnownDevices,
+ getDevice: getDevice,
+ createBonding: createBonding,
+ destroyBonding: destroyBonding,
+ registerRFCOMMServiceByUUID: registerRFCOMMServiceByUUID
};
adapter.__defineGetter__("name", function () {
return _devName;
});
+
adapter.__defineGetter__("address", function () {
return _devAddress;
});
+
adapter.__defineGetter__("powered", function () {
return _devPowered;
});
+
adapter.__defineGetter__("visible", function () {
return _devVisible;
});
return adapter;
};
-_initialize();
-
_self = function () {
+ var bluetooth;
+
function getDefaultAdapter() {
if (!_security.getDefaultAdapter) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
- }
-
- if (arguments.length > 0) {
- throw new WebAPIError(errorcode.TYPE_MISMATCH_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
if (!_data.adapter) {
- throw new WebAPIError(errorcode.UNKNOWN_ERR);
+ throw new WebAPIException(errorcode.UNKNOWN_ERR);
}
return _data.adapter;
}
}
- var bluetooth = {
- getDefaultAdapter : getDefaultAdapter,
- handleSubFeatures : handleSubFeatures
+ bluetooth = {
+ getDefaultAdapter: getDefaultAdapter,
+ handleSubFeatures: handleSubFeatures
};
bluetooth.__defineGetter__("deviceMajor", function () {
return _data.bluetoothClassDeviceMajor;
});
+
bluetooth.__defineGetter__("deviceMinor", function () {
return _data.bluetoothClassDeviceMinor;
});
+
bluetooth.__defineGetter__("deviceService", function () {
return _data.bluetoothClassDeviceService;
});
return bluetooth;
};
+_initialize();
+
module.exports = _self;
});
});
define('ripple/platform/tizen/2.0/calendar', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
TDur = require('ripple/platform/tizen/2.0/TimeDuration'),
CalendarItem = require('ripple/platform/tizen/2.0/CalendarItem'),
CalendarEvent = require('ripple/platform/tizen/2.0/CalendarEvent'),
+ CalendarEventId = require('ripple/platform/tizen/2.0/CalendarEventId'),
CalendarTask = require('ripple/platform/tizen/2.0/CalendarTask'),
Calendar,
CalendarStorage,
},
_calendarsStorage,
_security = {
- "http://tizen.org/privilege/calendar.read": ["getCalendars", "getDefaultCalendar", "getCalendar", "get", "find",
- "addChangeListener", "removeChangeListener", "expandRecurrence", "convertToString", "clone"],
- "http://tizen.org/privilege/calendar.write": ["add", "addBatch", "update", "updateBatch", "remove", "removeBatch"]
+ "http://tizen.org/privilege/calendar.read": ["getCalendars",
+ "getUnifiedCalendar", "getDefaultCalendar", "getCalendar",
+ "get", "find", "addChangeListener", "removeChangeListener",
+ "expandRecurrence", "convertToString", "clone"],
+ "http://tizen.org/privilege/calendar.write": ["add", "addBatch",
+ "update", "updateBatch", "remove", "removeBatch"]
},
_self;
var calendarManager;
// private
- function isValidType(type) {
- for (var t in _calendars) {
- if (type === t)
- return true;
- }
- return false;
- }
-
function loadCalendars(type) {
var calsStorage, defCalendar, id, i, item;
calsStorage = _calendarsStorage[type];
if (tizen1_utils.isEmptyObject(calsStorage)) {
- defCalendar = new Calendar(type, "DEF_CAL_" + type);
+ defCalendar = new Calendar(type, "Default " + type.toLowerCase() + " calendar");
_calendars[type][defCalendar.id] = defCalendar;
calsStorage[defCalendar.id] = new CalendarStorage(defCalendar);
for (i in calsStorage[id].items) {
item = calsStorage[id].items[i];
}
- _calendars[type][id] = new Calendar(type, calsStorage[id].name, calsStorage[id].items, id);
+ _calendars[type][id] = new Calendar(type, calsStorage[id].name,
+ calsStorage[id].items, id);
}
}
}
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- function _getCalendars() {
- var i, result = [];
+ t.CalendarManager("getCalendars", arguments);
- if (!isValidType(type))
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ window.setTimeout(function () {
+ var i, result = [];
if (tizen1_utils.isEmptyObject(_calendars[type])) {
loadCalendars(type);
for (i in _calendars[type]) {
result.push(_calendars[type][i]);
}
- window.setTimeout(function () {
- successCallback(result);
- }, 1);
+ successCallback(result);
} else if (errorCallback) {
- window.setTimeout(function () {
- errorCallback(new WebAPIError(errorcode.UNKNOWN_ERR));
- }, 1);
+ errorCallback(new WebAPIError(errorcode.UNKNOWN_ERR));
}
+ }, 1);
+ }
+
+ function getUnifiedCalendar(type) {
+ var id, calendar;
+
+ if (!_security.getUnifiedCalendar) {
+ throw new WebAPIException(errorcode.SECURITY_ERR);
+ }
+
+ t.CalendarManager("getUnifiedCalendar", arguments);
+
+ if (tizen1_utils.isEmptyObject(_calendars[type])) {
+ loadCalendars(type);
+ }
+
+ for (id in _calendars[type]) {
+ calendar = _calendars[type][id];
+ break;
}
- return tizen1_utils.validateTypeMismatch(successCallback, errorCallback, "calendar:getCalendars", _getCalendars);
+ if (calendar === undefined)
+ throw new WebAPIException(errorcode.NOT_FOUND_ERR);
+
+ return calendar;
}
function getDefaultCalendar(type) {
if (!_security.getDefaultCalendar) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- if (!isValidType(type))
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+
+ t.CalendarManager("getDefaultCalendar", arguments);
if (tizen1_utils.isEmptyObject(_calendars[type])) {
loadCalendars(type);
if (!_security.getCalendar) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- if (!isValidType(type) || !_isValidId(id))
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+
+ t.CalendarManager("getCalendar", arguments);
if (tizen1_utils.isEmptyObject(_calendars[type])) {
loadCalendars(type);
calendarManager = {
getCalendars: getCalendars,
+ getUnifiedCalendar: getUnifiedCalendar,
getDefaultCalendar: getDefaultCalendar,
getCalendar: getCalendar,
handleSubFeatures: handleSubFeatures
return calendarManager;
};
-Calendar = function (type, name, storageItems, id) {
+Calendar = function (type, name, storageItems, calendarId) {
var privateItems = {},
defaultWatchId = 0;
- id = id || Math.uuid(null, 16);
+ calendarId = calendarId || Math.uuid(null, 16);
// private
function createCalendarItem() {
if (typeof storageItem.startDate === 'string') {
calendarItem.startDate = new TZDate(new Date(storageItem.startDate));
}
-
+
calendarItem.duration = utils.copy(storageItem.duration);
calendarItem.location = utils.copy(storageItem.location);
calendarItem.geolocation = utils.copy(storageItem.geolocation);
}
function saveCalendarItems() {
- _calendarsStorage[type][id] || (_calendarsStorage[type][id] = {});
- _calendarsStorage[type][id].items = new CalendarItemsStorage(privateItems);
+ _calendarsStorage[type][calendarId] || (_calendarsStorage[type][calendarId] = {});
+ _calendarsStorage[type][calendarId].items = new CalendarItemsStorage(privateItems);
saveCalendars();
}
// public
function get(id) {
- var uid;
+ var item, uid, CalendarItemType, external = {};
if (!_security.get) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- uid = (type === "EVENT") ? id.uid : id;
+
+ t.Calendar("get", arguments);
+
+ if (type === "EVENT") {
+ if (typeof id !== "object") {
+ throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ }
+ uid = id.uid;
+ CalendarItemType = CalendarEvent;
+ } else {
+ uid = id;
+ CalendarItemType = CalendarTask;
+ }
+
if (!isValidCalendarItemId(uid))
throw new WebAPIException(errorcode.NOT_FOUND_ERR);
+ item = new CalendarItemType(privateItems[uid]);
+ external.id = privateItems[uid].id;
+ external.lastModificationDate = privateItems[uid].lastModificationDate;
+
+ item.__defineGetter__("calendarId", function () {
+ return calendarId;
+ });
+
+ item.__defineGetter__("id", function () {
+ return external.id;
+ });
+
+ item.__defineGetter__("lastModificationDate", function () {
+ return external.lastModificationDate;
+ });
- return privateItems[uid];
+ return item;
}
function add(item) {
- var uid;
+ var uid, external = {};
if (!_security.add) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
+ t.Calendar("add", arguments);
+
uid = Math.uuid(null, 16);
- privateItems[uid] = utils.copy(item);
+ privateItems[uid] = t.CalendarItem(item, "+");
if (type === "EVENT") {
- privateItems[uid].id = {uid: uid, rid: null};
+ privateItems[uid].id = new CalendarEventId(uid);
} else {
privateItems[uid].id = uid;
}
+ privateItems[uid].lastModificationDate = new TZDate();
+
+ external.id = privateItems[uid].id;
+ external.lastModificationDate = privateItems[uid].lastModificationDate;
saveCalendarItems();
// set the calendarId of the item
item.__defineGetter__("calendarId", function () {
- return id;
+ return calendarId;
});
item.__defineGetter__("id", function () {
- return privateItems[uid].id;
+ return external.id;
+ });
+
+ item.__defineGetter__("lastModificationDate", function () {
+ return external.lastModificationDate;
});
window.setTimeout(function () {
for (var i in _watchers) {
- _watchers[i].onitemsadded([utils.copy(item)]);
+ _watchers[i].onitemsadded([item]);
}
}, 1);
}
if (!_security.addBatch) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- tizen1_utils.validateCallbackType(successCallback, errorCallback);
- // typecoerce items
+ t.Calendar("addBatch", arguments, true);
window.setTimeout(function () {
- var i, uid;
+ var i, j, uid, external = [];
for (i in items) {
uid = Math.uuid(null, 16);
privateItems[uid] = utils.copy(items[i]);
if (type === "EVENT") {
- privateItems[uid].id = {uid: uid, rid: null};
+ privateItems[uid].id = new CalendarEventId(uid);
} else {
privateItems[uid].id = uid;
}
+ external[i] = {};
+ external[i].id = privateItems[uid].id;
+ external[i].lastModificationDate = new TZDate();
+
items[i].__defineGetter__("calendarId", function () {
- return id;
+ return calendarId;
});
items[i].__defineGetter__("id", function () {
- return privateItems[uid].id;
+ return external[i].id;
+ });
+
+ items[i].__defineGetter__("lastModificationDate", function () {
+ return external[i].lastModificationDate;
});
}
if (successCallback) {
successCallback(items);
}
- for (i in _watchers) {
- _watchers[i].onitemsadded(items);
+ for (j in _watchers) {
+ _watchers[j].onitemsadded(items);
}
}, 1);
}
if (!_security.update) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- // typecoerce item, updateAllInstances
+
+ t.Calendar("update", arguments);
uid = (type === "EVENT") ? item.id.uid : item.id;
if (!isValidCalendarItemId(uid))
saveCalendarItems();
}
- function updateBatch(items, successCallback, errorCallback, updateAllInstances) {
+ function updateBatch(items, successCallback, errorCallback,
+ updateAllInstances) {
if (!_security.updateBatch) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- tizen1_utils.validateCallbackType(successCallback, errorCallback);
- // typecoerce items updateAllInstances
- if (!tizen1_utils.isValidArray(items) ||
- (items.length === 0)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
+ t.Calendar("updateBatch", arguments, true);
window.setTimeout(function () {
var i, j, attr, calendarItem, updatedItems = [], uid;
throw new WebAPIException(errorcode.SECURITY_ERR);
}
+ t.Calendar("remove", arguments);
+
uid = (type === "EVENT") ? id.uid : id;
for (i in privateItems) {
if (i === uid) {
if (!_security.removeBatch) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- tizen1_utils.validateCallbackType(successCallback, errorCallback);
- if (!tizen1_utils.isValidArray(ids) || (ids.length === 0)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
+ t.Calendar("removeBatch", arguments, true);
window.setTimeout(function () {
var i, uid;
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- function _find() {
+ t.Calendar("find", arguments, true);
+
+ window.setTimeout(function () {
var i, calendarItems = [], result = [];
for (i in privateItems) {
if (calendarItems.length > 0) {
result = tizen1_utils.query(calendarItems, filter, sortMode);
}
- window.setTimeout(function () {
- successCallback(result);
- }, 1);
- }
-
- tizen1_utils.validateTypeMismatch(successCallback, errorCallback, "calendar:find", _find);
+ successCallback(result);
+ }, 1);
}
function addChangeListener(successCallback) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- successCallback = t.CalendarChangeCallback(successCallback);
+ t.Calendar("addChangeListener", arguments);
watchId = ++defaultWatchId;
_watchers[watchId] = successCallback;
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- watchId = t.long(watchId);
-
if (!_watchers[watchId])
return;
loadCalendarItems(type, privateItems, storageItems);
this.__defineGetter__("id", function () {
- return id;
+ return calendarId;
});
this.__defineGetter__("name", function () {
return name;
errorcode = require('ripple/platform/tizen/2.0/errorcode'),
WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError'),
WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
- t = require('ripple/platform/tizen/2.0/typedef'),
+ t = require('ripple/platform/tizen/2.0/typecast'),
TypeCoerce = require('ripple/platform/tizen/2.0/typecoerce'),
tizen1_utils = require('ripple/platform/tizen/2.0/tizen1_utils'),
_DB_CALL_KEY = "tizen1-db-callhistory",
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- if (!(new TypeCoerce(t.SuccessCallback)).match(successCallback)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if ((arguments.length > 1) && errorCallback !== null && !(new TypeCoerce(t.ErrorCallback)).match(errorCallback)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if ((arguments.length > 2) && filter !== null && !(new TypeCoerce(t.AbstractFilter)).match(filter)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if ((arguments.length > 3) && sortMode !== null && !(new TypeCoerce(t.SortMode)).match(sortMode)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
-
- if ((arguments.length > 4) && limit !== null && !(new TypeCoerce(t['unsigned long'])).match(limit)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if ((arguments.length > 5) && offset !== null && !(new TypeCoerce(t['unsigned long'])).match(offset)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
+ t.CallHistory("find", arguments);
filterResults = tizen1_utils.copy(_data.callHistory);
if (filter !== null && filter !== undefined) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- if (!_isValidCallHistoryEntry(entry)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
+ t.CallHistory("remove", arguments);
_data.callHistory = _data.callHistory.filter(function (element) {
return utils.some(element, function (value, key) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- if (tizen1_utils.isValidArray(entries) === false) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if ((arguments.length > 1) && successCallback !== null && !(new TypeCoerce(t.SuccessCallback)).match(successCallback)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if ((arguments.length > 2) && errorCallback !== null && !(new TypeCoerce(t.ErrorCallback)).match(errorCallback)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- for (i = 0; i < entries.length; i++) {
- if (!_isValidCallHistoryEntry(entries[i])) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- }
+ t.CallHistory("removeBatch", arguments);
setTimeout(function () {
isFound = entries.every(function (element) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- if ((arguments.length > 0) && successCallback !== null && !(new TypeCoerce(t.SuccessCallback)).match(successCallback)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if ((arguments.length > 1) && errorCallback !== null && !(new TypeCoerce(t.ErrorCallback)).match(errorCallback)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
+ t.CallHistory("removeAll", arguments);
for (i = 0; i < _data.callHistory.length; i++) {
rtn.push(_rtnEntry(_data.callHistory[i]));
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- if (observerObj === null || typeof observerObj !== 'object' ||
- (observerObj.hasOwnProperty("onadded") && typeof observerObj.onadded !== 'function') ||
- (observerObj.hasOwnProperty("onremoved") && typeof observerObj.onremoved !== 'function') ||
- (observerObj.hasOwnProperty("onchanged") && typeof observerObj.onchanged !== 'function')) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
+ t.CallHistory("addChangeListener", arguments);
_data.observers[handle] = observerObj;
if (!_security.removeChangeListener) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- if (typeof handle !== 'number') {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (_data.observers[handle]) {
- delete _data.observers[handle];
- }
- else {
- throw new WebAPIException(errorcode.INVALID_VALUES_ERR);
- }
+ if (!_data.observers[handle])
+ return;
+
+ delete _data.observers[handle];
};
this.handleSubFeatures = function (subFeatures) {
function setSecurity(method) {
});
define('ripple/platform/tizen/2.0/contact', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
dbStorage: {}
},
_security = {
- "http://tizen.org/privilege/contact.read": ["getAddressBooks", "getDefaultAddressBook",
- "getAddressBook", "get", "find", "addChangeListener", "removeChangeListener",
- "getGroup", "getGroups", "clone"],
+ "http://tizen.org/privilege/contact.read": ["getAddressBooks",
+ "getUnifiedAddressBook", "getDefaultAddressBook",
+ "getAddressBook", "get", "find", "addChangeListener",
+ "removeChangeListener", "getGroup", "getGroups", "clone"],
"http://tizen.org/privilege/contact.write": ["add", "addBatch",
"update", "updateBatch", "remove", "removeBatch", "addGroup",
"updateGroup", "removeGroup", "link", "unlink"]
_self;
function _get() {
- _data.dbStorage = db.retrieveObject(_data.DB_CONTACT_KEY) || {addressBooks: [], persons: {}};
+ _data.dbStorage = db.retrieveObject(_data.DB_CONTACT_KEY) ||
+ {addressBooks: [], persons: {}};
}
function _save() {
t.ContactManager("getAddressBooks", arguments);
+ window.setTimeout(function () {
+ if (_data.addressBooks.length === 0) {
+ loadAddressBooks();
+ }
+ successCallback(_data.addressBooks);
+ }, 1);
+ }
+
+ function getUnifiedAddressBook() {
+ if (!_security.getUnifiedAddressBook) {
+ throw new WebAPIException(errorcode.SECURITY_ERR);
+ }
if (_data.addressBooks.length === 0) {
loadAddressBooks();
}
- successCallback(_data.addressBooks);
+ return _data.addressBooks[0];
}
function getDefaultAddressBook() {
}
function find(successCallback, errorCallback, filter, sortMode) {
- var i, matched = [], result = [];
-
if (!_security.find) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- t.ContactManager("find", arguments);
+ t.ContactManager("find", arguments, true);
- if (filter) {
- switch (_filterType(filter)) {
- case 0:
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ window.setTimeout(function () {
+ var i, matched = [], result = [];
+
+ if (filter) {
+ switch (_filterType(filter)) {
+ case 0:
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.INVALID_VALUES_ERR));
+ }
+ return;
- case 1:
- //TODO:
- //"compositeFilter doesn't support"
- throw new WebAPIException(errorcode.NOT_SUPPORTED_ERR);
+ case 1:
+ //TODO:
+ //"compositeFilter doesn't support"
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.NOT_SUPPORTED_ERR));
+ }
+ return;
- case 2:
- case 3:
- break;
+ case 2:
+ case 3:
+ break;
+ }
}
- }
- if (filter === null || filter === undefined) {
- utils.forEach(_data.persons, function (person) {
- matched.push(person);
- });
- } else {
- switch (filter.attributeName) {
- case "id":
- case "displayName":
- case "photoURI":
- case "ringtoneURI":
- case "displayContactId":
- matched = tizen1_utils.matchAttributeFilter(_data.persons,
- filter.attributeName, filter.matchFlag, filter.matchValue);
- break;
+ if (filter === null || filter === undefined) {
+ utils.forEach(_data.persons, function (person) {
+ matched.push(person);
+ });
+ } else {
+ switch (filter.attributeName) {
+ case "id":
+ case "displayName":
+ case "photoURI":
+ case "ringtoneURI":
+ case "displayContactId":
+ matched = tizen1_utils.matchAttributeFilter(_data.persons,
+ filter.attributeName, filter.matchFlag, filter.matchValue);
+ break;
- case "contactCount":
- if (filter.matchFlag !== "EXACTLY" || typeof filter.matchValue !== "number") {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- matched = tizen1_utils.matchAttributeFilter(_data.persons,
- filter.attributeName, filter.matchFlag, filter.matchValue);
- break;
+ case "contactCount":
+ if ((filter.matchFlag !== "EXACTLY") ||
+ (typeof filter.matchValue !== "number")) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.INVALID_VALUES_ERR));
+ }
+ return;
+ }
+ matched = tizen1_utils.matchAttributeFilter(_data.persons,
+ filter.attributeName, filter.matchFlag, filter.matchValue);
+ break;
- case "hasPhoneNumber":
- case "hasEmail":
- case "isFavorite":
- if (filter.matchFlag !== "EXACTLY" || typeof filter.matchValue !== "boolean") {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ case "hasPhoneNumber":
+ case "hasEmail":
+ case "isFavorite":
+ if ((filter.matchFlag !== "EXACTLY") ||
+ (typeof filter.matchValue !== "boolean")) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.INVALID_VALUES_ERR));
+ }
+ return;
+ }
+ matched = tizen1_utils.matchAttributeBooleanFilter(_data.persons,
+ filter.attributeName, filter.matchValue);
+ break;
+
+ default:
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.INVALID_VALUES_ERR));
+ }
+ return;
}
- matched = tizen1_utils.matchAttributeBooleanFilter(_data.persons,
- filter.attributeName, filter.matchValue);
- break;
+ }
- default:
- break;
+ if (sortMode) {
+ _sort(matched, sortMode);
}
- }
- if (sortMode) {
- _sort(matched, sortMode);
- }
+ for (i in matched) {
+ result.push(new Person(matched[i]));
+ }
- for (i in matched) {
- result.push(new Person(matched[i]));
- }
- successCallback(result);
+ successCallback(result);
+ }, 1);
}
function addChangeListener(successCallback) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- t.ContactManager("removeChangeListener", arguments);
+ if (!_data.contactData.listeners[watchId])
+ return;
- if (_data.contactData.listeners[watchId] === undefined) {
- throw new WebAPIException(errorcode.NOT_FOUND_ERR);
- }
delete _data.contactData.listeners[watchId];
}
contact = {
getAddressBooks: getAddressBooks,
+ getUnifiedAddressBook: getUnifiedAddressBook,
getDefaultAddressBook: getDefaultAddressBook,
getAddressBook: getAddressBook,
}
function find(successCallback, errorCallback, filter, sortMode) {
- var result = [], begin, end, i,
- atr, _re, errFlag = false, _rangeMatch, low, high, matched,
- _existMatch, _arrayMatch;
-
if (!_security.find) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- t.AddressBook("find", arguments);
+ t.AddressBook("find", arguments, true);
- if (filter) {
- switch (_filterType(filter)) {
- case 0:
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- case 1:
- //TODO:
- //"compositeFilter doesn't support"
- throw new WebAPIException(errorcode.NOT_SUPPORTED_ERR);
- case 2:
- case 3:
- break;
- }
- }
+ window.setTimeout(function () {
+ var result = [], begin, end, i, atr, _re, errFlag = false,
+ _rangeMatch, low, high, matched, _existMatch, _arrayMatch;
- /* return all contacts if no filter argument */
- if (filter === null || filter === undefined) {
- utils.forEach(privateData.contacts, function (contact) {
- result.push(new Contact(contact));
- });
- window.setTimeout(function () {
- successCallback(result);
- }, 1);
- return;
- }
+ if (filter) {
+ switch (_filterType(filter)) {
+ case 0:
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.INVALID_VALUES_ERR));
+ }
+ return;
- /* check composition of filter.attributeName */
- switch (filter.attributeName) {
- case "id" :
- case "personId" :
- case "addressBookId" :
- case "name.prefix" :
- case "name.suffix" :
- case "name.firstName" :
- case "name.middleName" :
- case "name.lastName" :
- case "name.phoneticFirstName" :
- case "name.phoneticLastName" :
- case "name.displayName" :
- case "account.accountServiceId" :
- case "account.contactURI" :
- case "photoURI" :
- case "ringtoneURI" :
- matched = tizen1_utils.matchAttributeFilter(privateData.contacts,
- filter.attributeName, filter.matchFlag, filter.matchValue);
- break;
+ case 1:
+ //TODO:
+ //"compositeFilter doesn't support"
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.NOT_SUPPORTED_ERR));
+ }
+ return;
- case "name.nicknames" :
- case "notes" :
- case "groupIds" :
- matched = tizen1_utils.matchAttributeArrayFilter(privateData.contacts,
- filter.attributeName, filter.matchFlag, filter.matchValue);
- break;
+ case 2:
+ case 3:
+ break;
+ }
+ }
- case "addresses.country" :
- case "addresses.region" :
- case "addresses.city" :
- case "addresses.streetAddress" :
- case "addresses.additionalInformation" :
- case "addresses.postalCode" :
- case "phoneNumbers.number" :
- case "emails.email" :
- case "anniversaries.label" :
- case "organizations.name" :
- case "organizations.department" :
- case "organizations.title" :
- case "organizations.role" :
- case "organizations.logoURI" :
- case "urls.url" :
- case "urls.type" :
- atr = filter.attributeName.split(".");
- _existMatch = function (obj) {
- return (obj[atr[0]] !== undefined);
- };
+ /* return all contacts if no filter argument */
+ if (filter === null || filter === undefined) {
+ utils.forEach(privateData.contacts, function (contact) {
+ result.push(new Contact(contact));
+ });
- if (filter.matchValue === undefined || filter.matchFlag === "EXISTS") {
- matched = utils.filter(privateData.contacts, _existMatch);
- break;
+ successCallback(result);
+ return;
}
- errFlag = false;
-
- switch (filter.matchFlag)
- {
- case "EXACTLY":
- _re = new RegExp("^" + filter.matchValue + "$");
- break;
- case "FULLSTRING":
- _re = new RegExp("^" + filter.matchValue + "$", "i");
- break;
- case "CONTAINS":
- _re = new RegExp(filter.matchValue, "i");
- break;
- case "STARTSWITH":
- _re = new RegExp("^" + filter.matchValue, "i");
- break;
- case "ENDSWITH":
- _re = new RegExp(filter.matchValue + "$", "i");
+ /* check composition of filter.attributeName */
+ switch (filter.attributeName) {
+ case "id" :
+ case "personId" :
+ case "addressBookId" :
+ case "name.prefix" :
+ case "name.suffix" :
+ case "name.firstName" :
+ case "name.middleName" :
+ case "name.lastName" :
+ case "name.phoneticFirstName" :
+ case "name.phoneticLastName" :
+ case "name.displayName" :
+ case "account.accountServiceId" :
+ case "account.contactURI" :
+ case "photoURI" :
+ case "ringtoneURI" :
+ matched = tizen1_utils.matchAttributeFilter(privateData.contacts,
+ filter.attributeName, filter.matchFlag, filter.matchValue);
break;
- default:
- errFlag = true;
- }
- if (errFlag) {
- matched = [];
+ case "name.nicknames" :
+ case "notes" :
+ case "groupIds" :
+ matched = tizen1_utils.matchAttributeArrayFilter(privateData.contacts,
+ filter.attributeName, filter.matchFlag, filter.matchValue);
break;
- }
- _arrayMatch = function (obj) {
- return (obj[atr[0]].some(function (o) {
- if (typeof o[atr[1]] !== "string") {
- return false;
- } else {
- return (o[atr[1]].search(_re) !== -1);
- }
- }));
- };
+ case "addresses.country" :
+ case "addresses.region" :
+ case "addresses.city" :
+ case "addresses.streetAddress" :
+ case "addresses.additionalInformation" :
+ case "addresses.postalCode" :
+ case "phoneNumbers.number" :
+ case "emails.email" :
+ case "anniversaries.label" :
+ case "organizations.name" :
+ case "organizations.department" :
+ case "organizations.title" :
+ case "organizations.role" :
+ case "organizations.logoURI" :
+ case "urls.url" :
+ case "urls.type" :
+ atr = filter.attributeName.split(".");
+ _existMatch = function (obj) {
+ return (obj[atr[0]] !== undefined);
+ };
- matched = utils.filter(privateData.contacts, _arrayMatch);
- break;
+ if (filter.matchValue === undefined || filter.matchFlag === "EXISTS") {
+ matched = utils.filter(privateData.contacts, _existMatch);
+ break;
+ }
- case "addresses.types" :
- case "phoneNumbers.types" :
- case "emails.types" :
- atr = filter.attributeName.split(".");
- _existMatch = function (obj) {
- return (obj[atr[0]].some(function (o) {
- return (o[atr[1]] !== undefined);
- }));
- };
+ errFlag = false;
- if (filter.matchValue === undefined || filter.matchFlag === "EXISTS") {
- matched = utils.filter(privateData.contacts, _existMatch);
- break;
- }
+ switch (filter.matchFlag)
+ {
+ case "EXACTLY":
+ _re = new RegExp("^" + filter.matchValue + "$");
+ break;
+ case "FULLSTRING":
+ _re = new RegExp("^" + filter.matchValue + "$", "i");
+ break;
+ case "CONTAINS":
+ _re = new RegExp(filter.matchValue, "i");
+ break;
+ case "STARTSWITH":
+ _re = new RegExp("^" + filter.matchValue, "i");
+ break;
+ case "ENDSWITH":
+ _re = new RegExp(filter.matchValue + "$", "i");
+ break;
+ default:
+ errFlag = true;
+ }
- errFlag = false;
+ if (errFlag) {
+ matched = [];
+ break;
+ }
- switch (filter.matchFlag) {
- case "EXACTLY":
- _re = new RegExp("^" + filter.matchValue + "$");
- break;
- case "FULLSTRING":
- _re = new RegExp("^" + filter.matchValue + "$", "i");
- break;
- case "CONTAINS":
- _re = new RegExp(filter.matchValue, "i");
- break;
- case "STARTSWITH":
- _re = new RegExp("^" + filter.matchValue, "i");
- break;
- case "ENDSWITH":
- _re = new RegExp(filter.matchValue + "$", "i");
- break;
- default:
- errFlag = true;
- }
+ _arrayMatch = function (obj) {
+ return (obj[atr[0]].some(function (o) {
+ if (typeof o[atr[1]] !== "string") {
+ return false;
+ } else {
+ return (o[atr[1]].search(_re) !== -1);
+ }
+ }));
+ };
- if (errFlag) {
- matched = [];
+ matched = utils.filter(privateData.contacts, _arrayMatch);
break;
- }
- _arrayMatch = function (obj) {
- return (obj[atr[0]].some(function (o) {
- if (!tizen1_utils.isValidArray(o[atr[1]])) {
- return false;
- } else {
- return (o[atr[1]].some(function (t) {
- return (t.search(_re) !== -1);
- }));
- }
- }));
- };
+ case "addresses.types" :
+ case "phoneNumbers.types" :
+ case "emails.types" :
+ atr = filter.attributeName.split(".");
+ _existMatch = function (obj) {
+ return (obj[atr[0]].some(function (o) {
+ return (o[atr[1]] !== undefined);
+ }));
+ };
- matched = utils.filter(privateData.contacts, _arrayMatch);
- break;
+ if (filter.matchValue === undefined || filter.matchFlag === "EXISTS") {
+ matched = utils.filter(privateData.contacts, _existMatch);
+ break;
+ }
- case "anniversaries.date" :
- low = filter.initialValue;
- high = filter.endValue;
- atr = filter.attributeName.split(".");
+ errFlag = false;
- if (low !== undefined && low !== null) {
- if (!tizen1_utils.isValidDate(low)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ switch (filter.matchFlag) {
+ case "EXACTLY":
+ _re = new RegExp("^" + filter.matchValue + "$");
+ break;
+ case "FULLSTRING":
+ _re = new RegExp("^" + filter.matchValue + "$", "i");
+ break;
+ case "CONTAINS":
+ _re = new RegExp(filter.matchValue, "i");
+ break;
+ case "STARTSWITH":
+ _re = new RegExp("^" + filter.matchValue, "i");
+ break;
+ case "ENDSWITH":
+ _re = new RegExp(filter.matchValue + "$", "i");
+ break;
+ default:
+ errFlag = true;
}
- }
- if (high !== undefined && high !== null) {
- if (!tizen1_utils.isValidDate(high)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+
+ if (errFlag) {
+ matched = [];
+ break;
}
- }
- _rangeMatch = function (obj) {
- var isMatched = true;
- if (low !== null && low !== undefined) {
- if (!tizen1_utils.isValidArray(obj[atr[0]])) {
- isMatched = false;
- } else {
- isMatched = (obj[atr[0]].some(function (o) {
- return (o[atr[1]] >= low);
- }));
+ _arrayMatch = function (obj) {
+ return (obj[atr[0]].some(function (o) {
+ if (!tizen1_utils.isValidArray(o[atr[1]])) {
+ return false;
+ } else {
+ return (o[atr[1]].some(function (t) {
+ return (t.search(_re) !== -1);
+ }));
+ }
+ }));
+ };
+
+ matched = utils.filter(privateData.contacts, _arrayMatch);
+ break;
+
+ case "anniversaries.date" :
+ low = filter.initialValue;
+ high = filter.endValue;
+ atr = filter.attributeName.split(".");
+
+ _rangeMatch = function (obj) {
+ var isMatched = true;
+ if (low !== null && low !== undefined) {
+ if (!tizen1_utils.isValidArray(obj[atr[0]])) {
+ isMatched = false;
+ } else {
+ isMatched = (obj[atr[0]].some(function (o) {
+ return (o[atr[1]] >= low);
+ }));
+ }
}
- }
- if (isMatched && (high !== null && high !== undefined)) {
- if (!tizen1_utils.isValidArray(obj[atr[0]])) {
- isMatched = false;
- } else {
- isMatched = (obj[atr[0]].some(function (o) {
- return (o[atr[1]] <= high);
- }));
+ if (isMatched && (high !== null && high !== undefined)) {
+ if (!tizen1_utils.isValidArray(obj[atr[0]])) {
+ isMatched = false;
+ } else {
+ isMatched = (obj[atr[0]].some(function (o) {
+ return (o[atr[1]] <= high);
+ }));
+ }
}
- }
- return isMatched;
- };
+ return isMatched;
+ };
- matched = utils.filter(privateData.contacts, _rangeMatch);
- break;
+ matched = utils.filter(privateData.contacts, _rangeMatch);
+ break;
- case "addresses.isDefault" :
- case "phoneNumbers.isDefault" :
- case "emails.isDefault" :
- break;
+ case "addresses.isDefault" :
+ case "phoneNumbers.isDefault" :
+ case "emails.isDefault" :
+ break;
- case "isFavorite" :
- if (filter.matchFlag !== "EXACTLY" || typeof filter.matchValue !== "boolean") {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- } else {
- matched = tizen1_utils.matchAttributeBooleanFilter(privateData.contacts,
- filter.attributeName, filter.matchValue);
- }
- break;
+ case "isFavorite" :
+ if (filter.matchFlag !== "EXACTLY" || typeof filter.matchValue !== "boolean") {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.INVALID_VALUES_ERR));
+ }
+ return;
+ } else {
+ matched = tizen1_utils.matchAttributeBooleanFilter(privateData.contacts,
+ filter.attributeName, filter.matchValue);
+ }
+ break;
- case "birthday" :
- begin = filter.initialValue;
- end = filter.endValue;
+ case "birthday" :
+ begin = filter.initialValue;
+ end = filter.endValue;
- if (begin !== null && begin !== undefined) {
- if (!tizen1_utils.isValidDate(begin)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- }
+ matched = tizen1_utils.matchAttributeRangeFilter(privateData.contacts,
+ filter.attributeName, begin, end);
+ break;
- if (end !== null && end !== undefined) {
- if (!tizen1_utils.isValidDate(end)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ default:
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.INVALID_VALUES_ERR));
}
+ return;
}
- matched = tizen1_utils.matchAttributeRangeFilter(privateData.contacts,
- filter.attributeName, begin, end);
- break;
-
- default:
- throw new WebAPIException(errorcode.INVALID_VALUES_ERR);
- }
-
- if (sortMode) {
- _sort(matched, sortMode);
- }
+ if (sortMode) {
+ _sort(matched, sortMode);
+ }
- for (i in matched) {
- result.push(new Contact(matched[i]));
- }
+ for (i in matched) {
+ result.push(new Contact(matched[i]));
+ }
- window.setTimeout(function () {
successCallback(result);
}, 1);
}
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- t.AddressBook("removeChangeListener", arguments);
+ if (!privateData.listeners[watchId])
+ return;
- if (privateData.listeners[watchId] === undefined) {
- throw new WebAPIException(errorcode.NOT_FOUND_ERR);
- }
delete privateData.listeners[watchId];
}
};
Person = function (personInitDict) {
- var id;
+ var person = {};
function hasContactMethod(method) {
var idab, idc, contact, count = 0;
for (idab in _data.contacts) {
for (idc in _data.contacts[idab]) {
contact = _data.contacts[idab][idc];
- if (contact.personId === id) {
+ if (contact.personId === person.id) {
count += contact[method].length;
}
}
return (count !== 0);
}
+ person.id = personInitDict.id || Math.uuid(null, 16);
+ person.isFavorite = personInitDict.isFavorite || false;
+ person.photoURI = personInitDict.photoURI || null;
+ person.ringtoneURI = personInitDict.ringtoneURI || null;
+ person.displayContactId = personInitDict.displayContactId;
+
this.__defineGetter__("id", function () {
- return id;
+ return person.id;
});
this.__defineGetter__("displayName", function () {
for (idab in _data.contacts) {
for (idc in _data.contacts[idab]) {
- if (_data.contacts[idab][idc].personId === id) {
+ if (_data.contacts[idab][idc].personId === person.id) {
++contactCount;
}
}
return hasContactMethod("emails");
});
- id = personInitDict.id || Math.uuid(null, 16);
+ this.__defineGetter__("isFavorite", function () {
+ return person.isFavorite;
+ });
+ this.__defineSetter__("isFavorite", function (val) {
+ try {
+ person.isFavorite = t.boolean(val);
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("photoURI", function () {
+ return person.photoURI;
+ });
+ this.__defineSetter__("photoURI", function (val) {
+ try {
+ person.photoURI = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("ringtoneURI", function () {
+ return person.ringtoneURI;
+ });
+ this.__defineSetter__("ringtoneURI", function (val) {
+ try {
+ person.ringtoneURI = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
- this.isFavorite = personInitDict.isFavorite || false;
- this.photoURI = personInitDict.photoURI || null;
- this.ringtoneURI = personInitDict.ringtoneURI || null;
- this.displayContactId = personInitDict.displayContactId;
+ this.__defineGetter__("displayContactId", function () {
+ return person.displayContactId;
+ });
+ this.__defineSetter__("displayContactId", function (val) {
+ try {
+ person.displayContactId = t.ContactId(val);
+ } catch (e) {
+ }
+ });
this.link = function (personId) {
if (!_security.link) {
throw new WebAPIException(errorcode.NOT_FOUND_ERR);
}
- _replacePerson(personId, id);
+ _replacePerson(personId, person.id);
_save();
};
if (contact === undefined) {
throw new WebAPIException(errorcode.NOT_FOUND_ERR);
}
- if (contact.personId !== id) {
+ if (contact.personId !== person.id) {
throw new WebAPIException(errorcode.UNKNOWN_ERR);
}
errorcode = require('ripple/platform/tizen/2.0/errorcode'),
t = require('ripple/platform/tizen/2.0/typecast'),
tizen1_utils = require('ripple/platform/tizen/2.0/tizen1_utils'),
+ SimpleCoordinates = require('ripple/platform/tizen/2.0/SimpleCoordinates'),
WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError'),
WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
Content,
};
ContentDirectory = function (contentDirectoryInitDict) {
- var id, directoryURI, title, storageType, modifiedDate;
+ var contentDirectory = {};
- id = contentDirectoryInitDict.id || null;
- directoryURI = contentDirectoryInitDict.directoryURI || null;
- title = contentDirectoryInitDict.title || "";
- storageType = contentDirectoryInitDict.storageType || "INTERNAL";
- modifiedDate = contentDirectoryInitDict.modifiedDate ?
+ contentDirectory.id = contentDirectoryInitDict.id || null;
+ contentDirectory.directoryURI = contentDirectoryInitDict.directoryURI || null;
+ contentDirectory.title = contentDirectoryInitDict.title || "";
+ contentDirectory.storageType = contentDirectoryInitDict.storageType || "INTERNAL";
+ contentDirectory.modifiedDate = contentDirectoryInitDict.modifiedDate ?
new Date(contentDirectoryInitDict.modifiedDate) : null;
this.__defineGetter__("id", function () {
- return id;
+ return contentDirectory.id;
});
this.__defineGetter__("directoryURI", function () {
- return directoryURI;
+ return contentDirectory.directoryURI;
});
this.__defineGetter__("title", function () {
- return title;
+ return contentDirectory.title;
});
this.__defineGetter__("storageType", function () {
- return storageType;
+ return contentDirectory.storageType;
});
this.__defineGetter__("modifiedDate", function () {
- return modifiedDate;
+ return contentDirectory.modifiedDate;
});
};
};
Content = function (contentInitDict) {
- var editableAttributes, id, type, mimeType, title, contentURI,
- thumbnailURIs, releaseDate, modifiedDate, size;
-
- editableAttributes = contentInitDict.editableAttributes || [];
- id = contentInitDict.id || Math.uuid(null, 16);
- type = contentInitDict.type || "IMAGE";
- mimeType = contentInitDict.mimeType || "";
- title = contentInitDict.title || "";
- contentURI = contentInitDict.contentURI || "";
- thumbnailURIs = contentInitDict.thumbnailURIs || null;
- releaseDate = contentInitDict.releaseDate ?
+ var content = {};
+
+ content.editableAttributes = contentInitDict.editableAttributes || [];
+ content.id = contentInitDict.id || Math.uuid(null, 16);
+ content.name = contentInitDict.name || "";
+ content.type = contentInitDict.type || "IMAGE";
+ content.mimeType = contentInitDict.mimeType || "";
+ content.title = contentInitDict.title || "";
+ content.contentURI = contentInitDict.contentURI || "";
+ content.thumbnailURIs = contentInitDict.thumbnailURIs || null;
+ content.releaseDate = contentInitDict.releaseDate ?
new Date(contentInitDict.releaseDate) : null;
- modifiedDate = contentInitDict.modifiedDate ?
+ content.modifiedDate = contentInitDict.modifiedDate ?
new Date(contentInitDict.modifiedDate) : null;
- size = contentInitDict.size || 0;
- this.name = contentInitDict.name || "";
- this.description = contentInitDict.description || null;
- this.rating = contentInitDict.rating || 0;
+ content.size = contentInitDict.size || 0;
+ content.description = contentInitDict.description || null;
+ content.rating = contentInitDict.rating || 0;
this.__defineGetter__("editableAttributes", function () {
- return editableAttributes;
+ return content.editableAttributes;
});
this.__defineGetter__("id", function () {
- return id;
+ return content.id;
+ });
+
+ this.__defineGetter__("name", function () {
+ return content.name;
+ });
+ this.__defineSetter__("name", function (val) {
+ try {
+ content.name = t.DOMString(val);
+ } catch (e) {
+ }
});
this.__defineGetter__("type", function () {
- return type;
+ return content.type;
});
this.__defineGetter__("mimeType", function () {
- return mimeType;
+ return content.mimeType;
});
this.__defineGetter__("title", function () {
- return title;
+ return content.title;
});
this.__defineGetter__("contentURI", function () {
- return contentURI;
+ return content.contentURI;
});
this.__defineGetter__("thumbnailURIs", function () {
- return thumbnailURIs;
+ return content.thumbnailURIs;
});
this.__defineGetter__("releaseDate", function () {
- return releaseDate;
+ return content.releaseDate;
});
this.__defineGetter__("modifiedDate", function () {
- return modifiedDate;
+ return content.modifiedDate;
});
this.__defineGetter__("size", function () {
- return size;
+ return content.size;
+ });
+
+ this.__defineGetter__("description", function () {
+ return content.description;
+ });
+ this.__defineSetter__("description", function (val) {
+ try {
+ content.description = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ this.__defineGetter__("rating", function () {
+ return content.rating;
+ });
+ this.__defineSetter__("rating", function (val) {
+ try {
+ val = t.unsigned_long(val);
+ if ((val < 0) || (val > 10))
+ return;
+ content.rating = val;
+ } catch (e) {
+ }
});
};
VideoContentInternal = function (videoContentInitDict) {
ContentInternal.call(this, videoContentInitDict);
- this.geolocation = videoContentInitDict.geolocation || null;
this.album = videoContentInitDict.album || null;
this.artists = videoContentInitDict.artists || null;
this.duration = videoContentInitDict.duration || 0;
this.width = videoContentInitDict.width || 0;
this.height = videoContentInitDict.height || 0;
+ this.geolocation = null;
+
+ if (videoContentInitDict.geolocation) {
+ this.geolocation = new SimpleCoordinates(
+ videoContentInitDict.geolocation.latitude || null,
+ videoContentInitDict.geolocation.longitude || null);
+ }
};
VideoContent = function (videoContentInitDict) {
- var album, artists, duration, width, height;
+ var videoContent = {};
Content.call(this, videoContentInitDict);
- album = videoContentInitDict.album || null;
- artists = videoContentInitDict.artists || null;
- duration = videoContentInitDict.duration || 0;
- width = videoContentInitDict.width || 0;
- height = videoContentInitDict.height || 0;
- this.geolocation = videoContentInitDict.geolocation || null;
+ videoContent.album = videoContentInitDict.album || null;
+ videoContent.artists = videoContentInitDict.artists || null;
+ videoContent.duration = videoContentInitDict.duration || 0;
+ videoContent.width = videoContentInitDict.width || 0;
+ videoContent.height = videoContentInitDict.height || 0;
+ videoContent.geolocation = null;
+
+ if (videoContentInitDict.geolocation) {
+ videoContent.geolocation = new SimpleCoordinates(
+ videoContentInitDict.geolocation.latitude,
+ videoContentInitDict.geolocation.longitude);
+ }
+
+ this.__defineGetter__("geolocation", function () {
+ return videoContent.geolocation;
+ });
+ this.__defineSetter__("geolocation", function (val) {
+ try {
+ videoContent.geolocation = t.SimpleCoordinates(val, "?");
+ } catch (e) {
+ }
+ });
this.__defineGetter__("album", function () {
- return album;
+ return videoContent.album;
});
this.__defineGetter__("artists", function () {
- return artists;
+ return videoContent.artists;
});
this.__defineGetter__("duration", function () {
- return duration;
+ return videoContent.duration;
});
this.__defineGetter__("width", function () {
- return width;
+ return videoContent.width;
});
this.__defineGetter__("height", function () {
- return height;
+ return videoContent.height;
});
};
this.genres = audioContentInitDict.genres || null;
this.artists = audioContentInitDict.artists || null;
this.composers = audioContentInitDict.composers || null;
- this.lyrics = audioContentInitDict.lyrics || null;
+ this.lyrics = audioContentInitDict.lyrics ?
+ new AudioContentLyrics(audioContentInitDict.lyrics) : null;
this.copyright = audioContentInitDict.copyright || null;
this.bitrate = audioContentInitDict.bitrate || 0;
this.trackNumber = audioContentInitDict.trackNumber || null;
};
AudioContentLyrics = function (lyrics) {
- var type, texts, timestamps;
+ var audioContentLyrics = {};
- type = lyrics.type;
- texts = lyrics.texts;
- if (lyrics.type === "UNSYNCHRONIZED")
- timestamps = lyrics.timestamps;
+ audioContentLyrics.type = lyrics.type;
+ audioContentLyrics.texts = lyrics.texts;
+ audioContentLyrics.timestamps = (lyrics.type === "SYNCHRONIZED") ?
+ lyrics.timestamps : undefined;
this.__defineGetter__("type", function () {
- return type;
+ return audioContentLyrics.type;
});
this.__defineGetter__("texts", function () {
- return texts;
+ return audioContentLyrics.texts;
});
- if (timestamps) {
- this.__defineGetter__("timestamps", function () {
- return timestamps;
- });
- }
+ this.__defineGetter__("timestamps", function () {
+ return audioContentLyrics.timestamps;
+ });
};
AudioContent = function (audioContentInitDict) {
- var album, genres, artists, composers, lyrics, copyright, bitrate,
- trackNumber, duration;
+ var audioContent = {};
Content.call(this, audioContentInitDict);
- album = audioContentInitDict.album || null;
- genres = audioContentInitDict.genres || null;
- artists = audioContentInitDict.artists || null;
- composers = audioContentInitDict.composers || null;
- lyrics = audioContentInitDict.lyrics ?
+ audioContent.album = audioContentInitDict.album || null;
+ audioContent.genres = audioContentInitDict.genres || null;
+ audioContent.artists = audioContentInitDict.artists || null;
+ audioContent.composers = audioContentInitDict.composers || null;
+ audioContent.lyrics = audioContentInitDict.lyrics ?
new AudioContentLyrics(audioContentInitDict.lyrics) : null;
- copyright = audioContentInitDict.copyright || null;
- bitrate = audioContentInitDict.bitrate || 0;
- trackNumber = audioContentInitDict.trackNumber || null;
- duration = audioContentInitDict.duration || 0;
+ audioContent.copyright = audioContentInitDict.copyright || null;
+ audioContent.bitrate = audioContentInitDict.bitrate || 0;
+ audioContent.trackNumber = audioContentInitDict.trackNumber || null;
+ audioContent.duration = audioContentInitDict.duration || 0;
this.__defineGetter__("album", function () {
- return album;
+ return audioContent.album;
});
this.__defineGetter__("genres", function () {
- return genres;
+ return audioContent.genres;
});
this.__defineGetter__("artists", function () {
- return artists;
+ return audioContent.artists;
});
this.__defineGetter__("composers", function () {
- return composers;
+ return audioContent.composers;
});
this.__defineGetter__("lyrics", function () {
- return lyrics;
+ return audioContent.lyrics;
});
this.__defineGetter__("copyright", function () {
- return copyright;
+ return audioContent.copyright;
});
this.__defineGetter__("bitrate", function () {
- return bitrate;
+ return audioContent.bitrate;
});
this.__defineGetter__("trackNumber", function () {
- return trackNumber;
+ return audioContent.trackNumber;
});
this.__defineGetter__("duration", function () {
- return duration;
+ return audioContent.duration;
});
};
ImageContentInternal = function (imageContentInitDict) {
ContentInternal.call(this, imageContentInitDict);
- this.geolocation = imageContentInitDict.geolocation || null;
+ this.geolocation = null;
this.width = imageContentInitDict.width || 0;
this.height = imageContentInitDict.height || 0;
this.orientation = imageContentInitDict.orientation || "NORMAL";
+
+ if (imageContentInitDict.geolocation) {
+ this.geolocation = new SimpleCoordinates(
+ imageContentInitDict.geolocation.latitude,
+ imageContentInitDict.geolocation.longitude);
+ }
};
ImageContent = function (imageContentInitDict) {
- var width, height;
+ var imageContent = {};
Content.call(this, imageContentInitDict);
- width = imageContentInitDict.width || 0;
- height = imageContentInitDict.height || 0;
- this.geolocation = imageContentInitDict.geolocation || null;
- this.orientation = imageContentInitDict.orientation || "NORMAL";
+ imageContent.width = imageContentInitDict.width || 0;
+ imageContent.height = imageContentInitDict.height || 0;
+ imageContent.geolocation = null;
+ imageContent.orientation = imageContentInitDict.orientation || "NORMAL";
+
+ if (imageContentInitDict.geolocation) {
+ imageContent.geolocation = new SimpleCoordinates(
+ imageContentInitDict.geolocation.latitude,
+ imageContentInitDict.geolocation.longitude);
+ }
+
+ this.__defineGetter__("geolocation", function () {
+ return imageContent.geolocation;
+ });
+ this.__defineSetter__("geolocation", function (val) {
+ try {
+ imageContent.geolocation = t.SimpleCoordinates(val, "?");
+ } catch (e) {
+ }
+ });
this.__defineGetter__("width", function () {
- return width;
+ return imageContent.width;
});
this.__defineGetter__("height", function () {
- return height;
+ return imageContent.height;
+ });
+
+ this.__defineGetter__("orientation", function () {
+ return imageContent.orientation;
+ });
+ this.__defineSetter__("orientation", function (val) {
+ try {
+ imageContent.orientation = t.ImageContentOrientation(val);
+ } catch (e) {
+ }
});
};
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- t.SQLDataControlConsumer("insert", arguments);
+ t.SQLDataControlConsumer("insert", arguments, true);
privateData.insert(insertionData, function (rowId) {
if (successCallback) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- t.SQLDataControlConsumer("update", arguments);
+ t.SQLDataControlConsumer("update", arguments, true);
privateData.update(updateData, where, function () {
if (successCallback) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- t.SQLDataControlConsumer("remove", arguments);
+ t.SQLDataControlConsumer("remove", arguments, true);
privateData.remove(where, function () {
if (successCallback) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- t.SQLDataControlConsumer("select", arguments);
+ t.SQLDataControlConsumer("select", arguments, true);
privateData.select(columns, where, function (rows) {
successCallback(rows, reqId);
_data.dbBuilder.register("Content", "dbcontent.xml", Content);
_data.dbBuilder.register("Package", "dbpackage.xml");
_data.dbBuilder.register("Application", "dbapplication.xml");
+ _data.dbBuilder.register("Bluetooth", "dbbluetooth.xml");
_data.FileSystem.initdb();
}
}
function getType(node) {
- var type, reNum, reDate;
+ var type, reNum, reDate, reHexNum;
if (node.childNodes) {
return (node.childNodes[0].nodeName === "i") ? "Array" : "Object";
}
reNum = /^(-?\d+)(\.\d+)?$/;
+ reHexNum = /^0[xX][0-9a-fA-F]+$/;
reDate = /^(\d{4})\-(\d{2})\-(\d{2})\s+(\d{2}):(\d{2}):(\d{2})$/;
if (reNum.test(node.textContent)) {
type = "Number";
+ } else if (reHexNum.test(node.textContent)) {
+ type = "Number";
} else if (reDate.test(node.textContent)) {
type = "Date";
} else if (node.textContent === "true" || node.textContent === "false") {
raw.addressBookId = overlap ? overlap.addressBookId : null;
raw.lastUpdated = overlap ? overlap.lastUpdated : null;
raw.isFavorite = overlap ? overlap.isFavorite : false;
+ raw.name = contact.name;
+ raw.addresses = contact.addresses;
+ raw.photoURI = contact.photoURI;
+ raw.phoneNumbers = contact.phoneNumbers;
+ raw.emails = contact.emails;
+ raw.birthday = contact.birthday;
+ raw.anniversaries = contact.anniversaries;
+ raw.organizations = contact.organizations;
+ raw.notes = contact.notes;
+ raw.urls = contact.urls;
+ raw.ringtoneURI = contact.ringtoneURI;
+ raw.groupIds = contact.groupIds;
contact.__defineGetter__("id", function () {
return raw.id;
return raw.isFavorite;
});
+ contact.__defineGetter__("name", function () {
+ return raw.name;
+ });
+ contact.__defineSetter__("name", function (val) {
+ try {
+ raw.name = t.ContactName(val, "?");
+ } catch (e) {
+ }
+ });
+
+ contact.__defineGetter__("addresses", function () {
+ return raw.addresses;
+ });
+ contact.__defineSetter__("addresses", function (val) {
+ try {
+ raw.addresses = t.ContactAddress(val, "[]");
+ } catch (e) {
+ }
+ });
+
+ contact.__defineGetter__("photoURI", function () {
+ return raw.photoURI;
+ });
+ contact.__defineSetter__("photoURI", function (val) {
+ try {
+ raw.photoURI = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ contact.__defineGetter__("phoneNumbers", function () {
+ return raw.phoneNumbers;
+ });
+ contact.__defineSetter__("phoneNumbers", function (val) {
+ try {
+ raw.phoneNumbers = t.ContactPhoneNumber(val, "[]");
+ } catch (e) {
+ }
+ });
+
+ contact.__defineGetter__("emails", function () {
+ return raw.emails;
+ });
+ contact.__defineSetter__("emails", function (val) {
+ try {
+ raw.emails = t.ContactEmailAddress(val, "[]");
+ } catch (e) {
+ }
+ });
+
+ contact.__defineGetter__("birthday", function () {
+ return raw.birthday;
+ });
+ contact.__defineSetter__("birthday", function (val) {
+ try {
+ raw.birthday = t.Date(val, "?");
+ } catch (e) {
+ }
+ });
+
+ contact.__defineGetter__("anniversaries", function () {
+ return raw.anniversaries;
+ });
+ contact.__defineSetter__("anniversaries", function (val) {
+ try {
+ raw.anniversaries = t.ContactAnniversary(val, "[]");
+ } catch (e) {
+ }
+ });
+
+ contact.__defineGetter__("organizations", function () {
+ return raw.organizations;
+ });
+ contact.__defineSetter__("organizations", function (val) {
+ try {
+ raw.organizations = t.ContactOrganization(val, "[]");
+ } catch (e) {
+ }
+ });
+
+ contact.__defineGetter__("notes", function () {
+ return raw.notes;
+ });
+ contact.__defineSetter__("notes", function (val) {
+ try {
+ raw.notes = t.DOMString(val, "[]");
+ } catch (e) {
+ }
+ });
+
+ contact.__defineGetter__("urls", function () {
+ return raw.urls;
+ });
+ contact.__defineSetter__("urls", function (val) {
+ try {
+ raw.urls = t.ContactWebSite(val, "[]");
+ } catch (e) {
+ }
+ });
+
+ contact.__defineGetter__("ringtoneURI", function () {
+ return raw.ringtoneURI;
+ });
+ contact.__defineSetter__("ringtoneURI", function (val) {
+ try {
+ raw.ringtoneURI = t.DOMString(val, "?");
+ } catch (e) {
+ }
+ });
+
+ contact.__defineGetter__("groupIds", function () {
+ return raw.groupIds;
+ });
+ contact.__defineSetter__("groupIds", function (val) {
+ try {
+ raw.groupIds = t.ContactGroupId(val, "[]");
+ } catch (e) {
+ }
+ });
+
if (contact.name) {
contact.name.__defineGetter__("displayName", function () {
return ((overlap && overlap.name) ? overlap.name.displayName :
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
var db = require('ripple/db'),
event = require('ripple/event'),
t = require('ripple/platform/tizen/2.0/typecast'),
if (callback === null) {
return;
}
- switch (name) {
- case "onprogress" :
- callback[name](downloadId, arg1, arg2);
- break;
- case "onpaused" :
- callback[name](downloadId);
- break;
- case "oncanceled" :
- callback[name](downloadId);
- break;
- case "oncompleted" :
- callback[name](downloadId, arg1);
- break;
- case "onfailed" :
- callback[name](downloadId, arg1);
- break;
- default:
- break;
- }
+
+ window.setTimeout(function () {
+ switch (name) {
+ case "onprogress":
+ callback[name](downloadId, arg1, arg2);
+ break;
+
+ case "onpaused":
+ callback[name](downloadId);
+ break;
+
+ case "oncanceled":
+ callback[name](downloadId);
+ break;
+
+ case "oncompleted":
+ callback[name](downloadId, arg1);
+ break;
+
+ case "onfailed":
+ callback[name](downloadId, arg1);
+ break;
+
+ default:
+ break;
+ }
+ }, 1);
}
function _getDownloadObjById(id) {
_self = function () {
function start(downloadRequest, downloadCallback) {
var downloadObj, fileSize, increment, receivedSize = 0, intervalId;
- if (!_security.all && !_security.start) {
+
+ if (!_security.start) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- if (!(downloadRequest instanceof tizen.DownloadRequest)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
+
t.DownloadManager("start", arguments);
downloadObj = new DownloadItem(downloadRequest, downloadCallback);
function cancel(downloadId) {
var downloadObj;
+
t.DownloadManager("cancel", arguments);
downloadObj = _getDownloadObjById(downloadId);
function pause(downloadId) {
var downloadObj;
+
t.DownloadManager("pause", arguments);
downloadObj = _getDownloadObjById(downloadId);
function resume(downloadId) {
var downloadObj, fileSize, receivedSize, increment, intervalId;
+
t.DownloadManager("resume", arguments);
downloadObj = _getDownloadObjById(downloadId);
function getState(downloadId) {
var downloadObj;
+
t.DownloadManager("getState", arguments);
downloadObj = _getDownloadObjById(downloadId);
function getDownloadRequest(downloadId) {
var req, downloadObj;
+
t.DownloadManager("getDownloadRequest", arguments);
downloadObj = _getDownloadObjById(downloadId);
function getMIMEType(downloadId) {
var downloadObj;
+
t.DownloadManager("getMIMEType", arguments);
downloadObj = _getDownloadObjById(downloadId);
return downloadObj.MIMEType;
}
- function setListener(downloadId, callback) {
+ function setListener(downloadId, downloadCallback) {
var downloadObj;
+
t.DownloadManager("setListener", arguments);
downloadObj = _getDownloadObjById(downloadId);
if (downloadObj) {
- downloadObj.callback = callback;
+ downloadObj.callback = downloadCallback;
}
}
getDownloadRequest: getDownloadRequest,
getMIMEType: getMIMEType,
setListener: setListener,
- handleSubFeatures : handleSubFeatures
+ handleSubFeatures: handleSubFeatures
};
return download;
event.on('downloadResourceChanged', function () {
_isInitialized = false;
});
-module.exports = _self;
+module.exports = _self;
});
define('ripple/platform/tizen/2.0/errorcode', function (require, exports, module) {
},
removeStorageStateChangeListener: function (watchId) {
- if (!watchId || typeof watchId !== "number") {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- watchId = String(watchId);
+ if (!_observers[watchId])
+ return;
- if (_observers[watchId]) {
- event.deleteEventHandler("StateChange", _observers[watchId]);
- delete _observers[watchId];
- } else {
- throw new WebAPIException(errorcode.INVALID_VALUES_ERR);
- }
+ event.deleteEventHandler("StateChange", _observers[watchId]);
+ delete _observers[watchId];
},
handleSubFeatures: function (subFeatures) {
});
define('ripple/platform/tizen/2.0/nfc', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation
+ * Copyright 2013 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
errorcode = require('ripple/platform/tizen/2.0/errorcode'),
t = require('ripple/platform/tizen/2.0/typecast'),
WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError'),
+ WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
NDEFRecord = require('ripple/platform/tizen/2.0/NDEFRecordInternal'),
NDEFMessage = require('ripple/platform/tizen/2.0/NDEFMessage'),
NFCAdapter,
NFCTag,
NFCPeer,
_data = {
- DB_NFC_TAG : "tizen1.0-nfc-tag",
- DB_NFC_PEER : "tizen1.0-nfc-peer",
- DB_NFC_OUTPUT_MESSAGE : "tizen1.0-nfc-output-message",
- INTERVAL : 1000,
- listener : {
- onCardEmulationChanged : null,
- onTagDetected : null,
- onPeerDetected : null,
- onNDEFReceived : null
- },
- pairedNFC : null,
- nfcAdapter : {},
- nfcCardEmulation : {},
- nfcTags : [],
+ DB_NFC_TAG: "tizen1.0-nfc-tag",
+ DB_NFC_PEER: "tizen1.0-nfc-peer",
+ DB_NFC_OUTPUT_MESSAGE: "tizen1.0-nfc-output-message",
+ INTERVAL: 1000,
+ listener: {
+ onCardEmulationChanged: null,
+ onTagDetected: null,
+ onPeerDetected: null,
+ onNDEFReceived: null
+ },
+ pairedNFC: null,
+ nfcAdapter: {},
+ nfcCardEmulation: {},
+ nfcTags: [],
nfcTag: {},
- nfcPeer : {},
- isNear : false, // Identify the device is whether near
- isDetectTag : false, // Identify NFC tag is detected
- isPeerConnected : false,
- connectedState : false
+ nfcPeer: null,
+ isNear: false, // Identify the device is whether near
+ isDetectTag: false, // Identify NFC tag is detected
+ isPeerConnected: false,
+ connectedState: false
},
_security = {
"http://tizen.org/privilege/nfc.admin": ["setPowered"],
function getDefaultAdapter() {
if (!_security.getDefaultAdapter) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
t.NFCManager("getDefaultAdapter", arguments);
if (!_data.nfcAdapter) {
- throw new WebAPIError(errorcode.UNKNOWN_ERR);
+ throw new WebAPIException(errorcode.UNKNOWN_ERR);
}
return _data.nfcAdapter;
*/
function setExclusiveMode(mode) {
if (!_security.setExclusiveMode) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
t.NFCManager("setExclusiveMode", arguments);
nfc = {
getDefaultAdapter: getDefaultAdapter,
- setExclusiveMode: setExclusiveMode,
+ setExclusiveMode: setExclusiveMode,
handleSubFeatures: handleSubFeatures
};
});
event.on("nfc-peer-send", function (status) {
if (status) {
- _data.nfcPeer = new NFCPeer(true);
+ if (!_data.nfcPeer) {
+ _data.nfcPeer = new NFCPeer(true);
+ }
+ _data.isPeerConnected = true;
if (_data.listener.onPeerDetected) {
_data.listener.onPeerDetected.onattach(_data.nfcPeer);
}
- _data.isPeerConnected = true;
} else {
+ _data.isPeerConnected = false;
if (_data.listener.onPeerDetected) {
_data.listener.onPeerDetected.ondetach();
}
- _data.isPeerConnected = false;
}
});
event.on("nfc-peer-sending-ndef", function () {
// Turns NFC adapter on or off.
function setPowered(state, successCallback, errorCallback) {
if (!_security.setPowered) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
t.NFCAdapter("setPowered", arguments);
- updatePowerStatus(state);
- if (successCallback) {
- successCallback();
- }
+ window.setTimeout(function () {
+ updatePowerStatus(state);
+ if (successCallback) {
+ successCallback();
+ }
+ }, 1);
}
// Registers a callback function to invoke when NFC tag is detected.
function setTagListener(detectCallback, tagFilter) {
if (!_security.setTagListener) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
t.NFCAdapter("setTagListener", arguments);
// Registers a callback function to be invoked when NFC peer-to-peer target is detected.
function setPeerListener(detectCallback) {
if (!_security.setPeerListener) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
t.NFCAdapter("setPeerListener", arguments);
// Unregisters the listener for detecting an NFC tag.
function unsetTagListener() {
if (!_security.unsetTagListener) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
if (!powered || !_data.listener.onTagDetected) {
// Unregisters the listener for detecting an NFC peer-to-peer target.
function unsetPeerListener() {
if (!_security.unsetPeerListener) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
if (!powered || !_data.listener.onPeerDetected) {
// Gets NDEF message cached when the tag is detected.
function getCachedMessage() {
if (!_security.getCachedMessage) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
t.NFCAdapter("getCachedMessage", arguments);
}
nfcAdapterPrototype = {
- setPowered : setPowered,
- setTagListener : setTagListener,
- setPeerListener : setPeerListener,
- unsetTagListener : unsetTagListener,
- unsetPeerListener : unsetPeerListener,
- getCachedMessage : getCachedMessage
+ setPowered: setPowered,
+ setTagListener: setTagListener,
+ setPeerListener: setPeerListener,
+ unsetTagListener: unsetTagListener,
+ unsetPeerListener: unsetPeerListener,
+ getCachedMessage: getCachedMessage
};
nfcAdapterPrototype.__defineGetter__("powered", function () {
// Reads NDEF data.
function readNDEF(readCallback, errorCallback) {
if (!_security.readNDEF) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
t.NFCTag("readNDEF", arguments);
- if (!isConnected || !isSupportedNDEF) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.UNKNOWN_ERR));
+ window.setTimeout(function () {
+ if (!_data.isNear || !isSupportedNDEF ||
+ (_ndefs_index >= ndefSize)) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.UNKNOWN_ERR));
+ }
+ return;
}
- return;
- }
- if (_ndefs_index >= ndefSize) {
- errorCallback(new WebAPIError(errorcode.UNKNOWN_ERR));
- } else {
_data.pairedNFC = _ndefs[_ndefs_index];
readCallback(_ndefs[_ndefs_index]);
_ndefs_index++;
- }
+ }, 1);
}
// Writes NDEF data.
function writeNDEF(ndefMessage, successCallback, errorCallback) {
if (!_security.writeNDEF) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
- t.NFCTag("writeNDEF", arguments);
+ t.NFCTag("writeNDEF", arguments, true);
- if (!isConnected || !isSupportedNDEF) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.UNKNOWN_ERR));
+ window.setTimeout(function () {
+ if (!_data.isNear || !isSupportedNDEF) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.UNKNOWN_ERR));
+ }
+ return;
}
- return;
- }
- db.saveObject(_data.DB_NFC_OUTPUT_MESSAGE, ndefMessage);
- event.trigger("nfc-output-msg", []);
- if (successCallback) {
- successCallback();
- }
+ db.saveObject(_data.DB_NFC_OUTPUT_MESSAGE, ndefMessage);
+ event.trigger("nfc-output-msg", []);
+ if (successCallback) {
+ successCallback();
+ }
+ }, 1);
}
// Access the raw format card.
function transceive(data, dataCallback, errorCallback) {
if (!_security.transceive) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
- t.NFCTag("transceive", arguments);
+ t.NFCTag("transceive", arguments, true);
- if (!isConnected || isSupportedNDEF) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.UNKNOWN_ERR));
+ window.setTimeout(function () {
+ if (!_data.isNear || isSupportedNDEF) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.UNKNOWN_ERR));
+ }
+ return;
}
- return;
- }
- db.saveObject(_data.DB_NFC_OUTPUT_MESSAGE, data);
- event.trigger("nfc-output-msg", []);
- dataCallback(ndefs);
+ db.saveObject(_data.DB_NFC_OUTPUT_MESSAGE, data);
+ event.trigger("nfc-output-msg", []);
+ dataCallback(ndefs);
+ }, 1);
}
// Formats the detected tag that can store NDEF messages.
*/
nfcTag = {
- readNDEF : readNDEF,
- writeNDEF : writeNDEF,
- transceive : transceive
- //formatNDEF : formatNDEF
+ readNDEF: readNDEF,
+ writeNDEF: writeNDEF,
+ transceive: transceive
+ //formatNDEF: formatNDEF
};
nfcTag.__defineGetter__("type", function () {
});
nfcTag.__defineGetter__("isConnected", function () {
- return isConnected;
+ return _data.isNear;
});
return nfcTag;
// Registers a callback function to be invoked when NDEF message is received from NFC peer-to-peer target connected.
function setReceiveNDEFListener(successCallback) {
if (!_security.setReceiveNDEFListener) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
t.NFCPeer("setReceiveNDEFListener", arguments);
- if (!isConnected) {
+ if (!_data.isPeerConnected) {
return;
}
_data.listener.onNDEFReceived = successCallback;
// Unregisters the listener for receiving NDEFMessage from NFC peer-to-peer target connected.
function unsetReceiveNDEFListener() {
if (!_security.unsetReceiveNDEFListener) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
_data.listener.onNDEFReceived = null;
// Sends data to NFC peer-to-peer target.
function sendNDEF(ndefMessage, successCallback, errorCallback) {
if (!_security.sendNDEF) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
- t.NFCPeer("sendNDEF", arguments);
+ t.NFCPeer("sendNDEF", arguments, true);
- if (!isConnected) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.UNKNOWN_ERR));
+ window.setTimeout(function () {
+ if (!_data.isPeerConnected) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.UNKNOWN_ERR));
+ }
+ return;
}
- return;
- }
- db.saveObject(_data.DB_NFC_OUTPUT_MESSAGE, ndefMessage);
- event.trigger("nfc-output-msg", []);
- if (successCallback) {
- successCallback();
- }
+ db.saveObject(_data.DB_NFC_OUTPUT_MESSAGE, ndefMessage);
+ event.trigger("nfc-output-msg", []);
+ if (successCallback) {
+ successCallback();
+ }
+ }, 1);
}
nfcPeer = {
- setReceiveNDEFListener : setReceiveNDEFListener,
- unsetReceiveNDEFListener : unsetReceiveNDEFListener,
- sendNDEF : sendNDEF
+ setReceiveNDEFListener: setReceiveNDEFListener,
+ unsetReceiveNDEFListener: unsetReceiveNDEFListener,
+ sendNDEF: sendNDEF
};
nfcPeer.__defineGetter__("isConnected", function () {
- return isConnected;
+ return _data.isPeerConnected;
});
return nfcPeer;
});
define('ripple/platform/tizen/2.0/notification', function (require, exports, module) {
/*
- * Copyright 2012 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
utils = require('ripple/utils'),
event = require('ripple/event'),
errorcode = require('ripple/platform/tizen/2.0/errorcode'),
- WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError'),
- StatusNotification = require('ripple/platform/tizen/2.0/StatusNotification'),
t = require('ripple/platform/tizen/2.0/typecast'),
+ WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
+ StatusNotification = require('ripple/platform/tizen/2.0/StatusNotification'),
_notificationStack,
_security = {
- "http://tizen.org/privilege/notification": ["post", "update", "remove", "removeAll"]
+ "http://tizen.org/privilege/notification": ["post", "update", "remove",
+ "removeAll"]
},
_self;
_self = function () {
function post(notification) {
- var _id;
+ var posted = {};
+
if (!_security.post) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
t.NotificationManager("post", arguments);
if (notification.id !== undefined) {
return;
}
- _id = Math.uuid(null, 16);
- Object.defineProperty(notification, "id", {value: _id, writable: false});
+ posted.id = Math.uuid(null, 16);
- if (notification.statusType === "PROGRESS" &&
- notification.progressType === "PERCENTAGE" &&
- notification.progressValue &&
- (notification.progressValue < 1 || notification.progressValue > 100)) {
- throw new WebAPIError(errorcode.INVALID_VALUES_ERR);
- }
+ notification.__defineGetter__("id", function () {
+ return posted.id;
+ });
if (!_notificationStack[notification.id]) {
- Object.defineProperty(notification, "postedTime", {value: new Date(), writable: false});
- _notificationStack[notification.id] = utils.copy(notification);
+ posted.postedTime = new Date();
+
+ notification.__defineGetter__("postedTime", function () {
+ return posted.postedTime;
+ });
+
+ _notificationStack[notification.id] = t.Notification(notification,
+ "+");
db.saveObject("posted-notifications", _notificationStack);
event.trigger("refreshNotificationUI", [], true);
}
function update(notification) {
if (!_security.update) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
t.NotificationManager("update", arguments);
- if (typeof notification.id !== "string") {
- throw new WebAPIError(errorcode.UNKNOWN_ERR);
- }
-
- if (notification.statusType === "PROGRESS" &&
- notification.progressType === "PERCENTAGE" &&
- notification.progressValue &&
- (notification.progressValue < 1 || notification.progressValue > 100)) {
- throw new WebAPIError(errorcode.INVALID_VALUES_ERR);
- }
-
- if (_notificationStack[notification.id]) {
- _notificationStack[notification.id] = utils.copy(notification);
- db.saveObject("posted-notifications", _notificationStack);
- event.trigger("refreshNotificationUI", [], true);
- } else {
- throw new WebAPIError(errorcode.UNKNOWN_ERR);
+ if (!_notificationStack[notification.id]) {
+ throw new WebAPIException(errorcode.UNKNOWN_ERR);
}
-
+ _notificationStack[notification.id] = t.Notification(notification,
+ "+");
+ db.saveObject("posted-notifications", _notificationStack);
+ event.trigger("refreshNotificationUI", [], true);
}
function remove(id) {
if (!_security.remove) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
+ t.NotificationManager("remove", arguments);
+
if (!_notificationStack[id]) {
- throw (new WebAPIError(errorcode.NOT_FOUND_ERR));
+ throw new WebAPIException(errorcode.NOT_FOUND_ERR);
}
-
delete _notificationStack[id];
db.saveObject("posted-notifications", _notificationStack);
event.trigger('refreshNotificationUI', [], true);
function removeAll() {
if (!_security.removeAll) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
- t.NotificationManager("removeAll", arguments);
-
_notificationStack = {};
db.saveObject("posted-notifications", _notificationStack);
event.trigger('refreshNotificationUI', [], true);
}
function get(id) {
- var n, ret;
+ var n, notification;
+
+ t.NotificationManager("get", arguments);
if (!_notificationStack[id]) {
- throw (new WebAPIError(errorcode.NOT_FOUND_ERR));
+ throw new WebAPIException(errorcode.NOT_FOUND_ERR);
}
n = _notificationStack[id];
- ret = new StatusNotification(n.statusType, n.title, n);
- Object.defineProperty(ret, "id", {value: n.id, writable: false});
- Object.defineProperty(ret, "postedTime", {value: new Date(n.postedTime), writable: false});
+ notification = new StatusNotification(n.statusType, n.title, n);
- return ret;
+ notification.__defineGetter__("id", function () {
+ return n.id;
+ });
+
+ notification.__defineGetter__("postedTime", function () {
+ return n.postedTime;
+ });
+
+ return notification;
}
function getAll() {
- var notifications = [], ret;
-
- t.NotificationManager("getAll", arguments);
+ var notifications = [];
utils.forEach(_notificationStack, function (n) {
- ret = new StatusNotification(n.statusType, n.title, n);
- Object.defineProperty(ret, "id", {value: n.id, writable: false});
- Object.defineProperty(ret, "postedTime", {value: new Date(n.postedTime), writable: false});
+ var notification;
+
+ notification = new StatusNotification(n.statusType, n.title, n);
+
+ notification.__defineGetter__("id", function () {
+ return n.id;
+ });
+
+ notification.__defineGetter__("postedTime", function () {
+ return n.postedTime;
+ });
+
+ notifications.push(notification);
+ });
- notifications.push(ret);
- }, this);
return notifications;
}
}
var notification = {
- post: post,
- update: update,
- remove: remove,
- removeAll: removeAll,
- get: get,
- getAll: getAll,
+ post: post,
+ update: update,
+ remove: remove,
+ removeAll: removeAll,
+ get: get,
+ getAll: getAll,
handleSubFeatures: handleSubFeatures
};
function _initilize() {
_notificationStack = db.retrieveObject("posted-notifications") || {};
+
+ utils.forEach(_notificationStack, function (n) {
+ n.postedTime = new Date(n.postedTime);
+ });
+
event.on("refreshNotificationStack", function () {
_notificationStack = db.retrieveObject("posted-notifications");
});
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
var db = require('ripple/db'),
app = require('ripple/app'),
event = require('ripple/event'),
utils = require('ripple/utils'),
errorcode = require('ripple/platform/tizen/2.0/errorcode'),
+ t = require('ripple/platform/tizen/2.0/typecast'),
WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError'),
WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
PackageInformation = require('ripple/platform/tizen/2.0/PackageInformation'),
- t = require('ripple/platform/tizen/2.0/typecast'),
_security = {
"http://tizen.org/privilege/packagemanager.install": ["install", "uninstall"],
"http://tizen.org/privilege/package.info": ["getPackagesInfo", "getPackageInfo",
PSEUDO_APP_ID = "pseudoapp00",
_self;
+function _get() {
+ _data = db.retrieveObject(DB_PACKAGE_KEY);
+}
+
+function _save() {
+ db.saveObject(DB_PACKAGE_KEY, _data);
+}
+
+function _exec(callback, name, id, arg1) {
+ switch (name) {
+ case "onprogress":
+ callback[name](id, arg1);
+ break;
+ case "oncomplete":
+ callback[name](id);
+ break;
+ default:
+ break;
+ }
+}
+
function _setupCurrentPackage() {
var info, id, item, tizenAppId;
info = app.getInfo();
}
}
-function _get() {
- _data = db.retrieveObject(DB_PACKAGE_KEY);
+function _updatePackage(path, updateFlag) {
+ var item, p, info;
+
+ if (!_data.packageList[path]) {
+ return;
+ }
+ _get();
+ p = _data.packageList[path];
+ item = _data.installedList[p.id];
+ utils.forEach(_listeners, function (listener) {
+ info = new PackageInformation(
+ item.id, item.name, item.iconPath, item.version,
+ item.totalSize, item.dataSize, item.lastModified,
+ item.author, item.description, item.appIds);
+ if (!updateFlag) {
+ listener.oninstalled(info);
+ } else {
+ listener.onupdated(info);
+ }
+ });
+}
+
+function _initialize() {
+ _get();
+
if (!_data)
return;
+
utils.forEach(_data.installedList, function (item) {
item.lastModified = new Date(item.lastModified);
});
-}
-function _save() {
- db.saveObject(DB_PACKAGE_KEY, _data);
-}
+ _setupCurrentPackage();
-function _exec(callback, name, id, arg1) {
- switch (name) {
- case "onprogress":
- callback[name](id, arg1);
- break;
- case "oncomplete":
- callback[name](id);
- break;
- default:
- break;
- }
+ event.on("install-packge", function (path) {
+ _updatePackage(path, false);
+ });
+ event.on("update-package", function (path) {
+ _updatePackage(path, true);
+ });
+
+ event.on("uninstall-package", function (id) {
+ _get();
+ utils.forEach(_listeners, function (listener) {
+ listener.onuninstalled(id);
+ });
+ });
}
_self = function () {
- var _package;
- //public
+ var package;
+
+ // public
function install(path, progressCallback, errorCallback) {
- var intervalId, installedSize = 0, packageSize, updateFlag = false, item, info, progress;
if (!_security.install) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
t.PackageManager("install", arguments);
- if (!_data.packageList[path]) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
+ window.setTimeout(function () {
+ var intervalId, installedSize = 0, packageSize, updateFlag = false,
+ item, info, progress;
+
+ if (!_data.packageList[path]) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
+ }
+ return;
}
- return;
- }
- item = _data.packageList[path];
- //check package has been installed or not
- if (_data.installedList[item.id]) {
- updateFlag = true;
- }
- packageSize = item.totalSize;
- intervalId = setInterval(function () {
- if (installedSize >= packageSize) {
- //install complete
- _data.installedList[item.id] = new PackageInformation(
- item.id, item.name, item.iconPath, item.version,
- item.totalSize, item.dataSize, new Date(),
- item.author, item.description, item.appIds
- );
- event.trigger("install-apps", [item.appIds]);
- _save();
- _exec(progressCallback, "oncomplete", item.id);
- clearInterval(intervalId);
- item = _data.installedList[item.id];
- utils.forEach(_listeners, function (listener) {
- info = new PackageInformation(
+ item = _data.packageList[path];
+ if (_data.installedList[item.id]) {
+ updateFlag = true;
+ }
+ packageSize = item.totalSize;
+ intervalId = setInterval(function () {
+ if (installedSize >= packageSize) {
+ // Install complete
+ _data.installedList[item.id] = new PackageInformation(
item.id, item.name, item.iconPath, item.version,
- item.totalSize, item.dataSize, item.lastModified,
- item.author, item.description, item.appIds);
- if (!updateFlag) {
- listener.oninstalled(info);
- } else {
- listener.onupdated(info);
- }
- });
- event.trigger("installedList-updated");
- } else {
- installedSize += INSTALL_AMOUNT;
- if (installedSize > packageSize) {
- progress = 100;
+ item.totalSize, item.dataSize, new Date(),
+ item.author, item.description, item.appIds
+ );
+ event.trigger("install-apps", [item.appIds]);
+ _save();
+ _exec(progressCallback, "oncomplete", item.id);
+ clearInterval(intervalId);
+ item = _data.installedList[item.id];
+ utils.forEach(_listeners, function (listener) {
+ info = new PackageInformation(
+ item.id, item.name, item.iconPath, item.version,
+ item.totalSize, item.dataSize, item.lastModified,
+ item.author, item.description, item.appIds);
+ if (!updateFlag) {
+ listener.oninstalled(info);
+ } else {
+ listener.onupdated(info);
+ }
+ });
+ event.trigger("installedList-updated");
} else {
- progress = Math.floor(installedSize * 100 / packageSize);
+ installedSize += INSTALL_AMOUNT;
+ progress = (installedSize > packageSize) ? 100 :
+ Math.floor(installedSize * 100 / packageSize);
+ _exec(progressCallback, "onprogress", item.id, progress);
}
- _exec(progressCallback, "onprogress", item.id, progress);
- }
-
- }, INTERVAL);
+ }, INTERVAL);
+ }, 1);
}
function uninstall(id, progressCallback, errorCallback) {
- var intervalId, removedSize = 0, packageSize, item, progress;
if (!_security.uninstall) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
t.PackageManager("uninstall", arguments);
- if (!_data.installedList[id]) {
- if (errorCallback) {
- errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
+ window.setTimeout(function () {
+ var intervalId, removedSize = 0, packageSize, item, progress;
+
+ if (!_data.installedList[id]) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.NOT_FOUND_ERR));
+ }
+ return;
}
- return;
- }
- item = _data.installedList[id];
- packageSize = item.totalSize;
- intervalId = setInterval(function () {
- if (removedSize >= packageSize) {
- //remove complete
- utils.forEach(_data.packageList, function (_package) {
- if (_package.id === id) {
- event.trigger("remove-apps", [_package.appIds]);
- }
- });
- delete _data.installedList[item.id];
- _save();
- _exec(progressCallback, "oncomplete", item.id);
- clearInterval(intervalId);
- item = _data.installedList[item.id];
- utils.forEach(_listeners, function (listener) {
- listener.onuninstalled(id);
- });
- event.trigger("installedList-updated");
- } else {
- removedSize += INSTALL_AMOUNT * 10;
- if (removedSize > packageSize) {
- progress = 100;
+ item = _data.installedList[id];
+ packageSize = item.totalSize;
+ intervalId = setInterval(function () {
+ if (removedSize >= packageSize) {
+ utils.forEach(_data.packageList, function (package) {
+ if (package.id === id) {
+ event.trigger("remove-apps", [package.appIds]);
+ }
+ });
+ delete _data.installedList[item.id];
+ _save();
+ _exec(progressCallback, "oncomplete", item.id);
+ clearInterval(intervalId);
+ item = _data.installedList[item.id];
+ utils.forEach(_listeners, function (listener) {
+ listener.onuninstalled(id);
+ });
+ event.trigger("installedList-updated");
} else {
- progress = Math.floor(removedSize * 100 / packageSize);
+ removedSize += INSTALL_AMOUNT * 10;
+ progress = (removedSize > packageSize) ? 100 :
+ Math.floor(removedSize * 100 / packageSize);
+ _exec(progressCallback, "onprogress", item.id, progress);
}
- _exec(progressCallback, "onprogress", item.id, progress);
- }
- }, INTERVAL);
+ }, INTERVAL);
+ }, 1);
}
function getPackagesInfo(successCallback, errorCallback) {
- var packageArray = [];
if (!_security.getPackagesInfo) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
t.PackageManager("getPackagesInfo", arguments);
- utils.forEach(_data.installedList, function (item) {
- var i;
- i = new PackageInformation(
- item.id, item.name, item.iconPath, item.version,
- item.totalSize, item.dataSize, item.lastModified,
- item.author, item.description, item.appIds
- );
- packageArray.push(i);
- });
- successCallback(packageArray);
+ window.setTimeout(function () {
+ var packageArray = [];
+
+ utils.forEach(_data.installedList, function (item) {
+ var i;
+ i = new PackageInformation(
+ item.id, item.name, item.iconPath, item.version,
+ item.totalSize, item.dataSize, item.lastModified,
+ item.author, item.description, item.appIds
+ );
+ packageArray.push(i);
+ });
+ successCallback(packageArray);
+ }, 1);
}
function getPackageInfo(id) {
var p, item;
+
if (!_security.getPackageInfo) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- //assgin the defaul package ID
- if (arguments.length === 0) {
- id = "api1pack00";
- }
-
t.PackageManager("getPackageInfo", arguments);
+ id = id || "api1pack00";
+
if (!_data.installedList[id]) {
throw new WebAPIException(errorcode.NOT_FOUND_ERR);
}
item = _data.installedList[id];
- p = new PackageInformation(
- item.id, item.name, item.iconPath, item.version,
- item.totalSize, item.dataSize, item.lastModified,
- item.author, item.description, item.appIds
- );
+ p = new PackageInformation(item.id, item.name, item.iconPath,
+ item.version, item.totalSize, item.dataSize, item.lastModified,
+ item.author, item.description, item.appIds);
+
return p;
}
function handleSubFeatures(subFeatures) {
var i, subFeature;
+
for (subFeature in subFeatures) {
for (i in _security[subFeature]) {
_security[_security[subFeature][i]] = true;
}
}
- function updatePackage(path, updateFlag) {
- var item, p, info;
- if (!_data.packageList[path]) {
- return;
- }
- _get();
- p = _data.packageList[path];
- item = _data.installedList[p.id];
- utils.forEach(_listeners, function (listener) {
- info = new PackageInformation(
- item.id, item.name, item.iconPath, item.version,
- item.totalSize, item.dataSize, item.lastModified,
- item.author, item.description, item.appIds);
- if (!updateFlag) {
- listener.oninstalled(info);
- } else {
- listener.onupdated(info);
- }
- });
- }
-
- event.on("install-packge", function (path) {
- updatePackage(path, false);
- });
- event.on("update-package", function (path) {
- updatePackage(path, true);
- });
-
- event.on("uninstall-package", function (id) {
- _get();
- utils.forEach(_listeners, function (listener) {
- listener.onuninstalled(id);
- });
- });
-
- _package = {
- install: install,
- uninstall: uninstall,
- getPackagesInfo: getPackagesInfo,
- getPackageInfo: getPackageInfo,
- setPackageInfoEventListener: setPackageInfoEventListener,
+ package = {
+ install: install,
+ uninstall: uninstall,
+ getPackagesInfo: getPackagesInfo,
+ getPackageInfo: getPackageInfo,
+ setPackageInfoEventListener: setPackageInfoEventListener,
unsetPackageInfoEventListener: unsetPackageInfoEventListener,
- handleSubFeatures: handleSubFeatures
+ handleSubFeatures: handleSubFeatures
};
- return _package;
+ return package;
};
-function _initialize() {
- _get();
- if (!_data)
- return;
- _setupCurrentPackage();
-}
-
_initialize();
module.exports = _self;
StatusNotification = require('ripple/platform/tizen/2.0/StatusNotification'),
WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError'),
WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
- TypeCoerce = require('ripple/platform/tizen/2.0/typecoerce'),
PushMessage,
_data = {
service: {
var push;
function registerService(appControl, successCallback, errorCallback) {
- var appId, appService;
-
if (!_security.registerService) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- t.PushManager("registerService", arguments);
+ t.PushManager("registerService", arguments, true);
- appId = _getCurrentApplicationId();
- appService = {
- appId: appId,
- registrationId: null,
- appControl: appControl,
- isRegistered: false
- };
- _data.service[appId] = appService;
+ window.setTimeout(function () {
+ var appId, appService;
+
+ appId = _getCurrentApplicationId();
+ appService = {
+ appId: appId,
+ registrationId: null,
+ appControl: appControl,
+ isRegistered: false
+ };
+ _data.service[appId] = appService;
+
+ event.trigger("PushRequest", ["REGISTER", appService], true);
- event.trigger("PushRequest", ["REGISTER", appService], true);
+ if (appService.registrationId === null) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.UNKNOWN_ERR));
+ }
+ return;
+ }
- if (appService.registrationId !== null) {
appService.isRegistered = true;
successCallback(appService.registrationId);
- } else if (errorCallback) {
- window.setTimeout(function () {
- errorCallback(new WebAPIError(errorcode.UNKNOWN_ERR));
- }, 1);
- }
+ }, 1);
}
function unregisterService(successCallback, errorCallback) {
- var appId, appService;
-
if (!_security.unregisterService) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
t.PushManager("unregisterService", arguments);
- appId = _getCurrentApplicationId();
- delete _data.service[appId];
- event.trigger("PushRequest", ["UNREGISTER", appId]);
- if (successCallback) {
- window.setTimeout(function () {
+ window.setTimeout(function () {
+ var appId;
+
+ appId = _getCurrentApplicationId();
+ delete _data.service[appId];
+ event.trigger("PushRequest", ["UNREGISTER", appId]);
+ if (successCallback) {
successCallback();
- }, 1);
- }
+ }
+ }, 1);
}
function connectService(notificationCallback) {
appId = _getCurrentApplicationId();
appService = _data.service[appId];
- if (!appService || !appService.isRegistered) {
- throw new WebAPIException(errorcode.UNKNOWN_ERR);
- }
- if (!appService.isConnected) {
+ if (!appService || !appService.isRegistered ||
+ !appService.isConnected) {
return;
}
});
-define('ripple/platform/tizen/2.0/spec/btdevices', function (require, exports, module) {
-/*
- * Copyright 2012 Intel Corporation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-
-module.exports = {
- "22:33:44:12:34:56": {
- "name": "Tizen Phone",
- "address": "22:33:44:12:34:56",
- "deviceClass": {
- "major": 0x02,
- "majorName": "PHONE",
- "minor": 0x03,
- "minorName": "PHONE_SMARTPHONE",
- "services": [0x0080],
- "servicesName": ["OBJECT_TRANSFER"]
- },
- "isTrusted": false,
- "services": {
- "5bce9431-6c75-32ab-afe0-2ec108a30860" : {
- "name": "Data Exchange",
- "uuid": "5bce9431-6c75-32ab-afe0-2ec108a30860",
- "protocol": "RFCOMM"
- },
- "3537d485-0c1e-445a-a066-43fafcfb61d1" : {
- "name": "Data Transfer",
- "uuid": "3537d485-0c1e-445a-a066-43fafcfb61d1",
- "protocol": "RFCOMM"
- }
- }
- },
- "22:33:44:12:34:88": {
- "name": "Keyboard",
- "address": "22:33:44:12:34:88",
- "deviceClass": {
- "major": 0x05,
- "majorName": "PERIPHERAL",
- "minor": 0x10,
- "minorName": "PERIPHERAL_KEYBOARD",
- "services": [0x0080],
- "servicesName": ["OBJECT_TRANSFER"]
- },
- "isTrusted": true,
- "services": {
- "3537d485-0c1e-445a-a066-43fafcfb61d1" : {
- "name": "Data Exchange",
- "uuid": "3537d485-0c1e-445a-a066-43fafcfb61d1",
- "protocol": "RFCOMM"
- }
- }
- },
- "22:33:44:88:34:58": {
- "name": "Tizen Laptop",
- "address": "22:33:44:88:34:58",
- "deviceClass": {
- "major": 0x01,
- "majorName": "COMPUTER",
- "minor": 0x03,
- "minorName": "COMPUTER_LAPTOP",
- "services": [0x0080],
- "servicesName": ["OBJECT_TRANSFER"]
- },
- "isTrusted": true,
- "services": {
- "3537d485-0c1e-445a-a066-43fafcfb61d1" : {
- "name": "Data Exchange",
- "uuid": "3537d485-0c1e-445a-a066-43fafcfb61d1",
- "protocol": "RFCOMM"
- }
- }
- }
-};
-
-});
define('ripple/platform/tizen/2.0/spec/config', function (require, exports, module) {
/*
* Copyright 2011 Research In Motion Limited.
configFeatures,
configPreferences,
preferenceName,
- platform;
+ platform, rst, i, j,
+ settingRst = {
+ 'screen-orientation': 'portrait',
+ 'context-menu': 'enable',
+ 'background-support': 'disable',
+ encryption: 'disable',
+ 'install-location': 'auto',
+ 'hwkey-event': 'enable'
+ };
widgetInfo.id = configValidationObject.widget.validationResult[0].attributes.id.value || "";
widgetInfo.name = configValidationObject.widget.children.name.validationResult[0].value;
widgetInfo.features = {};
- if (configValidationObject.widget.children.setting.hasOwnProperty('validationResult') === true &&
- configValidationObject.widget.children.setting.validationResult[0].valid === true) {
- db.save("layout", configValidationObject.widget.children.setting.validationResult[0].attributes["screen-orientation"].value);
+ if (configValidationObject.widget.children.setting.hasOwnProperty('validationResult') === true) {
+ rst = configValidationObject.widget.children.setting.validationResult;
+ // the first one has higher priority per platform implementation
+ for (i = rst.length -1 ; i >= 0; i--) {
+ if (rst[i].valid === true) {
+ for (j in rst[i].attributes) {
+ if (rst[i].attributes[j].value !== undefined) {
+ settingRst[j] = rst[i].attributes[j].value;
+ }
+ }
+ }
+ }
+ db.save("layout", settingRst["screen-orientation"]);
}
configFeatures = configValidationObject.widget.children.feature.validationResult;
attributeName: "screen-orientation",
required: false,
type: "list",
- listValues: ['portrait', 'landscape']
+ listValues: ['portrait', 'landscape', 'auto']
},
'context-menu': {
attributeName: "context-menu",
},
'encryption': {
attributeName: "encryption",
- required: true,
+ required: false,
type: "list",
listValues: ['enable', 'disable']
},
required: false,
type: "list",
listValues: ['auto', 'internal-only', 'perfer-external']
+ },
+ 'hwkey-event': {
+ attributeName: "hwkey-event",
+ required: false,
+ type: "list",
+ listValues: ['enable', 'disable']
}
}
},
required_version: {
attributeName: "required_version",
required: true,
- type: "string"
+ type: "list",
+ listValues: ['1.0', '2.0', '2.1', '2.2']
},
package: {
attributeName: "package",
},
"tizen:content": {
nodeName: "tizen:content",
- required: true,
+ required: false,
occurrence: 1,
attributes: {
src: {
"network",
"power",
"download",
+ "notifications",
"package"
]
};
});
define('ripple/platform/tizen/2.0/systeminfo', function (require, exports, module) {
/*
- * Copyright 2011 Intel Corporation.
+ * Copyright 2013 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
var deviceSettings = require('ripple/deviceSettings'),
db = require('ripple/db'),
- t = require('ripple/platform/tizen/2.0/typedef'),
- TypeCoerce = require('ripple/platform/tizen/2.0/typecoerce'),
+ t = require('ripple/platform/tizen/2.0/typecast'),
+ typedef = require('ripple/platform/tizen/2.0/typedef'),
constants = require('ripple/constants'),
event = require('ripple/event'),
tizen_utils = require('ripple/platform/tizen/2.0/tizen1_utils'),
errorcode = require('ripple/platform/tizen/2.0/errorcode'),
- WebAPIError = require('ripple/platform/tizen/2.0/WebAPIError'),
WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
- _systemInfoProperties = ["BATTERY", "CPU", "STORAGE", "DISPLAY", "DEVICE_ORIENTATION", "BUILD", "LOCALE", "NETWORK", "WIFI_NETWORK", "CELLULAR_NETWORK", "SIM", "PERIPHERAL"],
+ SystemInfoDeviceCapability,
+ _systemInfoProperties = typedef.SystemInfoPropertyId,
_propertyMap = {}, // Object like: {"BATTERY": ["level", "isCharging"], ...}
_batteryEvent = ["BatteryLevelChanged", "BatteryChargingChanged"],
_watches = {},
_firstCall_watches = {},
_powerData = {},
+ _systemInfoDeviceCapability = null,
_security = {
- "http://tizen.org/privilege/system": ["SystemInfoSIM", "webApiVersion", "nativeApiVersion", "platformVersion"],
+ "http://tizen.org/privilege/system": ["SystemInfoSIM", "webApiVersion",
+ "nativeApiVersion", "platformVersion"],
"http://tizen.org/privilege/systemmanager": ["NetworkImei"]
},
_self;
-function _prepareObj(obj, aspect, property, value) {
+function _prepareObj(obj, aspect, property, value) {
if ((aspect === "CELLULAR_NETWORK") && (property === "imei")) {
obj.__defineGetter__("imei", function () {
if (!_security.NetworkImei) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
return deviceSettings.retrieve("CELLULAR_NETWORK.imei");
});
var properties = [], value, index = 0, property, obj = {};
if ((aspect === "SIM") && !_security.SystemInfoSIM) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
if (aspect === "BATTERY") {
});
}
-function _isPropertyFound(propertyId) {
+function _isPropertyFound(property) {
if (tizen_utils.isEmptyObject(_propertyMap)) {
_initialize();
}
- if (_propertyMap[propertyId]) {
+ if (_propertyMap[property]) {
return true;
}
return false;
}
-function _rtnCapability() {
- var _self = {};
+function _delayGetValue(timeout, property, successCallback, errorCallback) {
+ return window.setInterval(function () {
+ _getValue(property, successCallback, errorCallback);
+ }, timeout);
+}
+
+_self = function () {
+ function getCapabilities() {
+ if (_systemInfoDeviceCapability === null) {
+ _systemInfoDeviceCapability = new SystemInfoDeviceCapability();
+ }
+ return _systemInfoDeviceCapability;
+ }
+
+ function getPropertyValue(property, successCallback, errorCallback) {
+ t.SystemInfo("getPropertyValue", arguments);
+
+ if (!_isPropertyFound(property)) {
+ throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ }
+
+ window.setTimeout(function () {
+ _getValue(property, successCallback, errorCallback);
+ }, 1);
+ }
+
+ function addPropertyValueChangeListener(property, successCallback, options) {
+ var WatchOBJ, watchId = Number(Math.uuid(8, 10)),
+ _options = new Object(options), properties, prop, index = 0,
+ deviceEventType, watchObj, firstCallWatchObj;
+
+ t.SystemInfo("addPropertyValueChangeListener", arguments);
+
+ if (!_isPropertyFound(property)) {
+ throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ }
+
+ WatchOBJ = function (deviceEventType, property, successCallback) {
+ var obj = this;
+
+ this.eventType = deviceEventType;
+ this.onEvent = function (newValue) {
+ if (obj.timeout) {
+ window.clearInterval(obj.intervalId);
+ obj.intervalId = window.setInterval(function () {
+ _getValue(property, successCallback, null);
+ }, obj.timeout);
+ }
+
+ if ((obj.highThreshold && (newValue < obj.highThreshold)) ||
+ (obj.lowThreshold && (newValue > obj.lowThreshold))) {
+ return;
+ }
- _self.__defineGetter__("bluetooth", function () {
+ _getValue(property, successCallback, null);
+ };
+ };
+
+ // A listener will listen all the properties of one aspect, each of the property
+ // will have an internal watchObj to record the information.
+ _watches[watchId] = [];
+
+ if (property === "BATTERY") {
+ properties = _batteryEvent;
+ } else {
+ properties = _propertyMap[property];
+ }
+
+ for (; index < properties.length; index++) {
+ prop = properties[index];
+ if (property === "BATTERY") {
+ deviceEventType = prop;
+ } else {
+ deviceEventType = deviceSettings.retrieve(property)[prop].event;
+ }
+
+ if (deviceEventType === undefined) continue;
+ // These two items are needed when delete an event listener.
+ watchObj = new WatchOBJ(deviceEventType, property, successCallback);
+
+ if (options && _options.timeout) {
+ watchObj.intervalId = _delayGetValue(_options.timeout, property,
+ successCallback, null);
+ }
+
+ if ((watchObj.eventType === "CpuLoadChanged") ||
+ (watchObj.eventType === "DisplayBrightnessChanged") ||
+ (watchObj.eventType === "BatteryLevelChanged")) {
+ if (options && _options.highThreshold) {
+ watchObj.highThreshold = _options.highThreshold;
+ }
+
+ if (options && _options.lowThreshold) {
+ watchObj.lowThreshold = _options.lowThreshold;
+ }
+ }
+
+ _watches[watchId].push(watchObj);
+ if (watchObj.eventType) {
+ event.on(watchObj.eventType, watchObj.onEvent);
+ }
+ }
+
+ firstCallWatchObj = window.setTimeout(function () {
+ _getValue(property, successCallback, null);
+ delete _firstCall_watches[watchId];
+ }, 1);
+
+ _firstCall_watches[watchId] = firstCallWatchObj;
+
+ return watchId;
+ }
+
+ function removePropertyValueChangeListener(listenerID) {
+ var _handler = listenerID, index = 0, watchObjs = [], watchObj;
+
+ if (!_watches[_handler])
+ return;
+
+ watchObjs = _watches[_handler];
+ if (watchObjs) {
+ for (; index < watchObjs.length; index++) {
+ watchObj = watchObjs[index];
+ event.deleteEventHandler(watchObj.eventType, watchObj.onEvent);
+ if (watchObj.intervalId) {
+ window.clearInterval(watchObj.intervalId);
+ }
+ }
+ delete _watches[_handler];
+ }
+
+ if (_firstCall_watches[_handler]) {
+ window.clearTimeout(_firstCall_watches[_handler]);
+ delete _firstCall_watches[_handler];
+ }
+ }
+
+ function handleSubFeatures(subFeatures) {
+ var i, subFeature;
+
+ for (subFeature in subFeatures) {
+ for (i in _security[subFeature]) {
+ _security[_security[subFeature][i]] = true;
+ }
+ }
+ }
+
+ var systeminfo = {
+ getCapabilities: getCapabilities,
+ getPropertyValue: getPropertyValue,
+ addPropertyValueChangeListener: addPropertyValueChangeListener,
+ removePropertyValueChangeListener: removePropertyValueChangeListener,
+ handleSubFeatures: handleSubFeatures
+ };
+
+ return systeminfo;
+};
+
+SystemInfoDeviceCapability = function () {
+ this.__defineGetter__("bluetooth", function () {
return true;
});
- _self.__defineGetter__("nfc", function () {
+ this.__defineGetter__("nfc", function () {
return true;
});
- _self.__defineGetter__("nfcReservedPush", function () {
+ this.__defineGetter__("nfcReservedPush", function () {
return false;
});
- _self.__defineGetter__("multiTouchCount", function () {
+ this.__defineGetter__("multiTouchCount", function () {
return 5;
});
- _self.__defineGetter__("inputKeyboard", function () {
+ this.__defineGetter__("inputKeyboard", function () {
return false;
});
- _self.__defineGetter__("inputKeyboardLayout", function () {
+ this.__defineGetter__("inputKeyboardLayout", function () {
return false;
});
- _self.__defineGetter__("wifi", function () {
+ this.__defineGetter__("wifi", function () {
return true;
});
- _self.__defineGetter__("wifiDirect", function () {
+ this.__defineGetter__("wifiDirect", function () {
return true;
});
- _self.__defineGetter__("opengles", function () {
+ this.__defineGetter__("opengles", function () {
return false;
});
- _self.__defineGetter__("openglestextureFormat", function () {
- return "3dc";
+ this.__defineGetter__("openglestextureFormat", function () {
+ return "";
});
- _self.__defineGetter__("openglesVersion1_1", function () {
+ this.__defineGetter__("openglesVersion1_1", function () {
return false;
});
- _self.__defineGetter__("openglesVersion2_0", function () {
+ this.__defineGetter__("openglesVersion2_0", function () {
return false;
});
- _self.__defineGetter__("fmRadio", function () {
+ this.__defineGetter__("fmRadio", function () {
return false;
});
- _self.__defineGetter__("platformVersion", function () {
+ this.__defineGetter__("platformVersion", function () {
if (!_security.platformVersion) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
- return "2.2";
+ return "2.2.0";
});
- _self.__defineGetter__("webApiVersion", function () {
+ this.__defineGetter__("webApiVersion", function () {
if (!_security.webApiVersion) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
return "2.2";
});
- _self.__defineGetter__("nativeApiVersion", function () {
+ this.__defineGetter__("nativeApiVersion", function () {
if (!_security.nativeApiVersion) {
- throw new WebAPIError(errorcode.SECURITY_ERR);
+ throw new WebAPIException(errorcode.SECURITY_ERR);
}
return "2.2";
});
- _self.__defineGetter__("platformName", function () {
+ this.__defineGetter__("platformName", function () {
return "Tizen";
});
- _self.__defineGetter__("camera", function () {
+ this.__defineGetter__("camera", function () {
return false;
});
- _self.__defineGetter__("cameraFront", function () {
+ this.__defineGetter__("cameraFront", function () {
return false;
});
- _self.__defineGetter__("cameraFrontFlash", function () {
+ this.__defineGetter__("cameraFrontFlash", function () {
return false;
});
- _self.__defineGetter__("cameraBack", function () {
+ this.__defineGetter__("cameraBack", function () {
return false;
});
- _self.__defineGetter__("cameraBackFlash", function () {
+ this.__defineGetter__("cameraBackFlash", function () {
return false;
});
- _self.__defineGetter__("location", function () {
+ this.__defineGetter__("location", function () {
return true;
});
- _self.__defineGetter__("locationGps", function () {
+ this.__defineGetter__("locationGps", function () {
return true;
});
- _self.__defineGetter__("locationWps", function () {
+ this.__defineGetter__("locationWps", function () {
return false;
});
- _self.__defineGetter__("microphone", function () {
+ this.__defineGetter__("microphone", function () {
return false;
});
- _self.__defineGetter__("usbHost", function () {
- return false;
+ this.__defineGetter__("usbHost", function () {
+ return true;
});
- _self.__defineGetter__("usbAccessory", function () {
+ this.__defineGetter__("usbAccessory", function () {
return false;
});
- _self.__defineGetter__("screenOutputRca", function () {
+ this.__defineGetter__("screenOutputRca", function () {
return false;
});
- _self.__defineGetter__("screenOutputHdmi", function () {
+ this.__defineGetter__("screenOutputHdmi", function () {
return false;
});
- _self.__defineGetter__("platformCoreCpuArch", function () {
+ this.__defineGetter__("platformCoreCpuArch", function () {
return "x86";
});
- _self.__defineGetter__("platformCoreFpuArch", function () {
+ this.__defineGetter__("platformCoreFpuArch", function () {
return "ssse3";
});
- _self.__defineGetter__("sipVoip", function () {
+ this.__defineGetter__("sipVoip", function () {
return false;
});
- _self.__defineGetter__("duid", function () {
+ this.__defineGetter__("duid", function () {
return "device unique ID";
});
- _self.__defineGetter__("speechRecognition", function () {
+ this.__defineGetter__("speechRecognition", function () {
return false;
});
- _self.__defineGetter__("speechSynthesis", function () {
+ this.__defineGetter__("speechSynthesis", function () {
return false;
});
- _self.__defineGetter__("accelerometer", function () {
+ this.__defineGetter__("accelerometer", function () {
return true;
});
- _self.__defineGetter__("accelerometerWakeup", function () {
+ this.__defineGetter__("accelerometerWakeup", function () {
return false;
});
- _self.__defineGetter__("barometer", function () {
+ this.__defineGetter__("barometer", function () {
return false;
});
- _self.__defineGetter__("barometerWakeup", function () {
+ this.__defineGetter__("barometerWakeup", function () {
return false;
});
- _self.__defineGetter__("gyroscope", function () {
+ this.__defineGetter__("gyroscope", function () {
return true;
});
- _self.__defineGetter__("gyroscopeWakeup", function () {
+ this.__defineGetter__("gyroscopeWakeup", function () {
return false;
});
- _self.__defineGetter__("magnetometer", function () {
+ this.__defineGetter__("magnetometer", function () {
return false;
});
- _self.__defineGetter__("magnetometerWakeup", function () {
+ this.__defineGetter__("magnetometerWakeup", function () {
return false;
});
- _self.__defineGetter__("photometer", function () {
+ this.__defineGetter__("photometer", function () {
return false;
});
- _self.__defineGetter__("photometerWakeup", function () {
+ this.__defineGetter__("photometerWakeup", function () {
return false;
});
- _self.__defineGetter__("proximity", function () {
+ this.__defineGetter__("proximity", function () {
return false;
});
- _self.__defineGetter__("proximityWakeup", function () {
+ this.__defineGetter__("proximityWakeup", function () {
return false;
});
- _self.__defineGetter__("tiltmeter", function () {
+ this.__defineGetter__("tiltmeter", function () {
return false;
});
- _self.__defineGetter__("tiltmeterWakeup", function () {
+ this.__defineGetter__("tiltmeterWakeup", function () {
return false;
});
- _self.__defineGetter__("dataEncryption", function () {
+ this.__defineGetter__("dataEncryption", function () {
return false;
});
- _self.__defineGetter__("graphicsAcceleration", function () {
+ this.__defineGetter__("graphicsAcceleration", function () {
return false;
});
- _self.__defineGetter__("push", function () {
+ this.__defineGetter__("push", function () {
return true;
});
- _self.__defineGetter__("telephony", function () {
+ this.__defineGetter__("telephony", function () {
return true;
});
- _self.__defineGetter__("telephonyMms", function () {
+ this.__defineGetter__("telephonyMms", function () {
return true;
});
- _self.__defineGetter__("telephonySms", function () {
+ this.__defineGetter__("telephonySms", function () {
return true;
});
- _self.__defineGetter__("screenSizeNormal", function () {
+ this.__defineGetter__("screenSizeNormal", function () {
return true;
});
- _self.__defineGetter__("screenSize480_800", function () {
+ this.__defineGetter__("screenSize480_800", function () {
return true;
});
- _self.__defineGetter__("screenSize720_1280", function () {
+ this.__defineGetter__("screenSize720_1280", function () {
return true;
});
- _self.__defineGetter__("autoRotation", function () {
+ this.__defineGetter__("autoRotation", function () {
return true;
});
- _self.__defineGetter__("shellAppWidget", function () {
+ this.__defineGetter__("shellAppWidget", function () {
return false;
});
- _self.__defineGetter__("visionImageRecognition", function () {
+ this.__defineGetter__("visionImageRecognition", function () {
return false;
});
- _self.__defineGetter__("visionQrcodeGeneration", function () {
+ this.__defineGetter__("visionQrcodeGeneration", function () {
return false;
});
- _self.__defineGetter__("visionQrcodeRecognition", function () {
+ this.__defineGetter__("visionQrcodeRecognition", function () {
return false;
});
- _self.__defineGetter__("visionFaceRecognition", function () {
+ this.__defineGetter__("visionFaceRecognition", function () {
return false;
});
- _self.__defineGetter__("secureElement", function () {
+ this.__defineGetter__("secureElement", function () {
return false;
});
- _self.__defineGetter__("nativeOspCompatible", function () {
+ this.__defineGetter__("nativeOspCompatible", function () {
return false;
});
- _self.__defineGetter__("inputKeyBack", function () {
- return true;
- });
- _self.__defineGetter__("inputKeyMenu", function () {
- return true;
- });
- _self.__defineGetter__("profile", function () {
+ this.__defineGetter__("profile", function () {
return "MOBILE_WEB";
});
- return _self;
-}
-
-
-function _delayGetValue(timeout, propertyId, successCallback, errorCallback) {
- return setInterval(function () {
- _getValue(propertyId, successCallback, errorCallback);
- }, timeout);
-}
-
-_self = function () {
- function getCapabilities() {
- return _rtnCapability();
- }
-
- function getPropertyValue(propertyId, successCallback, errorCallback) {
- if (arguments.length === 2) {
- errorCallback = null;
- }
- if (!(new TypeCoerce(t.DOMString)).match(propertyId)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (_isPropertyFound(propertyId) === false) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (!(new TypeCoerce(t.SuccessCallback)).match(successCallback)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (!(new TypeCoerce(t.ErrorCallback)).match(errorCallback) && (arguments.length !== 2)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
-
- return tizen_utils.validateTypeMismatch(successCallback, errorCallback, "getPropertyValue", function () {
-
- setTimeout(_getValue(propertyId, successCallback, errorCallback), 1); // Simulate a async operation
-
- });
- }
-
- function addPropertyValueChangeListener(propertyId, successCallback, options) {
- // no error callback in spec, as of 2.0.0 RC7.
- var WatchOBJ;
- if (arguments.length === 2) {
- options = null;
- }
- if (!(new TypeCoerce(t.DOMString)).match(propertyId)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (_isPropertyFound(propertyId) === false) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (!(new TypeCoerce(t.SuccessCallback)).match(successCallback)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (options !== null) {
- if ((typeof options !== 'object') ||
- (options.hasOwnProperty("timeout") && typeof options.timeout !== 'number') ||
- (options.hasOwnProperty("highThrashold") && typeof options.highThrashold !== 'number') ||
- (options.hasOwnProperty("lowThrashold") && typeof options.lowThrashold !== 'number'))
- {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- }
- WatchOBJ = function (deviceEventType, propertyId, successCallback) {
- var obj = this;
- this.eventType = deviceEventType;
- this.onEvent = function (newValue) {
- if (obj.timeout) {
- clearInterval(obj.intervalId);
- obj.intervalId = setInterval(function () {
- _getValue(propertyId, successCallback, null);
- }, obj.timeout);
- }
-
- if ((obj.highThreshold && (newValue < obj.highThreshold)) ||
- (obj.lowThreshold && (newValue > obj.lowThreshold))) {
- return;
- }
-
- _getValue(propertyId, successCallback, null);
- };
- };
-
- return tizen_utils.validateTypeMismatch(successCallback, null, "addPropertyValueChangeListener", function () {
- var watchId = Number(Math.uuid(8, 10)),
- _options = new Object(options),
- properties, property, index = 0, deviceEventType, watchObj, firstCallWatchObj;
-
- // A listener will listen all the properties of one aspect, each of the property
- // will have an internal watchObj to record the information.
- _watches[watchId] = [];
-
- if (propertyId === "BATTERY") {
- properties = _batteryEvent;
- } else {
- properties = _propertyMap[propertyId];
- }
-
- for (; index < properties.length; index++) {
- property = properties[index];
- if (propertyId === "BATTERY") {
- deviceEventType = property;
- } else {
- deviceEventType = deviceSettings.retrieve(propertyId)[property].event;
- }
-
- if (deviceEventType === undefined) continue;
- // These two items are needed when delete an event listener.
- watchObj = new WatchOBJ(deviceEventType, propertyId, successCallback);
-
- if (options && _options.timeout) {
- watchObj.intervalId = _delayGetValue(_options.timeout, propertyId, successCallback, null);
- }
-
- if (watchObj.eventType === "CpuLoadChanged" || watchObj.eventType === "DisplayBrightnessChanged" || watchObj.eventType === "BatteryLevelChanged") {
- if (options && _options.highThreshold) {
- watchObj.highThreshold = _options.highThreshold;
- }
-
- if (options && _options.lowThreshold) {
- watchObj.lowThreshold = _options.lowThreshold;
- }
- }
-
- _watches[watchId].push(watchObj);
- if (watchObj.eventType) {
- event.on(watchObj.eventType, watchObj.onEvent);
- }
- }
-
- firstCallWatchObj = setTimeout(function () {
- _getValue(propertyId, successCallback, null);
- delete(_firstCall_watches[watchId]);
- }, 1);
-
- _firstCall_watches[watchId] = firstCallWatchObj;
- return watchId;
- });
- }
-
- function removePropertyValueChangeListener(listenerID) {
- var _handler = listenerID, index = 0, watchObjs = [], watchObj;
-
- if (typeof listenerID !== 'number') {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (!_watches[_handler]) {
- throw new WebAPIException(errorcode.INVALID_VALUES_ERR);
- }
- watchObjs = _watches[_handler];
- if (watchObjs) {
- for (; index < watchObjs.length; index++) {
- watchObj = watchObjs[index];
- event.deleteEventHandler(watchObj.eventType, watchObj.onEvent);
- if (watchObj.intervalId) {
- clearInterval(watchObj.intervalId);
- }
- }
- delete(_watches[_handler]);
- }
-
- if (_firstCall_watches[_handler]) {
- clearTimeout(_firstCall_watches[_handler]);
- delete(_firstCall_watches[_handler]);
- }
- }
-
- function handleSubFeatures(subFeatures) {
- var i, subFeature;
-
- for (subFeature in subFeatures) {
- for (i in _security[subFeature]) {
- _security[_security[subFeature][i]] = true;
- }
- }
- }
-
- var systeminfo = {
- getCapabilities: getCapabilities,
- getPropertyValue: getPropertyValue,
- addPropertyValueChangeListener: addPropertyValueChangeListener,
- removePropertyValueChangeListener: removePropertyValueChangeListener,
- handleSubFeatures: handleSubFeatures
- };
-
- return systeminfo;
};
module.exports = _self;
-
});
define('ripple/platform/tizen/2.0/systemsetting', function (require, exports, module) {
/*
var db = require('ripple/db'),
event = require('ripple/event'),
- t = require('ripple/platform/tizen/2.0/typedef'),
- TypeCoerce = require('ripple/platform/tizen/2.0/typecoerce'),
errorcode = require('ripple/platform/tizen/2.0/errorcode'),
+ t = require('ripple/platform/tizen/2.0/typecast'),
WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
- _systemSettingTypes = ["HOME_SCREEN", "LOCK_SCREEN", "INCOMING_CALL", "NOTIFICATION_EMAIL"],
- _systemSettings = {},
+ _systemSettings = null,
DBSYSTEMSETTING_KEY = "tizen2-systemsetting",
- _security = {
+ _security = {
"http://tizen.org/privilege/setting": ["setProperty"]
},
- _self = {};
-
-function _isTypeFound(type) {
- if (_systemSettingTypes.indexOf(type) !== -1) {
- return true;
- }
- return false;
-}
+ _self;
function _initialize() {
_systemSettings = db.retrieveObject(DBSYSTEMSETTING_KEY);
}
_self = function () {
+ var systemSetting;
+
function setProperty(type, value, successCallback, errorCallback) {
if (!_security.setProperty) {
throw new WebAPIException(errorcode.SECURITY_ERR);
}
- if (!(new TypeCoerce(t.DOMString)).match(type)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (!_isTypeFound(type)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (!(new TypeCoerce(t.DOMString)).match(value)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (!(new TypeCoerce(t.SuccessCallback)).match(successCallback)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (!(new TypeCoerce(t.ErrorCallback)).match(errorCallback) && (arguments.length !== 3)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
+
+ t.SystemSettingManager("setProperty", arguments);
_systemSettings = db.retrieveObject(DBSYSTEMSETTING_KEY);
_systemSettings[type] = value;
db.saveObject(DBSYSTEMSETTING_KEY, _systemSettings);
event.trigger("SystemSettingChanged");
- setTimeout(function () {
+ window.setTimeout(function () {
successCallback();
}, 1);
}
- function getProperty(type, successCallback, errorCallback) {
- if (arguments.length === 2) {
- errorCallback = null;
- }
- if (!(new TypeCoerce(t.DOMString)).match(type)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (!_isTypeFound(type)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
-
- if (!(new TypeCoerce(t.SuccessCallback)).match(successCallback)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
- if (!(new TypeCoerce(t.ErrorCallback)).match(errorCallback) && (arguments.length !== 2)) {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
+ function getProperty(type, successCallback, errorCallback) {
+ t.SystemSettingManager("getProperty", arguments);
_systemSettings = db.retrieveObject(DBSYSTEMSETTING_KEY);
- setTimeout(function () {
+ window.setTimeout(function () {
successCallback(_systemSettings[type]);
}, 1);
}
}
}
- var systemsetting = {
- setProperty: setProperty,
- getProperty: getProperty,
+ systemSetting = {
+ setProperty: setProperty,
+ getProperty: getProperty,
handleSubFeatures: handleSubFeatures
};
- return systemsetting;
+
+ return systemSetting;
};
_initialize();
* limitations under the License.
*/
-var TZDate = require('ripple/platform/tizen/2.0/TZDate'),
- errorcode = require('ripple/platform/tizen/2.0/errorcode'),
- WebAPIException = require('ripple/platform/tizen/2.0/WebAPIException'),
+var t = require('ripple/platform/tizen/2.0/typecast'),
+ TZDate = require('ripple/platform/tizen/2.0/TZDate'),
db = require('ripple/db'),
tz = require('ripple/platform/tizen/2.0/timezone_info'),
_timeFormat = "h:m:s ap", _shortDateFormat = "d/m/y",
_self = {
getCurrentDateTime: function () {
+ t.TimeUtil("getCurrentDateTime", arguments);
return new TZDate();
},
getLocalTimezone: function () {
+ t.TimeUtil("getLocalTimezone", arguments);
var localtz = db.retrieve("tizen-timezone") || "UTC";
return localtz;
},
getAvailableTimezones: function () {
+ t.TimeUtil("getAvailableTimezones", arguments);
var ret = tz.getAllTimezone();
return ret;
},
getDateFormat: function (shortformat) {
- if (shortformat !== undefined && shortformat !== null &&
- typeof shortformat !== 'boolean') {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
+ t.TimeUtil("getDateFormat", arguments);
+
if (shortformat) {
return _shortDateFormat;
} else {
}
},
getTimeFormat: function () {
+ t.TimeUtil("getTimeFormat", arguments);
return _timeFormat;
},
isLeapYear: function (year) {
- if (typeof year !== 'number') {
- throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
- }
+ t.TimeUtil("isLeapYear", arguments);
return ((year % 4 === 0) && (year % 100 !== 0 || year % 400 === 0));
}
};
"Asia/Bangkok": {diff: 7, abbr: "ICT"},
"Asia/Beirut": {diff: 2, abbr: "EET"},
"Asia/Chungking": {diff: 8, abbr: "CST"},
- "Asia/Dubai": {diff: 4, abbr: "GST", desc:"GMT\+0400 United Arab Emirates Time"},
+ "Asia/Dubai": {diff: 4, abbr: "GST", desc:"GMT+0400 United Arab Emirates Time"},
"Asia/Harbin": {diff: 8, abbr: "CST"},
"Asia/Ho_Chi_Minh": {diff: 7, abbr: "IST"},
"Asia/Hong_Kong": {diff: 8, abbr: "HKT"},
};
}
- if (value === undefined) {
+ if (value === undefined || value === null) {
return utils.filter(src, _existMatch);
}
};
}
- if (value === undefined) {
+ if (value === undefined || value === null) {
return utils.filter(src, _existMatch);
}
tc = new TypeCoerce(pattern);
tcFunc = isDuplicate ? tc.copy : tc.cast;
- if (tcFunc(obj) === null) {
+ if ((obj = tcFunc(obj)) === null) {
throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
}
+
+ return obj;
}
function _castType(pattern) {
*
* "?" Nullable types
* "[]" Array
+ * "+" Deep copy
*
* Return
- * Casted object.
+ * Casted or duplicated object.
*/
return function (obj, aux) {
- var tc, isNullable;
+ var type, isNullable, isDuplicate;
aux = aux ? String(aux) : "";
- tc = new TypeCoerce((aux.indexOf("[]") !== -1) ? [pattern] : pattern);
+ type = (aux.indexOf("[]") !== -1) ? [pattern] : pattern;
isNullable = (aux.indexOf("?") !== -1);
+ isDuplicate = (aux.indexOf("+") !== -1);
- if (isNullable && !obj) {
- return null;
- }
-
- if ((isNullable && obj) || !isNullable) {
- if ((obj = tc.copy(obj)) === null) {
+ if ((obj === null) || (obj === undefined)) {
+ if (!isNullable) {
throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
}
+ return obj;
}
- return obj;
+ return _cast(type, obj, isDuplicate);
};
}
* String of method name
*
* argv
- * arguments. The keyword 'arguments' will be always passed in.
+ * arguments. The keyword 'arguments' will always be passed in.
*
* isDuplicate
* A boolean value to indicate whether arguments will be copied or not.
return "dictionary";
}
+ type = "Object";
+
for (attr in val) {
if (attr === "0") {
type = "Arguments";
} else if (val[attr] === "Callback") {
type = "Callback";
- } else {
- type = "Object";
}
break;
}
type = "Function";
break;
+ case "TZDate":
case "any": // Any type
case "byte":
case "octet":
case "unsigned long":
+ case "unsigned short":
type = val;
break;
}
function instanceOfPattern(pattern, obj) {
- var i, derived;
+ var ret, i, derived;
- if (("_constructor" in pattern) &&
- (obj instanceof window.tizen[pattern._constructor])) {
- return -1;
+ if ("_constructor" in pattern) {
+ if (obj instanceof window.tizen[pattern._constructor]) {
+ return -1;
+ }
+ ret = NaN;
+ } else {
+ ret = -1;
+ }
+
+ if (!("_derived" in pattern)) {
+ return ret;
}
for (i in pattern._derived) {
derived = pattern._derived[i];
- if (("_constructor" in derived) &&
- (obj instanceof window.tizen[derived._constructor])) {
+ if (typeof derived !== "object") {
+ return (typeof derived === typeof obj) ? i : NaN;
+ }
+ if (!isNaN(instanceOfPattern(derived, obj))) {
return i;
}
}
}
function toInteger(x) {
- x = Number(x);
return (x < 0) ? Math.ceil(x) : Math.floor(x);
}
return a - Math.floor(a / b) * b;
}
+ function toUInt(x, bits) {
+ x = Number(x);
+
+ if (isNaN(x) || !isFinite(x))
+ return null;
+
+ return modulo(toInteger(x), Math.pow(2, bits));
+ }
+
+ function toUInt16(x) {
+ return toUInt(x, 16);
+ }
+
function toUInt32(x) {
- return modulo(toInteger(x), Math.pow(2, 32));
+ return toUInt(x, 32);
}
// public
"Object": function () {
var attr, iInstance, ret;
- if (typeOfObj !== typeOfPattern) {
+ if (!("_derived" in pattern) &&
+ (typeOfObj !== typeOfPattern)) {
return null;
}
return obj;
},
+ "TZDate": function () {
+ if (typeOfObj !== "Object") {
+ return null;
+ }
+ return (obj instanceof window.tizen.TZDate) ? obj : null;
+ },
+
"any": function () {
return obj;
},
}
for (attr in pattern) {
- if ((attr in obj) && (obj[attr] !== null) &&
- (obj[attr] !== undefined)) {
- ret = _self(pattern[attr]).cast(obj[attr]);
- if (ret === null) {
- return null;
+ switch (attr) {
+ case "_dictionary":
+ if (pattern._dictionary !== null) {
+ ret = _self(pattern._dictionary).cast(obj);
+ if (ret === null) {
+ return null;
+ }
}
- obj[attr] = ret;
+ break;
+
+ default:
+ if ((attr in obj) && (obj[attr] !== null) &&
+ (obj[attr] !== undefined)) {
+ ret = _self(pattern[attr]).cast(obj[attr]);
+ if (ret === null) {
+ return null;
+ }
+ obj[attr] = ret;
+ }
+ break;
}
}
n = toUInt32(obj);
- return isNaN(n) ? null : n;
+ return (n === null) ? null : n;
+ },
+
+ "unsigned short": function () {
+ var n;
+
+ n = toUInt16(obj);
+
+ return (n === null) ? null : n;
},
"octet": function () {
return null;
}
+ if ("_constructor" in pattern) {
+ ret.__proto__ = window.tizen[pattern._constructor].prototype;
+ }
+
for (attr in pattern) {
switch (attr) {
case "_optional":
},
"dictionary": function () {
- var ret = {}, attr;
+ var ret = {}, attr, base, i;
if (typeOfObj !== "Object") {
return null;
}
for (attr in pattern) {
- if ((attr in obj) && (obj[attr] !== null) &&
- (obj[attr] !== undefined)) {
- ret[attr] = _self(pattern[attr]).copy(obj[attr]);
- if (ret[attr] === null) {
- return null;
+ switch (attr) {
+ case "_dictionary":
+ if (pattern._dictionary !== null) {
+ base = _self(pattern._dictionary).copy(obj);
+ if (base === null) {
+ return null;
+ }
+ for (i in base) {
+ ret[i] = base[i];
+ }
+ }
+ break;
+
+ default:
+ if ((attr in obj) && (obj[attr] !== null) &&
+ (obj[attr] !== undefined)) {
+ ret[attr] = _self(pattern[attr]).copy(obj[attr]);
+ if (ret[attr] === null) {
+ return null;
+ }
}
+ break;
}
}
}
for (attr in pattern) {
- if ((attr in obj) && (obj[attr] !== null) &&
- (obj[attr] !== undefined)) {
- isMatched = _self(pattern[attr]).match(obj[attr]);
- if (!isMatched)
- break;
+ switch (attr) {
+ case "_dictionary":
+ if (pattern._dictionary !== null) {
+ isMatched = _self(pattern._dictionary).match(obj);
+ if (!isMatched)
+ break;
+ }
+ break;
+
+ default:
+ if ((attr in obj) && (obj[attr] !== null) &&
+ (obj[attr] !== undefined)) {
+ isMatched = _self(pattern[attr]).match(obj[attr]);
+ if (!isMatched)
+ break;
+ }
+ break;
}
}
n = toUInt32(obj);
- return !isNaN(n);
+ return (n !== null);
+ },
+
+ "unsigned short": function () {
+ var n;
+
+ n = toUInt16(obj);
+
+ return (n !== null);
},
"octet": function () {
DOMString: "",
Date: new Date(),
Function: function () {},
+ TZDate: "TZDate",
any: "any",
boolean: false,
byte: "byte",
long: 0,
octet: "octet",
short: 0,
- "unsigned long": "unsigned long",
- "unsigned long long": 0,
- "unsigned short": 0,
+ long_long: 0,
+ unsigned_long: "unsigned long",
+ unsigned_long_long: 0,
+ unsigned_short: "unsigned short",
// Common
FilterMatchFlag: ["EXACTLY", "FULLSTRING", "CONTAINS",
SortModeOrder: ["ASC", "DESC"],
CompositeFilterType: ["UNION", "INTERSECTION"],
+ // Bluetooth
+ BluetoothSocketState: ["CLOSED", "OPEN"],
+ BluetoothProfileType: ["HEALTH", "HEALTH"],
+ BluetoothHealthChannelType: ["RELIABLE", "STREAMING"],
+
// Calendar
- ByDayValue: ["MO", "TU", "WE", "TH", "FR", "SA", "SU"],
+ CalendarType: ["EVENT", "TASK"],
+ CalendarTextFormat: ["ICALENDAR_20", "VCALENDAR_10"],
+ AlarmMethod: ["SOUND", "DISPLAY"],
+ RecurrenceRuleFrequency: ["DAILY", "WEEKLY", "MONTHLY",
+ "YEARLY"],
+ ByDayValue: ["MO", "TU", "WE", "TH", "FR", "SA",
+ "SU"],
+ EventAvailability: ["BUSY", "FREE"],
+ AttendeeType: ["INDIVIDUAL", "GROUP", "RESOURCE",
+ "ROOM", "UNKNOWN"],
+ AttendeeStatus: ["PENDING", "ACCEPTED", "DECLINED",
+ "TENTATIVE", "DELEGATED", "COMPLETED",
+ "IN_PROCESS"],
+ AttendeeRole: ["REQ_PARTICIPANT", "OPT_PARTICIPANT",
+ "NON_PARTICIPANT", "CHAIR"],
+ CalendarItemPriority: ["HIGH", "MEDIUM", "LOW"],
+ CalendarItemVisibility: ["PUBLIC", "PRIVATE", "CONFIDENTIAL"],
+ CalendarItemStatus: ["TENTATIVE", "CONFIRMED", "CANCELLED",
+ "NEEDS_ACTION", "IN_PROCESS",
+ "COMPLETED"],
// Contact
ContactTextFormat: ["VCARD_30", "VCARD_30"], // Enum must has more than one value
ContentDirectoryStorageType: ["INTERNAL", "EXTERNAL"],
ContentType: ["IMAGE", "VIDEO", "AUDIO", "OTHER"],
AudioContentLyricsType: ["SYNCHRONIZED", "UNSYNCHRONIZED"],
- ImageContentOrientation: ["NORMAL", "FLIP_HORIZONTAL", "ROTATE_180",
- "FLIP_VERTICAL", "TRANSPOSE", "ROTATE_90",
- "TRANSVERSE", "ROTATE_270"],
+ ImageContentOrientation: ["NORMAL", "FLIP_HORIZONTAL",
+ "ROTATE_180", "FLIP_VERTICAL",
+ "TRANSPOSE", "ROTATE_90", "TRANSVERSE",
+ "ROTATE_270"],
// Data Control
DataType: ["MAP", "SQL"],
SyncStatus: ["SUCCESS", "FAIL", "STOP", "NONE"],
// Download
- DownloadState: ["QUEUED", "DOWNLOADING", "PAUSED", "CANCELED", "COMPLETED", "FAILED"],
+ DownloadState: ["QUEUED", "DOWNLOADING", "PAUSED",
+ "CANCELED", "COMPLETED", "FAILED"],
DownloadNetworkType: ["CELLULAR", "WIFI", "ALL"],
// Messaging
- MessageServiceTag: ["messaging.sms", "messaging.mms", "messaging.email"],
+ MessageServiceTag: ["messaging.sms", "messaging.mms",
+ "messaging.email"],
// Network Bearer Selection
NetworkType: ["CELLULAR", "UNKNOWN"],
// NFC
NDEFRecordTextEncoding: ["UTF8", "UTF16"],
NFCTagType: ["GENERIC_TARGET", "ISO14443_A",
- "ISO14443_4A", "ISO14443_3A", "MIFARE_MINI",
- "MIFARE_1K", "MIFARE_4K", "MIFARE_ULTRA",
+ "ISO14443_4A", "ISO14443_3A",
+ "MIFARE_MINI", "MIFARE_1K",
+ "MIFARE_4K", "MIFARE_ULTRA",
"MIFARE_DESFIRE", "ISO14443_B",
- "ISO14443_4B", "ISO14443_BPRIME", "FELICA",
- "JEWEL", "ISO15693", "UNKNOWN_TARGET"],
+ "ISO14443_4B", "ISO14443_BPRIME",
+ "FELICA", "JEWEL", "ISO15693",
+ "UNKNOWN_TARGET"],
// Notification
NotificationType: ["STATUS", "STATUS"],
StatusNotificationType: ["SIMPLE", "THUMBNAIL", "ONGOING",
"PROGRESS"],
- NotificationProgressType: ["PERCENTAGE", "BYTE"]
+ NotificationProgressType: ["PERCENTAGE", "BYTE"],
+
+ // System Info
+ SystemInfoPropertyId: ["BATTERY", "CPU", "STORAGE", "DISPLAY",
+ "DEVICE_ORIENTATION", "BUILD",
+ "LOCALE", "NETWORK", "WIFI_NETWORK",
+ "CELLULAR_NETWORK", "SIM",
+ "PERIPHERAL"],
+ SystemInfoNetworkType: ["NONE", "2G", "2.5G", "3G", "4G",
+ "WIFI", "ETHERNET", "UNKNOWN"],
+ SystemInfoDeviceOrientationStatus: ["PORTRAIT_PRIMARY",
+ "PORTRAIT_SECONDARY",
+ "LANDSCAPE_PRIMARY",
+ "LANDSCAPE_SECONDARY"],
+ SystemInfoSimState: ["ABSENT", "INITIALIZING", "READY",
+ "PIN_REQUIRED", "PUK_REQUIRED",
+ "NETWORK_LOCKED", "SIM_LOCKED",
+ "UNKNOWN"],
+ SystemInfoProfile: ["MOBILE_FULL", "MOBILE_WEB"],
+
+ // System Setting
+ SystemSettingType: ["HOME_SCREEN", "LOCK_SCREEN",
+ "INCOMING_CALL", "NOTIFICATION_EMAIL"],
+
+ // Time
+ TimeDurationUnit: ["MSECS", "SECS", "MINS", "HOURS",
+ "DAYS"]
};
/*
/*
* Object attributes
- * Contruct a prototype of an object. Specify a primitive type for each attribute.
+ * Contruct a prototype of an object. Specify a primitive type for each
+ * attribute.
*
* _optional
* Optional attributes table, which consists of two types of attributes,
* Common
*/
-_t.CompositeFilter = {
- type: _t.CompositeFilterType,
- filters: ["AbstractFilter"] // Recursive expansion
-};
-
_t.AttributeFilter = {
attributeName: _t.DOMString,
matchFlag: _t.FilterMatchFlag,
- matchValue: _t.any
+ matchValue: _t.any,
+
+ _optional: {
+ // nullable
+ matchValue: true
+ }
};
_t.AttributeRangeFilter = {
attributeName: _t.DOMString,
initialValue: _t.any,
- endValue: _t.any
+ endValue: _t.any,
+
+ _optional: {
+ // nullable
+ initialValue: true,
+ endValue: true
+ }
+};
+
+_t.CompositeFilter = {
+ type: _t.CompositeFilterType,
+ filters: ["AbstractFilter"] // Recursive expansion
};
_t.AbstractFilter = {
- _derived: [_t.CompositeFilter, _t.AttributeFilter, _t.AttributeRangeFilter]
+ _derived: [_t.AttributeFilter, _t.AttributeRangeFilter, _t.CompositeFilter]
};
_t.SortMode = {
_t.ErrorCallback = _t.Function;
/*
+ * Time
+ */
+
+_t.TimeDuration = {
+ length: _t.long_long,
+ unit: _t.TimeDurationUnit,
+ difference: _t.Function,
+ equalsTo: _t.Function,
+ lessThan: _t.Function,
+ greaterThan: _t.Function
+};
+
+/*
* Alarm
*/
_t.AlarmId = _t.DOMString;
_t.AlarmRelative = {
- delay: _t["unsigned long long"],
- period: _t["unsigned long long"],
+ delay: _t.unsigned_long_long,
+ period: _t.unsigned_long_long,
getRemainingSeconds: _t.Function,
_optional: {
_t.AlarmAbsolute = {
date: _t.Date,
- period: _t["unsigned long long"],
+ period: _t.unsigned_long_long,
daysOfTheWeek: [_t.ByDayValue],
getNextScheduledDate: _t.Function,
};
/*
+ * Bluetooth
+ */
+
+_t.BluetoothAddress = _t.DOMString;
+_t.BluetoothUUID = _t.DOMString;
+_t.BluetoothDeviceSuccessCallback = _t.Function;
+_t.BluetoothDeviceArraySuccessCallback = _t.Function;
+_t.BluetoothSocketSuccessCallback = _t.Function;
+_t.BluetoothServiceSuccessCallback = _t.Function;
+_t.BluetoothHealthApplicationSuccessCallback = _t.Function;
+_t.BluetoothHealthChannelSuccessCallback = _t.Function;
+
+_t.BluetoothClass = {
+ major: _t.octet,
+ minor: _t.octet,
+ services: [_t.unsigned_short],
+ hasService: _t.Function
+};
+
+_t.BluetoothDevice = {
+ name: _t.DOMString,
+ address: _t.BluetoothAddress,
+ deviceClass: _t.BluetoothClass,
+ isBonded: _t.boolean,
+ isTrusted: _t.boolean,
+ isConnected: _t.boolean,
+ uuids: [_t.BluetoothUUID],
+ connectToServiceByUUID: _t.Function
+};
+
+_t.BluetoothHealthApplication = {
+ dataType: _t.unsigned_short,
+ name: _t.DOMString,
+ onconnect: _t.BluetoothHealthChannelSuccessCallback,
+ unregister: _t.Function,
+
+ _optional: {
+ onconnect: true
+ }
+};
+
+_t.BluetoothAdapterChangeCallback = {
+ onstatechanged: _t.Callback,
+ onnamechanged: _t.Callback,
+ onvisibilitychanged: _t.Callback
+};
+
+_t.BluetoothDiscoverDevicesSuccessCallback = {
+ onstarted: _t.Callback,
+ ondevicefound: _t.Callback,
+ ondevicedisappeared: _t.Callback,
+ onfinished: _t.Callback
+};
+
+_t.BluetoothHealthChannelChangeCallback = {
+ onmessage: _t.Callback,
+ onclose: _t.Callback
+};
+
+/*
* Bookmark
*/
};
/*
- * Calendar
- */
-
-_t.CalendarChangeCallback = {
- onitemsadded: _t.Callback,
- onitemsupdated: _t.Callback,
- onitemsremoved: _t.Callback
-};
-
-/*
* Contact
*/
ringtoneURI: _t.DOMString,
groupIds: [_t.ContactGroupId],
- _dictionary: true
+ _dictionary: null
};
_t.ContactNameInit = {
phoneticFirstName: _t.DOMString,
phoneticLastName: _t.DOMString,
- _dictionary: true
+ _dictionary: null
};
_t.ContactOrganizationInit = {
role: _t.DOMString,
logoURI: _t.DOMString,
- _dictionary: true
+ _dictionary: null
};
_t.ContactAddressInit = {
isDefault: _t.boolean,
types: [_t.DOMString],
- _dictionary: true
+ _dictionary: null
+};
+
+/*
+ * Calendar
+ */
+
+_t.CalendarId = _t.DOMString;
+_t.CalendarTaskId = _t.DOMString;
+_t.CalendarEventArraySuccessCallback = _t.Function;
+_t.CalendarItemArraySuccessCallback = _t.Function;
+_t.CalendarArraySuccessCallback = _t.Function;
+
+_t.CalendarEventId = {
+ uid: _t.DOMString,
+ rid: _t.DOMString,
+
+ _optional: {
+ // nullable
+ rid: true
+ }
+};
+
+_t.CalendarItemId = {
+ _derived: [_t.CalendarEventId, _t.CalendarTaskId]
+};
+
+_t.CalendarAlarm = {
+ absoluteDate: _t.TZDate,
+ before: _t.TimeDuration,
+ method: _t.AlarmMethod,
+ description: _t.DOMString,
+
+ _optional: {
+ // nullable
+ absoluteDate: true,
+ before: true,
+ description: true
+ }
+};
+
+_t.CalendarAttendee = {
+ uri: _t.DOMString,
+ name: _t.DOMString,
+ role: _t.AttendeeRole,
+ status: _t.AttendeeStatus,
+ RSVP: _t.boolean,
+ type: _t.AttendeeType,
+ group: _t.DOMString,
+ delegatorURI: _t.DOMString,
+ delegateURI: _t.DOMString,
+ contactRef: _t.ContactRef,
+
+ _optional: {
+ // nullable
+ name: true,
+ group: true,
+ delegatorURI: true,
+ delegateURI: true,
+ contactRef: true
+ }
+};
+
+_t.CalendarRecurrenceRule = {
+ frequency: _t.RecurrenceRuleFrequency,
+ interval: _t.unsigned_short,
+ untilDate: _t.TZDate,
+ occurrenceCount: _t.long,
+ daysOfTheWeek: [_t.ByDayValue],
+ setPositions: [_t.short],
+ exceptions: [_t.TZDate],
+
+ _optional: {
+ // nullable
+ untilDate: true
+ }
+};
+
+_t.CalendarTask = {
+ dueDate: _t.TZDate,
+ completedDate: _t.TZDate,
+ progress: _t.unsigned_short,
+
+ _optional: {
+ // nullable
+ dueDate: true,
+ completedDate: true
+ }
+};
+
+_t.CalendarEvent = {
+ isDetached: _t.boolean,
+ endDate: _t.TZDate,
+ availability: _t.EventAvailability,
+ recurrenceRule: _t.CalendarRecurrenceRule,
+ expandRecurrence: _t.Function,
+
+ _optional: {
+ // nullable
+ endDate: true,
+ recurrenceRule: true
+ }
+};
+
+_t.CalendarItem = {
+ id: _t.CalendarItemId,
+ calendarId: _t.CalendarId,
+ lastModificationDate: _t.TZDate,
+ description: _t.DOMString,
+ summary: _t.DOMString,
+ isAllDay: _t.boolean,
+ startDate: _t.TZDate,
+ duration: _t.TimeDuration,
+ location: _t.DOMString,
+ geolocation: _t.SimpleCoordinates,
+ organizer: _t.DOMString,
+ visibility: _t.CalendarItemVisibility,
+ status: _t.CalendarItemStatus,
+ priority: _t.CalendarItemPriority,
+ alarms: [_t.CalendarAlarm],
+ categories: [_t.DOMString],
+ attendees: [_t.CalendarAttendee],
+ convertToString: _t.Function,
+ clone: _t.Function,
+
+ _optional: {
+ // nullable
+ id: true,
+ calendarId: true,
+ lastModificationDate: true,
+ description: true,
+ summary: true,
+ startDate: true,
+ duration: true,
+ location: true,
+ geolocation: true,
+ organizer: true
+ },
+
+ _derived: [_t.CalendarTask, _t.CalendarEvent]
+};
+
+_t.CalendarItemInit = {
+ description: _t.DOMString,
+ summary: _t.DOMString,
+ isAllDay: _t.boolean,
+ startDate: _t.TZDate,
+ duration: _t.TimeDuration,
+ location: _t.DOMString,
+ geolocation: _t.SimpleCoordinates,
+ organizer: _t.DOMString,
+ visibility: _t.CalendarItemVisibility,
+ status: _t.CalendarItemStatus,
+ priority: _t.CalendarItemPriority,
+ alarms: [_t.CalendarAlarm],
+ categories: [_t.DOMString],
+ attendees: [_t.CalendarAttendee],
+
+ _dictionary: null
+};
+
+_t.CalendarTaskInit = {
+ dueDate: _t.TZDate,
+ completedDate: _t.TZDate,
+ progress: _t.short,
+
+ _dictionary: _t.CalendarItemInit
+};
+
+_t.CalendarEventInit = {
+ endDate: _t.TZDate,
+ availability: _t.EventAvailability,
+ recurrenceRule: _t.CalendarRecurrenceRule,
+
+ _dictionary: _t.CalendarItemInit
+};
+
+_t.CalendarAttendeeInit = {
+ name: _t.DOMString,
+ role: _t.AttendeeRole,
+ status: _t.AttendeeStatus,
+ RSVP: _t.boolean,
+ type: _t.AttendeeType,
+ group: _t.DOMString,
+ delegatorURI: _t.DOMString,
+ delegateURI: _t.DOMString,
+ contactRef: _t.ContactRef,
+
+ _dictionary: null
+};
+
+_t.CalendarRecurrenceRuleInit = {
+ interval: _t.short,
+ untilDate: _t.TZDate,
+ occurrenceCount: _t.long,
+ daysOfTheWeek: [_t.ByDayValue],
+ setPositions: [_t.short],
+ exceptions: [_t.TZDate],
+
+ _dictionary: null
+};
+
+_t.CalendarChangeCallback = {
+ onitemsadded: _t.Callback,
+ onitemsupdated: _t.Callback,
+ onitemsremoved: _t.Callback
+};
+
+/*
+ * CallHistory
+ */
+
+_t.CallHistoryEntryArraySuccessCallback = _t.Function;
+
+_t.RemoteParty = {
+ remoteParty: _t.DOMString,
+ personId: _t.PersonId,
+
+ _optional: {
+ // nullable
+ remoteParty: true,
+ personId: true
+ }
+};
+
+_t.CallHistoryEntry = {
+ uid: _t.DOMString,
+ type: _t.DOMString,
+ features: [_t.DOMString],
+ remoteParties: [_t.RemoteParty],
+ startTime: _t.Date,
+ duration: _t.unsigned_long,
+ direction: _t.DOMString,
+
+ _optional: {
+ // nullable
+ features: true
+ }
+};
+
+_t.CallHistoryChangeCallback = {
+ onadded: _t.Callback,
+ onchanged: _t.Callback,
+ onremoved: _t.Callback
};
/*
geolocation: _t.SimpleCoordinates,
album: _t.DOMString,
artists: [_t.DOMString],
- duration: _t["unsigned long"],
- width: _t["unsigned long"],
- height: _t["unsigned long"],
+ duration: _t.unsigned_long,
+ width: _t.unsigned_long,
+ height: _t.unsigned_long,
_optional: {
// nullable
_t.AudioContentLyrics = {
type: _t.AudioContentLyricsType,
- timestamps: [_t["unsigned long"]],
+ timestamps: [_t.unsigned_long],
texts: [_t.DOMString]
};
composers: [_t.DOMString],
lyrics: _t.AudioContentLyrics,
copyright: _t.DOMString,
- bitrate: _t["unsigned long"],
- trackNumber: _t["unsigned short"],
- duration: _t["unsigned long"],
+ bitrate: _t.unsigned_long,
+ trackNumber: _t.unsigned_short,
+ duration: _t.unsigned_long,
_optional: {
// nullable
_t.ImageContent = {
geolocation: _t.SimpleCoordinates,
- width: _t["unsigned long"],
- height: _t["unsigned long"],
+ width: _t.unsigned_long,
+ height: _t.unsigned_long,
orientation: _t.ImageContentOrientation,
_optional: {
thumbnailURIs: [_t.DOMString],
releaseDate: _t.Date,
modifiedDate: _t.Date,
- size: _t["unsigned long"],
+ size: _t.unsigned_long,
description: _t.DOMString,
rating: _t.float,
_t.DownloadHTTPHeaderFields = {};
_t.DownloadRequest = {
- url: _t.DOMString,
- destination: _t.DOMString,
- fileName: _t.DOMString,
- networkType: _t.DownloadNetworkType,
- httpHeader: _t.DownloadHTTPHeaderFields,
+ url: _t.DOMString,
+ destination: _t.DOMString,
+ fileName: _t.DOMString,
+ networkType: _t.DownloadNetworkType,
+ httpHeader: _t.DownloadHTTPHeaderFields,
_optional: {
- destination: true,
- fileName: true,
- networkType: true,
- httpHeader: true
+ destination: true,
+ fileName: true,
+ networkType: true,
+ httpHeader: true
}
};
_t.DownloadCallback = {
- onprogress: _t.Callback,
- onpaused: _t.Callback,
- oncanceled: _t.Callback,
- oncompleted: _t.Callback,
- onfailed: _t.Callback,
+ onprogress: _t.Callback,
+ onpaused: _t.Callback,
+ oncanceled: _t.Callback,
+ oncompleted: _t.Callback,
+ onfailed: _t.Callback
};
/*
// nullable
parentId: true
}
-
};
_t.MessagesChangeCallback = {
}
};
+_t.StatusNotificationInit = {
+ content: _t.DOMString,
+ iconPath: _t.DOMString,
+ soundPath: _t.DOMString,
+ vibration: _t.boolean,
+ appControl: _t.ApplicationControl,
+ appId: _t.ApplicationId,
+ progressType: _t.NotificationProgressType,
+ progressValue: _t.unsigned_long,
+ number: _t.long,
+ subIconPath: _t.DOMString,
+ detailInfo: [_t.NotificationDetailInfo],
+ ledColor: _t.DOMString,
+ ledOnPeriod: _t.unsigned_long,
+ ledOffPeriod: _t.unsigned_long,
+ backgroundImagePath: _t.DOMString,
+ thumbnails: [_t.DOMString],
+
+ _dictionary: null
+};
+
_t.StatusNotification = {
statusType: _t.StatusNotificationType,
iconPath: _t.DOMString,
number: _t.long,
detailInfo: [_t.NotificationDetailInfo],
ledColor: _t.DOMString,
- ledOnPeriod: _t["unsigned long"],
- ledOffPeriod: _t["unsigned long"],
+ ledOnPeriod: _t.unsigned_long,
+ ledOffPeriod: _t.unsigned_long,
backgroundImagePath: _t.DOMString,
thumbnails: [_t.DOMString],
soundPath: _t.DOMString,
appControl: _t.ApplicationControl,
appId: _t.ApplicationId,
progressType: _t.NotificationProgressType,
- progressValue: _t["unsigned long"],
+ progressValue: _t.unsigned_long,
_optional: {
// nullable
};
/*
+ * System Info
+ */
+
+_t.SystemInfoPropertySuccessCallback = _t.Callback;
+
+_t.SystemInfoOptions = {
+ timeout: _t.unsigned_long,
+ highThreshold: _t.double,
+ lowThreshold: _t.double,
+
+ _dictionary: null
+};
+
+/*
+ * System Setting
+ */
+
+_t.SystemSettingSuccessCallback = _t.Function;
+
+/*
+ * Vehicle
+ */
+_t.SupportedPropertiesSuccessCallback = _t.Function;
+
+_t.VehiclePropertyErrorCallback = _t.Function;
+
+/*
* Constructor list definition
*/
// Alarm
AlarmAbsolute: [],
+ // Calendar
+ CalendarTask: [],
+ CalendarEvent: [],
+ CalendarAlarm: [],
+
// Contact
Contact: [],
NDEFRecord: [],
// Data Synchronization
- SyncInfo: []
+ SyncInfo: [],
+
+ // Time
+ TZDate: []
};
/*
* Common
*/
+// AttributeFilter
+_c.AttributeFilter = {
+ 0: _t.DOMString,
+ 1: _t.FilterMatchFlag,
+ 2: _t.any,
+
+ _optional: {
+ 1: true,
+ 2: true
+ }
+};
+
+// AttributeRangeFilter
+_c.AttributeRangeFilter = {
+ 0: _t.DOMString,
+ 1: _t.any,
+ 2: _t.any,
+
+ _optional: {
+ 1: true,
+ 2: true
+ }
+};
+
+// CompositeFilter
+_c.CompositeFilter = {
+ 0: _t.CompositeFilterType,
+ 1: [_t.AbstractFilter],
+
+ _optional: {
+ 1: true
+ }
+};
+
// SortMode
_c.SortMode = {
0: _t.DOMString,
}
};
+// SimpleCoordinates
+_c.SimpleCoordinates = {
+ 0: _t.double,
+ 1: _t.double
+};
+
/*
* Alarm
*/
};
/*
+ * Calendar
+ */
+
+// CalendarTask
+_c.CalendarTask[0] = {
+ 0: _t.CalendarTaskInit,
+
+ _optional: {
+ // nullable
+ 0: true
+ }
+};
+
+_c.CalendarTask[1] = {
+ 0: _t.DOMString,
+ 1: _t.CalendarTextFormat
+};
+
+// CalendarEvent
+_c.CalendarEvent[0] = {
+ 0: _t.CalendarEventInit,
+
+ _optional: {
+ // nullable
+ 0: true
+ }
+};
+
+_c.CalendarEvent[1] = {
+ 0: _t.DOMString,
+ 1: _t.CalendarTextFormat
+};
+
+// CalendarAttendee
+_c.CalendarAttendee = {
+ 0: _t.DOMString,
+ 1: _t.CalendarAttendeeInit,
+
+ _optional: {
+ 1: true
+ }
+};
+
+// CalendarRecurrenceRule
+_c.CalendarRecurrenceRule = {
+ 0: _t.RecurrenceRuleFrequency,
+ 1: _t.CalendarRecurrenceRuleInit,
+
+ _optional: {
+ 1: true
+ }
+};
+
+// CalendarEventId
+_c.CalendarEventId = {
+ 0: _t.DOMString,
+ 1: _t.DOMString,
+
+ _optional: {
+ 1: true
+ }
+};
+
+// CalendarAlarm
+_c.CalendarAlarm[0] = {
+ 0: _t.TZDate,
+ 1: _t.AlarmMethod,
+ 2: _t.DOMString,
+
+ _optional: {
+ 2: true
+ }
+};
+
+_c.CalendarAlarm[1] = {
+ 0: _t.TimeDuration,
+ 1: _t.AlarmMethod,
+ 2: _t.DOMString,
+
+ _optional: {
+ 2: true
+ }
+};
+
+/*
* Contact
*/
};
/*
+ * Download
+ */
+
+// DownloadRequest
+_c.DownloadRequest = {
+ 0: _t.DOMString,
+ 1: _t.DOMString,
+ 2: _t.DOMString,
+ 3: _t.DownloadNetworkType,
+ 4: _t.DownloadHTTPHeaderFields,
+
+ _optional: {
+ 1: true,
+ 2: true,
+ 3: true,
+ 4: true
+ }
+};
+
+/*
* NFC
*/
};
/*
+ * Notification
+ */
+
+// StatusNotification
+_c.StatusNotification = {
+ 0: _t.StatusNotificationType,
+ 1: _t.DOMString,
+ 2: _t.StatusNotificationInit,
+
+ _optional: {
+ 2: true
+ }
+};
+
+// NotificationDetailInfo
+_c.NotificationDetailInfo = {
+ 0: _t.DOMString,
+ 1: _t.DOMString,
+
+ _optional: {
+ 1: true
+ }
+};
+
+/*
+ * Time
+ */
+
+// TZDate
+_c.TZDate[0] = {
+ 0: _t.Date,
+ 1: _t.DOMString,
+
+ _optional: {
+ // nullable
+ 0: true,
+ 1: true
+ }
+};
+
+_c.TZDate[1] = {
+ 0: _t.long,
+ 1: _t.long,
+ 2: _t.long,
+ 3: _t.long,
+ 4: _t.long,
+ 5: _t.long,
+ 6: _t.long,
+ 7: _t.DOMString,
+
+ _optional: {
+ // nullable
+ 3: true,
+ 4: true,
+ 5: true,
+ 6: true,
+ 7: true
+ }
+};
+
+// TimeDuration
+_c.TimeDuration = {
+ 0: _t.long_long,
+ 1: _t.TimeDurationUnit,
+
+ _optional: {
+ // nullable
+ 1: true
+ }
+};
+
+/*
* Interface prototype definition
*/
Application: {},
RequestedApplicationControl: {},
+ // Bluetooth
+ BluetoothManager: {},
+ BluetoothAdapter: {},
+ BluetoothDevice: {},
+ BluetoothSocket: {},
+ BluetoothClass: {},
+ BluetoothServiceHandler: {},
+ BluetoothHealthProfileHandler: {},
+ BluetoothHealthApplication: {},
+ BluetoothHealthChannel: {},
+
// Bookmark
BookmarkManager: {},
+ // Calendar
+ CalendarManager: {},
+ Calendar: {},
+ CalendarItem: {},
+ CalendarEvent: {},
+
+ // Call History
+ CallHistory: {},
+
// Contact
ContactManager: {},
AddressBook: {},
PackageManager: {},
// Push
- PushManager: {}
+ PushManager: {},
+
+ // System Info
+ SystemInfo: {},
+
+ // System Setting
+ SystemSettingManager: {},
+
+ // Time
+ TimeUtil: {},
+ TZDate: {},
+ TimeDuration: {},
+
+ // Vehicle
+ Vehicle: {}
};
/*
_i.RequestedApplicationControl.replyFailure = null;
/*
+ * Bluetooth
+ */
+
+// BluetoothManager
+_i.BluetoothManager.getDefaultAdapter = null;
+
+// BluetoothAdapter
+_i.BluetoothAdapter.setName = {
+ 0: _t.DOMString,
+ 1: _t.SuccessCallback,
+ 2: _t.ErrorCallback,
+
+ _optional: {
+ 1: true,
+ 2: true
+ }
+};
+
+_i.BluetoothAdapter.setPowered = {
+ 0: _t.boolean,
+ 1: _t.SuccessCallback,
+ 2: _t.ErrorCallback,
+
+ _optional: {
+ 1: true,
+ 2: true
+ }
+};
+
+_i.BluetoothAdapter.setVisible = {
+ 0: _t.boolean,
+ 1: _t.SuccessCallback,
+ 2: _t.ErrorCallback,
+ 3: _t.unsigned_short,
+
+ _optional: {
+ 1: true,
+ 2: true,
+ 3: true
+ }
+};
+
+_i.BluetoothAdapter.setChangeListener = {
+ 0: _t.BluetoothAdapterChangeCallback
+};
+
+_i.BluetoothAdapter.unsetChangeListener = null;
+
+_i.BluetoothAdapter.discoverDevices = {
+ 0: _t.BluetoothDiscoverDevicesSuccessCallback,
+ 1: _t.ErrorCallback,
+
+ _optional: {
+ 1: true
+ }
+};
+
+_i.BluetoothAdapter.stopDiscovery = {
+ 0: _t.SuccessCallback,
+ 1: _t.ErrorCallback,
+
+ _optional: {
+ 0: true,
+ 1: true
+ }
+};
+
+_i.BluetoothAdapter.getKnownDevices = {
+ 0: _t.BluetoothDeviceArraySuccessCallback,
+ 1: _t.ErrorCallback,
+
+ _optional: {
+ 1: true
+ }
+};
+
+_i.BluetoothAdapter.getDevice = {
+ 0: _t.BluetoothAddress,
+ 1: _t.BluetoothDeviceSuccessCallback,
+ 2: _t.ErrorCallback,
+
+ _optional: {
+ 2: true
+ }
+};
+
+_i.BluetoothAdapter.createBonding = {
+ 0: _t.BluetoothAddress,
+ 1: _t.BluetoothDeviceSuccessCallback,
+ 2: _t.ErrorCallback,
+
+ _optional: {
+ 2: true
+ }
+};
+
+_i.BluetoothAdapter.destroyBonding = {
+ 0: _t.BluetoothAddress,
+ 1: _t.SuccessCallback,
+ 2: _t.ErrorCallback,
+
+ _optional: {
+ 1: true,
+ 2: true
+ }
+};
+
+_i.BluetoothAdapter.registerRFCOMMServiceByUUID = {
+ 0: _t.BluetoothUUID,
+ 1: _t.DOMString,
+ 2: _t.BluetoothServiceSuccessCallback,
+ 3: _t.ErrorCallback,
+
+ _optional: {
+ 3: true
+ }
+};
+
+_i.BluetoothAdapter.getBluetoothProfileHandler = {
+ 0: _t.BluetoothProfileType
+};
+
+// BluetoothDevice
+_i.BluetoothDevice.connectToServiceByUUID = {
+ 0: _t.BluetoothUUID,
+ 1: _t.BluetoothSocketSuccessCallback,
+ 2: _t.ErrorCallback,
+
+ _optional: {
+ 2: true
+ }
+};
+
+// BluetoothSocket
+_i.BluetoothSocket.readData = null;
+_i.BluetoothSocket.close = null;
+
+_i.BluetoothSocket.writeData = {
+ 0: [_t.byte]
+};
+
+// BluetoothClass
+_i.BluetoothClass.hasService = {
+ 0: _t.unsigned_short
+};
+
+// BluetoothServiceHandler
+_i.BluetoothServiceHandler.unregister = {
+ 0: _t.SuccessCallback,
+ 1: _t.ErrorCallback,
+
+ _optional: {
+ 0: true,
+ 1: true
+ }
+};
+
+// BluetoothHealthProfileHandler
+_i.BluetoothHealthProfileHandler.registerSinkApplication = {
+ 0: _t.unsigned_short,
+ 1: _t.DOMString,
+ 2: _t.BluetoothHealthApplicationSuccessCallback,
+ 3: _t.ErrorCallback,
+
+ _optional: {
+ 3: true
+ }
+};
+
+_i.BluetoothHealthProfileHandler.connectToSource = {
+ 0: _t.BluetoothDevice,
+ 1: _t.BluetoothHealthApplication,
+ 2: _t.BluetoothHealthChannelSuccessCallback,
+ 3: _t.ErrorCallback,
+
+ _optional: {
+ 3: true
+ }
+};
+
+// BluetoothHealthApplication
+_i.BluetoothHealthApplication.unregister = {
+ 0: _t.SuccessCallback,
+ 1: _t.ErrorCallback,
+
+ _optional: {
+ 0: true,
+ 1: true
+ }
+};
+
+// BluetoothHealthChannel
+_i.BluetoothHealthChannel.close = null;
+_i.BluetoothHealthChannel.unsetListener = null;
+
+_i.BluetoothHealthChannel.sendData = {
+ 0: [_t.byte]
+};
+
+_i.BluetoothHealthChannel.setListener = {
+ 0: _t.BluetoothHealthChannelChangeCallback
+};
+
+/*
* Bookmark
*/
};
/*
+ * Calendar
+ */
+
+// CalendarManager
+_i.CalendarManager.getCalendars = {
+ 0: _t.CalendarType,
+ 1: _t.CalendarArraySuccessCallback,
+ 2: _t.ErrorCallback,
+
+ _optional: {
+ 2: true
+ }
+};
+
+_i.CalendarManager.getUnifiedCalendar = {
+ 0: _t.CalendarType
+};
+
+_i.CalendarManager.getDefaultCalendar = {
+ 0: _t.CalendarType
+};
+
+_i.CalendarManager.getCalendar = {
+ 0: _t.CalendarType,
+ 1: _t.CalendarId
+};
+
+// Calendar
+_i.Calendar.get = {
+ 0: _t.CalendarItemId
+};
+
+_i.Calendar.add = {
+ 0: _t.CalendarItem
+};
+
+_i.Calendar.addBatch = {
+ 0: [_t.CalendarItem],
+ 1: _t.CalendarItemArraySuccessCallback,
+ 2: _t.ErrorCallback,
+
+ _optional: {
+ 1: true,
+ 2: true
+ }
+};
+
+_i.Calendar.update = {
+ 0: _t.CalendarItem,
+ 1: _t.boolean,
+
+ _optional: {
+ 1: true
+ }
+};
+
+_i.Calendar.updateBatch = {
+ 0: [_t.CalendarItem],
+ 1: _t.SuccessCallback,
+ 2: _t.ErrorCallback,
+ 3: _t.boolean,
+
+ _optional: {
+ 1: true,
+ 2: true,
+ 3: true
+ }
+};
+
+_i.Calendar.remove = {
+ 0: _t.CalendarItemId
+};
+
+_i.Calendar.removeBatch = {
+ 0: [_t.CalendarItemId],
+ 1: _t.SuccessCallback,
+ 2: _t.ErrorCallback,
+
+ _optional: {
+ 1: true,
+ 2: true
+ }
+};
+
+_i.Calendar.find = {
+ 0: _t.CalendarItemArraySuccessCallback,
+ 1: _t.ErrorCallback,
+ 2: _t.AbstractFilter,
+ 3: _t.SortMode,
+
+ _optional: {
+ 1: true,
+ 2: true,
+ 3: true
+ }
+};
+
+_i.Calendar.addChangeListener = {
+ 0: _t.CalendarChangeCallback
+};
+
+_i.Calendar.removeChangeListener = {
+ 0: _t.long
+};
+
+// CalendarItem
+_i.CalendarItem.convertToString = {
+ 0: _t.CalendarTextFormat
+};
+
+_i.CalendarItem.clone = null;
+
+// CalendarEvent
+_i.CalendarEvent.expandRecurrence = {
+ 0: _t.TZDate,
+ 1: _t.TZDate,
+ 2: _t.CalendarEventArraySuccessCallback,
+ 3: _t.ErrorCallback,
+
+ _optional: {
+ 3: true
+ }
+};
+
+/*
+ * Call History
+ */
+
+// CallHistory
+_i.CallHistory.find = {
+ 0: _t.CallHistoryEntryArraySuccessCallback,
+ 1: _t.ErrorCallback,
+ 2: _t.AbstractFilter,
+ 3: _t.SortMode,
+ 4: _t.unsigned_long,
+ 5: _t.unsigned_long,
+
+ _optional: {
+ // nullable
+ 1: true,
+ 2: true,
+ 3: true,
+ 4: true,
+ 5: true
+ }
+};
+
+_i.CallHistory.remove = {
+ 0: _t.CallHistoryEntry
+};
+
+_i.CallHistory.removeBatch = {
+ 0: [_t.CallHistoryEntry],
+ 1: _t.SuccessCallback,
+ 2: _t.ErrorCallback,
+
+ _optional: {
+ // nullable
+ 1: true,
+ 2: true
+ }
+};
+
+_i.CallHistory.removeAll = {
+ 0: _t.SuccessCallback,
+ 1: _t.ErrorCallback,
+
+ _optional: {
+ // nullable
+ 0: true,
+ 1: true
+ }
+};
+
+_i.CallHistory.addChangeListener = {
+ 0: _t.CallHistoryChangeCallback
+};
+
+_i.CallHistory.removeChangeListener = {
+ 0: _t.long
+};
+
+/*
* Contact
*/
2: _t.ContentDirectoryId,
3: _t.AbstractFilter,
4: _t.SortMode,
- 5: _t["unsigned long"],
- 6: _t["unsigned long"],
+ 5: _t.unsigned_long,
+ 6: _t.unsigned_long,
_optional: {
1: true,
// SQLDataControlConsumer
_i.SQLDataControlConsumer.insert = {
- 0: _t["unsigned long"],
+ 0: _t.unsigned_long,
1: _t.RowData,
2: _t.DataControlInsertSuccessCallback,
3: _t.DataControlErrorCallback,
};
_i.SQLDataControlConsumer.update = {
- 0: _t["unsigned long"],
+ 0: _t.unsigned_long,
1: _t.RowData,
2: _t.DOMString,
3: _t.DataControlSuccessCallback,
};
_i.SQLDataControlConsumer.remove = {
- 0: _t["unsigned long"],
+ 0: _t.unsigned_long,
1: _t.DOMString,
2: _t.DataControlSuccessCallback,
3: _t.DataControlErrorCallback,
};
_i.SQLDataControlConsumer.select = {
- 0: _t["unsigned long"],
+ 0: _t.unsigned_long,
1: [_t.DOMString],
2: _t.DOMString,
3: _t.DataControlSelectSuccessCallback,
4: _t.DataControlErrorCallback,
- 5: _t["unsigned long"],
- 6: _t["unsigned long"],
+ 5: _t.unsigned_long,
+ 6: _t.unsigned_long,
_optional: {
4: true,
// MappedDataControlConsumer
_i.MappedDataControlConsumer.addValue = {
- 0: _t["unsigned long"],
+ 0: _t.unsigned_long,
1: _t.DOMString,
2: _t.DOMString,
3: _t.DataControlSuccessCallback,
};
_i.MappedDataControlConsumer.removeValue = {
- 0: _t["unsigned long"],
+ 0: _t.unsigned_long,
1: _t.DOMString,
2: _t.DOMString,
3: _t.DataControlSuccessCallback,
};
_i.MappedDataControlConsumer.getValue = {
- 0: _t["unsigned long"],
+ 0: _t.unsigned_long,
1: _t.DOMString,
2: _t.DataControlGetValueSuccessCallback,
3: _t.DataControlErrorCallback,
};
_i.MappedDataControlConsumer.updateValue = {
- 0: _t["unsigned long"],
+ 0: _t.unsigned_long,
1: _t.DOMString,
2: _t.DOMString,
3: _t.DOMString,
};
_i.DownloadManager.cancel = {
- 0: _t["unsigned long"]
+ 0: _t.long
};
_i.DownloadManager.pause = {
- 0: _t["unsigned long"]
+ 0: _t.long
};
_i.DownloadManager.resume = {
- 0: _t["unsigned long"]
+ 0: _t.long
};
_i.DownloadManager.getState = {
- 0: _t["unsigned long"]
+ 0: _t.long
};
_i.DownloadManager.getDownloadRequest = {
- 0: _t["unsigned long"]
+ 0: _t.long
};
_i.DownloadManager.getMIMEType = {
- 0: _t["unsigned long"]
+ 0: _t.long
};
_i.DownloadManager.setListener = {
- 0: _t["unsigned long"],
+ 0: _t.long,
1: _t.DownloadCallback
};
_i.PushManager.disconnectService = null;
_i.PushManager.getRegistrationId = null;
+/*
+ * System Info
+ */
+
+// SystemInfo
+_i.SystemInfo.getCapabilities = null;
+
+_i.SystemInfo.getPropertyValue = {
+ 0: _t.SystemInfoPropertyId,
+ 1: _t.SystemInfoPropertySuccessCallback,
+ 2: _t.ErrorCallback,
+
+ _optional: {
+ 2: true
+ }
+};
+
+_i.SystemInfo.addPropertyValueChangeListener = {
+ 0: _t.SystemInfoPropertyId,
+ 1: _t.SystemInfoPropertySuccessCallback,
+ 2: _t.SystemInfoOptions,
+
+ _optional: {
+ 2: true
+ }
+};
+
+_i.SystemInfo.removePropertyValueChangeListener = {
+ 0: _t.unsigned_long
+};
+
+/*
+ * System Setting
+ */
+
+// SystemSettingManager
+_i.SystemSettingManager.setProperty = {
+ 0: _t.SystemSettingType,
+ 1: _t.DOMString,
+ 2: _t.SuccessCallback,
+ 3: _t.ErrorCallback,
+
+ _optional: {
+ 3: true
+ }
+};
+
+_i.SystemSettingManager.getProperty = {
+ 0: _t.SystemSettingType,
+ 1: _t.SystemSettingSuccessCallback,
+ 2: _t.ErrorCallback,
+
+ _optional: {
+ 2: true
+ }
+};
+
+/*
+ * Time
+ */
+
+// TimeUtil
+_i.TimeUtil.getCurrentDateTime = null;
+_i.TimeUtil.getLocalTimezone = null;
+_i.TimeUtil.getAvailableTimezones = null;
+_i.TimeUtil.getTimeFormat = null;
+
+_i.TimeUtil.getDateFormat = {
+ 0: _t.boolean,
+
+ _optional: {
+ 0: true
+ }
+};
+
+_i.TimeUtil.isLeapYear = {
+ 0: _t.long
+};
+
+// TimeDuration
+_i.TimeDuration.difference = {
+ 0: _t.TimeDuration
+};
+
+_i.TimeDuration.equalsTo = {
+ 0: _t.TimeDuration
+};
+
+_i.TimeDuration.lessThan = {
+ 0: _t.TimeDuration
+};
+
+_i.TimeDuration.greaterThan = {
+ 0: _t.TimeDuration
+};
+
+_i.Vehicle.getSupported = {
+ 0: _t.SupportedPropertiesSuccessCallback,
+ 1: _t.VehiclePropertyErrorCallback
+}
+
// Exports
_t.constructor = _c;
_t.interface = _i;
_data.status = _status.DIALED;
_initRecord();
_showCall();
- jQuery("#callSettings tr:last-child td").text("Calliing...");
+ jQuery("#callSettings tr:last-child td").text("Calling...");
jQuery("#communication-callStart > span").text("End Call");
jQuery("#callSettings input").attr("disabled", "disabled");
} else {
$("#overlayBackground").css("width", $(window).width());
$("#overlayBackground").css("height", $(window).height());
});
+
+ if (jQuery("#platform-select").val() === "ivi") {
+ jQuery("#configuration-window-save-btn").hide();
+ jQuery("#configuration-window-load-btn").hide();
+
+ jQuery("#item_container :nth-child(2)").hide();
+ jQuery("#item_container :nth-child(3)").hide();
+ }
+ else {
+ jQuery("#configuration-window-save-btn").show();
+ jQuery("#configuration-window-load-btn").show();
+
+ jQuery("#item_container :nth-child(2)").show();
+ jQuery("#item_container :nth-child(3)").show();
+ }
}
module.exports = {
utils = require('ripple/utils'),
event = require('ripple/event'),
deviceSettings = require('ripple/deviceSettings'),
- btdevices = require('ripple/platform/tizen/2.0/spec/btdevices'),
+ //dbinit = require('ripple/platform/tizen/2.0/dbinit'),
_NFC_TAG = "tizen1.0-nfc-tag",
_NFC_PEER = "tizen1.0-nfc-peer",
_NFC_OUTPUT_MESSAGE = "tizen1.0-nfc-output-message",
},
btNodes,
_btDeviceTemplate = "",
- _btSimulatedDevs = {};
+ _btSimulatedDevs = {},
+ _btBluetoothDB;
function elementEnableDisableSetting(prop) {
jQuery("#nfc-attach-msg").text("\xa0");
$("#network-bt-box").empty();
btNodes = jQuery("#network-bt-device-select");
btNodes.html("");
- utils.forEach(btdevices, function (item, index) {
+
+ //_btBluetoothDB = dbinit.Bluetooth;
+ _btBluetoothDB = db.retrieveObject("bt-simulated-devices");
+ utils.forEach(_btBluetoothDB, function (item, index) {
btNodes.append(utils.createElement("option", {
"value": index,
"innerText": item.name
if (_btSimulatedDevs[index]) {
return;
}
- _btSimulatedDevs[index] = btdevices[index];
+ _btSimulatedDevs[index] = _btBluetoothDB[index];
db.saveObject("bt-simulated-devices", _btSimulatedDevs);
event.trigger("bt-simulated-devices-changed", []);
_btRender();
});
//Default "Tizen Phone" is nearby
- _btSimulatedDevs["22:33:44:12:34:56"] = btdevices["22:33:44:12:34:56"];
+ //_btSimulatedDevs["00:02:60:00:05:63"] = _btBluetoothDB["00:02:60:00:05:63"];
+ for (var address in _btBluetoothDB) {
+ _btSimulatedDevs[address] = _btBluetoothDB[address];
+ break;
+ }
+
db.saveObject("bt-simulated-devices", _btSimulatedDevs);
_btRender();
}
* limitations under the License.
*/
var emulatorBridge = require('ripple/emulatorBridge'),
+ platform = require('ripple/platform'),
db = require('ripple/db'),
+ devices = require('ripple/devices'),
constants = require('ripple/constants'),
_event = require('ripple/event'),
tooltip = require('ripple/ui/plugins/tooltip'),
_persistRoot(url);
});
+function _getUrlParams(url) {
+ var params = {};
+
+ url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(str, key, value) {
+ params[key] = value;
+ });
+
+ return params;
+}
+
module.exports = {
initialize: function () {
- var omnibar = _omnibar(),
- position, loc, tmp,
- url, filename, matching,
- xhr;
+ var omnibar = _omnibar(), loc, tmp,
+ url, filename, matching, deviceId,
+ xhr, uriParams, platformName, platformVersion;
jQuery(".logo, .beta, .left, .right, .left-panel-collapse, .right-panel-collapse").css({
"marginTop": "35px"
$(".omni-bar").show();
- position = document.documentURI.indexOf("?url=");
- if (position !== -1) {
- url = document.documentURI.substring(position + 5, document.documentURI.length);
+ uriParams = _getUrlParams(document.documentURI);
+
+ if (uriParams.platform !== undefined) {
+ platformName = uriParams.platform.split("-")[0];
+
+ if (platformName === "mobile" || platformName === "tizen") {
+ platformName = "tizen";
+ platformVersion = "2.0";
+ }
+ else {
+ platformName = "ivi";
+ platformVersion = "3.0";
+ }
+
+ if (platform.current().id !== platformName) {
+ deviceId = devices.getCurrentDevice().id;
+ if (deviceId == "CUSTOM") {
+ deviceId = "custom";
+ }
+
+ platform.changeEnvironment({
+ "name": platformName,
+ "version": platformVersion
+ }, deviceId, function () {
+ window.tinyHipposReload = true;
+ location.reload();
+ });
+ }
+ }
+
+ if (uriParams.url !== undefined) {
+ url = uriParams.url;
if (url.match(/^\.[\.]?/) !== null) {
loc = document.location;
filename = loc.pathname.replace(/^.*[\\\/]/, '');
devicesSelect.appendChild(deviceNode);
});
+
+ if (platformID === "ivi") {
+ jQuery("#configuration-window-save-btn").hide();
+ jQuery("#configuration-window-load-btn").hide();
+
+ jQuery("#item_container :nth-child(2)").hide();
+ jQuery("#item_container :nth-child(3)").hide();
+ }
+ else {
+ jQuery("#configuration-window-save-btn").show();
+ jQuery("#configuration-window-load-btn").show();
+
+ jQuery("#item_container :nth-child(2)").show();
+ jQuery("#item_container :nth-child(3)").show();
+ }
}
function checkResolutionSize(evt) {
});
if (currentPlatform && version.id === currentPlatform) {
+ versionSelect.appendChild(versionNode);
if (currentVersion && currentVersion === versionNumber) {
platformNode.selected = true;
versionNode.selected = true;
}
}
- if (currentPlatform && version.id === currentPlatform) {
- versionSelect.appendChild(versionNode);
- }
});
platformSelect.appendChild(platformNode);
});
};
});
+define('ripple/ui/plugins/vehicle', function (require, exports, module) {
+/*
+ * Copyright 2013 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+var utils = require('ripple/utils'),
+ event = require('ripple/event'),
+ db = require('ripple/db'),
+ exception = require('ripple/exception'),
+ vehicledb = require('ripple/platform/ivi/3.0/spec/vehicledb'),
+ _vehicleGlobal = {
+ dataIndex: 0,
+ subscribes: {},
+ time: null,
+ noShow: ["time", "zone", "source"],
+ properties: vehicledb.properties,
+ status: "stop",
+ oldManual: 0
+ },
+ _t;
+
+function _trimString (str, length) {
+ return str.length > length ? str.substring(0, length) + "...": str;
+}
+
+function _getPropertyUnit (property) {
+ var propertyUnits = {
+ "VehicleSpeed-vehicleSpeed": "KPH",
+ "EngineSpeed-engineSpeed": "RPM",
+ "TripMeter-tripMeters": "[M,...]",
+ "CruiseControlStatus-speed": "KPH",
+ "Fuel-level": "%",
+ "Fuel-instantConsumption": "ML/S",
+ "Fuel-instantEconomy": "KM/L",
+ "Fuel-averageEconomy": "KM/L",
+ "EngineOil-remaining": "%",
+ "EngineOil-temperature": "C",
+ "EngineOil-pressure": "KPA",
+ "ExteriorBrightness-exteriorBrightness": "LUX",
+ "Temperature-interior": "C",
+ "Temperature-exterior": "C",
+ "HVAC-targetTemperature": "C",
+ "Sunroof-openness": "%",
+ "Sunroof-tilt": "%",
+ "ConvertibleRoof-openness": "%",
+ "Size-width": "MM",
+ "Size-height": "MM",
+ "Size-length": "MM",
+ "WheelInformation-frontWheelRadius": "MM",
+ "WheelInformation-rearWheelRadius": "MM",
+ "WheelInformation-wheelTrack": "MM",
+ "Odometer-odometer": "KM",
+ "Fluid-transmission": "%",
+ "Fluid-brake": "%",
+ "Fluid-washer": "%",
+ "Battery-voltage": "V",
+ "Battery-current": "A",
+ "TirePressure-leftFront": "KPA",
+ "TirePressure-rightFront": "KPA",
+ "TirePressure-leftRear": "KPA",
+ "TirePressure-rightRear": "KPA",
+ "TireTemperature-leftFront": "C",
+ "TireTemperature-rightFront": "C",
+ "TireTemperature-leftRear": "C",
+ "TireTemperature-rightRear": "C",
+ "VehicleTopSpeedLimit-vehicleTopSpeedLimit": "KPH"
+ };
+
+ return !propertyUnits[property] ? "" : "(" + propertyUnits[property] + ")";
+}
+
+function _initializeVehicleSupported() {
+ try {
+ db.saveObject("ivi-vehicle-db", vehicledb);
+
+ _inializeConfig();
+ _initializeSettingRunning();
+ _initializeProperties();
+ _setSupportedProperties();
+ _initializePropertiesSetting();
+ _initializeVehicleDomEvent();
+ _initializeVehicleEvent();
+
+ _runVehicleInfo();
+ jQuery("#vehicle-container .vehicle-property-auto").hide();
+ jQuery("#vehicle-container .vehicle-property-manual").show();
+
+ jQuery(function () {
+ var stop = false;
+ jQuery("#vehicle-supported-properties h3").click(function (event) {
+ if (stop) {
+ event.stopImmediatePropagation();
+ event.preventDefault();
+ stop = false;
+ }
+ });
+ jQuery("#vehicle-supported-properties").accordion("destroy").accordion({
+ header: "> div > h3",
+ autoHeight: false
+ });
+ });
+ } catch (e) {
+ exception.handle(e, true);
+ }
+}
+
+function _setAutoPropertyValue () {
+ var runInputSelector = "#vehicle-container .vehicle-property-manual input";
+
+ //run set
+ jQuery(runInputSelector).bind("change", function () {
+ var propertyId = this.id, item,
+ btVehicleDB = db.retrieveObject("ivi-vehicle-db"),
+ property, type, val, data;
+
+ item = propertyId.split("-");
+ property = item[0];
+ type = item[1];
+ val = this.value;
+
+ if (val.indexOf(",") > -1) {
+ val = val.split(",");
+ }
+
+ if (btVehicleDB.history[btVehicleDB.now]) {
+ data = btVehicleDB.history[btVehicleDB.now];
+ }
+ else {
+ data = btVehicleDB.data[btVehicleDB.now];
+ }
+
+ btVehicleDB.history[btVehicleDB.now] = utils.copy(data);
+
+ if (btVehicleDB.history[btVehicleDB.now][property] &&
+ btVehicleDB.supported.indexOf(property) > -1) {
+ btVehicleDB.history[btVehicleDB.now][property][type] = val;
+
+ btVehicleDB.historyCount++;
+ saveVehicleData(btVehicleDB);
+
+ event.trigger("vehicle-db-refresh");
+
+ if (_vehicleGlobal.subscribes[property]) {
+ event.trigger("vehicle-subscribe-request", [property, false,
+ btVehicleDB.history[btVehicleDB.now][property].zone]);
+ }
+ }
+ });
+}
+
+function saveVehicleData (btVehicleDB) {
+ var dataKey;
+
+ if (btVehicleDB.historyCount > 2000) {
+ for (dataKey in btVehicleDB.history) {
+ delete btVehicleDB.history[dataKey];
+ break;
+ }
+ }
+
+ db.saveObject("ivi-vehicle-db", btVehicleDB);
+}
+
+/**
+ * initialize vehicle properties to panel("Supported Properties")
+ * @private
+ */
+function _initializeProperties () {
+ var i, inputHtml = "", tdHtml = "", tdNum = 0,
+ inputContainer = jQuery("#vehicle-container #vehicle-supported-types"),
+ viewContainer = jQuery("#vehicle-container #vehicle-supported-view"),
+ properties = db.retrieveObject("ivi-vehicle-db").properties,
+ pro, realPro;
+
+ for (i = 0; i < properties.length; i++) {
+ realPro = properties[i];
+ pro = _trimString(realPro, 12);
+
+ inputHtml += '<input type="checkbox" id="' + realPro +
+ '-supported" name="vehicle-supported" value="' + realPro +
+ '" />';
+ inputContainer.append(inputHtml);
+
+ if (tdNum % 3 === 0) {
+ tdHtml += '<tr><td id="' + realPro + '-view" ' +
+ 'class="vehicle-unsupported" title="' + realPro + '">' +
+ pro + '</td>';
+ }
+ else if (tdNum % 3 === 1){
+ tdHtml += '<td id="' + realPro + '-view" ' +
+ 'class="vehicle-unsupported" title="' + realPro + '">' +
+ pro + '</td>';
+ }
+ else if (tdNum % 3 === 2){
+ tdHtml += '<td id="' + realPro + '-view" ' +
+ 'class="vehicle-unsupported" title="' + realPro + '">' +
+ pro + '</td></tr>';
+ }
+ tdNum++;
+ }
+ inputContainer.html(inputHtml);
+ viewContainer.html(tdHtml);
+}
+
+/**
+ * set vehicle supported properties.
+ * @private
+ */
+function _setSupportedProperties () {
+ var supported = db.retrieveObject("ivi-vehicle-db").supported, i,
+ inputSelector = "#vehicle-container div#vehicle-supported-types input",
+ viewSelector = "#vehicle-container table#vehicle-supported-view td",
+ inputEls, viewEls;
+
+ for (i = 0; i < supported.length; i++) {
+ inputEls = jQuery(inputSelector + "#" + supported[i] + "-supported");
+ if (inputEls && inputEls.length > 0) {
+ inputEls.attr("checked", "checked");
+ }
+
+ viewEls = jQuery(viewSelector + "#" + supported[i] + "-view");
+ if (viewEls && viewEls.length > 0) {
+ viewEls.removeClass("vehicle-unsupported");
+ viewEls.addClass("vehicle-supported");
+ }
+ }
+}
+
+function _makeSettingHtml (settingData) {
+ var property, propertyItems, item, viewHtml = "", style,
+ optionHtml = "", i, optionName, option, options, attr;
+
+ for (property in settingData) {
+ viewHtml += '<tr><td colspan="2" class="vehicle-property-setting-title">' +
+ property + '</td></tr>';
+
+ propertyItems = settingData[property];
+ for (item in propertyItems) {
+ if (propertyItems[item].type === "radio") {
+ if (propertyItems[item].default == true) {
+ viewHtml += '<tr><td> ' + item + '</td>' +
+ '<td align="right" class="vehicle-property-setting-set">' +
+ '<input id="' + property + '-' + item + '-set" ' +
+ ' value="true" type="checkbox" checked />' +
+ '<label for="' + property + '-' + item + '-set">' +
+ propertyItems[item].options[0] + '</label>' +
+ '</td></tr>';
+ }
+ else {
+ viewHtml += '<tr><td> ' + item + '</td>' +
+ '<td align="right" class="vehicle-property-setting-set">' +
+ '<input id="' + property + '-' + item + '-set" ' +
+ ' value="true" type="checkbox" /> ' +
+ '<label for="' + property + '-' + item + '-set">' +
+ propertyItems[item].options[0] + '</label>' +
+ ' </td></tr>';
+ }
+ }
+ else if (propertyItems[item].type === "select") {
+ optionHtml = "";
+ options = propertyItems[item].options;
+ for (i = 0; i < options.length; i++) {
+ option = options[i];
+ for (optionName in option) {
+ if (option[optionName] == propertyItems[item].default) {
+ optionHtml += '<option value="' + option[optionName] + '" selected>' +
+ optionName + '</option>';
+ }
+ else {
+ optionHtml += '<option value="' + option[optionName] + '">' +
+ optionName + '</option>';
+ }
+ break;
+ }
+ }
+ viewHtml += '<tr><td> ' + item + '</td>' +
+ '<td class="vehicle-property-setting-set">' +
+ '<select id="' + property + '-' + item + '-set">' +
+ optionHtml + '</select></td></tr>';
+ }
+ else if (propertyItems[item].type === "text") {
+ attr = "";
+ style = "";
+ if (propertyItems[item].default == null) {
+ attr = "disabled";
+ style = "color: red;";
+ }
+ viewHtml += '<tr><td style="'+ style +'"> ' + item +
+ _getPropertyUnit(property + '-' + item) + '</td>' +
+ '<td class="vehicle-property-setting-set" title="' +
+ propertyItems[item].title + '">' +
+ '<input id="' + property + '-' + item + '-set" type="text" ' +
+ attr + ' value="' + propertyItems[item].default + '" />' +
+ '</td></tr>';
+ }
+ }
+ }
+
+ return viewHtml;
+}
+
+/**
+ * initialize vehicle setting
+ * @private
+ */
+function _initializePropertiesSetting () {
+ var btVehicleDB = db.retrieveObject("ivi-vehicle-db"),
+ enabledSet = btVehicleDB.enabledSet,
+ stopSet = btVehicleDB.stopSet,
+ settingSelector = "#vehicle-container div#vehicle-properties-setting",
+ viewHtml = "";
+
+ viewHtml += '<table class="vehicle-property-setting">';
+
+ viewHtml += _makeSettingHtml(enabledSet);
+ viewHtml += _makeSettingHtml(stopSet);
+ viewHtml += '</table>';
+
+ jQuery(settingSelector).html(viewHtml);
+}
+
+function _runVehicleInfo () {
+ var time, property, propertyItem, tableString = '', i = 0, now, newData,
+ btVehicleDB = db.retrieveObject("ivi-vehicle-db"), value, data,
+ content = jQuery("#vehicle-container table.vehicle-supported-info");
+
+ _vehicleGlobal.dataIndex = _vehicleGlobal.dataIndex % btVehicleDB.dataCount;
+
+ now = (new Date()).getTime();
+ tableString += '<tr style="display: none;"><td align="left">Time</td><td align="right">' + now + '</td></tr>';
+ _vehicleGlobal.time = now;
+
+ for (time in btVehicleDB.data) {
+ if (i !== _vehicleGlobal.dataIndex) {
+ i++;
+ continue;
+ }
+ break;
+ }
+
+ data = btVehicleDB.data[time];
+
+ for (property in data) {
+ if (btVehicleDB.supported.indexOf(property) === -1) continue;
+
+ if (_vehicleGlobal.subscribes[property]) {
+ event.trigger("vehicle-subscribe-request", [property, false,
+ btVehicleDB.data[time][property].zone]);
+ }
+
+ if (btVehicleDB.enabledSet[property]) continue;
+ if (btVehicleDB.stopSet[property]) continue;
+ if (btVehicleDB.config[btVehicleDB.config.current][property]) continue;
+
+ tableString += '<tr><td colspan="2" class="vehicle-property-title">' +
+ property + '</td></tr>';
+
+ for (propertyItem in data[property]) {
+ if (_vehicleGlobal.noShow.indexOf(propertyItem) > -1) continue;
+ if (/^[A-Z][A-Z_]+[A-Z0-9]$/.test(propertyItem) &&
+ propertyItem !== "WMI" &&
+ propertyItem !== "VIN") continue;
+
+ value = btVehicleDB.data[time][property][propertyItem];
+
+ tableString += '<tr><td align="left">' + propertyItem + _getPropertyUnit(property + '-' + propertyItem) +
+ '</td><td align="right" class="vehicle-property-auto">' + value +
+ '</td><td align="right" class="vehicle-property-manual">' +
+ '<input style="text-align: right;" type="text" value="' + value +'" id="' + property + '-' + propertyItem + '-set">' +
+ '</td></tr>';
+ }
+ }
+
+ content.html('');
+ content.html(tableString);
+
+ _setAutoPropertyValue();
+
+ newData = utils.copy(btVehicleDB.data[time]);
+ btVehicleDB.history[now] = newData;
+ btVehicleDB.now = now;
+ btVehicleDB.historyCount++;
+ saveVehicleData(btVehicleDB);
+
+ event.trigger("vehicle-db-refresh");
+
+ _vehicleGlobal.dataIndex++;
+}
+
+/**
+ * initialize vehicle dom events
+ * @private
+ */
+function _initializeVehicleDomEvent () {
+ var viewSelector = "#vehicle-container #vehicle-supported-view td",
+ runSelector = "#vehicle-container #vehicle-run",
+ carSelector = "#vehicle-container #vehicle-config-cars",
+ searchSelector = "#vehicle-container #vehicle-supported-search",
+ setSelector1 = "#vehicle-container .vehicle-property-setting-set select",
+ setSelector2 = "#vehicle-container .vehicle-property-setting-set input:checkbox",
+ setSelector3 = "#vehicle-container .vehicle-property-setting-set input:text",
+ setSelector;
+
+ setSelector = setSelector1 + "," + setSelector2 + "," + setSelector3;
+
+ //add vehicle supported click event
+ jQuery(viewSelector).bind("click", function () {
+ var content = jQuery(this).html(),
+ inputPropertyID = content + "-supported",
+ element = jQuery(this),
+ vehicleChecked,
+ btVehicleDB = db.retrieveObject("ivi-vehicle-db"),
+ inputSelector = "#vehicle-container #vehicle-supported-types input";
+
+ if (element.hasClass("vehicle-unsupported")) {
+ jQuery(inputSelector + "#" + inputPropertyID).attr("checked", "checked");
+ element.removeClass("vehicle-unsupported");
+ element.addClass("vehicle-supported");
+ }
+ else {
+ jQuery(inputSelector + "#" + inputPropertyID).removeAttr("checked");
+ element.removeClass("vehicle-supported");
+ element.addClass("vehicle-unsupported");
+ }
+
+ vehicleChecked = jQuery(inputSelector + ":checked");
+ btVehicleDB.supported.length = 0;
+ vehicleChecked.each(function (index, els) {
+ btVehicleDB.supported.push(els.value);
+ });
+
+ db.saveObject("ivi-vehicle-db", btVehicleDB);
+ event.trigger("vehicle-db-refresh");
+ });
+
+ //run
+ jQuery(runSelector).bind("click", function () {
+ var element = jQuery(this),
+ noSetSelector = "#vehicle-container .vehicle-noSet";
+
+ if (element.hasClass("vehicle-unsupported")) {
+ element.removeClass("vehicle-unsupported");
+ element.addClass("vehicle-supported");
+
+ _vehicleGlobal.status = "run";
+ jQuery(noSetSelector).show();
+
+ _t = window.setInterval(function () {
+ _runVehicleInfo();
+ jQuery("#vehicle-container .vehicle-property-auto").show();
+ jQuery("#vehicle-container .vehicle-property-manual").hide();
+ }, 2000);
+ }
+ else {
+ element.removeClass("vehicle-supported");
+ element.addClass("vehicle-unsupported");
+
+ _vehicleGlobal.status = "stop";
+ jQuery(noSetSelector).hide();
+
+ window.clearTimeout(_t);
+ jQuery("#vehicle-container .vehicle-property-auto").hide();
+ jQuery("#vehicle-container .vehicle-property-manual").show();
+ }
+ });
+
+ //filter
+ jQuery(searchSelector).bind("keyup", function () {
+ var filterText = this.value.toLowerCase(), realPro, pro,
+ filterProperty, tableString = "", index = 0, i,
+ vehicleView = jQuery("#vehicle-container table#vehicle-supported-view");
+
+ vehicleView.html("");
+
+ for (i = 0; i < _vehicleGlobal.properties.length; i++) {
+ realPro = _vehicleGlobal.properties[i];
+ pro = _trimString(realPro, 12);
+ filterProperty = realPro.toLowerCase();
+
+ if (filterProperty.indexOf(filterText) > -1) {
+ if (index % 3 === 0) {
+ tableString += '<tr><td id="' + realPro + '-view" ' +
+ 'class="vehicle-unsupported" title="' + realPro + '">' +
+ pro + '</td>';
+ }
+ else if (index % 3 === 1){
+ tableString += '<td id="' + realPro + '-view" ' +
+ 'class="vehicle-unsupported" title="' + realPro + '">' +
+ pro + '</td>';
+ }
+ else if (index % 3 === 2){
+ tableString += '<td id="' + realPro + '-view" ' +
+ 'class="vehicle-unsupported" title="' + realPro + '">' +
+ pro + '</td></tr>';
+ }
+ index++;
+ }
+ }
+ vehicleView.html(tableString);
+
+ _setSupportedProperties();
+ });
+
+ //set
+ jQuery(setSelector).bind("change", function () {
+ var propertyId = this.id, item, dic = false, dicAttr,
+ btVehicleDB = db.retrieveObject("ivi-vehicle-db"),
+ property, type, val, data, time;
+
+ item = propertyId.split("-");
+ property = item[0];
+ type = item[1];
+ val = this.type && this.type === "checkbox" ?
+ (this.checked ? true : false) : this.value;
+
+ if (item.length === 4) {
+ dicAttr = item[2];
+ dic = true;
+ }
+
+ for (time in btVehicleDB.data) {
+ if (dic) {
+ btVehicleDB.data[time][property][type][dicAttr] = val;
+ }
+ else {
+ btVehicleDB.data[time][property][type] = val;
+ }
+ }
+
+ if (btVehicleDB.history[btVehicleDB.now]) {
+ data = btVehicleDB.history[btVehicleDB.now];
+ }
+ else {
+ data = btVehicleDB.data[btVehicleDB.now];
+ }
+ btVehicleDB.history[btVehicleDB.now] = utils.copy(data);
+
+ if (btVehicleDB.history[btVehicleDB.now][property] &&
+ btVehicleDB.supported.indexOf(property) > -1) {
+ if (dic) {
+ btVehicleDB.history[btVehicleDB.now][property][type][dicAttr] = val;
+ }
+ else {
+ btVehicleDB.history[btVehicleDB.now][property][type] = val;
+ }
+
+ btVehicleDB.historyCount++;
+ saveVehicleData(btVehicleDB);
+ event.trigger("vehicle-db-refresh");
+
+ if (_vehicleGlobal.subscribes[property]) {
+ event.trigger("vehicle-subscribe-request", [property, false,
+ btVehicleDB.history[btVehicleDB.now][property].zone]);
+ }
+ }
+ });
+
+ //car config
+ jQuery(carSelector).bind("change", function () {
+ var btVehicleDB = db.retrieveObject("ivi-vehicle-db"),
+ property, propertyItems, item, viewHtml = "", config,
+ configView = jQuery("#vehicle-container #vehicle-config-view"),
+ propertyObj, time, data;
+
+ config = btVehicleDB.config[this.value];
+ btVehicleDB.config.current = this.value;
+
+ for (property in btVehicleDB.config[btVehicleDB.config.current]) {
+ propertyObj = btVehicleDB.config[btVehicleDB.config.current][property];
+
+ for (time in btVehicleDB.data) {
+ data = btVehicleDB.data[time];
+ data[property] = utils.copy(propertyObj);
+ }
+
+ btVehicleDB.history[btVehicleDB.now] = utils.copy(btVehicleDB.data[btVehicleDB.now]);
+ btVehicleDB.historyCount++;
+ }
+
+ saveVehicleData(btVehicleDB);
+
+ for (property in config) {
+ viewHtml += '<tr><td colspan="2" class="vehicle-property-setting-title">' +
+ property + '</td></tr>';
+
+ if (_vehicleGlobal.subscribes[property]) {
+ event.trigger("vehicle-subscribe-request", [property, false,
+ config[property].zone]);
+ }
+
+ propertyItems = config[property];
+ for (item in propertyItems) {
+ viewHtml += '<tr><td> ' + item + _getPropertyUnit(property + '-' + item) + '</td>' +
+ '<td class="vehicle-property-setting-set">' + propertyItems[item] +
+ '<input id="' + property + '-' + item + '-set" type="hidden" ' +
+ 'value="' + propertyItems[item] + '" />' +
+ '</td></tr>';
+ }
+ }
+
+ configView.html(viewHtml);
+ });
+}
+
+function _inializeConfig () {
+ var btVehicleDB = db.retrieveObject("ivi-vehicle-db"),
+ property, propertyItems, item, viewHtml = "", config,
+ configView = jQuery("#vehicle-container #vehicle-config-view");
+
+ config = btVehicleDB.config[btVehicleDB.config.current];
+
+ for (property in config) {
+ viewHtml += '<tr><td colspan="2" class="vehicle-property-setting-title">' +
+ property + '</td></tr>';
+
+ propertyItems = config[property];
+ for (item in propertyItems) {
+ viewHtml += '<tr><td> ' + item + _getPropertyUnit(property + '-' + item) + '</td>' +
+ '<td class="vehicle-property-setting-set">' + propertyItems[item] +
+ '<input id="' + property + '-' + item + '-set" type="hidden" ' +
+ 'value="' + propertyItems[item] + '" />' +
+ '</td></tr>';
+ }
+ }
+
+ configView.html(viewHtml);
+}
+
+function _initializeSettingRunning () {
+ var btVehicleDB = db.retrieveObject("ivi-vehicle-db"),
+ property, propertyObj, time, data, item, propertyItemObj,
+ dic = false, dicAttr, dicName;
+
+ for (property in btVehicleDB.enabledSet) {
+ propertyObj = btVehicleDB.enabledSet[property];
+ propertyItemObj = {};
+
+ for (item in propertyObj) {
+ if (item.indexOf("-") > -1) {
+ dic = true;
+ dicName = item.split("-")[0];
+ dicAttr = item.split("-")[1];
+ if (!propertyItemObj[dicName]) {
+ propertyItemObj[dicName] = {};
+ }
+ propertyItemObj[dicName][dicAttr] = propertyObj[item].default;
+ }
+ else {
+ propertyItemObj[item] = propertyObj[item].default;
+ }
+ }
+
+ for (time in btVehicleDB.data) {
+ data = btVehicleDB.data[time];
+ data[property] = propertyItemObj;
+ data.zone = 0;
+ }
+ }
+
+ for (property in btVehicleDB.stopSet) {
+ propertyObj = btVehicleDB.stopSet[property];
+ propertyItemObj = {};
+
+ for (item in propertyObj) {
+ propertyItemObj[item] = propertyObj[item].default;
+ }
+
+ for (time in btVehicleDB.data) {
+ data = btVehicleDB.data[time];
+ data[property] = propertyItemObj;
+ data.zone = 0;
+ }
+ }
+
+ for (property in btVehicleDB.config[btVehicleDB.config.current]) {
+ propertyObj = btVehicleDB.config[btVehicleDB.config.current][property];
+ for (time in btVehicleDB.data) {
+ data = btVehicleDB.data[time];
+ data[property] = utils.copy(propertyObj);
+ data.zone = 0;
+ }
+ }
+
+ db.saveObject("ivi-vehicle-db", btVehicleDB);
+}
+
+function _initializeVehicleEvent () {
+ event.on("vehicle-history-request", function (property, zone, startTime, endTime) {
+ var supported, data, value, values = [], status, time,
+ btVehicleDB = db.retrieveObject("ivi-vehicle-db");
+
+ supported = btVehicleDB.supported;
+ data = btVehicleDB.history;
+
+ if (supported.indexOf(property) > -1) {
+ for (time in data) {
+ if (time >= startTime && time <= endTime &&
+ data[time].hasOwnProperty(property)) {
+ value = data[time][property];
+ value.time = time;
+ values.push(value);
+ }
+ }
+ status = true;
+ }
+ else {
+ status = false;
+ }
+
+ event.trigger("vehicle-history-response", [values, status]);
+ });
+
+ event.on("vehicle-subscribe-request", function (property, isInitial, zone) {
+ if (isInitial) {
+ _vehicleGlobal.subscribes[property] = true;
+ return;
+ }
+
+ var supported, value, status, time, history,
+ btVehicleDB = db.retrieveObject("ivi-vehicle-db"),
+ propertyObj = {};
+
+ supported = btVehicleDB.supported;
+ history = btVehicleDB.history;
+
+ if (supported.indexOf(property) > -1) {
+ if (!_vehicleGlobal.time) {
+ for (time in history) {
+ _vehicleGlobal.time = time;
+ break;
+ }
+ }
+
+ value = history[_vehicleGlobal.time][property];
+ value.time = _vehicleGlobal.time;
+ status = true;
+ }
+ else {
+ status = false;
+ }
+
+ propertyObj.val = value;
+ propertyObj.supported = status;
+ propertyObj.type = property;
+
+ event.trigger("vehicle-subscribe-response", [propertyObj]);
+ });
+}
+
+module.exports = {
+ panel: {
+ domId: "vehicle-container",
+ collapsed: true,
+ pane: "right",
+ titleName: "Vehicle Information",
+ display: true
+ },
+ initialize: function () {
+ _initializeVehicleSupported();
+ }
+};
+
+});
define('ripple/ui/plugins/videoPlayer', function (require, exports, module) {
/*
* Copyright 2011 Research In Motion Limited.
"platform",
"information",
"layout",
- "notifications",
"themeSwitcher",
"settings-menu",
"configWindow",
window.onbeforeunload = function () {
if (!window.tinyHipposReload) {
- return "Tizen Web Simulator";
+ return "Web Simulator";
}
};