--- /dev/null
+Dariusz Paziewski <d.paziewski at samsung dot com>
+Pawel Sierszen <p.sierszen at samsung dot com>
+Tomasz Lukawski <t.lukawski at samsung dot com>
+Piotr Wronski <p.wronski at samsung dot com>
+Piotr Szydelko <p.szydelko at samsung dot com>
+Tomasz Paciorek <t.paciorek at samsung dot com>
--- /dev/null
+Flora License
+
+Version 1.0, May, 2012
+
+http://floralicense.org/license/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction,
+and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by
+the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and
+all other entities that control, are controlled by, or are
+under common control with that entity. For the purposes of
+this definition, "control" means (i) the power, direct or indirect,
+to cause the direction or management of such entity,
+whether by contract or otherwise, or (ii) ownership of fifty percent (50%)
+or more of the outstanding shares, or (iii) beneficial ownership of
+such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity
+exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation source,
+and configuration files.
+
+"Object" form shall mean any form resulting from mechanical
+transformation or translation of a Source form, including but
+not limited to compiled object code, generated documentation,
+and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form,
+made available under the License, as indicated by a copyright notice
+that is included in or attached to the work (an example is provided
+in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form,
+that is based on (or derived from) the Work and for which the editorial
+revisions, annotations, elaborations, or other modifications represent,
+as a whole, an original work of authorship. For the purposes of this License,
+Derivative Works shall not include works that remain separable from,
+or merely link (or bind by name) to the interfaces of, the Work and
+Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original
+version of the Work and any modifications or additions to that Work or
+Derivative Works thereof, that is intentionally submitted to Licensor
+for inclusion in the Work by the copyright owner or by an individual or
+Legal Entity authorized to submit on behalf of the copyright owner.
+For the purposes of this definition, "submitted" means any form of
+electronic, verbal, or written communication sent to the Licensor or
+its representatives, including but not limited to communication on
+electronic mailing lists, source code control systems, and issue
+tracking systems that are managed by, or on behalf of, the Licensor
+for the purpose of discussing and improving the Work, but excluding
+communication that is conspicuously marked or otherwise designated
+in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity
+on behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+
+"Tizen Certified Platform" shall mean a software platform that complies
+with the standards set forth in the Compatibility Definition Document
+and passes the Compatibility Test Suite as defined from time to time
+by the Tizen Technical Steering Group and certified by the Tizen
+Association or its designated agent.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the
+Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made,
+use, offer to sell, sell, import, and otherwise transfer the Work
+solely as incorporated into a Tizen Certified Platform, where such
+license applies only to those patent claims licensable by such
+Contributor that are necessarily infringed by their Contribution(s)
+alone or by combination of their Contribution(s) with the Work solely
+as incorporated into a Tizen Certified Platform to which such
+Contribution(s) was submitted. If You institute patent litigation
+against any entity (including a cross-claim or counterclaim
+in a lawsuit) alleging that the Work or a Contribution incorporated
+within the Work constitutes direct or contributory patent infringement,
+then any patent licenses granted to You under this License for that
+Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+Work or Derivative Works thereof pursuant to the copyright license
+above, in any medium, with or without modifications, and in Source or
+Object form, provided that You meet the following conditions:
+
+ 1. You must give any other recipients of the Work or Derivative Works
+ a copy of this License; and
+ 2. You must cause any modified files to carry prominent notices stating
+ that You changed the files; and
+ 3. You must retain, in the Source form of any Derivative Works that
+ You distribute, all copyright, patent, trademark, and attribution
+ notices from the Source form of the Work, excluding those notices
+ that do not pertain to any part of the Derivative Works; and
+ 4. If the Work includes a "NOTICE" text file as part of its distribution,
+ then any Derivative Works that You distribute must include a readable
+ copy of the attribution notices contained within such NOTICE file,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works, in at least one of the following places:
+ within a NOTICE text file distributed as part of the Derivative Works;
+ within the Source form or documentation, if provided along with the
+ Derivative Works; or, within a display generated by the Derivative Works,
+ if and wherever such third-party notices normally appear.
+ The contents of the NOTICE file are for informational purposes only
+ and do not modify the License.
+
+You may add Your own attribution notices within Derivative Works
+that You distribute, alongside or as an addendum to the NOTICE text
+from the Work, provided that such additional attribution notices
+cannot be construed as modifying the License. You may add Your own
+copyright statement to Your modifications and may provide additional or
+different license terms and conditions for use, reproduction, or
+distribution of Your modifications, or for any such Derivative Works
+as a whole, provided Your use, reproduction, and distribution of
+the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+any Contribution intentionally submitted for inclusion in the Work
+by You to the Licensor shall be under the terms and conditions of
+this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify
+the terms of any separate license agreement you may have executed
+with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+names, trademarks, service marks, or product names of the Licensor,
+except as required for reasonable and customary use in describing the
+origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+agreed to in writing, Licensor provides the Work (and each
+Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied, including, without limitation, any warranties or conditions
+of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+PARTICULAR PURPOSE. You are solely responsible for determining the
+appropriateness of using or redistributing the Work and assume any
+risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+whether in tort (including negligence), contract, or otherwise,
+unless required by applicable law (such as deliberate and grossly
+negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a
+result of this License or out of the use or inability to use the
+Work (including but not limited to damages for loss of goodwill,
+work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses), even if such Contributor
+has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+the Work or Derivative Works thereof, You may choose to offer,
+and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this
+License. However, in accepting such obligations, You may act only
+on Your own behalf and on Your sole responsibility, not on behalf
+of any other Contributor, and only if You agree to indemnify,
+defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason
+of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Flora License to your work
+
+To apply the Flora License to your work, attach the following
+boilerplate notice, with the fields enclosed by brackets "[]"
+replaced with your own identifying information. (Don't include
+the brackets!) The text should be enclosed in the appropriate
+comment syntax for the file format. We also recommend that a
+file or class name and description of purpose be included on the
+same "printed page" as the copyright notice for easier
+identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Flora License, Version 1.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://floralicense.org/license/
+
+ 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.
+
--- /dev/null
+Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Flora License, Version 1.
+Please, see the LICENSE.Flora file for Flora License terms and conditions.
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://sample-web-application.tizen.org/contacts-exchanger" version="2.1.0" viewmodes="maximized">
+ <tizen:application id="FkdFMekdRH" required_version="1.0"/>
+ <tizen:app-control>
+ <src name="index.html"/>
+ <operation name="http://tizen.org/appcontrol/operation/nfc_empty_type"/>
+ <mime name="*/*"/>
+ </tizen:app-control>
+ <tizen:app-control>
+ <src name="index.html"/>
+ <operation name="http://tizen.org/appcontrol/operation/nfc_well_known_type"/>
+ <mime name="*/*"/>
+ </tizen:app-control>
+ <tizen:app-control>
+ <src name="index.html"/>
+ <operation name="http://tizen.org/appcontrol/operation/nfc_mime_type"/>
+ <mime name="*/*"/>
+ </tizen:app-control>
+ <tizen:app-control>
+ <src name="index.html"/>
+ <operation name="http://tizen.org/appcontrol/operation/nfc_uri_type"/>
+ <mime name="*/*"/>
+ </tizen:app-control>
+ <content src="index.html"/>
+ <icon src="icon.png"/>
+ <name>ContactsExchanger</name>
+ <tizen:privilege name="http://tizen.org/privilege/application.launch"/>
+ <tizen:privilege name="http://tizen.org/privilege/application.read"/>
+ <tizen:privilege name="http://tizen.org/privilege/contact.read"/>
+ <tizen:privilege name="http://tizen.org/privilege/contact.write"/>
+ <tizen:privilege name="http://tizen.org/privilege/nfc.admin"/>
+ <tizen:privilege name="http://tizen.org/privilege/nfc.common"/>
+ <tizen:privilege name="http://tizen.org/privilege/nfc.cardemulation"/>
+ <tizen:privilege name="http://tizen.org/privilege/nfc.common"/>
+ <tizen:privilege name="http://tizen.org/privilege/nfc.p2p"/>
+ <tizen:privilege name="http://tizen.org/privilege/nfc.tag"/>
+ <tizen:setting screen-orientation="portrait" context-menu="disable" background-support="enable" encryption="disable" nodisplay="false"/>
+</widget>
--- /dev/null
+.ui-btn-start {
+ margin: 0px auto;
+ margin-top: 10px;
+ padding: 40px 0px 0px 0px;
+ width: 90%;
+ height: 50px;
+ font-size: 16px;
+}
+
+.defaultText {
+ font-size: 20px;
+ text-align: center;
+}
+
+.comment {
+ font-size: 16px;
+ text-align: center;
+ line-height: 3px;
+ color: black;
+ padding: 0px;
+ margin: 0px 0px 12px 0px;
+}
+
+#comment {
+ left: 0px;
+ margin: 0 auto;
+ right: 0px;
+ width: inherit;
+}
+
+.box {
+ margin: 0px;
+ padding: 0px;
+ display: table-cell;
+ vertical-align: middle;
+ height: inherit;
+ width: inherit;
+}
+
+.gap {
+ width: 100%;
+ height: 10px;
+}
+
+#list-choose li a {
+ white-space: nowrap;
+ overflow: hidden !important;
+ text-overflow: ellipsis;
+ width: 60%;
+ float: left;
+}
+
+#list-choose li .ui-li-text-sub {
+ white-space: nowrap;
+ overflow: hidden !important;
+ text-overflow: ellipsis;
+ width: 40%;
+}
+
+#list-choose li.ui-btn-down-s a {
+ color: black;
+}
+
+#comment-name {
+ white-space: nowrap;
+ overflow: hidden !important;
+ text-overflow: ellipsis;
+ width: 90%;
+ margin-left: 5%;
+ line-height: inherit;
+ font-size: 1rem;
+ font-weight: bold;
+}
+
+#accept-choose {
+ width: auto;
+}
+
+.defaultVeryBigText {
+ font-size: 30px;
+ margin: 0px;
+ padding: 0px;
+ text-align: center;
+ line-height: 30px;
+}
+
+.defaultCounterText {
+ margin-top: 10px;
+ margin-bottom: 10px;
+ font-size: 100px;
+ padding: 0px;
+ text-align: center;
+ line-height: 100px;
+}
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<html>
+
+<head>
+ <meta charset="utf-8"/>
+ <meta name="description" content="Contacts-exchanger"/>
+
+ <title>Contacts-exchanger</title>
+
+ <script src="/usr/share/tizen-web-ui-fw/latest/js/jquery.js"></script>
+ <script src="/usr/share/tizen-web-ui-fw/latest/js/tizen-web-ui-fw-libs.js"></script>
+ <script src="/usr/share/tizen-web-ui-fw/latest/js/tizen-web-ui-fw.js" data-framework-theme="tizen-white" data-framework-viewport-scale="false"></script>
+
+ <script type="text/javascript" src="./js/app.js"></script>
+ <script type="text/javascript" src="./js/app.ui.js"></script>
+ <script type="text/javascript" src="./js/app.nfc.js"></script>
+ <script type="text/javascript" src="./js/app.nfc.card.js"></script>
+ <script type="text/javascript" src="./js/app.nfc.peer.js"></script>
+
+ <link rel="stylesheet" type="text/css" href="./css/style.css"/>
+</head>
+
+<body>
+ <div id="start" data-role="page" data-add-back-btn="header" data-footer-exist="true">
+ <div data-role="header" id="header-start" data-position="fixed">
+ <h1>Contacts-exchanger</h1>
+ </div>
+
+ <div data-role="content" id="content-start" data-scroll="none"></div>
+ </div>
+
+ <div id="choose" data-role="page" data-add-back-btn="footer" data-footer-exist="true">
+ <div data-role="header" id="header-choose" data-position="fixed">
+ <h1>Contacts list</h1>
+ <a data-role="button" id="accept-choose">Accept</a>
+ </div>
+
+ <div data-role="content" id="content-choose"></div>
+
+ <div data-role="footer" id="footer-choose" data-position="fixed"></div>
+ </div>
+
+ <div id="transfer" data-role="page">
+ <div data-role="header" id="header-transfer" data-position="fixed">
+ <h1></h1>
+ </div>
+
+ <div data-role="content" id="content-transfer" data-scroll="none"></div>
+ </div>
+
+ <div id="contact" data-role="page" data-add-back-btn="footer" data-footer-exist="true">
+ <div data-role="header" id="header-contact" data-position="fixed">
+ <h1>Add contact</h1>
+ <a data-role="button" id="save-contact">Save</a>
+ </div>
+
+ <div data-role="content" id="content-contact"></div>
+
+ <div data-role="footer" id="footer-contact" data-position="fixed"></div>
+ </div>
+</body>
+
+</html>
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.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://floralicense.org/license/
+ *
+ * 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.
+ */
+
+/*jslint devel: true*/
+/*global $, tizen */
+
+var App = null;
+
+// App instance
+var app = null;
+
+(function () { // strict mode wrapper
+ 'use strict';
+
+ function checkCharsSize(string) {
+ var i, result = '', length = string.length;
+ for (i = 0; i < length; i += 1) {
+ if (string.charCodeAt(i) < 256) {
+ result += string[i];
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Creates a new application object
+ *
+ * @class Application
+ */
+ App = function App() {};
+
+ App.prototype = {
+ nfcAdapter: null,
+ addressBook: null,
+ started: false,
+ timeOutHandler: null,
+ nfc: null,
+
+ init: function appInit() {
+ this.ui = new App.Ui(this);
+ this.nfc = new App.NFCControl(this);
+
+ this.ui.disableSelections();
+ this.ui.defineEvents();
+ this.initAddressBook();
+ this.nfc.startNFC();
+ },
+
+ saveDefaultCard: function saveDefaultCard() {
+ var elementSelected = $('#list-choose li.selected');
+ localStorage.started = true;
+ localStorage.id = elementSelected.attr('id');
+ localStorage.firstName = elementSelected.attr('firstName');
+ localStorage.lastName = elementSelected.attr('lastName');
+ localStorage.phoneNumber = elementSelected.attr('phoneNumber');
+ localStorage.vCard = elementSelected.attr('vCard');
+ $.mobile.changePage('#start');
+ },
+
+ initAddressBook: function initAddressBook() {
+ var addressBooksCB = function (addressbooks) {
+ if (addressbooks.length > 0) {
+ this.addressBook = addressbooks[0];
+ } else {
+ console.error('initAddressBook failed');
+ }
+ },
+ errorCB = function (e) {
+ console.log('problem with getAddressBooks() method: ' + e.message);
+ };
+
+ try {
+ tizen.contact.getAddressBooks(addressBooksCB.bind(this), errorCB);
+ } catch (e) {
+ console.error('problem with getAddressBooks() method: ' + e.message);
+ }
+ },
+
+ countDown: function countDown(time, obj) {
+ obj.text(time);
+ if (time > 0) {
+ time -= 1;
+ this.timeOutHandler = setTimeout(function () { this.countDown(time, obj); }.bind(this), 1000);
+ } else {
+ this.nfc.timeExpired();
+ }
+ },
+
+ saveContact: function saveContact() {
+ var phone, first, last, contactPage = $('#contact'), contact = null;
+ phone = contactPage.data('contactsData').phone;
+ first = contactPage.data('contactsData').first;
+ last = contactPage.data('contactsData').last;
+
+ try {
+ contact = new tizen.Contact({name: new tizen.ContactName({firstName: first, lastName: last}), phoneNumbers: [new tizen.ContactPhoneNumber(phone)]});
+ this.addressBook.add(contact);
+ this.app.ui.moveToStartPage('New contact added');
+ } catch (err) {
+ this.app.ui.moveToStartPage('Problem with new contact adding');
+ console.error('The following error occurred while adding: ' + err.name);
+ }
+ },
+
+ loadContacts: function loadContacts() {
+ var self = this,
+ errorCB = function (e) {
+ console.error('loadContacts() problem with find() method: ' + e.message);
+ };
+ this.addressBook.find(function (contacts) {
+ self.ui.showContactsList(contacts);
+ }, errorCB);
+ }
+
+ };
+
+}());
+
+app = new App();
+
+$(document).ready(app.init.bind(app));
--- /dev/null
+/*jslint devel: true*/
+/*global $, tizen, App, app */
+
+(function () { // strict mode wrapper
+ 'use strict';
+
+ App.NFCCard = function (nfcControl) {
+ this.app = nfcControl.app;
+
+ };
+
+ App.NFCCard.prototype = {
+
+ prepareForNFC: null,
+
+ /* card read */
+
+ readMessageErr: function readMessageErr(e) {
+ app.nfc.timeExpired('Read error!');
+ },
+
+ sucTagReadAttach: function sucTagReadAttach(tag) {
+ if (tag.isSupportedNDEF) {
+ tag.readNDEF(this.app.nfc.readMessage.bind(this.app.nfc), this.readMessageErr.bind(this));
+ } else {
+ console.warn("This Tag doesn't support NDEF");
+ }
+ },
+
+ setTagDetectRead: function setTagDetectRead() {
+ var suc = { onattach: this.sucTagReadAttach.bind(this), ondetach: this.app.nfc.sucDetach.bind(this.app.nfc) };
+ try {
+ app.nfc.nfcAdapter.setTagListener(suc);
+ } catch (error) {
+ console.error('error: ' + error.message);
+ }
+ },
+
+
+ /* card write */
+
+ sucSend: function sucSend() {
+ app.nfc.timeExpired('Send success!');
+ },
+
+ errSend: function errSend(e) {
+ console.warn('errSend');
+ app.nfc.timeExpired('Send problem! ' + e.message);
+ },
+
+ sucTagWriteAttach: function sucTagWriteAttach(tag) {
+ var newMessage = null,
+ separator = String.fromCharCode(30),
+ endOfText = String.fromCharCode(3),
+ fullContact = localStorage.phoneNumber + separator + localStorage.firstName + separator + localStorage.lastName,
+ prepareForNFC;
+
+ prepareForNFC = this.prepareForNFC || function prepareForNFC(contact) {
+ if (contact.length > 31) {
+ contact = contact.substring(0, 31);
+ if (contact[29] !== separator) {
+ contact = contact.substring(0, 30) + endOfText;
+ }
+ }
+ return contact;
+ };
+
+ fullContact = prepareForNFC(fullContact);
+
+ try {
+ newMessage = this.app.nfc.phoneNumber2NDEF(fullContact);
+ } catch (err) {
+ console.error("NDEFMessage problem: " + err.message);
+ }
+
+ if (tag.isSupportedNDEF) {
+ tag.writeNDEF(newMessage, this.sucSend.bind(this), this.errSend.bind(this));
+ } else {
+ console.warn("This Tag doesn't support NDEF");
+ }
+ },
+
+ setTagDetectWrite: function setTagDetectWrite() {
+ var suc = { onattach: this.sucTagWriteAttach.bind(this), ondetach: this.app.nfc.sucDetach };
+ try {
+ app.nfc.nfcAdapter.setTagListener(suc);
+ } catch (error) {
+ console.error('error: ' + error.message);
+ }
+ }
+
+ };
+
+}());
--- /dev/null
+/*jslint devel: true*/
+/*global $, tizen, App, app */
+
+(function () { // strict mode wrapper
+ 'use strict';
+
+ App.NFCControl = function (app) {
+ this.app = app;
+ this.init();
+ };
+
+ App.NFCControl.prototype = {
+ nfcTarget: null,
+ nfcStateMemory: false,
+
+ init: function init() {
+ this.card = new App.NFCCard(this);
+ this.peer = new App.NFCPeer(this);
+ },
+
+ timeExpired: function timeExpired(monit) {
+ clearTimeout(this.app.timeOutHandler);
+ this.unsetTargetDetect();
+ this.unsetTagDetect();
+ this.app.ui.moveToStartPage(monit);
+ },
+
+ resolveContact: function resolveContact(contactsString) {
+ var separator = String.fromCharCode(30),
+ endOfText = String.fromCharCode(3),
+ contactsArray,
+ phone = '',
+ first = '',
+ last = '',
+ resolveData;
+
+ contactsArray = contactsString.split(separator);
+
+ resolveData = function (value) {
+ if (!value) {
+ return '';
+ }
+ return value.replace(endOfText, '…');
+ };
+
+ phone = resolveData(contactsArray[0]);
+ first = resolveData(contactsArray[1]);
+ last = resolveData(contactsArray[2]);
+ return {phone: phone, first: first, last: last};
+ },
+
+ fillRecordInfo: function fillRecordInfo(record) {
+ try {
+ var contactsData = this.resolveContact(this.convertNDEF2phoneNumber(record.payload));
+ this.app.ui.displayContact(contactsData);
+ } catch (error) {
+ console.error(error);
+ }
+ },
+
+ readMessage: function readMessage(message) {
+ try {
+ this.fillRecordInfo(message.records[0]);
+ } catch (e) {
+ console.error(e.message);
+ }
+ },
+
+ contact2NDEF: function contact2NDEF(contact) {
+ var t, a = [], i, newMessage = new tizen.NDEFMessage();
+ if (typeof contact === 'string') {
+ t = contact;
+ } else {
+ t = contact.convertToString("VCARD_30");
+ }
+ a.length = t.length;
+ for (i = 0; i < a.length; i += 1) {
+ a[i] = t.charCodeAt(i);
+ }
+ newMessage.records[0] = new tizen.NDEFRecordMedia('text/x-vcard', a);
+ return newMessage;
+ },
+
+ phoneNumber2NDEF: function phoneNumber2NDEF(contact) {
+ var phoneNumberArray = [], i, length = contact.length, newMessage = new tizen.NDEFMessage();
+ for (i = 0; i < length; i += 1) {
+ phoneNumberArray.push(contact.charCodeAt(i));
+ }
+ newMessage.records[0] = new tizen.NDEFRecordMedia('text/x-vcard', phoneNumberArray);
+ return newMessage;
+ },
+
+ convertNDEF2phoneNumber: function convertNDEF2phoneNumber(contact) {
+ var i, length = contact.length, phoneNumber = '';
+ for (i = 0; i < length; i += 1) {
+ phoneNumber += String.fromCharCode(contact[i]);
+ }
+ return phoneNumber;
+ },
+
+ startNFC: function startNFC() {
+ var onPowerOn, onPowerOnFails;
+
+ onPowerOn = function () {
+ app.started = true;
+ app.ui.loadStartPage();
+ };
+ onPowerOnFails = function (err) {
+ console.error('Power On error: ' + err.message);
+ };
+
+ try {
+ this.nfcAdapter = tizen.nfc.getDefaultAdapter();
+ try {
+ if (this.nfcAdapter.powered) {
+ this.nfcStateMemory = true;
+ onPowerOn();
+ } else {
+ this.nfcStateMemory = false;
+ this.nfcAdapter.setPowered(true, onPowerOn, onPowerOnFails);
+ }
+ } catch (err) {
+ console.error('setPowered(true) problem: ' + err.message);
+ }
+ } catch (e) {
+ console.error('getDefaultAdapter() method problem: ' + e.message);
+ }
+ },
+
+ stopNFC: function stopNFC() {
+ var onPowerOff, onPowerOffFails;
+
+ onPowerOff = function () {
+ tizen.application.getCurrentApplication().exit();
+ };
+
+ onPowerOffFails = function (err) {
+ console.error('Power Off error: ' + err.message);
+ tizen.application.getCurrentApplication().exit();
+ };
+
+ try {
+ if (this.nfcStateMemory) {
+ onPowerOff();
+ } else {
+ this.nfcAdapter.setPowered(false, onPowerOff, onPowerOffFails);
+ }
+ } catch (err) {
+ console.error('setPowered(false) problem: ' + err);
+ }
+ },
+
+ unsetTargetDetect: function unsetTargetDetect() {
+ try {
+ if (this.nfcTarget) {
+ this.nfcTarget.unsetReceiveNDEFListener();
+ this.nfcTarget = null;
+ } else {
+ console.warn("app.nfc.nfcTarget not set");
+ }
+ } catch (error) {
+ console.error('error: ' + error.message);
+ }
+ try {
+ this.nfcAdapter.unsetPeerListener();
+ } catch (e) {
+ console.error('error: ' + e.message);
+ }
+ },
+
+ unsetTagDetect: function unsetTagDetect() {
+ try {
+ this.nfcAdapter.unsetTagListener();
+ } catch (error) {
+ console.error('error: ' + error.message);
+ }
+ },
+
+ displayContact: function displayContact(obj) {
+ clearTimeout(this.app.timeOutHandler);
+ this.unsetTargetDetect();
+ this.unsetTagDetect();
+ this.app.ui.moveToContactPage(obj);
+ },
+
+ sucDetach: function sucDetach() {
+ }
+ };
+
+}());
--- /dev/null
+/*jslint devel: true*/
+/*global $, tizen, App, app */
+
+(function () { // strict mode wrapper
+ 'use strict';
+
+ App.NFCPeer = function (nfcControl) {
+ this.app = nfcControl.app;
+ };
+
+ App.NFCPeer.prototype = {
+
+ sucSendToTarget: function sucSendToTarget() {
+ },
+
+ errSendToTarget: function errSendToTarget(e) {
+ this.app.nfc.timeExpired('Send problem! ' + e.message);
+ },
+
+ errorMessage: function errorMessage(e) {
+ console.error('Target Receiving Error: ' + e.message);
+ },
+
+ setReceiveFromTarget: function setReceiveFromTarget() {
+ try {
+ if (this.app.nfc.nfcTarget) {
+ this.app.nfc.nfcTarget.setReceiveNDEFListener(this.app.nfc.readMessage.bind(this.app.nfc), this.errorMessage.bind(this));
+ } else {
+ console.warn("app.nfc.nfcTarget not set");
+ }
+ } catch (error) {
+ console.error('setReceiveFromTarget error: ' + error.message);
+ }
+ },
+
+ sucTargetAttach: function sucTargetAttach(target) {
+ var newMessage = null,
+ separator = String.fromCharCode(30),
+ fullContact = localStorage.phoneNumber + separator + localStorage.firstName + separator + localStorage.lastName;
+ this.app.nfc.nfcTarget = target;
+ this.setReceiveFromTarget();
+
+ try {
+ newMessage = this.app.nfc.phoneNumber2NDEF(fullContact);
+ } catch (err) {
+ console.error("NDEFMessage problem: " + err.message);
+ }
+
+ try {
+ target.sendNDEF(newMessage, this.sucSendToTarget.bind(this), this.errSendToTarget.bind(this));
+ } catch (e) {
+ console.error("NDEFMessage problem: " + e.message);
+ }
+ },
+
+ setTargetDetect: function setTargetDetect() {
+ var err = function (e) {
+ console.error('Target Listen Error: ' + e.message);
+ },
+ suc = { onattach: this.sucTargetAttach.bind(this), ondetach: this.app.nfc.sucDetach.bind(this.app.nfc) };
+ try {
+ app.nfc.nfcAdapter.setPeerListener(suc, err);
+ } catch (error) {
+ console.error('error: ' + error.message);
+ }
+ }
+ };
+
+}());
--- /dev/null
+/*jslint devel: true*/
+/*global $, tizen, App, app */
+
+App.Ui = null;
+
+(function () { // strict mode wrapper
+ 'use strict';
+
+ var prepareCallerName = function prepareCallerName(contact) {
+ var callerName, firstName, lastName;
+ callerName = '';
+ firstName = contact.name.firstName;
+ lastName = contact.name.lastName;
+ if (firstName !== '' && firstName !== null) {
+ callerName = firstName;
+ }
+ if (lastName !== '' && lastName !== null) {
+ if (callerName === '') {
+ callerName += lastName;
+ } else {
+ callerName += ' ';
+ callerName += lastName;
+ }
+ }
+ if (callerName === '') {
+ callerName = 'no name';
+ }
+ return callerName;
+ };
+
+ App.Ui = function App_Ui(app) {
+ this.app = app;
+ };
+
+ App.Ui.prototype = {
+ popup: null,
+
+ showPopup: function showPopup(message, page) {
+ this.popup = $('<div id="popup" data-role="popupwindow" data-style="center_basic_1btn"><p data-role="text">' + message + '</p><div data-role="button-bg"><a href="#" data-role="button" data-inline="true" onclick="closePopup();">OK</a></div></div>');
+ this.page.append(this.popup);
+ this.page.trigger('create');
+ this.popup.data('page', page);
+ this.popup.popupwindow('open');
+ },
+
+ closePopup: function closePopup() {
+ var page = this.popup.data('page');
+ page.data('monit', '');
+ this.popup.popupwindow('close');
+ this.popup.remove();
+ this.popup = null;
+ },
+
+ disableAccept: function disableAccept() {
+ $('#accept-choose').css('pointer-events', 'none').addClass('ui-disabled');
+ },
+
+ enableAccept: function enableAccept() {
+ $('#accept-choose').css('pointer-events', 'auto').removeClass('ui-disabled');
+ },
+
+ createListRecord: function createListRecord(contacts) {
+ $.mobile.changePage('#choose');
+ },
+
+ prepareWaitingPage: function prepareWaitingPage(title, text) {
+ var waitingBox, waitingContent,
+ contentTransfer = $('#content-transfer');
+ waitingBox = $('<div class="box" id="waitingBox"></div>');
+ waitingContent = $('<p class="defaultVeryBigText">' + text + '</p><p class="defaultCounterText" id="counter"></p>');
+ $('#header-transfer H1').text(title);
+ contentTransfer.empty();
+ waitingBox.append(waitingContent);
+ contentTransfer.append(waitingBox);
+ $('#content-start').trigger('create');
+
+ this.app.countDown(10, $('#counter'));
+ },
+
+ loadTemporaryContent: function loadTemporaryContent() {
+ var temporaryBox, temporaryContent, temporaryButton, contentStart;
+
+ temporaryBox = $('<div class="box" id="temporaryBox"></div>');
+ temporaryContent = $('<p class="defaultText">Default card hasn\'t defined yet!<br>Do you want to define it now?</p>');
+ temporaryButton = $('<div data-role="button" class="ui-btn-create">Create default card</div>');
+ contentStart = $('#content-start');
+
+ temporaryButton.on('tap', function (event) {
+ event.preventDefault();
+ $.mobile.changePage('#choose');
+ });
+
+ contentStart.empty();
+ temporaryBox.append(temporaryContent).append(temporaryButton);
+
+ contentStart.append(temporaryBox);
+ contentStart.trigger('create');
+ },
+
+ loadStartContent: function loadStartContent() {
+ var startBox, contentStart, gap, comment, changeContact, readFromCard, writeToCard, communicateWithOtherDevice;
+ contentStart = $('#content-start');
+ startBox = $('<div class="box" id="startBox"></div>');
+ gap = $('<div class="gap"></div>');
+ comment = $('<div id="comment"><p class="comment">Your default contact</p><p class="comment" id="comment-name">' + (localStorage.firstName || '') + ' ' + (localStorage.lastName || '') + '</p></div>');
+ changeContact = $('<div data-role="button" class="ui-btn-create">Change your default contact</div>');
+ changeContact.on('tap', function (event) {
+ event.preventDefault();
+ $.mobile.changePage('#choose');
+ });
+ readFromCard = $('<div data-role="button" class="ui-btn-create">Read from card</div>');
+ readFromCard.on('tap', function (event) {
+ event.preventDefault();
+ $('#transfer').data('option', 'read');
+ $.mobile.changePage('#transfer');
+ });
+ writeToCard = $('<div data-role="button" class="ui-btn-create">Write to card</div>');
+ writeToCard.on('tap', function (event) {
+ event.preventDefault();
+ $('#transfer').data('option', 'write');
+ $.mobile.changePage('#transfer');
+ });
+ communicateWithOtherDevice = $('<div data-role="button" class="ui-btn-create">Communicate with other device</div>');
+ communicateWithOtherDevice.on('tap', function (event) {
+ event.preventDefault();
+ $('#transfer').data('option', 'communicate');
+ $.mobile.changePage('#transfer');
+ });
+
+ contentStart.empty();
+ startBox.append(changeContact).append(gap.clone()).append(readFromCard).append(gap.clone()).append(writeToCard).append(gap.clone()).append(communicateWithOtherDevice).prepend(comment);
+
+ contentStart.append(startBox);
+ contentStart.trigger('create');
+ },
+
+ loadStartPage: function loadStartPage() {
+ if (localStorage.started === undefined) {
+
+ this.loadTemporaryContent();
+ } else {
+
+ this.loadStartContent();
+ }
+ },
+
+ prepareContactsTemplate: function prepareContactsTemplate(phone, first, last) {
+ var ul;
+
+ ul = $('<ul data-role="listview" id="contacts-data"></ul>');
+ $('#contact > #content-contact > .ui-scrollview-view').empty().append(ul);
+
+ ul.append($('<li class="ui-li-multiline"><a href="#">' + ((first === '' || first === 'null') ? '...' : first) + '<span class="ui-li-text-sub">First Name</span></a></li>'));
+ ul.append($('<li class="ui-li-multiline"><a href="#">' + ((last === '' || last === 'null') ? '...' : last) + '<span class="ui-li-text-sub">Last Name</span></a></li>'));
+ ul.append($('<li class="ui-li-multiline"><a href="#">' + ((phone === '' || phone === 'null') ? '...' : phone) + '<span class="ui-li-text-sub">Phone Number</span></a></li>'));
+
+ $('#contact > #content-contact').trigger('create');
+ },
+
+ showContactsList: function showContactsList(contacts) {
+ var self = this,
+ ul = $('<ul data-role="listview" id="list-choose"></ul>'),
+ listElementTap,
+ sortedContactList = [],
+ i,
+ j,
+ len,
+ length,
+ firstName = '',
+ lastName = '',
+ phoneNumber = '',
+ id,
+ vCard,
+ listElement;
+
+ $('#choose > #content-choose > .ui-scrollview-view').empty().append(ul);
+
+ listElementTap = function (event) {
+ event.preventDefault();
+
+ self.enableAccept();
+
+ $(this).parent().find('li').css('background-color', 'inherit').removeClass('selected');
+ $(this).css('background-color', '#ccc').addClass('selected');
+ };
+
+ for (i = 0, len = contacts.length; i < len; i += 1) {
+ firstName = '';
+ lastName = '';
+ phoneNumber = '';
+ id = contacts[i].id;
+ vCard = contacts[i].convertToString('VCARD_30');
+ if (contacts[i].name.firstName !== null) {
+ firstName = contacts[i].name.firstName;
+ }
+ if (contacts[i].name.lastName !== null) {
+ lastName = contacts[i].name.lastName;
+ }
+ if (contacts[i].phoneNumbers[0] !== undefined) {
+ phoneNumber = contacts[i].phoneNumbers[0].number;
+ }
+ sortedContactList.push({caller: prepareCallerName(contacts[i]), firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, id: id, vCard: vCard, contact: contacts[i]});
+ }
+
+ sortedContactList.sort(function (a, b) {
+ if (a.caller < b.caller) {
+ return -1;
+ }
+ if (a.caller > b.caller) {
+ return 1;
+ }
+ return 0;
+ });
+
+ for (j = 0, length = sortedContactList.length; j < length; j += 1) {
+ listElement = $('<li class="ui-li-multiline" firstName="' + sortedContactList[j].firstName + '" lastName="' + sortedContactList[j].lastName + '" phoneNumber="' + sortedContactList[j].phoneNumber + '" id="' + sortedContactList[j].id + '" vCard="' + sortedContactList[j].vCard + '"><a href="#">' + sortedContactList[j].caller + '<span class="ui-li-text-sub">' + sortedContactList[j].phoneNumber + '</span></a></li>');
+ if (localStorage.id === listElement.attr('id')) {
+ listElement.css('background-color', '#ccc');
+ }
+ listElement.on('tap', listElementTap);
+ ul.append(listElement);
+ }
+
+ $('#choose > #content-choose').trigger('create');
+ },
+
+ moveToStartPage: function moveToStartPage(monit) {
+ $('#start').data('monit', monit || '');
+ $.mobile.changePage('#start');
+ },
+
+ moveToContactPage: function moveToContactPage(obj) {
+ $('#start').data('monit', '');
+ $('#contact').data('contactsData', obj);
+ $.mobile.changePage('#contact');
+ },
+
+ disableSelections: function disableSelections() {
+ $.mobile.tizen.disableSelection(document);
+ },
+
+ defineEvents: function defineEvents() {
+ var self = this;
+
+ $('#header-start .ui-btn-back').on('tap', function (event) {
+ event.preventDefault();
+ self.app.nfc.stopNFC();
+ });
+
+ $('#footer-transfer').on('tap', '.ui-btn-back', function (event) {
+ event.preventDefault();
+ self.app.nfc.timeExpired();
+ });
+
+ $('#footer-contact').on('tap', '.ui-btn-back', function (event) {
+ event.preventDefault();
+ $.mobile.changePage('#start');
+ });
+
+ $('#choose').on('pagebeforeshow', function () {
+ self.disableAccept();
+ });
+
+ $('#choose').on('pageshow', function (event) {
+ self.app.loadContacts();
+ });
+
+ $('#contact').on('pageshow', function (event) {
+ var phone, first, last;
+ phone = $(this).data('contactsData').phone;
+ first = $(this).data('contactsData').first;
+ last = $(this).data('contactsData').last;
+ self.prepareContactsTemplate(phone, first, last);
+ });
+
+ $('#accept-choose').on('tap', function (event) {
+ event.preventDefault();
+ self.app.saveDefaultCard();
+ });
+
+ $('#save-contact').on('tap', function (event) {
+ event.preventDefault();
+ self.app.saveContact();
+ });
+
+ $('#start').on('pagebeforeshow', function () {
+ if (self.app.started) {
+ self.loadStartPage();
+ }
+ });
+
+ $('#start').on('pageshow', function () {
+ var monit, obj, contentStart;
+ obj = $(this);
+ monit = obj.data('monit');
+ if (monit !== '' && monit !== undefined) {
+ self.showPopup(obj.data('monit'), obj);
+ }
+ contentStart = $('#content-start');
+ contentStart.css('height', contentStart.height() + 'px').css('width', contentStart.width() + 'px');
+ });
+
+ $('#transfer').on('pageshow', function () {
+ var contentTransfer = $('#content-transfer');
+ contentTransfer.css('width', contentTransfer.width() + 'px');
+ setTimeout(function () { // workaround (setTimeout with 0 delay)
+ contentTransfer.css('height', contentTransfer.css('min-height'));
+ }, 0);
+ });
+
+ $('#transfer').on('pageshow', function () {
+ var option = $(this).data('option');
+ if (option === 'read') {
+ self.prepareWaitingPage('Card to Device', 'PUT WIRELESS TAG<br>CLOSE TO<br>YOUR DEVICE');
+ try {
+ self.app.nfc.card.setTagDetectRead();
+ } catch (err) {
+ console.error(err.message);
+ }
+ } else if (option === 'write') {
+ self.prepareWaitingPage('Device to Card', 'PUT WIRELESS TAG<br>CLOSE TO<br>YOUR DEVICE');
+ try {
+ self.app.nfc.card.setTagDetectWrite();
+ } catch (er) {
+ console.error(er.message);
+ }
+ } else {
+ self.prepareWaitingPage('Device to Device', 'PUT YOUR DEVICE<br>CLOSE TO<br>OTHER DEVICE');
+ try {
+ self.app.nfc.peer.setTargetDetect();
+ } catch (e) {
+ console.error(e.message);
+ }
+ }
+ });
+ }
+
+ };
+
+}());
--- /dev/null
+/*jslint devel: true*/
+/*global $, tizen, nfcAdapter, timeOutHandler, nfcTarget: true, sucDetach, timeExpired, readMessage, phoneNumber2NDEF */
+
+var sucSendToTarget = function () {
+ "use strict";
+ //timeExpired('Send success!');
+};
+
+var errSendToTarget = function (e) {
+ "use strict";
+ timeExpired('Send problem! ' + e.message);
+};
+
+var errorMessage = function (e) {
+ "use strict";
+ console.log('Target Receiving Error: ' + e.message);
+};
+
+var setReceiveFromTarget = function () {
+ "use strict";
+ try {
+ nfcTarget.setReceiveNDEFListener(readMessage, errorMessage);
+ } catch (error) {
+ console.log('setReceiveFromTarget error: ' + error.message);
+ }
+};
+
+var sucTargetAttach = function (target) {
+ "use strict";
+ var newMessage = null,
+ separator = String.fromCharCode(30),
+ endOfText = String.fromCharCode(3),
+ fullContact = localStorage.phoneNumber + separator + localStorage.firstName + separator + localStorage.lastName;
+
+ nfcTarget = target;
+ setReceiveFromTarget();
+
+ try {
+ newMessage = phoneNumber2NDEF(fullContact);
+ } catch (err) {
+ console.log("NDEFMessage problem: " + err.message);
+ }
+
+ try {
+ nfcTarget.sendNDEF(newMessage, sucSendToTarget, errSendToTarget);
+ } catch (e) {
+ console.log("NDEFMessage problem: " + e.message);
+ }
+};
+
+var setTargetDetect = function () {
+ "use strict";
+ var err = function (e) {
+ console.log('Target Listen Error: ' + e.message);
+ },
+ suc = { onattach: sucTargetAttach, ondetach: sucDetach };
+ try {
+ nfcAdapter.setPeerListener(suc, err);
+ } catch (error) {
+ console.log('error: ' + error.message);
+ }
+};
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+ *
+ * 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.
+ */
+
+/*jslint devel: true*/
+/*global $, tizen, timeExpired, contactList: true, moveToStartPage, stopNFC, setTagDetectRead, setTagDetectWrite, setTargetDetect, startNFC */
+
+var nfcAdapter = null;
+var addressBook = null;
+var appStarted = false;
+var timeOutHandler = null;
+var popup = null;
+var nfcTarget = null;
+var nfcStateMemory = false;
+
+var showPopup = function (message, page) {
+ "use strict";
+ popup = $('<div id="popup" data-role="popupwindow" data-style="center_basic_1btn"><p data-role="text">' + message + '</p><div data-role="button-bg"><a href="#" data-role="button" data-inline="true" onclick="closePopup();">OK</a></div></div>');
+ page.append(popup);
+ page.trigger('create');
+ popup.data('page', page);
+ popup.popupwindow('open');
+};
+
+var closePopup = function () {
+ "use strict";
+ var page = popup.data('page');
+ page.data('monit', '');
+ popup.popupwindow('close');
+ popup.remove();
+};
+
+var disableAccept = function () {
+ "use strict";
+ $('#accept-choose').css('pointer-events', 'none').addClass('ui-disabled');
+};
+
+var enableAccept = function () {
+ "use strict";
+ $('#accept-choose').css('pointer-events', 'auto').removeClass('ui-disabled');
+};
+
+var checkCharsSize = function (string) {
+ "use strict";
+ var i, result = '', length = string.length;
+ for (i = 0; i < length; i += 1) {
+ if (string.charCodeAt(i) < 256) {
+ result += string[i];
+ }
+ }
+ return result;
+};
+
+var saveDefaultCard = function () {
+ "use strict";
+ var elementSelected = $('#message-chat li.selected');
+ localStorage.started = true;
+ localStorage.id = elementSelected.attr('id');
+ localStorage.firstName = checkCharsSize(elementSelected.attr('firstName'));
+ localStorage.lastName = checkCharsSize(elementSelected.attr('lastName'));
+ localStorage.phoneNumber = checkCharsSize(elementSelected.attr('phoneNumber'));
+ localStorage.vCard = elementSelected.attr('vCard');
+ $.mobile.changePage('#start');
+};
+
+var initAddressBook = function () {
+ "use strict";
+ var addressBooksCB = function (addressbooks) {
+ if (addressbooks.length > 0) {
+ addressBook = addressbooks[0];
+ } else {
+ console.log('addressBook: failed');
+ }
+ },
+ errorCB = function (e) {
+ console.log('problem with getAddressBooks() method: ' + e.message);
+ };
+
+ try {
+ tizen.contact.getAddressBooks(addressBooksCB, errorCB);
+ } catch (e) {
+ console.log('problem with getAddressBooks() method: ' + e.message);
+ }
+};
+
+var createListRecord = function (contacts) {
+ "use strict";
+ contactList = contacts;
+ $.mobile.changePage('#choose');
+};
+
+var prepareCallerName = function (contact) {
+ "use strict";
+ var callerName, firstName, lastName;
+ callerName = '';
+ firstName = contact.name.firstName;
+ lastName = contact.name.lastName;
+ if (firstName !== '' && firstName !== null) {
+ callerName = firstName;
+ }
+ if (lastName !== '' && lastName !== null) {
+ if (callerName === '') {
+ callerName += lastName;
+ } else {
+ callerName += ' ';
+ callerName += lastName;
+ }
+ }
+ if (callerName === '') {
+ callerName = 'no name';
+ }
+ return callerName;
+};
+
+var showContactsList = function () {
+ "use strict";
+ var errorCB,
+ contactsFoundCB;
+
+ contactsFoundCB = function (contacts) {
+ var ul = $('<ul data-role="listview" id="message-chat"></ul>'),
+ listElementTap,
+ sortedContactList = [],
+ i,
+ j,
+ len,
+ length,
+ firstName = '',
+ lastName = '',
+ phoneNumber = '',
+ id,
+ vCard,
+ listElement;
+
+ $('#choose > #content-choose > .ui-scrollview-view').empty().append(ul);
+
+ listElementTap = function (event) {
+ event.preventDefault();
+ enableAccept();
+ $(this).parent().find('li').css('background-color', '#fff').removeClass('selected');
+ $(this).css('background-color', '#ccc').addClass('selected');
+ };
+
+ for (i = 0, len = contacts.length; i < len; i += 1) {
+ firstName = '';
+ lastName = '';
+ phoneNumber = '';
+ id = contacts[i].id;
+ vCard = contacts[i].convertToString('VCARD_30');
+ if (contacts[i].name.firstName !== null) {
+ firstName = contacts[i].name.firstName;
+ }
+ if (contacts[i].name.lastName !== null) {
+ lastName = contacts[i].name.lastName;
+ }
+ if (contacts[i].phoneNumbers[0] !== undefined) {
+ phoneNumber = contacts[i].phoneNumbers[0].number;
+ }
+ sortedContactList.push({caller: prepareCallerName(contacts[i]), firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, id: id, vCard: vCard, contact: contacts[i]});
+ }
+
+ sortedContactList.sort(function (a, b) {
+ if (a.caller < b.caller) {
+ return -1;
+ }
+ if (a.caller > b.caller) {
+ return 1;
+ }
+ return 0;
+ });
+
+ for (j = 0, length = sortedContactList.length; j < length; j += 1) {
+ listElement = $('<li class="ui-li-2line-2sub" firstName="' + sortedContactList[j].firstName + '" lastName="' + sortedContactList[j].lastName + '" phoneNumber="' + sortedContactList[j].phoneNumber + '" id="' + sortedContactList[j].id + '" vCard="' + sortedContactList[j].vCard + '"><span class="ui-li-text-main">' + sortedContactList[j].caller + '</span><span class="ui-li-text-sub">' + sortedContactList[j].phoneNumber + '</span></li>');
+ if (localStorage.id === listElement.attr('id')) {
+ listElement.css('background-color', '#ccc');
+ }
+ listElement.on('tap', listElementTap);
+ ul.append(listElement);
+ }
+
+ $('#choose > #content-choose').trigger('create');
+ };
+ errorCB = function (e) {
+ console.log('problem with find() method: ' + e.message);
+ };
+ addressBook.find(contactsFoundCB, errorCB);
+};
+
+var countDown = function (time, obj) {
+ "use strict";
+ obj.text(time);
+ if (time > 0) {
+ time -= 1;
+ timeOutHandler = setTimeout(function () { countDown(time, obj); }, 1000);
+ } else {
+ timeExpired();
+ }
+};
+
+var prepareWaitingPage = function (title, text) {
+ "use strict";
+ var waitingBox, waitingContent;
+ waitingBox = $('<div class="box" id="waitingBox"></div>');
+ waitingContent = $('<p class="defaultVeryBigText">' + text + '</p><p class="defaultCounterText" id="counter"></p>');
+ $('#header-transfer H1').text(title);
+ $('#content-transfer .ui-scrollview-view').empty();
+ waitingBox.append(waitingContent);
+ $('#content-transfer .ui-scrollview-view').append(waitingBox);
+ $('#content-start').trigger('create');
+ countDown(10, $('#counter'));
+};
+
+var loadTemporaryContent = function () {
+ "use strict";
+ var temporaryBox, temporaryContent, temporaryButton;
+ temporaryBox = $('<div class="box" id="temporaryBox"></div>');
+ temporaryContent = $('<p class="defaultText">Default card hasn\'t defined yet!<br>Do you want to define it now?</p>');
+ temporaryButton = $('<div data-role="button" class="ui-btn-create">Create default card</div>');
+
+ temporaryButton.on('tap', function (event) {
+ event.preventDefault();
+ $.mobile.changePage('#choose');
+ });
+
+ $('#content-start .ui-scrollview-view').empty();
+ temporaryBox.append(temporaryContent).append(temporaryButton);
+ $('#content-start .ui-scrollview-view').append(temporaryBox);
+ $('#content-start').trigger('create');
+};
+
+var loadStartContent = function () {
+ "use strict";
+ var startBox, gap, comment, changeContact, readFromCard, writeToCard, communicateWithOtherDevice;
+ startBox = $('<div class="box" id="startBox"></div>');
+ gap = $('<div class="gap"></div>');
+ comment = $('<div id="comment"><p class="comment">Your default contact</p><p class="comment">( ' + (localStorage.firstName || '') + ' ' + (localStorage.lastName || '') + ' )</p></div>');
+ changeContact = $('<div data-role="button" class="ui-btn-create">Change your default contact</div>');
+ changeContact.on('tap', function (event) {
+ event.preventDefault();
+ $.mobile.changePage('#choose');
+ });
+ readFromCard = $('<div data-role="button" class="ui-btn-create">Read from card</div>');
+ readFromCard.on('tap', function (event) {
+ event.preventDefault();
+ $('#transfer').data('option', 'read');
+ $.mobile.changePage('#transfer');
+ });
+ writeToCard = $('<div data-role="button" class="ui-btn-create">Write to card</div>');
+ writeToCard.on('tap', function (event) {
+ event.preventDefault();
+ $('#transfer').data('option', 'write');
+ $.mobile.changePage('#transfer');
+ });
+ communicateWithOtherDevice = $('<div data-role="button" class="ui-btn-create">Communicate with other device</div>');
+ communicateWithOtherDevice.on('tap', function (event) {
+ event.preventDefault();
+ $('#transfer').data('option', 'communicate');
+ $.mobile.changePage('#transfer');
+ });
+
+ $('#content-start .ui-scrollview-view').empty();
+ startBox.append(changeContact).append(gap.clone()).append(readFromCard).append(gap.clone()).append(writeToCard).append(gap.clone()).append(communicateWithOtherDevice);
+ $('#content-start .ui-scrollview-view').append(comment);
+ $('#content-start .ui-scrollview-view').append(startBox);
+ $('#content-start').trigger('create');
+};
+
+var loadStartPage = function () {
+ "use strict";
+ if (localStorage.started === undefined) {
+ loadTemporaryContent();
+ } else {
+ loadStartContent();
+ }
+};
+
+var prepareContactsTemplate = function (phone, first, last) {
+ "use strict";
+ var i, ul;
+
+ ul = $('<ul data-role="listview" id="contacts-data"></ul>');
+ $('#contact > #content-contact > .ui-scrollview-view').empty().append(ul);
+
+ ul.append($('<li class="ui-li-2line-2sub"><span class="ui-li-text-main contacts-data-value">' + ((first === '' || first === 'null') ? '...' : first) + '</span><span class="ui-li-text-sub contacts-data-title">First Name</span></li>'));
+ ul.append($('<li class="ui-li-2line-2sub"><span class="ui-li-text-main contacts-data-value">' + ((last === '' || last === 'null') ? '...' : last) + '</span><span class="ui-li-text-sub contacts-data-title">Last Name</span></li>'));
+ ul.append($('<li class="ui-li-2line-2sub"><span class="ui-li-text-main contacts-data-value">' + ((phone === '' || phone === 'null') ? '...' : phone) + '</span><span class="ui-li-text-sub contacts-data-title">Phone Number</span></li>'));
+
+ $('#contact > #content-contact').trigger('create');
+};
+
+var saveContact = function () {
+ "use strict";
+ var phone, first, last, contactPage = $('#contact'), contact = null;
+ phone = contactPage.data('contactsData').phone;
+ first = contactPage.data('contactsData').first;
+ last = contactPage.data('contactsData').last;
+
+ try {
+ contact = new tizen.Contact({name: new tizen.ContactName({firstName: first, lastName: last}), phoneNumbers: [new tizen.ContactPhoneNumber(phone)]});
+ addressBook.add(contact);
+ moveToStartPage('New contact added');
+ } catch (err) {
+ moveToStartPage('Problem with new contact adding');
+ console.log('The following error occurred while adding: ' + err.name);
+ }
+};
+
+var defineEvents = function () {
+ "use strict";
+ $('#header-start .ui-btn-back').on('tap', function (event) {
+ event.preventDefault();
+ stopNFC();
+ });
+
+ $('#footer-transfer').on('tap', '.ui-btn-back', function (event) {
+ event.preventDefault();
+ timeExpired();
+ });
+
+ $('#footer-contact').on('tap', '.ui-btn-back', function (event) {
+ event.preventDefault();
+ $.mobile.changePage('#start');
+ });
+
+ $('#choose').on('pagebeforeshow', function () {
+ disableAccept();
+ });
+
+ $('#choose').on('pageshow', function (event) {
+ showContactsList();
+ });
+
+ $('#contact').on('pageshow', function (event) {
+ var phone, first, last;
+ phone = $(this).data('contactsData').phone;
+ first = $(this).data('contactsData').first;
+ last = $(this).data('contactsData').last;
+ prepareContactsTemplate(phone, first, last);
+ });
+
+ $('#accept-choose').on('tap', function (event) {
+ event.preventDefault();
+ saveDefaultCard();
+ });
+
+ $('#save-contact').on('tap', function (event) {
+ event.preventDefault();
+ saveContact();
+ });
+
+ $('#start').on('pagebeforeshow', function () {
+ if (appStarted) {
+ loadStartPage();
+ }
+ });
+
+ $('#start').on('pageshow', function () {
+ var monit, obj;
+ obj = $(this);
+ monit = obj.data('monit');
+ if (monit !== '' && monit !== undefined) {
+ showPopup(obj.data('monit'), obj);
+ }
+ });
+
+ $('#transfer').on('pageshow', function () {
+ var option = $(this).data('option');
+ if (option === 'read') {
+ prepareWaitingPage('Card to Device', 'PUT WIRELESS TAG<br>CLOSE TO<br>YOUR DEVICE');
+ try {
+ setTagDetectRead();
+ } catch (err) {
+ console.log(err);
+ }
+ } else if (option === 'write') {
+ prepareWaitingPage('Device to Card', 'PUT WIRELESS TAG<br>CLOSE TO<br>YOUR DEVICE');
+ try {
+ setTagDetectWrite();
+ } catch (er) {
+ console.log(er);
+ }
+ } else {
+ prepareWaitingPage('Device to Device', 'PUT YOUR DEVICE<br>CLOSE TO<br>OTHER DEVICE');
+ try {
+ setTargetDetect();
+ } catch (e) {
+ console.log(e);
+ }
+ }
+ });
+};
+
+var init = function () {
+ "use strict";
+ defineEvents();
+ initAddressBook();
+ startNFC();
+};
+
+$(document).ready(init);
\ No newline at end of file
--- /dev/null
+/*jslint devel: true*/
+/*global $, tizen, nfcAdapter: true, appStarted: true, timeOutHandler, nfcTarget: true, nfcStateMemory: true, convertNDEF2phoneNumber, loadStartPage, resolveContact, displayContact: true */
+
+var fillRecordInfo = function (record) {
+ "use strict";
+ try {
+ var contactsData = resolveContact(convertNDEF2phoneNumber(record.payload));
+ displayContact(contactsData);
+ } catch (error) {
+ console.log(error);
+ }
+};
+
+var readMessage = function (message) {
+ "use strict";
+ try {
+ fillRecordInfo(message.records[0]);
+ } catch (e) {
+ console.log(e.message);
+ }
+};
+
+var contact2NDEF = function (contact) {
+ "use strict";
+ var t, a = [], i, newMessage = new tizen.NDEFMessage();
+ if (typeof contact === 'string') {
+ t = contact;
+ } else {
+ t = contact.convertToString("VCARD_30");
+ }
+ a.length = t.length;
+ for (i = 0; i < a.length; i += 1) {
+ a[i] = t.charCodeAt(i);
+ }
+ newMessage.records[0] = new tizen.NDEFRecordMedia('text/x-vcard', a);
+ return newMessage;
+};
+
+var phoneNumber2NDEF = function (contact) {
+ "use strict";
+ var phoneNumberArray = [], i, length = contact.length, newMessage = new tizen.NDEFMessage();
+ for (i = 0; i < length; i += 1) {
+ phoneNumberArray.push(contact.charCodeAt(i));
+ }
+ newMessage.records[0] = new tizen.NDEFRecordMedia('text/x-vcard', phoneNumberArray);
+ return newMessage;
+};
+
+var convertNDEF2phoneNumber = function (contact) {
+ "use strict";
+ var i, length = contact.length, phoneNumber = '';
+ for (i = 0; i < length; i += 1) {
+ phoneNumber += String.fromCharCode(contact[i]);
+ }
+ return phoneNumber;
+};
+
+var startNFC = function () {
+ "use strict";
+ var onPowerOn, onPowerOnFails;
+
+ onPowerOn = function () {
+ appStarted = true;
+ loadStartPage();
+ };
+ onPowerOnFails = function (err) {
+ console.log('Power On error: ' + err.message);
+ };
+
+ try {
+ nfcAdapter = tizen.nfc.getDefaultAdapter();
+ try {
+ if (nfcAdapter.powered) {
+ nfcStateMemory = true;
+ onPowerOn();
+ } else {
+ nfcStateMemory = false;
+ nfcAdapter.setPowered(true, onPowerOn, onPowerOnFails);
+ }
+ } catch (err) {
+ console.log('setPowered(true) problem: ' + err);
+ }
+ } catch (e) {
+ console.log('getDefaultAdapter() method problem: ' + e);
+ }
+};
+
+var stopNFC = function () {
+ "use strict";
+ var onPowerOff, onPowerOffFails;
+
+ onPowerOff = function () {
+ tizen.application.getCurrentApplication().exit();
+ };
+
+ onPowerOffFails = function (err) {
+ console.log('Power Off error: ' + err.message);
+ tizen.application.getCurrentApplication().exit();
+ };
+
+ try {
+ if (nfcStateMemory) {
+ onPowerOff();
+ } else {
+ nfcAdapter.setPowered(false, onPowerOff, onPowerOffFails);
+ }
+ } catch (err) {
+ console.log('setPowered(false) problem: ' + err);
+ }
+};
+
+var unsetTargetDetect = function () {
+ "use strict";
+ try {
+ nfcTarget.unsetReceiveNDEFListener();
+ nfcTarget = null;
+ } catch (error) {
+ console.log('error: ' + error.message);
+ }
+ try {
+ nfcAdapter.unsetPeerListener();
+ } catch (e) {
+ console.log('error: ' + e.message);
+ }
+};
+
+var unsetTagDetect = function () {
+ "use strict";
+ try {
+ nfcAdapter.unsetTagListener();
+ } catch (error) {
+ console.log('error: ' + error.message);
+ }
+};
+
+var moveToStartPage = function (monit) {
+ "use strict";
+ $('#start').data('monit', monit || '');
+ $.mobile.changePage('#start');
+};
+
+var moveToContactPage = function (obj) {
+ "use strict";
+ $('#start').data('monit', '');
+ $('#contact').data('contactsData', obj);
+ $.mobile.changePage('#contact');
+};
+
+var timeExpired = function (monit) {
+ "use strict";
+ clearTimeout(timeOutHandler);
+ if (nfcTarget) {
+ unsetTargetDetect();
+ } else {
+ unsetTagDetect();
+ }
+ moveToStartPage(monit);
+};
+
+var displayContact = function (obj) {
+ "use strict";
+ clearTimeout(timeOutHandler);
+ if (nfcTarget) {
+ unsetTargetDetect();
+ } else {
+ unsetTagDetect();
+ }
+ moveToContactPage(obj);
+};
+
+var sucDetach = function () {
+ "use strict";
+ console.log('sucDetach');
+};
\ No newline at end of file
--- /dev/null
+/*jslint devel: true*/
+/*global $, tizen, nfcAdapter, timeOutHandler, timeExpired, readMessage, sucDetach */
+
+var resolveContact = function (contactsString) {
+ "use strict";
+ var separator = String.fromCharCode(30),
+ endOfText = String.fromCharCode(3),
+ contactsArray,
+ phone = '',
+ first = '',
+ last = '',
+ resolveData;
+
+ contactsArray = contactsString.split(separator);
+
+ resolveData = function (value) {
+ if (!value) {
+ return '';
+ }
+ return value.replace(endOfText, '…');
+ };
+
+ phone = resolveData(contactsArray[0]);
+ first = resolveData(contactsArray[1]);
+ last = resolveData(contactsArray[2]);
+ return {phone: phone, first: first, last: last};
+};
+
+var readMessageErr = function (e) {
+ "use strict";
+ timeExpired('Read error!');
+};
+
+var sucTagReadAttach = function (tag) {
+ "use strict";
+ if (tag.isSupportedNDEF) {
+ tag.readNDEF(readMessage, readMessageErr);
+ } else {
+ console.log("This Tag doesn't support NDEF");
+ }
+};
+
+var setTagDetectRead = function () {
+ "use strict";
+ /*
+ var err, suc;
+ err = function (e) {
+ console.log('Tag Listen Error: ' + e.message);
+ };
+ */
+ var suc = { onattach: sucTagReadAttach, ondetach: sucDetach };
+ try {
+ //nfcAdapter.setTagListener(suc, err);
+ nfcAdapter.setTagListener(suc);
+ } catch (error) {
+ console.log('error: ' + error.message);
+ }
+};
\ No newline at end of file
--- /dev/null
+/*jslint devel: true*/
+/*global $, tizen, nfcAdapter, timeOutHandler, timeExpired, phoneNumber2NDEF, sucDetach */
+
+var sucSend = function () {
+ "use strict";
+ console.log('sucSend');
+ timeExpired('Send success!');
+};
+
+var errSend = function (e) {
+ "use strict";
+ console.log('errSend');
+ timeExpired('Send problem! ' + e.message);
+};
+
+var prepareForNFC;
+
+var sucTagWriteAttach = function (tag) {
+ "use strict";
+ var newMessage = null,
+ separator = String.fromCharCode(30),
+ endOfText = String.fromCharCode(3),
+ fullContact = localStorage.phoneNumber + separator + localStorage.firstName + separator + localStorage.lastName,
+ prepareForNFC;
+
+ prepareForNFC = prepareForNFC || function prepareForNFC(contact) {
+ if (contact.length > 31) {
+ contact = contact.substring(0, 31);
+ if (contact[29] !== separator) {
+ contact = contact.substring(0, 30) + endOfText;
+ }
+ }
+ return contact;
+ };
+
+ fullContact = prepareForNFC(fullContact);
+
+ try {
+ newMessage = phoneNumber2NDEF(fullContact);
+ } catch (err) {
+ console.log("NDEFMessage problem: " + err.message);
+ }
+
+ if (tag.isSupportedNDEF) {
+ tag.writeNDEF(newMessage, sucSend, errSend);
+ } else {
+ console.log("This Tag doesn't support NDEF");
+ }
+};
+
+var setTagDetectWrite = function () {
+ "use strict";
+ /*
+ var err, suc;
+ err = function (e) {
+ console.log('Tag Listen Error: ' + e.message);
+ };
+ */
+ var suc = { onattach: sucTagWriteAttach, ondetach: sucDetach };
+ try {
+ //nfcAdapter.setTagListener(suc, err);
+ nfcAdapter.setTagListener(suc);
+ } catch (error) {
+ console.log('error: ' + error.message);
+ }
+};
\ No newline at end of file
--- /dev/null
+<Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="DistributorSignature">
+<SignedInfo>
+<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></CanonicalizationMethod>
+<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"></SignatureMethod>
+<Reference URI="css/style.css">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>O8655N55M/0g9vx6pmER5u1mOjODjaPQSBkW+6cUPYg=</DigestValue>
+</Reference>
+<Reference URI="js/read_from_card.js">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>qU95u6MPilGevk4TxJThVweuIHj+Tq6eoF70QxT6/ek=</DigestValue>
+</Reference>
+<Reference URI="js/device_to_device.js">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>odaI/pI419AFYI66t3/xwrN7hvISxsnf51XKCJ+vjsg=</DigestValue>
+</Reference>
+<Reference URI="js/write_to_card.js">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>3glY615PZgnLt0NNSqlFkNZZlPB9649zWdIJdv/4wTU=</DigestValue>
+</Reference>
+<Reference URI="js/nfc_common.js">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>wrbIrjrBHmvJiPMr07wUgIwe8qDDEFE9hWbSHcfZ1PQ=</DigestValue>
+</Reference>
+<Reference URI="js/main.js">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>K33xbgsyFtJA0HWDjO4Poy1D5vQhfrFDwfU5+UT0QQU=</DigestValue>
+</Reference>
+<Reference URI="icon.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>wfwuPIJiNBXrBw5Nl4NE8B7X1QpT3UVtFoiOoAiJsnU=</DigestValue>
+</Reference>
+<Reference URI="config.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>Jru8YNJAdNGjUhV8UMPXeFjxyUKYOnp4hdFIzCvaa9c=</DigestValue>
+</Reference>
+<Reference URI="LICENSE">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>3eAKfddMvUo3Opri3yMldvBqZpQeoqxOo4o/v00KuUo=</DigestValue>
+</Reference>
+<Reference URI="index.html">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>BiLxpHGjpcvnPJByV1Sb8h7UpFXESN0kQXenj5OWR+o=</DigestValue>
+</Reference>
+<Reference URI="#prop">
+<Transforms>
+<Transform Algorithm="http://www.w3.org/2006/12/xml-c14n11"></Transform>
+</Transforms>
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>u/jU3U4Zm5ihTMSjKGlGYbWzDfRkGphPPHx3gJIYEJ4=</DigestValue>
+</Reference>
+</SignedInfo>
+<SignatureValue>
+uYECfAv3dRcpaqXy5uE5xnw8LxXsu+NIUw9Gpyfty1kvKUwsIItqQ57PUR+5nyyN4/hvt0FAbpi8
+TtLS/Ss8dlb9pJu4fjDZEWQXevKbDPmC5r2dMuIoD962nZGTK2TqDlXEKImA9OV9TyR8VyPuPKKu
+16Z5p61SKu+HTxHSFuc=
+</SignatureValue>
+<KeyInfo>
+<X509Data>
+<X509Certificate>
+MIICmzCCAgQCCQDXI7WLdVZwiTANBgkqhkiG9w0BAQUFADCBjzELMAkGA1UEBhMCS1IxDjAMBgNV
+BAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6ZW4gVGVzdCBDQTEiMCAGA1UE
+CwwZVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEkMCIGA1UEAwwbVGl6ZW4gUHVibGljIERpc3Ry
+aWJ1dG9yIENBMB4XDTEyMTAyOTEzMDMwNFoXDTIyMTAyNzEzMDMwNFowgZMxCzAJBgNVBAYTAktS
+MQ4wDAYDVQQIDAVTdXdvbjEOMAwGA1UEBwwFU3V3b24xFjAUBgNVBAoMDVRpemVuIFRlc3QgQ0Ex
+IjAgBgNVBAsMGVRpemVuIERpc3RyaWJ1dG9yIFRlc3QgQ0ExKDAmBgNVBAMMH1RpemVuIFB1Ymxp
+YyBEaXN0cmlidXRvciBTaWduZXIwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALtMvlc5hENK
+90ZdA+y66+Sy0enD1gpZDBh5T9RP0oRsptJv5jjNTseQbQi0SZOdOXb6J7iQdlBCtR343RpIEz8H
+mrBy7mSY7mgwoU4EPpp4CTSUeAuKcmvrNOngTp5Hv7Ngf02TTHOLK3hZLpGayaDviyNZB5PdqQdB
+hokKjzAzAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAvGp1gxxAIlFfhJH1efjb9BJK/rtRkbYn9+Ez
+GEbEULg1svsgnyWisFimI3uFvgI/swzr1eKVY3Sc8MQ3+Fdy3EkbDZ2+WAubhcEkorTWjzWz2fL1
+vKaYjeIsuEX6TVRUugHWudPzcEuQRLQf8ibZWjbQdBmpeQYBMg5x+xKLCJc=
+</X509Certificate>
+<X509Certificate>
+MIICtDCCAh2gAwIBAgIJAMDbehElPNKvMA0GCSqGSIb3DQEBBQUAMIGVMQswCQYDVQQGEwJLUjEO
+MAwGA1UECAwFU3V3b24xDjAMBgNVBAcMBVN1d29uMRYwFAYDVQQKDA1UaXplbiBUZXN0IENBMSMw
+IQYDVQQLDBpUVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEpMCcGA1UEAwwgVGl6ZW4gUHVibGlj
+IERpc3RyaWJ1dG9yIFJvb3QgQ0EwHhcNMTIxMDI5MTMwMjUwWhcNMjIxMDI3MTMwMjUwWjCBjzEL
+MAkGA1UEBhMCS1IxDjAMBgNVBAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6
+ZW4gVGVzdCBDQTEiMCAGA1UECwwZVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEkMCIGA1UEAwwb
+VGl6ZW4gUHVibGljIERpc3RyaWJ1dG9yIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDe
+OTS/3nXvkDEmsFCJIvRlQ3RKDcxdWJJp625pFqHdmoJBdV+x6jl1raGK2Y1sp2Gdvpjc/z92yzAp
+bE/UVLPh/tRNZPeGhzU4ejDDm7kzdr2f7Ia0U98K+OoY12ucwg7TYNItj9is7Cj4blGfuMDzd2ah
+2AgnCGlwNwV/pv+uVQIDAQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACqJ
+KO33YdoGudwanZIxMdXuxnnD9R6u72ltKk1S4zPfMJJv482CRGCI4FK6djhlsI4i0Lt1SVIJEed+
+yc3qckGm19dW+4xdlkekon7pViEBWuyHw8OWv3RXtTum1+PGHjBJ2eYY4ZKIpz73U/1NC16sTB/0
+VhfnkHwPltmrpYVe
+</X509Certificate>
+</X509Data>
+</KeyInfo>
+<Object Id="prop"><SignatureProperties xmlns:dsp="http://www.w3.org/2009/xmldsig-properties"><SignatureProperty Id="profile" Target="#DistributorSignature"><dsp:Profile URI="http://www.w3.org/ns/widgets-digsig#profile"></dsp:Profile></SignatureProperty><SignatureProperty Id="role" Target="#DistributorSignature"><dsp:Role URI="http://www.w3.org/ns/widgets-digsig#role-distributor"></dsp:Role></SignatureProperty><SignatureProperty Id="identifier" Target="#DistributorSignature"><dsp:Identifier></dsp:Identifier></SignatureProperty></SignatureProperties></Object>
+</Signature>
\ No newline at end of file