a705d3cc64b31c19eacbabbacfdcda8607891d90
[profile/ivi/wrt-plugins-tizen.git] / src / platform / API / NFC / NFCFactory.cpp
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 #include "NFCFactory.h"
19
20 #include <NFC/NFCManager.h>
21 #include <NFC/NdefMessage.h>
22 #include <NFC/NdefRecord.h>
23 #include <NFC/NFCTag.h>
24 #include <NFC/NFCTagMifareClassic.h>
25 #include <NFC/NFCTagMifareUltra.h>
26 #include <NFC/NFCTarget.h>
27
28 namespace TizenApis {
29 namespace Api {
30 namespace NFC {
31
32 INFCManagerPtr NFCFactory::createNFCManagerObject() {
33         return INFCManagerPtr( new Platform::NFC::NFCManager() );
34 }
35
36 INdefMessagePtr NFCFactory::createNDEFMessageObject() {
37         return INdefMessagePtr( new Platform::NFC::NdefMessage() );
38 }
39
40 INdefMessagePtr NFCFactory::createNDEFMessageObject(void *messageHandle) {
41         return INdefMessagePtr( new Platform::NFC::NdefMessage(messageHandle) );
42 }
43
44 INdefMessagePtr NFCFactory::createNDEFMessageObject(std::vector<void *> ndefRcords) {
45         return INdefMessagePtr( new Platform::NFC::NdefMessage(ndefRcords) );
46 }
47
48 INdefMessagePtr NFCFactory::createNDEFMessageObject(std::vector<unsigned char> rawdata) {
49         return INdefMessagePtr( new Platform::NFC::NdefMessage(rawdata) );
50 }
51
52 INdefRecordPtr NFCFactory::createNDEFRecordObject(const NdefRecordProperties &ndefRecordProperties, std::vector<unsigned char> payload) {
53         return INdefRecordPtr( new Platform::NFC::NdefRecord(ndefRecordProperties, payload) );
54 }
55
56 INdefRecordPtr NFCFactory::createNDEFRecordObject(const std::string &text, const std::string &langCode, const short encodeType) {
57         return INdefRecordPtr( new Platform::NFC::NdefRecord(text, langCode, encodeType) );
58 }
59
60 INdefRecordPtr NFCFactory::createNDEFRecordObject(const std::string &uri) {
61         return INdefRecordPtr( new Platform::NFC::NdefRecord(uri) );
62 }
63
64 INdefRecordPtr NFCFactory::createNDEFRecordObject(const std::string &mimeType, const std::vector<unsigned char> data) {
65         return INdefRecordPtr( new Platform::NFC::NdefRecord(mimeType, data) );
66 }
67
68 INFCTagPtr NFCFactory::createNFCTagObject(void *tagHandle) {
69         return INFCTagPtr( new Platform::NFC::NFCTag(tagHandle));
70 }
71
72 INFCTagMifareClassicPtr NFCFactory::createNFCTagMifareClassicObject(void *tagHandle) {
73         return INFCTagMifareClassicPtr( new Platform::NFC::NFCTagMifareClassic(tagHandle));
74 }
75
76 INFCTagMifareUltraPtr NFCFactory::createNFCTagMifareUltraObject(void *tagHandle) {
77         return INFCTagMifareUltraPtr( new Platform::NFC::NFCTagMifareUltra(tagHandle));
78 }
79
80 INFCTargetPtr NFCFactory::createNFCTargetObject(void *targetHandle) {
81         return INFCTargetPtr( new Platform::NFC::NFCTarget(targetHandle));
82 }
83
84 NFCFactory& NFCFactory::getInstance() {
85         static NFCFactory theInstance;
86         return theInstance;
87 }
88
89 }
90 }
91 }