forked from Integreight/1Sheeld-Arduino-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NFCRecord.cpp
88 lines (68 loc) · 1.65 KB
/
NFCRecord.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
Project: 1Sheeld Library
File: NFCRecord.cpp
Version: 1.5
Compiler: Arduino avr-gcc 4.3.2
Author: Integreight
Date: 2015.3
*/
#define FROM_ONESHEELD_LIBRARY
#include "OneSheeld.h"
#include "NFCRecord.h"
NFCRecord::NFCRecord(byte _recordNumber)
{
recordType =0;
recordTypeLength =0;
recordDataLength =0;
recordNumber = _recordNumber;
isRecordNull = false;
}
NFCRecord::NFCRecord()
{
recordType =0;
recordTypeLength =0;
recordDataLength =0;
recordNumber = 0;
isRecordNull = true;
}
bool NFCRecord::isNull()
{
return isRecordNull;
}
byte NFCRecord::getTypeCategory()
{
return recordType;
}
int NFCRecord::getTypeLength()
{
return recordTypeLength;
}
int NFCRecord::getDataLength()
{
return recordDataLength;
}
void NFCRecord::queryData(int start,byte size)
{
byte startArray[2] ;
startArray[1] = (start >> 8) & 0xFF;
startArray[0] = start & 0xFF;
if(!isRecordNull)
OneSheeld.sendShieldFrame(NFC_ID,0,NFC_RECORD_QUERY_DATA,3,new FunctionArg(1,&recordNumber),
new FunctionArg(2,startArray),
new FunctionArg(1,&size));
}
void NFCRecord::queryType(int start,byte size)
{
byte startArray[2] ;
startArray[1] = (start >> 8) & 0xFF;
startArray[0] = start & 0xFF;
if(!isRecordNull)
OneSheeld.sendShieldFrame(NFC_ID,0,NFC_RECORD_QUERY_TYPE,3,new FunctionArg(1,&recordNumber),
new FunctionArg(2,startArray),
new FunctionArg(1,&size));
}
void NFCRecord::queryParsedData()
{
if(!isRecordNull)
OneSheeld.sendShieldFrame(NFC_ID,0,NFC_RECORD_QUERY_PARSED_DATA,1,new FunctionArg(1,&recordNumber));
}