2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __TIZEN_NFC_NFC_MESSAGE_UTILS_H_
18 #define __TIZEN_NFC_NFC_MESSAGE_UTILS_H_
20 #include <network/nfc.h>
25 #include "common/picojson.h"
26 #include "common/platform_result.h"
31 typedef std::vector<unsigned char> UCharVector;
33 class NFCMessageUtils {
35 static common::PlatformResult ToNdefRecords(const nfc_ndef_message_h message,
36 picojson::array& array);
37 static common::PlatformResult ReportNdefMessageFromData(unsigned char* data, unsigned long size,
38 picojson::object& out);
39 static common::PlatformResult ReportNDEFMessage(const picojson::value& args,
40 picojson::object& out);
41 static common::PlatformResult NDEFMessageToStruct(const picojson::array& records_array,
42 const int size, nfc_ndef_message_h* message);
43 static common::PlatformResult NDEFMessageToByte(const picojson::value& args,
44 picojson::object& out);
45 static common::PlatformResult ConstructNdefRecordFromRecordHandle(nfc_ndef_record_h record_handle,
46 picojson::object& out);
47 static common::PlatformResult ReportNdefRecordFromMessage(nfc_ndef_message_h message_handle,
48 const int index, picojson::object& out);
49 static common::PlatformResult ReportNDEFRecord(const picojson::value& args,
50 picojson::object& out);
51 static common::PlatformResult ReportNdefRecordTextFromMessage(nfc_ndef_message_h message_handle,
53 picojson::object& out);
54 static common::PlatformResult ReportNDEFRecordText(const picojson::value& args,
55 picojson::object& out);
56 static common::PlatformResult ReportNdefRecordURIFromMessage(nfc_ndef_message_h message_handle,
58 picojson::object& out);
59 static common::PlatformResult ReportNDEFRecordURI(const picojson::value& args,
60 picojson::object& out);
61 static common::PlatformResult ReportNdefRecordMediaFromMessage(nfc_ndef_message_h message_handle,
63 picojson::object& out);
64 static common::PlatformResult ReportNDEFRecordMedia(const picojson::value& args,
65 picojson::object& out);
66 static void RemoveMessageHandle(nfc_ndef_message_h message_handle);
72 #endif // __TIZEN_NFC_NFC_MESSAGE_UTILS_H_