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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
|
/******************************************************************************
*
* Copyright (C) 2011-2012 Broadcom Corporation
*
* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
*
* 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.
*
******************************************************************************/
/******************************************************************************
*
* The original Work has been changed by NXP Semiconductors.
*
* Copyright (C) 2013-2014 NXP Semiconductors
*
* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
*
* 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.
*
******************************************************************************/
#include <stdio.h>
#include <sys/stat.h>
#include <list>
#include <string>
#include <vector>
#include <phNxpConfig.h>
#include <phNxpLog.h>
#include "sparse_crc32.h"
#if GENERIC_TARGET
const char alternative_config_path[] = "/data/vendor/nfc/";
#else
const char alternative_config_path[] = "";
#endif
#if 1
const char* transport_config_paths[] = {"/odm/etc/", "/vendor/etc/", "/etc/"};
#else
const char* transport_config_paths[] = {"res/"};
#endif
const int transport_config_path_size =
(sizeof(transport_config_paths) / sizeof(transport_config_paths[0]));
#define config_name "libnfc-nxp.conf"
#define extra_config_base "libnfc-nxp-"
#define extra_config_ext ".conf"
#define IsStringValue 0x80000000
const char config_timestamp_path[] =
"/data/vendor/nfc/libnfc-nxpConfigState.bin";
namespace {
size_t readConfigFile(const char* fileName, uint8_t** p_data) {
FILE* fd = fopen(fileName, "rb");
if (fd == nullptr) return 0;
fseek(fd, 0L, SEEK_END);
const size_t file_size = ftell(fd);
rewind(fd);
uint8_t* buffer = new uint8_t[file_size];
size_t read = fread(buffer, file_size, 1, fd);
fclose(fd);
if (read == 1) {
*p_data = buffer;
return file_size;
}
return 0;
}
} // namespace
using namespace ::std;
class CNfcParam : public string {
public:
CNfcParam();
CNfcParam(const char* name, const string& value);
CNfcParam(const char* name, unsigned long value);
virtual ~CNfcParam();
unsigned long numValue() const { return m_numValue; }
const char* str_value() const { return m_str_value.c_str(); }
size_t str_len() const { return m_str_value.length(); }
private:
string m_str_value;
unsigned long m_numValue;
};
class CNfcConfig : public vector<const CNfcParam*> {
public:
virtual ~CNfcConfig();
static CNfcConfig& GetInstance();
friend void readOptionalConfig(const char* optional);
bool isModified();
void resetModified();
bool getValue(const char* name, char* pValue, size_t len) const;
bool getValue(const char* name, unsigned long& rValue) const;
bool getValue(const char* name, unsigned short& rValue) const;
bool getValue(const char* name, char* pValue, long len, long* readlen) const;
const CNfcParam* find(const char* p_name) const;
void clean();
private:
CNfcConfig();
bool readConfig(const char* name, bool bResetContent);
void moveFromList();
void moveToList();
void add(const CNfcParam* pParam);
list<const CNfcParam*> m_list;
bool mValidFile;
uint32_t config_crc32_;
unsigned long state;
inline bool Is(unsigned long f) { return (state & f) == f; }
inline void Set(unsigned long f) { state |= f; }
inline void Reset(unsigned long f) { state &= ~f; }
};
/*******************************************************************************
**
** Function: isPrintable()
**
** Description: determine if 'c' is printable
**
** Returns: 1, if printable, otherwise 0
**
*******************************************************************************/
inline bool isPrintable(char c) {
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') ||
(c >= '0' && c <= '9') || c == '/' || c == '_' || c == '-' || c == '.';
}
/*******************************************************************************
**
** Function: isDigit()
**
** Description: determine if 'c' is numeral digit
**
** Returns: true, if numerical digit
**
*******************************************************************************/
inline bool isDigit(char c, int base) {
if ('0' <= c && c <= '9') return true;
if (base == 16) {
if (('A' <= c && c <= 'F') || ('a' <= c && c <= 'f')) return true;
}
return false;
}
/*******************************************************************************
**
** Function: getDigitValue()
**
** Description: return numerical value of a decimal or hex char
**
** Returns: numerical value if decimal or hex char, otherwise 0
**
*******************************************************************************/
inline int getDigitValue(char c, int base) {
if ('0' <= c && c <= '9') return c - '0';
if (base == 16) {
if ('A' <= c && c <= 'F')
return c - 'A' + 10;
else if ('a' <= c && c <= 'f')
return c - 'a' + 10;
}
return 0;
}
/*******************************************************************************
**
** Function: findConfigFilePathFromTransportConfigPaths()
**
** Description: find a config file path with a given config name from transport
** config paths
**
** Returns: none
**
*******************************************************************************/
void findConfigFilePathFromTransportConfigPaths(const string& configName,
string& filePath) {
for (int i = 0; i < transport_config_path_size - 1; i++) {
filePath.assign(transport_config_paths[i]);
filePath += configName;
struct stat file_stat;
if (stat(filePath.c_str(), &file_stat) == 0 && S_ISREG(file_stat.st_mode)) {
return;
}
}
filePath.assign(transport_config_paths[transport_config_path_size - 1]);
filePath += configName;
}
/*******************************************************************************
**
** Function: CNfcConfig::readConfig()
**
** Description: read Config settings and parse them into a linked list
** move the element from linked list to a array at the end
**
** Returns: 1, if there are any config data, 0 otherwise
**
*******************************************************************************/
bool CNfcConfig::readConfig(const char* name, bool bResetContent) {
enum {
BEGIN_LINE = 1,
TOKEN,
STR_VALUE,
NUM_VALUE,
BEGIN_HEX,
BEGIN_QUOTE,
END_LINE
};
uint8_t* p_config = nullptr;
size_t config_size = readConfigFile(name, &p_config);
if (p_config == nullptr) {
ALOGE("%s Cannot open config file %s\n", __func__, name);
if (bResetContent) {
ALOGE("%s Using default value for all settings\n", __func__);
mValidFile = false;
}
return false;
}
string token;
string strValue;
unsigned long numValue = 0;
CNfcParam* pParam = NULL;
int i = 0;
int base = 0;
char c;
int bflag = 0;
state = BEGIN_LINE;
config_crc32_ = sparse_crc32(0, p_config, config_size);
mValidFile = true;
if (size() > 0) {
if (bResetContent)
clean();
else
moveToList();
}
for (size_t offset = 0; offset != config_size; ++offset) {
c = p_config[offset];
switch (state & 0xff) {
case BEGIN_LINE:
if (c == '#')
state = END_LINE;
else if (isPrintable(c)) {
i = 0;
token.erase();
strValue.erase();
state = TOKEN;
token.push_back(c);
}
break;
case TOKEN:
if (c == '=') {
token.push_back('\0');
state = BEGIN_QUOTE;
} else if (isPrintable(c))
token.push_back(c);
else
state = END_LINE;
break;
case BEGIN_QUOTE:
if (c == '"') {
state = STR_VALUE;
base = 0;
} else if (c == '0')
state = BEGIN_HEX;
else if (isDigit(c, 10)) {
state = NUM_VALUE;
base = 10;
numValue = getDigitValue(c, base);
i = 0;
} else if (c == '{') {
state = NUM_VALUE;
bflag = 1;
base = 16;
i = 0;
Set(IsStringValue);
} else
state = END_LINE;
break;
case BEGIN_HEX:
if (c == 'x' || c == 'X') {
state = NUM_VALUE;
base = 16;
numValue = 0;
i = 0;
break;
} else if (isDigit(c, 10)) {
state = NUM_VALUE;
base = 10;
numValue = getDigitValue(c, base);
break;
} else if (c != '\n' && c != '\r') {
state = END_LINE;
break;
}
// fall through to numValue to handle numValue
case NUM_VALUE:
if (isDigit(c, base)) {
numValue *= base;
numValue += getDigitValue(c, base);
++i;
} else if (bflag == 1 &&
(c == ' ' || c == '\r' || c == '\n' || c == '\t')) {
break;
} else if (base == 16 &&
(c == ',' || c == ':' || c == '-' || c == ' ' || c == '}')) {
if (c == '}') {
bflag = 0;
}
if (i > 0) {
int n = (i + 1) / 2;
while (n-- > 0) {
numValue = numValue >> (n * 8);
unsigned char c = (numValue)&0xFF;
strValue.push_back(c);
}
}
Set(IsStringValue);
numValue = 0;
i = 0;
} else {
if (c == '\n' || c == '\r') {
if (bflag == 0) {
state = BEGIN_LINE;
}
} else {
if (bflag == 0) {
state = END_LINE;
}
}
if (Is(IsStringValue) && base == 16 && i > 0) {
int n = (i + 1) / 2;
while (n-- > 0) strValue.push_back(((numValue >> (n * 8)) & 0xFF));
}
if (strValue.length() > 0)
pParam = new CNfcParam(token.c_str(), strValue);
else
pParam = new CNfcParam(token.c_str(), numValue);
add(pParam);
strValue.erase();
numValue = 0;
}
break;
case STR_VALUE:
if (c == '"') {
strValue.push_back('\0');
state = END_LINE;
pParam = new CNfcParam(token.c_str(), strValue);
add(pParam);
} else if (isPrintable(c))
strValue.push_back(c);
break;
case END_LINE:
if (c == '\n' || c == '\r') state = BEGIN_LINE;
break;
default:
break;
}
}
delete[] p_config;
moveFromList();
return size() > 0;
}
/*******************************************************************************
**
** Function: CNfcConfig::CNfcConfig()
**
** Description: class constructor
**
** Returns: none
**
*******************************************************************************/
CNfcConfig::CNfcConfig() : mValidFile(true), state(0) {}
/*******************************************************************************
**
** Function: CNfcConfig::~CNfcConfig()
**
** Description: class destructor
**
** Returns: none
**
*******************************************************************************/
CNfcConfig::~CNfcConfig() {}
/*******************************************************************************
**
** Function: CNfcConfig::GetInstance()
**
** Description: get class singleton object
**
** Returns: none
**
*******************************************************************************/
CNfcConfig& CNfcConfig::GetInstance() {
static CNfcConfig theInstance;
if (theInstance.size() == 0 && theInstance.mValidFile) {
string strPath;
if (alternative_config_path[0] != '\0') {
strPath.assign(alternative_config_path);
strPath += config_name;
theInstance.readConfig(strPath.c_str(), true);
if (!theInstance.empty()) {
return theInstance;
}
}
findConfigFilePathFromTransportConfigPaths(config_name, strPath);
theInstance.readConfig(strPath.c_str(), true);
}
return theInstance;
}
/*******************************************************************************
**
** Function: CNfcConfig::getValue()
**
** Description: get a string value of a setting
**
** Returns: true if setting exists
** false if setting does not exist
**
*******************************************************************************/
bool CNfcConfig::getValue(const char* name, char* pValue, size_t len) const {
const CNfcParam* pParam = find(name);
if (pParam == NULL) return false;
if (pParam->str_len() > 0) {
memset(pValue, 0, len);
memcpy(pValue, pParam->str_value(), pParam->str_len());
return true;
}
return false;
}
bool CNfcConfig::getValue(const char* name, char* pValue, long len,
long* readlen) const {
const CNfcParam* pParam = find(name);
if (pParam == NULL) return false;
if (pParam->str_len() > 0) {
if (pParam->str_len() <= (unsigned long)len) {
memset(pValue, 0, len);
memcpy(pValue, pParam->str_value(), pParam->str_len());
*readlen = pParam->str_len();
} else {
*readlen = -1;
}
return true;
}
return false;
}
/*******************************************************************************
**
** Function: CNfcConfig::getValue()
**
** Description: get a long numerical value of a setting
**
** Returns: true if setting exists
** false if setting does not exist
**
*******************************************************************************/
bool CNfcConfig::getValue(const char* name, unsigned long& rValue) const {
const CNfcParam* pParam = find(name);
if (pParam == NULL) return false;
if (pParam->str_len() == 0) {
rValue = static_cast<unsigned long>(pParam->numValue());
return true;
}
return false;
}
/*******************************************************************************
**
** Function: CNfcConfig::getValue()
**
** Description: get a short numerical value of a setting
**
** Returns: true if setting exists
** false if setting does not exist
**
*******************************************************************************/
bool CNfcConfig::getValue(const char* name, unsigned short& rValue) const {
const CNfcParam* pParam = find(name);
if (pParam == NULL) return false;
if (pParam->str_len() == 0) {
rValue = static_cast<unsigned short>(pParam->numValue());
return true;
}
return false;
}
/*******************************************************************************
**
** Function: CNfcConfig::find()
**
** Description: search if a setting exist in the setting array
**
** Returns: pointer to the setting object
**
*******************************************************************************/
const CNfcParam* CNfcConfig::find(const char* p_name) const {
if (size() == 0) return NULL;
for (const_iterator it = begin(), itEnd = end(); it != itEnd; ++it) {
if (**it < p_name) {
continue;
} else if (**it == p_name) {
if ((*it)->str_len() > 0) {
NXPLOG_EXTNS_D("%s found %s=%s\n", __func__, p_name,
(*it)->str_value());
} else {
NXPLOG_EXTNS_D("%s found %s=(0x%lx)\n", __func__, p_name,
(*it)->numValue());
}
return *it;
} else
break;
}
return NULL;
}
/*******************************************************************************
**
** Function: CNfcConfig::clean()
**
** Description: reset the setting array
**
** Returns: none
**
*******************************************************************************/
void CNfcConfig::clean() {
if (size() == 0) return;
for (iterator it = begin(), itEnd = end(); it != itEnd; ++it) delete *it;
clear();
}
/*******************************************************************************
**
** Function: CNfcConfig::Add()
**
** Description: add a setting object to the list
**
** Returns: none
**
*******************************************************************************/
void CNfcConfig::add(const CNfcParam* pParam) {
if (m_list.size() == 0) {
m_list.push_back(pParam);
return;
}
for (list<const CNfcParam *>::iterator it = m_list.begin(),
itEnd = m_list.end();
it != itEnd; ++it) {
if (**it < pParam->c_str()) continue;
m_list.insert(it, pParam);
return;
}
m_list.push_back(pParam);
}
/*******************************************************************************
**
** Function: CNfcConfig::moveFromList()
**
** Description: move the setting object from list to array
**
** Returns: none
**
*******************************************************************************/
void CNfcConfig::moveFromList() {
if (m_list.size() == 0) return;
for (list<const CNfcParam *>::iterator it = m_list.begin(),
itEnd = m_list.end();
it != itEnd; ++it)
push_back(*it);
m_list.clear();
}
/*******************************************************************************
**
** Function: CNfcConfig::moveToList()
**
** Description: move the setting object from array to list
**
** Returns: none
**
*******************************************************************************/
void CNfcConfig::moveToList() {
if (m_list.size() != 0) m_list.clear();
for (iterator it = begin(), itEnd = end(); it != itEnd; ++it)
m_list.push_back(*it);
clear();
}
bool CNfcConfig::isModified() {
FILE* fd = fopen(config_timestamp_path, "r+");
if (fd == nullptr) {
ALOGE("%s Unable to open file '%s' - assuming modified", __func__,
config_timestamp_path);
return true;
}
uint32_t stored_crc32 = 0;
fread(&stored_crc32, sizeof(uint32_t), 1, fd);
fclose(fd);
return stored_crc32 != config_crc32_;
}
void CNfcConfig::resetModified() {
FILE* fd = fopen(config_timestamp_path, "w+");
if (fd == nullptr) {
ALOGE("%s Unable to open file '%s' for writing", __func__,
config_timestamp_path);
return;
}
fwrite(&config_crc32_, sizeof(uint32_t), 1, fd);
fclose(fd);
}
/*******************************************************************************
**
** Function: CNfcParam::CNfcParam()
**
** Description: class constructor
**
** Returns: none
**
*******************************************************************************/
CNfcParam::CNfcParam() : m_numValue(0) {}
/*******************************************************************************
**
** Function: CNfcParam::~CNfcParam()
**
** Description: class destructor
**
** Returns: none
**
*******************************************************************************/
CNfcParam::~CNfcParam() {}
/*******************************************************************************
**
** Function: CNfcParam::CNfcParam()
**
** Description: class copy constructor
**
** Returns: none
**
*******************************************************************************/
CNfcParam::CNfcParam(const char* name, const string& value)
: string(name), m_str_value(value), m_numValue(0) {}
/*******************************************************************************
**
** Function: CNfcParam::CNfcParam()
**
** Description: class copy constructor
**
** Returns: none
**
*******************************************************************************/
CNfcParam::CNfcParam(const char* name, unsigned long value)
: string(name), m_numValue(value) {}
/*******************************************************************************
**
** Function: GetStrValue
**
** Description: API function for getting a string value of a setting
**
** Returns: True if found, otherwise False.
**
*******************************************************************************/
extern "C" int GetNxpStrValue(const char* name, char* pValue,
unsigned long len) {
CNfcConfig& rConfig = CNfcConfig::GetInstance();
return rConfig.getValue(name, pValue, len);
}
/*******************************************************************************
**
** Function: GetByteArrayValue()
**
** Description: Read byte array value from the config file.
**
** Parameters:
** name - name of the config param to read.
** pValue - pointer to input buffer.
** bufflen - input buffer length.
** len - out parameter to return the number of bytes read from
** config file, return -1 in case bufflen is not enough.
**
** Returns: TRUE[1] if config param name is found in the config file, else
** FALSE[0]
**
*******************************************************************************/
extern "C" int GetNxpByteArrayValue(const char* name, char* pValue,
long bufflen, long* len) {
CNfcConfig& rConfig = CNfcConfig::GetInstance();
return rConfig.getValue(name, pValue, bufflen, len);
}
/*******************************************************************************
**
** Function: GetNumValue
**
** Description: API function for getting a numerical value of a setting
**
** Returns: true, if successful
**
*******************************************************************************/
extern "C" int GetNxpNumValue(const char* name, void* pValue,
unsigned long len) {
if (!pValue) return false;
CNfcConfig& rConfig = CNfcConfig::GetInstance();
const CNfcParam* pParam = rConfig.find(name);
if (pParam == NULL) return false;
unsigned long v = pParam->numValue();
if (v == 0 && pParam->str_len() > 0 && pParam->str_len() < 4) {
const unsigned char* p = (const unsigned char*)pParam->str_value();
for (unsigned int i = 0; i < pParam->str_len(); ++i) {
v *= 256;
v += *p++;
}
}
switch (len) {
case sizeof(unsigned long):
*(static_cast<unsigned long*>(pValue)) = (unsigned long)v;
break;
case sizeof(unsigned short):
*(static_cast<unsigned short*>(pValue)) = (unsigned short)v;
break;
case sizeof(unsigned char):
*(static_cast<unsigned char*>(pValue)) = (unsigned char)v;
break;
default:
return false;
}
return true;
}
/*******************************************************************************
**
** Function: resetConfig
**
** Description: reset settings array
**
** Returns: none
**
*******************************************************************************/
extern "C" void resetNxpConfig()
{
CNfcConfig& rConfig = CNfcConfig::GetInstance();
rConfig.clean();
}
/*******************************************************************************
**
** Function: readOptionalConfig()
**
** Description: read Config settings from an optional conf file
**
** Returns: none
**
*******************************************************************************/
void readOptionalConfig(const char* extra) {
string strPath;
string configName(extra_config_base);
configName += extra;
configName += extra_config_ext;
if (alternative_config_path[0] != '\0') {
strPath.assign(alternative_config_path);
strPath += configName;
} else {
findConfigFilePathFromTransportConfigPaths(configName, strPath);
}
CNfcConfig::GetInstance().readConfig(strPath.c_str(), false);
}
/*******************************************************************************
**
** Function: isNxpConfigModified()
**
** Description: check if config file has modified
**
** Returns: 0 if not modified, 1 otherwise.
**
*******************************************************************************/
extern "C" int isNxpConfigModified() {
CNfcConfig& rConfig = CNfcConfig::GetInstance();
return rConfig.isModified();
}
/*******************************************************************************
**
** Function: updateNxpConfigTimestamp()
**
** Description: update if config file has modified
**
** Returns: 0 if not modified, 1 otherwise.
**
*******************************************************************************/
extern "C" int updateNxpConfigTimestamp() {
CNfcConfig& rConfig = CNfcConfig::GetInstance();
rConfig.resetModified();
return 0;
}
|