[Verification] Code compiles without errors.
Change-Id: I1cfbe765d7e544b0b26cc43e325a4d050fdb2243
Signed-off-by: Lukasz Bardeli <l.bardeli@samsung.com>
--- /dev/null
+{
+ 'includes':[
+ '../common/common.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'tizen_nfc',
+ 'type': 'loadable_module',
+ 'sources': [
+ 'nfc_api.js',
+ 'nfc_extension.cc',
+ 'nfc_extension.h',
+ 'nfc_instance.cc',
+ 'nfc_instance.h'
+ ],
+ 'includes': [
+ '../common/pkg-config.gypi',
+ ],
+ 'conditions': [
+ ['tizen == 1', {
+ 'variables': {
+ 'packages': [
+
+ ]
+ },
+ }],
+ ],
+ },
+ ],
+}
\ No newline at end of file
--- /dev/null
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var validator_ = xwalk.utils.validator;
+var types_ = validator_.Types;
+var native_ = new xwalk.utils.NativeManager(extension);
+
+//enumeration NDEFRecordTextEncoding ////////////////////////////////////////////////////
+var NDEFRecordTextEncoding = {
+ UTF8 : 'UTF8',
+ UTF16 : 'UTF16'
+};
+
+//enumeration NFCTagType ////////////////////////////////////////////////////
+var NFCTagType = {
+ GENERIC_TARGET : 'GENERIC_TARGET',
+ ISO14443_A : 'ISO14443_A',
+ ISO14443_4A : 'ISO14443_4A',
+ ISO14443_3A : 'ISO14443_3A',
+ MIFARE_MINI : 'MIFARE_MINI',
+ MIFARE_1K : 'MIFARE_1K',
+ MIFARE_4K : 'MIFARE_4K',
+ MIFARE_ULTRA : 'MIFARE_ULTRA',
+ MIFARE_DESFIRE : 'MIFARE_DESFIRE',
+ ISO14443_B : 'ISO14443_B',
+ ISO14443_4B : 'ISO14443_4B',
+ ISO14443_BPRIME : 'ISO14443_BPRIME',
+ FELICA : 'FELICA',
+ JEWEL : 'JEWEL',
+ ISO15693 : 'ISO15693',
+ UNKNOWN_TARGET : 'UNKNOWN_TARGET'
+};
+
+////enumeration CardEmulationMode ////////////////////////////////////////////////////
+var CardEmulationMode = {
+ ALWAYS_ON : 'ALWAYS_ON',
+ OFF : 'OFF'
+};
+
+////enumeration SecureElementType ////////////////////////////////////////////////////
+var SecureElementType = {
+ ESE : 'ESE',
+ UICC : 'UICC'
+};
+
+//////////////////NFCManager /////////////////
+
+function NFCManager() {
+ Object.defineProperties(this, {
+ NFC_RECORD_TNF_EMPTY: {value: 0, writable: false, enumerable: true},
+ NFC_RECORD_TNF_WELL_KNOWN: {value: 1, writable: false, enumerable: true},
+ NFC_RECORD_TNF_MIME_MEDIA: {value: 2, writable: false, enumerable: true},
+ NFC_RECORD_TNF_URI: {value: 3, writable: false, enumerable: true},
+ NFC_RECORD_TNF_EXTERNAL_RTD: {value: 4, writable: false, enumerable: true},
+ NFC_RECORD_TNF_UNKNOWN: {value: 5, writable: false, enumerable: true},
+ NFC_RECORD_TNF_UNCHANGED: {value: 6, writable: false, enumerable: true}
+ });
+}
+
+NFCManager.prototype.getDefaultAdapter = function() {
+ return new NFCAdapter();
+};
+
+NFCManager.prototype.setExclusiveMode = function() {
+
+};
+
+//////////////////NFCAdapter /////////////////
+
+function NFCAdapter() {
+ Object.defineProperties(this, {
+ powered: {enumerable: true,
+ set : function(){},
+ get : function(){}},
+ cardEmulationMode: {enumerable: true,
+ set : function(){},
+ get : function(){}},
+ activeSecureElement: {enumerable: true,
+ set : function(){},
+ get : function(){}}
+ });
+};
+
+NFCAdapter.prototype.setPowered = function() {
+
+};
+
+NFCAdapter.prototype.setTagListener = function() {
+
+};
+
+NFCAdapter.prototype.setPeerListener = function() {
+
+};
+
+NFCAdapter.prototype.unsetTagListener = function() {
+
+};
+
+NFCAdapter.prototype.unsetPeerListener = function() {
+
+};
+
+NFCAdapter.prototype.addCardEmulationModeChangeListener = function() {
+
+};
+
+NFCAdapter.prototype.removeCardEmulationModeChangeListener = function() {
+
+};
+
+NFCAdapter.prototype.addTransactionEventListener = function() {
+
+};
+
+NFCAdapter.prototype.removeTransactionEventListener = function() {
+
+};
+
+NFCAdapter.prototype.addActiveSecureElementChangeListener = function() {
+
+};
+
+NFCAdapter.prototype.removeActiveSecureElementChangeListener = function() {
+
+};
+
+NFCAdapter.prototype.getCachedMessage = function() {
+
+};
+
+NFCAdapter.prototype.setExclusiveModeForTransaction = function() {
+
+};
+
+//////////////////NFCTag /////////////////
+
+function NFCTag(data) {
+ Object.defineProperties(this, {
+ type: {value: data.type, writable: false, enumerable: true},
+ isSupportedNDEF: {value: data.isSupportedNDEF,
+ writable: true, enumerable: true},
+ ndefSize: {value: data.ndefSize,
+ writable: true, enumerable: true},
+ properties: {value: data.properties, writable: true, enumerable: true},
+ isConnected: {value: data.isConnected,
+ writable: true, enumerable: true}
+ });
+}
+
+NFCTag.prototype.readNDEF = function() {
+
+};
+
+NFCTag.prototype.writeNDEF = function() {
+
+};
+
+NFCTag.prototype.transceive = function() {
+
+};
+
+//////////////////NFCPeer /////////////////
+
+function NFCPeer(data) {
+ Object.defineProperties(this, {
+ isConnected: {value: data.isConnected,
+ writable: true, enumerable: true}
+ });
+}
+
+NFCPeer.prototype.setReceiveNDEFListener = function() {
+
+};
+
+NFCPeer.prototype.unsetReceiveNDEFListener = function() {
+
+};
+
+NFCPeer.prototype.sendNDEF = function() {
+
+};
+
+//////////////////NDEFMessage /////////////////
+
+tizen.NDEFMessage = function(data) {
+
+};
+
+tizen.NDEFMessage.prototype.toByte = function() {
+
+};
+
+//////////////////NDEFRecord /////////////////
+
+tizen.NDEFRecord = function(data, type, payload, id) {
+
+};
+
+//////////////////NDEFRecordText /////////////////
+
+tizen.NDEFRecordText = function(text, languageCode, encoding) {
+
+};
+
+//////////////////NDEFRecordURI /////////////////
+
+tizen.NDEFRecordURI = function(uri) {
+
+};
+
+//////////////////NDEFRecordMedia /////////////////
+
+tizen.NDEFRecordMedia = function(mimeType, data) {
+
+};
+
+//Exports
+var NFCManagerObject = new NFCManager();
+
+exports.getDefaultAdapter = NFCManagerObject.getDefaultAdapter;
+exports.setExclusiveMode = NFCManagerObject.setExclusiveMode;
--- /dev/null
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "nfc/nfc_extension.h"
+
+#include "nfc/nfc_instance.h"
+
+// This will be generated from messageport_api.js.
+extern const char kSource_nfc_api[];
+
+common::Extension* CreateExtension() {
+ return new NFCExtension;
+}
+
+NFCExtension::NFCExtension() {
+ SetExtensionName("tizen.nfc");
+ SetJavaScriptAPI(kSource_nfc_api);
+}
+
+NFCExtension::~NFCExtension() {}
+
+common::Instance* NFCExtension::CreateInstance() {
+ return new extension::nfc::NFCInstance;
+}
--- /dev/null
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NFC_NFC_EXTENSION_H_
+#define NFC_NFC_EXTENSION_H_
+
+#include "common/extension.h"
+
+class NFCExtension : public common::Extension {
+public:
+ NFCExtension();
+ virtual ~NFCExtension();
+private:
+ // common::Extension implementation.
+ virtual common::Instance* CreateInstance();
+};
+
+#endif // NFC_NFC_EXTENSION_H_
--- /dev/null
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "nfc/nfc_instance.h"
+
+#include "common/picojson.h"
+#include "common/logger.h"
+#include "common/platform_exception.h"
+
+
+namespace extension {
+namespace nfc {
+
+using namespace common;
+
+NFCInstance::NFCInstance() {
+ using namespace std::placeholders;
+#define REGISTER_SYNC(c,x) \
+ RegisterSyncHandler(c, std::bind(&NFCInstance::x, this, _1, _2));
+ REGISTER_SYNC("NFCManager_getDefaultAdapter", GetDefaultAdapter);
+ REGISTER_SYNC("NFCManager_setExclusiveMode", SetExclusiveMode);
+ REGISTER_SYNC("NFCAdapter_setPeerListener", SetPeerListener);
+ REGISTER_SYNC("NFCAdapter_setTagListener", SetTagListener);
+ REGISTER_SYNC("NFCAdapter_setPeerListener", SetPeerListener);
+ REGISTER_SYNC("NFCAdapter_unsetTagListener", UnsetTagListener);
+ REGISTER_SYNC("NFCAdapter_unsetPeerListener", UnsetPeerListener);
+ REGISTER_SYNC("NFCAdapter_addCardEmulationModeChangeListener",
+ AddCardEmulationModeChangeListener);
+ REGISTER_SYNC("NFCAdapter_removeCardEmulationModeChangeListener",
+ RemoveCardEmulationModeChangeListener);
+ REGISTER_SYNC("NFCAdapter_addTransactionEventListener",
+ AddTransactionEventListener);
+ REGISTER_SYNC("NFCAdapter_addActiveSecureElementChangeListener",
+ AddActiveSecureElementChangeListener);
+ REGISTER_SYNC("NFCAdapter_removeActiveSecureElementChangeListener",
+ RemoveActiveSecureElementChangeListener);
+ REGISTER_SYNC("NFCAdapter_getCachedMessage", GetCachedMessage);
+ REGISTER_SYNC("NFCAdapter_setExclusiveModeForTransaction",
+ SetExclusiveModeForTransaction);
+ REGISTER_SYNC("NFCPeer_unsetReceiveNDEFListener", UnsetReceiveNDEFListener);
+ REGISTER_SYNC("NDEFMessage_toByte", ToByte);
+#undef REGISTER_SYNC
+#define REGISTER(c,x) \
+ RegisterHandler(c, std::bind(&NFCInstance::x, this, _1, _2));
+ REGISTER("NFCAdapter_setPowered", SetPowered);
+ REGISTER("NFCTag_readNDEF", ReadNDEF);
+ REGISTER("NFCTag_writeNDEF", WriteNDEF);
+ REGISTER("NFCTag_transceive ", Transceive );
+ REGISTER("NFCPeer_setReceiveNDEFListener", SetReceiveNDEFListener);
+ REGISTER("NFCPeer_sendNDEF", SendNDEF);
+#undef REGISTER
+}
+
+NFCInstance::~NFCInstance() {
+}
+
+void NFCInstance::GetDefaultAdapter(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::SetExclusiveMode(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::SetPowered(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::SetTagListener(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::SetPeerListener(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::UnsetTagListener(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::UnsetPeerListener(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::AddCardEmulationModeChangeListener(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::RemoveCardEmulationModeChangeListener(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::AddTransactionEventListener(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::AddActiveSecureElementChangeListener(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::RemoveActiveSecureElementChangeListener(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::GetCachedMessage(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::SetExclusiveModeForTransaction(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::ReadNDEF(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::WriteNDEF(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::Transceive(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::SetReceiveNDEFListener(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::UnsetReceiveNDEFListener(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::SendNDEF(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+void NFCInstance::ToByte(
+ const picojson::value& args, picojson::object& out) {
+
+}
+
+} // namespace nfc
+} // namespace extension
--- /dev/null
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NFC_NFC_INSTANCE_H_
+#define NFC_NFC_INSTANCE_H_
+
+#include "common/extension.h"
+
+#include "nfc/nfc_extension.h"
+
+namespace extension {
+namespace nfc {
+
+class NFCInstance: public common::ParsedInstance {
+public:
+ NFCInstance();
+ virtual ~NFCInstance();
+
+private:
+ void GetDefaultAdapter(const picojson::value& args, picojson::object& out);
+ void SetExclusiveMode(const picojson::value& args, picojson::object& out);
+ void SetPowered(const picojson::value& args, picojson::object& out);
+ void SetTagListener(const picojson::value& args, picojson::object& out);
+ void SetPeerListener(const picojson::value& args, picojson::object& out);
+ void UnsetTagListener(const picojson::value& args, picojson::object& out);
+ void UnsetPeerListener(const picojson::value& args, picojson::object& out);
+ void AddCardEmulationModeChangeListener(const picojson::value& args, picojson::object& out);
+ void RemoveCardEmulationModeChangeListener(const picojson::value& args, picojson::object& out);
+ void AddTransactionEventListener(const picojson::value& args, picojson::object& out);
+ void RemoveTransactionEventListener(const picojson::value& args, picojson::object& out);
+ void AddActiveSecureElementChangeListener(const picojson::value& args, picojson::object& out);
+ void RemoveActiveSecureElementChangeListener(const picojson::value& args, picojson::object& out);
+ void GetCachedMessage(const picojson::value& args, picojson::object& out);
+ void SetExclusiveModeForTransaction(const picojson::value& args, picojson::object& out);
+ void ReadNDEF(const picojson::value& args, picojson::object& out);
+ void WriteNDEF(const picojson::value& args, picojson::object& out);
+ void Transceive(const picojson::value& args, picojson::object& out);
+ void SetReceiveNDEFListener(const picojson::value& args, picojson::object& out);
+ void UnsetReceiveNDEFListener(const picojson::value& args, picojson::object& out);
+ void SendNDEF(const picojson::value& args, picojson::object& out);
+ void ToByte(const picojson::value& args, picojson::object& out);
+
+};
+
+} // namespace nfc
+} // namespace extension
+
+#endif // NFC_NFC_INSTANCE_H_
'calendar/calendar.gyp:*',
'datasync/datasync.gyp:*',
'messaging/messaging.gyp:*',
+ 'nfc/nfc.gyp:*'
],
},
],