summaryrefslogtreecommitdiffstats
path: root/nsframework/framework_unified/client/include/native_service/ns_logger_if.h
blob: a1ca9ef75e56cda583adafecee151a0decf8c096 (plain)
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
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
/*
 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR 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.
 */


//////////////////////////////////////////////////////////////////////////////////////////////////
/// \file
/// Declares the external APIs to Logger.
///
//////////////////////////////////////////////////////////////////////////////////////////////////
/**
 * @file
 * @brief \~english Declares the external APIs to Logger.
 */
/** @addtogroup BaseSystem
 *  @{
 */
/** @addtogroup native_service
 *  @ingroup BaseSystem
 *  @{
 */
/** @addtogroup framework_unified
 *  @ingroup Native_service
 *  @{
 */
/** @addtogroup native
 *  @ingroup framework_unified
 *  @{
 */
#ifndef  __NATIVESERVICES_LOGGER_IF_H__  // NOLINT  (build/header_guard)
#define __NATIVESERVICES_LOGGER_IF_H__

#include <native_service/frameworkunified_types.h>
#include <stdarg.h>

#ifdef __cplusplus
extern "C" {
#endif

#define FRAMEWORKUNIFIEDLOG_MSGQ_NAME "/NSLog"
#define FRAMEWORKUNIFIEDLOG_SHAREDMEM_NAME "/frameworkunified_debug.log.1"
#define FRAMEWORKUNIFIEDLOG_SHAREDMEM_SIZE 5242880  // 5MB

#define MASTER_ZONE_COUNT  16U

#include <native_service/loglibrarylog_if.h>

///////////////////////////////////////////////////////////////////////////////
/// \ingroup  tag_NSLogger
/// \brief    typedef of ZONE
///////////////////////////////////////////////////////////////////////////////
typedef UI_32 TFrameworkunifiedZone;
// Note: if the BITS_IN_TZONE macro is getting modified do the corresponding changes
// in GET_ZONE_INDEX and GET_ZONE_BIT_MASK
#define BITS_IN_BYTE (8U)
#define BITS_IN_TZONE ((UI_32 )(sizeof( TFrameworkunifiedZone ) * BITS_IN_BYTE))
#define TZONE_COUNT ((UI_32)MASTER_ZONE_COUNT)
#define BITS_IN_ZONE_MASK ((UI_32)(BITS_IN_TZONE * TZONE_COUNT))
#define DEBUG_ZONE_COUNT  BITS_IN_ZONE_MASK

#define ZONE_MASK_ARRAY_ELTS ((UI_32)TZONE_COUNT)

#define USER_ZONES_COUNT BITS_IN_ZONE_MASK -10

#define ZONE_TEXT_SIZE  24

///////////////////////////////////////////////////////////////////////////////
/// \ingroup  tag_NSLogger
/// \brief    Array of mask options
///////////////////////////////////////////////////////////////////////////////
typedef TFrameworkunifiedZone TFrameworkunifiedZoneMask[ZONE_MASK_ARRAY_ELTS];

typedef enum _TFrameworkunifiedLoggerSeverity {
  FRAMEWORKUNIFIED_SEVERITY_LOW  = 0x0,  /// <all enable(default)
  FRAMEWORKUNIFIED_SEVERITY_DEBUG2,    /// <enable FRAMEWORKUNIFIEDLOG_DEBUG() and FRAMEWORKUNIFIEDLOG_DEBUG2() and all the follows
  FRAMEWORKUNIFIED_SEVERITY_DEBUG1,    /// <enable FRAMEWORKUNIFIEDLOG_DEBUG1() and all the follows
  FRAMEWORKUNIFIED_SEVERITY_INFO,      /// <enable FRAMEWORKUNIFIEDLOG_INFO() and all the follows
  FRAMEWORKUNIFIED_SEVERITY_WARN,      /// <enable FRAMEWORKUNIFIEDLOG_WARN() and all the follows
  FRAMEWORKUNIFIED_SEVERITY_ERROR,     /// <enable FRAMEWORKUNIFIEDLOG_ERROR() and all the follows
  FRAMEWORKUNIFIED_SEVERITY_FATAL,     /// <enable FRAMEWORKUNIFIEDLOG_FATAL() and FRAMEWORKUNIFIEDLOG_ALWAYS()
  FRAMEWORKUNIFIED_SEVERITY_ALWAYS     /// <enable FRAMEWORKUNIFIEDLOG_ALWAYS()
} TFrameworkunifiedLoggerSeverity;

///////////////////////////////////////////////////////////////////////////////
/// \ingroup  tag_NSLogger
/// \brief    FRAMEWORKUNIFIEDLOG parameter
///////////////////////////////////////////////////////////////////////////////
typedef struct _FRAMEWORKUNIFIEDLOGPARAM {
  UI_8           uiLogOptions;                 /// <output options (ref. NS_LoggingMethod_t )
  CHAR           cZones[USER_ZONES_COUNT][ZONE_TEXT_SIZE];   /// <mask text    ZONE_TEXT_10 ... ZONE_TEXT_n
  TFrameworkunifiedZoneMask     uiZoneMask;                 /// <mask options ZONEMASK(10)...ZONEMASK(n) (ref. TFrameworkunifiedZone)
  TFrameworkunifiedLoggerSeverity eSeverity;                  /// <severity level(ref. TFrameworkunifiedLoggerSeverity)
} FRAMEWORKUNIFIEDLOGPARAM, *LPFRAMEWORKUNIFIEDLOGPARAM;

///////////////////////////////////////////////////////////////////////////////
/// \ingroup  tag_NSLogger
/// \brief    FRAMEWORKUNIFIEDLOG output direction
/// \note     LMSGQ and LSLOGGER are disabled
///////////////////////////////////////////////////////////////////////////////
typedef enum _NS_LOGGER_METHODS {
  LPRINT    = 0x01,   /// <Print to the console(similar to printf)
  LMSGQ     = 0x02,   /// <Disabled
  LSLOGGER  = 0x04,   /// <Disabled
  LSHAREDMEM  = 0x08    /// <Output to shared memory. this is the default logging method.
} NS_LoggingMethod_t;
// Note: Don't remove #paragma pack(1) this is required for the
// ARM processor, forces data structures to be on a byte boundary
// all messages should be place in between #pragma pack(1) and #pragma pack()
#pragma pack(1)        // *** DO NOT REMOVE ***

typedef struct tag_Change_Log_Parameters {
  TFrameworkunifiedZoneMask     uiZoneMask;
  UI_8           uiLogOptions;
  TFrameworkunifiedLoggerSeverity eSeverity;
} CHANGELOGPARAMS;

#pragma pack(0)        // *** DO NOT REMOVE ***

// RCS related
#define NS_RCS_LOGGER_PLUGIN_Q  "/NsRcsLoggerPlugin"

typedef enum _NS_RCS_LOGGER_SETTINGS {
  NS_RCS_LOGGER_PLUGIN_ADD_APPNAME = 0x500,
} NS_RCS_LOGGER_SETTINGS;

typedef struct _TNS_EnableRcsLogging {
  CHAR m_cAppName[MAX_NAME_SIZE_APP];
  BOOL m_bEnable;
} TNS_EnableRcsLogging;

// End RCS related

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLog
/// \~english @par Brief
///        Writes a log to the Native Services logging mechanism
/// \~english @param [in] p_lLine_i
///        const UI_16 - Line number(0 to 65535) that this log was was written on
/// \~english @param [in] f_uiZoneIndex
///        const UI_64 - Mask value(0 to 511) to check against
/// \~english @param [in] p_pstrClassName_i
///        PCSTR - Name of the class or method where the log was written
/// \~english @param [in] lpszFormat
///        PCSTR - string similar to that of a printf statement
/// \~english @param [in] arg list
///        ... - Data arguments(option)
/// \~english @retval none
///        void - there is no return.
/// \~english @par Prerequisite
///         FRAMEWORKUNIFIEDLOG parameter is set throuth NsLogSetFrameworkunifiedLogParams
/// \~english @par Change of internal state
///         None
/// \~english @par Conditions of processing failure
///       - Real-time log output switch can be turn on by NsLogSetRealtimeLog() generally.
///         But in case of FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE real-time log and/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog /will not print out
/// \~~english @par
///       - in the following conditions,real-time log will not print out:
///        - log output way is LPRINT but f_uiZoneIndex parameter is in [96 to 127]
///        - log output way is LPRINT but real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_open system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_send system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and socket system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and setsockopt system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and bind system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and inet_addr system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and sendto system call failed(retry 5 times)
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE
/// \~english @par
///        in the following conditions /ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/ log can not be print out
///        - log file for parameter f_uiZoneIndex and
///          log file for parameter FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter can not be found
///        - the ring_buffer of log file(log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when
///          log file is not exited) for parameter f_uiZoneIndex is not opened (CNSRingBuffer::IsOpen())
///        - the write-in operation to ring_buffer of log file for parameter f_uiZoneIndex
///          (log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when file is not exited) is failed
/// \~english @par Detail
///         Writes a log to the Native Services logging mechanism
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////
void NsLog(const UI_16 p_lLine_i,       // Line number where message was generated
           const UI_16 f_uiZoneIndex,
           PCSTR p_pstrClassName_i,
           PCSTR lpszFormat,
           ...)
#ifdef  __GNUC__
__attribute__((format(printf, 4, 5)))
#endif
;  // NOLINT  (readability/nolint)

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLog0
/// \~english @par Brief
///        Writes a log to the Native Services logging mechanism
/// \~english @param [in] p_lLine_i
///        const UI_16 - Line number(0 to 65535) that this log was was written on
/// \~english @param [in] f_uiZoneIndex
///        const UI_64 - Mask value(0 to 511) to check against
/// \~english @param [in] p_pstrClassName_i
///        PCSTR - Name of the class or method where the log was written
/// \~english @param [in] lpszFormat
///        PCSTR - string similar to that of a printf statement
/// \~english @param [in] arg list
///        ... - Data arguments(option)
/// \~english @retval none
///        void - there is no return.
/// \~english @par Prerequisite
///        FRAMEWORKUNIFIEDLOG parameter is set throuth NsLogSetFrameworkunifiedLogParams
/// \~english @par Change of internal state
///        None
/// \~english @par Conditions of processing failure
///       - Real-time log output switch can be turn on by NsLogSetRealtimeLog() generally.
///         But in case of FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE real-time log and/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog /will not print out
/// \~~english @par
///       - in the following conditions,real-time log will not print out:
///        - log output way is LPRINT but f_uiZoneIndex parameter is in [96 to 127]
///        - log output way is LPRINT but real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_open system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_send system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and socket system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and setsockopt system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and bind system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and inet_addr system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and sendto system call failed(retry 5 times)
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE
/// \~english @par
///        in the following conditions /ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/ log can not be print out
///        - log file for parameter f_uiZoneIndex and
///          log file for parameter FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter can not be found
///        - the ring_buffer of log file(log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when
///          log file is not exited) for parameter f_uiZoneIndex is not opened (CNSRingBuffer::IsOpen())
///        - the write-in operation to ring_buffer of log file for parameter f_uiZoneIndex
///          (log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when file is not exited) is failed
/// \~english @par Detail
///          Writes a log to the Native Services logging mechanism
/// \~english @par Classification
///        Public
/// \~english @par Type
///        Sync only
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////
void NsLog0(const UI_16 p_lLine_i,        // Line number where message was generated
            const UI_16 f_uiZoneIndex,
            PCSTR p_pstrClassName_i,
            PCSTR lpszFormat);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogTime
/// \~english @par Brief
///        Print out real-time in log using Native Service mechanism
/// \~english @param [in] f_uiZoneIndex
///        const UI_64 - Mask value(0 to 511) to check against
/// \~english @param [in] lpszFormat
///        PCSTR - string similar to that of a printf statement
/// \~english @retval none
///        void - there is no return.
/// \~english @par Prerequisite
///        parameter FRAMEWORKUNIFIEDLOG has already set using NsLogSetFrameworkunifiedLogParams
/// \~english @par Change of internal state
///       None
/// \~english @par Conditions of processing failure
///       - Real-time log output switch can be turn on by NsLogSetRealtimeLog() generally.
///         But in case of FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE real-time log and/ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog /will not print out
/// \~~english @par
///       - in the following conditions,real-time log will not print out:
///        - log output way is LPRINT but f_uiZoneIndex parameter is in [96 to 127]
///        - log output way is LPRINT but real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_open system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB and mq_send system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and socket system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and setsockopt system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and bind system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and inet_addr system call failed
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER and sendto system call failed(retry 5 times)
///        - log output way is LPRINT,real-time log output setting is
///          FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE
/// \~english @par
///        in the following conditions /ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/ log can not be print out
///        - log file for parameter f_uiZoneIndex and
///          log file for parameter FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter can not be found
///        - the ring_buffer of log file(log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when
///          log file is not exited) for parameter f_uiZoneIndex is not opened (CNSRingBuffer::IsOpen())
///        - the write-in operation to ring_buffer of log file for parameter f_uiZoneIndex
///          (log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter when file is not exited) is failed
/// \~english @par Detail
///        Print out real-time in log using Native Service mechanism
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////
void NsLogTime(const UI_16 f_uiZoneIndex,
               PCSTR lpszFormat);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogData
/// \~english @par Brief
///        log print-out function
/// \~english @param [in] f_uiZoneIndex
///        const UI_64 - Mask value(0 to 511) to check against
/// \~english @param [in] data
///        PCSTR -log print-out data
/// \~english @param [in] size (0 to ULONG_MAX)
///        UI_32 - data size (0 to ULONG_MAX)
/// \~english @retval none
///        void - there is no return.
/// \~english @par Prerequisite
///        FRAMEWORKUNIFIEDLOG has already set by NsLogSetFrameworkunifiedLogParams
/// \~english @par Change of internal state
///        None
/// \~english @par Conditions of processing failure
///        -Process will failed under following conditions:
///         -Real-time log output switch can be turn on by NsLogSetRealtimeLog() generally.
///         But the set value is FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE
///         -the log file for f_uiZoneIndex and log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG parameter
///          are both not found
///        - the ring_buffer of log file for f_uiZoneIndex(using log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG
///          if file is not exited)is not opened (CNSRingBuffer::IsOpen())
///        - write operation on ring_buffer of log file for f_uiZoneIndex
///          (using log file for FrameworkunifiedLogFlagId which is set by FRAMEWORKUNIFIEDLOG if file is not exited)is failed
/// \~english @par Detail
///         the difference bewteen NsLog and NsLogData:
///        - NsLog()will print out real-time log
///          NsLogData() will not print out real-time log but noly print out logs under /ramd/BS/ss/logger_service/rwdata/frameworkunifiedlog/
///        - NsLog() will add ZoneIndex, process name, real-time info to log but
///          NsLogData() only print out log
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////
void NsLogData(const UI_16 f_uiZoneIndex,
               PCSTR data,
               UI_32 size);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogSetFrameworkunifiedLogParams
/// \~english @par Brief
///        Sets the FRAMEWORKUNIFIEDLOG parameter of your application\process based on
///        the value passed in.
/// \~english @param [in] p_FrameworkunifiedLogParams
///        FRAMEWORKUNIFIEDLOGPARAM * - FRAMEWORKUNIFIEDLOG parameter in process
/// \~english @par
///        FRAMEWORKUNIFIEDLOGPARAM Structure
/// \~english @code
///                 typedef struct _FRAMEWORKUNIFIEDLOGPARAM {
///                   UI_8 uiLogOptions;                              // output options (ref. NS_LoggingMethod_t )
///                   CHAR cZones[USER_ZONES_COUNT][ZONE_TEXT_SIZE];  // mask text ZONE_TEXT_10 ... ZONE_TEXT_n
///                   // mask options ZONEMASK(10)...ZONEMASK(n) (ref. TFrameworkunifiedZone)
///                   TFrameworkunifiedZoneMask uiZoneMask;
///                   TFrameworkunifiedLoggerSeverity eSeverity;                   // severity level(ref. TFrameworkunifiedLoggerSeverity)
///                  } FRAMEWORKUNIFIEDLOGPARAM, *LPFRAMEWORKUNIFIEDLOGPARAM;
///            @endcode
/// \~english @par
///        TFrameworkunifiedZoneMask Array
/// \~english @code
///                 typedef TFrameworkunifiedZone TFrameworkunifiedZoneMask[ZONE_MASK_ARRAY_ELTS];
///            @endcode
/// \~english @par
///        TFrameworkunifiedZone typedef
/// \~english @code
///                 UI_32 TFrameworkunifiedZone;  // 32bit
///            @endcode
/// \~english @par
///        TFrameworkunifiedLoggerSeverity Enum
/// \~english @code
///                  typedef enum _TFrameworkunifiedLoggerSeverity {
///                    FRAMEWORKUNIFIED_SEVERITY_LOW  = 0x0,  // all enable(default)
///                    FRAMEWORKUNIFIED_SEVERITY_DEBUG2,      // enable FRAMEWORKUNIFIEDLOG_DEBUG() and FRAMEWORKUNIFIEDLOG_DEBUG2() and all the follows
///                    FRAMEWORKUNIFIED_SEVERITY_DEBUG1,      // enable FRAMEWORKUNIFIEDLOG_DEBUG1() and all the follows
///                    FRAMEWORKUNIFIED_SEVERITY_INFO,        // enable FRAMEWORKUNIFIEDLOG_INFO() and all the follows
///                    FRAMEWORKUNIFIED_SEVERITY_WARN,        // enable FRAMEWORKUNIFIEDLOG_WARN() and all the follows
///                    FRAMEWORKUNIFIED_SEVERITY_ERROR,       // enable FRAMEWORKUNIFIEDLOG_ERROR() and all the follows
///                    FRAMEWORKUNIFIED_SEVERITY_FATAL,       // enable FRAMEWORKUNIFIEDLOG_FATAL() and FRAMEWORKUNIFIEDLOG_ALWAYS()
///                    FRAMEWORKUNIFIED_SEVERITY_ALWAYS       // enable FRAMEWORKUNIFIEDLOG_ALWAYS()
///                  } TFrameworkunifiedLoggerSeverity;
///            @endcode
/// \~english @retval none
///        void - there is no return.
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - none
/// \~english @par Conditions of processing failure
///        - process will not conducted when p_FrameworkunifiedLogParams is NULL.
/// \~english @par Detail
///        set the FRAMEWORKUNIFIEDLOG of Application using the parameter set in parameter\n
///        ZONE_NS_WAR(8), ZONE_NS_ERR(9) will be put-out forcely in the function\n
///        log will be print out when ForceOutput is set.
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////
void NsLogSetFrameworkunifiedLogParams(FRAMEWORKUNIFIEDLOGPARAM *p_FrameworkunifiedLogParams);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogSetProcessName
/// \~english @par Brief
///        Sets the name of your application\process based on
///        the value passed in.
/// \~english @param [in] p_strProcessName_i
///        PCSTR - name of your application process.(string array ended by NULL below 20byte)
/// \~english @retval none
///        void - there is no return.
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - none
/// \~english @par Conditions of processing failure
///        The specified Aplication names are not set in the following cases:
///        - When the Application name specified in the arguments (p_strProcessName_i) is NULL
///        - When the Application name specified in the arguments (p_strProcessName_i) is a NULL termination character string of 21 bytes or more
/// \~english @par Detail
///        -name in prarameter should be string array(less than 20byte) ended by NULL
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////
void NsLogSetProcessName(PCSTR p_strProcessName_i);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogSetControlMask
/// \~english @par Brief
///        Sets the control word that should be logged
/// \~english @param [in] p_ulNSLogControl_i
///        TFrameworkunifiedZoneMask - Set mask to the new value.
/// \~english @par
///        TFrameworkunifiedZoneMask Array
/// \~english @code
///                 typedef TFrameworkunifiedZone TFrameworkunifiedZoneMask[ZONE_MASK_ARRAY_ELTS];
///            @endcode
/// \~english @par
///        TFrameworkunifiedZone typedef
/// \~english @code
///                 UI_32 TFrameworkunifiedZone;  // 32bit
///            @endcode
/// \~english @retval none
///        void - there is no return.
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - none
/// \~english @par Conditions of processing failure
///        -process will not be conducted when p_ulNSLogControl_i is none
/// \~english @par Detail
///        -Sets the control word that should be logged
///         zone mask(16) will be rewrited using parameter value
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        NsLogGetControlMask
////////////////////////////////////////////////////////////////////////////////////////////
void NsLogSetControlMask(TFrameworkunifiedZoneMask p_ulNSLogControl_i);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogIsZoneSet
/// \~english @par Brief
///        check wheather the FRAMEWORKUNIFIEDLOG ZONE is set by your application process.
/// \~english @param [in] set_zone
///        UI_32 - checking zone_index
/// \~english @retval TRUE  zone is enable
/// \~english @retval FALSE zone is disable
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - none
/// \~english @par Conditions of processing failure
///        If the parameter of set_zone is outside(set_zone < 0 or 511 > set_zone), it will return FALSE.
/// \~english @par Detail
///        check wheather the FRAMEWORKUNIFIEDLOG ZONE is set by your application process.\n
///        zone parameter first 4bit(0 to 15)is the index of zone mask array\n
///        second 5bit(0 to 31) is showing bit position of mask(9bit,511 for the most)\n
///        True will be returned when bit for zone mask is set as 1
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////
BOOL NsLogIsZoneSet(UI_32 set_zone);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogGetControlMask
/// \~english @par Brief
///        Get the control word that you currently have set.
/// \~english @param [out] p_Zonemask_i
///        TFrameworkunifiedZoneMask - current mask value.
/// \~english @par
///        TFrameworkunifiedZoneMask Array
/// \~english @code
///                 typedef TFrameworkunifiedZone TFrameworkunifiedZoneMask[ZONE_MASK_ARRAY_ELTS];
///            @endcode
/// \~english @par
///        TFrameworkunifiedZone typedef
/// \~english @code
///                 UI_32 TFrameworkunifiedZone;  // 32bit
///            @endcode
/// \~english @retval none
///        void - there is no return.
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - none
/// \~english @par Conditions of processing failure
///        - If p_Zonemask_i is NULL, no operation is performed.
/// \~english @par Detail
///        Get all 16 zone mask.
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        NsLogSetControlMask
////////////////////////////////////////////////////////////////////////////////////////////
void NsLogGetControlMask(TFrameworkunifiedZoneMask p_Zonemask_i);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogSetLogMethod
/// \~english @par Brief
///        Sets the logging place, LPRINT, LSHAREDMEM or any combination of these.
///        If this is never called the default is LSHAREDMEM.
/// \~english @param [in] p_eMethod_i
///        UI_8 - Where you would like to log your data.
/// \~english @par
///        NS_LoggingMethod_t Enum
/// \~english @code
///           typedef enum _NS_LOGGER_METHODS {
///             LPRINT      = 0x01,        // Print to the console(similar to printf)
///             LMSGQ       = 0x02,        // Disabled
///             LSLOGGER    = 0x04,        // Disabled
///             LSHAREDMEM  = 0x08         // Output to shared memory. this is the default logging method.
///            } NS_LoggingMethod_t;
///            @endcode
/// \~english @retval none
///        void - there is no return.
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        -switch the out-put place for NsLog API
/// \~english @par Conditions of processing failure
///        - none
/// \~english @par Detail
///         Sets the logging place, LPRINT, LSHAREDMEM or any combination of these.
///        If this is never called the default is LSHAREDMEM.
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        NsLogGetLogMethod
////////////////////////////////////////////////////////////////////////////////////////////
void NsLogSetLogMethod(UI_8 p_eMethod_i);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogGetLogMethod
/// \~english @par Brief
///        Get the logging method.
/// \~english @param None
/// \~english @retval - return the way you log your data.
///        UI_8 - Log data type(NS_LoggingMethod_t Enum).
/// \~english @par
///        NS_LoggingMethod_t Enum
/// \~english @code
///           typedef enum _NS_LOGGER_METHODS {
///             LPRINT      = 0x01,        // Print to the console(similar to printf)
///             LMSGQ       = 0x02,        // Disabled
///             LSLOGGER    = 0x04,        // Disabled
///             LSHAREDMEM  = 0x08         // Output to shared memory. this is the default logging method.
///            } NS_LoggingMethod_t;
///            @endcode
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - The internal state is not changed.
/// \~english @par Conditions of processing failure
///        - none
/// \~english @par Detail
///        Invoke callback function to get the logging method.\n
///        If callback function is null and expectedCalls is '0',
///        using default SetSeparator function to get the logging method. \n
/// \~english @par Classification
///        Public
/// \~english @par Type
///        Sync only
/// \~english @see
///        NsLogSetLogMethod
////////////////////////////////////////////////////////////////////////////////////////////
UI_8 NsLogGetLogMethod(void);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogInitialize
/// \~english @par Brief
///        Initialize the log level and real-time log out-put setting
/// \~english @retval none
///        void - there is no return.
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - none
/// \~english @par Conditions of processing failure
///        if the getting process of FRAMEWORKUNIFIEDLOG CONFIG file data is failed
/// \~english @par Detail
///        Initialize the log level and real-time log out-put setting
///        if the getting process of FRAMEWORKUNIFIEDLOG CONFIG file data is failed,log
///        level and real-time log out-put setting will not be initialized
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////
void NsLogInitialize(void);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogSetFrameworkunifiedLogFlag
/// \~english @par Brief
///           set LogLevel of FRAMEWORKUNIFIEDLOG flag
/// \~english @param [in] flag_id
///        UI_8 - index for FRAMEWORKUNIFIEDLOG flag(0 to FLAG_LIST(declared in FRAMEWORKUNIFIEDLOG CONFIG file)
/// \~english @param [in] mode
///        UI_8 - LogLevel
/// \~english @par
///        avaliable LogLevel
///          - FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE
///          - FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG
/// \~english @retval none
///        void - there is no return.
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - none
/// \~english @par Conditions of processing failure
///     in the following conditions FRAMEWORKUNIFIEDLOG flag will not be set
///        - mode  is not FRAMEWORKUNIFIEDLOG_FLAG_MODE_RELEASE, FRAMEWORKUNIFIEDLOG_FLAG_MODE_DEBUG
///        - the getting process of FRAMEWORKUNIFIEDLOG CONFIG file is failed(ns_logger_frameworkunifiedlog_xxx.cfg)
///        - flag_id is not declared in FRAMEWORKUNIFIEDLOG CONFIG file
/// \~english @par Detail
///        set loglevel for specific FRAMEWORKUNIFIEDLOG flag
/// \~english @par Classification
///        Public
/// \~english @par Type
///        Sync only
/// \~english @see
///        NsLogGetFrameworkunifiedLogFlag
////////////////////////////////////////////////////////////////////////////////////////////
void NsLogSetFrameworkunifiedLogFlag(UI_8 flag_id, UI_8 mode);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogGetFrameworkunifiedLogFlag
/// \~english @par Brief
///           get LogLevel of FRAMEWORKUNIFIEDLOG flag
/// \~english @param [in] flag_id
///        UI_8 -  index for FRAMEWORKUNIFIEDLOG flag(0 to FLAG_LIST(declared in FRAMEWORKUNIFIEDLOG CONFIG file)
/// \~english @param [out]mode
///        UI_8 - LogLevel value
/// \return none
///        void - there is no return.
/// \~english @retval eFrameworkunifiedStatusOK   Success
/// \~english @retval eFrameworkunifiedStatusFail any sort of error occurred
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - none
/// \~english @par Conditions of processing failure
///        -parameter mode is NULL[eFrameworkunifiedStatusFail]
///        -flag_id is not declared in FRAMEWORKUNIFIEDLOG CONFIG file [eFrameworkunifiedStatusFail]
/// \~english @par Detail
///        get FRAMEWORKUNIFIEDLOG flage for specific flag_id
/// \~english @par Classification
///        Public
/// \~english @par Type
///        Sync only
/// \~english @see
///        NsLogSetFrameworkunifiedLogFlag
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus NsLogGetFrameworkunifiedLogFlag(UI_8 flag_id, UI_8 *mode);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogSetRealtimeLog
/// \~english @par Brief
///            real-time log output setting
/// \~english @param [in] mode
///        UI_8 - set mode for Real time log
/// \~english @par
///        available setting for real-time log output
///        default value is REALTIME_LOG in FRAMEWORKUNIFIEDLOG CFG file
///        (FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF when FRAMEWORKUNIFIEDLOG CFG file get failed)
/// \~english @code
///                 #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_UART        1     // : UARTOUT
///                 #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB         2     // : USB OUT
///                 #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE 0x82  // : USB OFF
///                 #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER       3     // : Ether OUT
///                 #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF         0     // : ALL OFF
///                 #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE      0xFF  // : FREEZE
///            @endcode
/// \~english @retval none
///        void - there is no return
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - none
/// \~english @par Conditions of processing failure
///        -mode is not in FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_XXX above
/// \~english @par Detail
///        set the real-time log output using the setting value.\n
///        need to reboot during ROM start in order to switch to Ethernet output\n
///        /nv/BS/ns/framework_unified/rwdata/frameworkunifiedlog.ether file will be generated
///        when mode FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER /nv/BS/ns/framework_unified/rwdata/frameworkunifiedlog.ether\n
///        and /nv/BS/ns/framework_unified/rwdata/frameworkunifiedlog.ether file will be delated when mode is not FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER
/// \~english @par Classification
///        Public
/// \~english @par Type
///        Sync only
/// \~english @see
///        NsLogGetRealtimeLog
////////////////////////////////////////////////////////////////////////////////////////////
void NsLogSetRealtimeLog(UI_8 mode);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogGetRealtimeLog
/// \~english @par Brief
///        get the setting of real-time log output
/// \~english @param [out] mode
///        UI_8 * -the setting of real-time log output
/// \~english @par
///        available settings of real-time log output
///        default value is REALTIME_LOG in FRAMEWORKUNIFIEDLOG CFG file
///        (FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF when FRAMEWORKUNIFIEDLOG CFG file get failed)
/// \~english @code
///                 #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_UART        1     // : UARTOUT
///                 #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB         2     // : USB OUT
///                 #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_USB_DISABLE 0x82  // : USB OFF
///                 #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_ETHER       3     // : Ether OUT
///                 #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF         0     // : ALL OFF
///                 #define FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_FREEZE      0xFF  // : FREEZE
///            @endcode
/// \~english @retval none
///        void - there is no return
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - none
/// \~english @par Conditions of processing failure
///        - cannot get when mode is NULL
///        -FRAMEWORKUNIFIEDLOG_REALTIMELOG_MODE_OFF will be returned when the approach
///        of FRAMEWORKUNIFIEDLOG CONFIG file (ns_logger_frameworkunifiedlog_xxx.cfg)is failed
/// \~english @par Detail
///        get the setting of real-time log output
/// \~english @par Classification
///        Public
/// \~english @par Type
///        Sync only
/// \~english @see
///        NsLogSetRealtimeLog
////////////////////////////////////////////////////////////////////////////////////////////
void NsLogGetRealtimeLog(UI_8 *mode);

// Deprecated API: Not use.
////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogSetSeverity
/// \~english @par Brief
///        Set log severity level
/// \~english @param [in] p_eLogSeverity_i
///        TFrameworkunifiedLoggerSeverity - Log severity
/// \~english @par
///        TFrameworkunifiedLoggerSeverity Enum
/// \~english @code
///           typedef enum _TFrameworkunifiedLoggerSeverity {
///             FRAMEWORKUNIFIED_SEVERITY_LOW  = 0x0,  /// <all enable(default)
///             FRAMEWORKUNIFIED_SEVERITY_DEBUG2,    /// <enable FRAMEWORKUNIFIEDLOG_DEBUG() and FRAMEWORKUNIFIEDLOG_DEBUG2() and all the follows
///             FRAMEWORKUNIFIED_SEVERITY_DEBUG1,    /// <enable FRAMEWORKUNIFIEDLOG_DEBUG1() and all the follows
///             FRAMEWORKUNIFIED_SEVERITY_INFO,      /// <enable FRAMEWORKUNIFIEDLOG_INFO() and all the follows
///             FRAMEWORKUNIFIED_SEVERITY_WARN,      /// <enable FRAMEWORKUNIFIEDLOG_WARN() and all the follows
///             FRAMEWORKUNIFIED_SEVERITY_ERROR,     /// <enable FRAMEWORKUNIFIEDLOG_ERROR() and all the follows
///             FRAMEWORKUNIFIED_SEVERITY_FATAL,     /// <enable FRAMEWORKUNIFIEDLOG_FATAL() and FRAMEWORKUNIFIEDLOG_ALWAYS()
///             FRAMEWORKUNIFIED_SEVERITY_ALWAYS     /// <enable FRAMEWORKUNIFIEDLOG_ALWAYS()
///            } TFrameworkunifiedLoggerSeverity;
///            @endcode
/// \~english @retval none
///        void - there is no return.
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - The internal state is not changed.
/// \~english @par Conditions of processing failure
///       - Function pointer specified by the argument is NULL.
///       - It is an incorrect value(p_eLogSeverity_i).
/// \~english @par Detail
///        Invoke callback function to set log severity.\n
///        If callback function is null and expectedCalls is '0', using default function to set log severity.
/// \~english @par Classification
///        Public
/// \~english @par Type
///        Sync only
/// \~english @see
///        NsLogGetSeverity
////////////////////////////////////////////////////////////////////////////////////////////
void NsLogSetSeverity(TFrameworkunifiedLoggerSeverity p_eLogSeverity_i);

// Deprecated API: Not use.
////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogGetSeverity
/// \~english @par Brief
///        Get the log severity.
/// \~english @param none
/// \~english @retval Log Severity
///        TFrameworkunifiedLoggerSeverity - Log severity.
/// \~english @par
///        TFrameworkunifiedLoggerSeverity Enum
/// \~english @code
///           typedef enum _TFrameworkunifiedLoggerSeverity {
///             FRAMEWORKUNIFIED_SEVERITY_LOW  = 0x0,  /// <all enable(default)
///             FRAMEWORKUNIFIED_SEVERITY_DEBUG2,    /// <enable FRAMEWORKUNIFIEDLOG_DEBUG() and FRAMEWORKUNIFIEDLOG_DEBUG2() and all the follows
///             FRAMEWORKUNIFIED_SEVERITY_DEBUG1,    /// <enable FRAMEWORKUNIFIEDLOG_DEBUG1() and all the follows
///             FRAMEWORKUNIFIED_SEVERITY_INFO,      /// <enable FRAMEWORKUNIFIEDLOG_INFO() and all the follows
///             FRAMEWORKUNIFIED_SEVERITY_WARN,      /// <enable FRAMEWORKUNIFIEDLOG_WARN() and all the follows
///             FRAMEWORKUNIFIED_SEVERITY_ERROR,     /// <enable FRAMEWORKUNIFIEDLOG_ERROR() and all the follows
///             FRAMEWORKUNIFIED_SEVERITY_FATAL,     /// <enable FRAMEWORKUNIFIEDLOG_FATAL() and FRAMEWORKUNIFIEDLOG_ALWAYS()
///             FRAMEWORKUNIFIED_SEVERITY_ALWAYS     /// <enable FRAMEWORKUNIFIEDLOG_ALWAYS()
///            } TFrameworkunifiedLoggerSeverity;
///            @endcode
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - The internal state is not changed.
/// \~english @par Conditions of processing failure
///        none
/// \~english @par Detail
///        Invoke callback function to get log severity.\n
///        If callback function is null and expectedCalls is '0', using default function to get log severity.
/// \~english @par Classification
///        Public
/// \~english @par Type
///        Sync only
/// \~english @see
///        NsLogSetSeverity
////////////////////////////////////////////////////////////////////////////////////////////
TFrameworkunifiedLoggerSeverity NsLogGetSeverity(void);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLog_EvtCnt
/// \~english @par Brief
///        Event and count logger.
/// \~english @param [in] @param [in] Cnt_Id
///        UI_16 - ID of counter from comm layer
/// \~english @param [in] Evt_Id
///        UI_16 - ID of Event from comm layer
/// \~english @param [in] n
///        UI_8 - number of variable arguments inputted
/// \~english @param [in] arg list
///        ... - Data arguments(option)
/// \~english @retval none
///        void - there is no return.
/// \~english @par Prerequisite
///        none
/// \~english @par Change of internal state
///       - The internal state is not changed.
/// \~english @par Conditions of processing failure
///       - Function pointer specified by the argument is NULL.
///       - It is an incorrect value(Cnt_Id).
///       - It is an incorrect value(Evt_Id).
///       - It is an incorrect value(n).
/// \~english @par Detail
///        Invoke callback function with argument 'Cnt_Id', 'Evt_Id', 'n' to log.\n
///        If callback function is null and expectedCalls is '0', using default SetSeparator function to log. \n
///        In other situation, match and log 'Cnt_Id', 'Evt_Id', 'n'.
/// \~english @par Classification
///        Public
/// \~english @par Type
///        Sync only
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////
// Deprecated API: Not use.
void NsLog_EvtCnt(      // Line number where message was generated
  UI_16 Cnt_Id,
  UI_16 Evt_Id, UI_8 n,
  ...);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLog_Evt
/// \~english @par Brief
///        Event logger mechanism.(Send data to SS event logger Queue)
/// \~english @param [in] Evt_Id
///        UI_16 - ID of Event from comm layer
/// \~english @param [in] nu
///        UI_8 - number of variable arguments inputted
/// \~english @param [in] ...
///        ... - Data arguments
/// \~english @retval none
///        void - there is no return.
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - none
/// \~english @par Conditions of processing failure
///        - process nothing when Evt_id is in [0 to 0xFF]
///        - process nothing when nu is not 1 or 4
/// \~english @par Detail
///        -send the log event queue to SS(logger mechanism Event)
/// \~english @par Classification
///        Public
/// \~english @par Type
///        Fire and Forget
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////
// Deprecated API: Not use.
void NsLog_Evt(UI_16 Evt_Id, UI_8 nu, ...);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLog_Cnt
/// \~english @par Brief
///        Counter logger mechanism.(Send data to SS event logger Queue)
/// \~english @param [in] Cnt_Id
///        UI_16 - ID of Counter from comm layer
/// \~english @param [in] nu
///        UI_8 - number of variable arguments inputted
/// \~english @param [in] ...
///        ... - Data arguments
/// \~english @retval none
///        void - there is no return.
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - none
/// \~english @par Conditions of processing failure
///        - process nothing when Cnt_Id is 0
///        - process nothing when nu is not 0 or 1
/// \~english @par Detail
///        send the log event queue to SS(logger mechanism counter)
/// \~english @par Classification
///        Public
/// \~english @par Type
///        Fire and Forget
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////
// Deprecated API: Not use.
void NsLog_Cnt(UI_16 Cnt_Id, UI_8 nu, ...);  // Not to use.

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogDetermineLogMethod
/// \~english @par Brief
///        Determines the control log method based on the string passed.
///        If the string passed doesn't match any of the key words:
///        slogger or msgr or console the method will return a value of
///        zero. This string may be in the form of the following:
///        "msgq|console" would cause the output to go to both the NSLog
///        message queue and the console.
/// \~english @param [in] output_type
///        PCSTR - The key words:
/// \~english @retval 1 ... 0xF Success
/// \~english @retval 0 the string passed doesn't match any of the key words
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - none
/// \~english @par Conditions of processing failure
///        the string passed doesn't match any of the key words
/// \~english @par Detail
///        mask value retruned from application can be used as parameter in NsLogSetLogMethod()
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////
UI_8 NsLogDetermineLogMethod(PCSTR output_type);

// Unused API.
// VOID NsLogEnableRcsLogging(BOOL f_bRCSEnableLogging);

// Private API.
////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogGetZoneTextList
/// \~english @par Brief
///        Get the zone data list.
/// \~english @param [out] f_cZoneList
///        CHAR [][ZONE_TEXT_SIZE] - zone text list(0 ... 511)
/// \~english @par
///        PUI_32 - Pointer to preallocated array of CHAR cZones[USER_ZONES_COUNT][ZONE_TEXT_SIZE];
/// \~english @retval none
///        VOID - There is no return
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - The internal state is not changed.
/// \~english @par Conditions of processing failure
///       - Function pointer specified by the argument is NULL.
///       - It is an incorrect value(f_cZoneList) or f_cZoneList is empty.
///       - Some error occur when get value from f_cZoneList
/// \~english @par Detail
///        Invoke callback function to get zone text list.\n
///        If callback function is null and expectedCalls is '0', using default function to get zone text list.
/// \~english @par Classification
///        Public
/// \~english @par Type
///        Sync only
/// \~english @see
///        NsLogSetZones
////////////////////////////////////////////////////////////////////////////////////////////
VOID NsLogGetZoneTextList(CHAR f_cZoneList[][ZONE_TEXT_SIZE]);

/////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogSetZones
/// \~english @par Brief
///            set FRAMEWORKUNIFIEDLOG ZONE
/// \~english @param [in] f_uiZoneCount
///        UI_32   - number of zone
/// \~english @param [in] ...
///        arg_list     - zone list (0 ... 511)
/// \~english @retval none
///        void - there is no return.
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///        - none
/// \~english @par Conditions of processing failure
///        - zone value will not over 512
/// \~english @par Detail
///        set the specific bit to existed zone mask\n
///        first 4bit(0 to 15) in zone is the index of zone mask array\n
///        second 5bit(0 to 31)set the 9bit which shows the bit position of mask(blew 511)\n
///        eg:in the case of setting three zones=31,30,29, function should be called like NsLogSetZones(3,31,30,29) \n
///        operation may not be right when parameter shows in arg_list differs with array num in f_uiZoneCount
///
/// \~english @par Classification
///        Public
/// \~english @par Type
///        Set Get
/// \~english @see
///        none
/////////////////////////////////////////////////////////////////////////////////////
void NsLogSetZones(UI_32 f_uiZoneCount, ...);

/////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsLogParseZones
/// \~english @par Brief
///        Parse the FRAMEWORKUNIFIEDLOG ZONE.
/// \~english @param [out] p_FrameworkunifiedLogParams
///        FRAMEWORKUNIFIEDLOGPARAM * - Input/output FRAMEWORKUNIFIEDLOG parameter
/// \~english @param [in] f_uiZoneCount
///        UI_32   - Zone setting
/// \~english @param [in] ...
///        arg_list     - Zone lists (zone values are 0 to 511)
/// \~english @par
///        FRAMEWORKUNIFIEDLOGPARAM structures
/// \~english @code
/// typedef struct _FRAMEWORKUNIFIEDLOGPARAM {
///    UI_8         uiLogOptions;                             // Log output location (ref NS_LoggingMethod_t)
///    CHAR         cZones[USER_ZONES_COUNT][ZONE_TEXT_SIZE];  // ZONE_TEXT_10 ... ZONE_TEXT_n
///    TFrameworkunifiedZoneMask uiZoneMask;                               // ZONEMASK(10)...ZONEMASK(n) (ref TFrameworkunifiedZone)
///    TFrameworkunifiedLoggerSeverity eSeverity;                          // Logging level (ref TFrameworkunifiedLoggerSeverity)
/// } FRAMEWORKUNIFIEDLOGPARAM, *LPFRAMEWORKUNIFIEDLOGPARAM;
///            @endcode
/// \~english @retval none
/// \~english @par Prerequisite
///       - none
/// \~english @par Change of internal state
///       - The internal state is not changed.
/// \~english @par Conditions of processing failure
///       - none
/// \~english @par Detail
///         In the FRAMEWORKUNIFIEDLOG parameter (p_FrameworkunifiedLogParams) specified in the arguments,\n
///         add (or) all masked values of the zone lists specified by the arguments.
/// \~english @par Classification
///          Public
/// \~english @see
///          none
/////////////////////////////////////////////////////////////////////////////////////
void NsLogParseZones(FRAMEWORKUNIFIEDLOGPARAM *p_FrameworkunifiedLogParams, UI_32 f_uiZoneCount, ...);

// Unused API.
// VOID NsRcsSendTraceData(PCHAR f_pData, UI_32 f_len);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NSLogGetFrameworkunifiedlogFileTotalNum
/// \~english @par Brief
///        get total number of log file
/// \~english @retval num
///        UI_32 - Total numger of frameworkunifiedlog files.
/// \~english @par Prerequisite
///        set log file using NsLogSetFrameworkunifiedLogParams
/// \~english @par Change of internal state
///        - none
/// \~english @par Conditions of processing failure
///        - none
/// \~english @par Detail
///        get total number of log file
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////
UI_32 NSLogGetFrameworkunifiedlogFileTotalNum(void);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NSLogGetFrameworkunifiedlogFileName
/// \~english @par Brief
///        get the name of log file
/// \~english @param [in] index
///        UI_32 - Index of a list of frameworkunifiedlog file names.(0 to  NSLogGetFrameworkunifiedlogFileTotalNum()-1)
/// \~english @retval file name -file with specific index is exsisted
/// \~english @retval NULL -file with specific index is not exsisted
/// \~english @par Prerequisite
///          set log file using NsLogSetFrameworkunifiedLogParams
/// \~english @par Change of internal state
///          - none
/// \~english @par Conditions of processing failure
///          file with specific index is not exsisted
/// \~english @par Detail
///         get the file name with specific index is not exsisted
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No macth
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////
PCSTR NSLogGetFrameworkunifiedlogFileName(UI_32 index);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NSLogGetFrameworkunifiedlogFileName
/// \~english @par Brief
///          get index of log file
/// \~english @param [in] filename
///        PCSTR - Name of frameworkunifiedlog file.
/// \~english @retval 0 log file specific logfile is not exsisted
/// \~english @retval index of log file specific logfile is exsisted
/// \~english @par Prerequisite
///             set log file using NsLogSetFrameworkunifiedLogParams
/// \~english @par Change of internal state
///            - none
/// \~english @par Conditions of processing failure
///           process nothing when file name is NULL
///           process nothing when file name is not exsisted
/// \~english @par Detail
///           get index of log file
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////
int NSLogGetFrameworkunifiedlogIndex(PCSTR filename);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup NsForceClose
/// \~english @par Brief
///        clear log forcely.
/// \~english @retval none
///        return void
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///       - none
/// \~english @par Conditions of processing failure
///       - none
/// \~english @par Detail
///       -clear log forcely.
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////
VOID NsForceClose(void);

#ifdef __cplusplus
}
#endif


///////////////////////////////////////////////////////////////////////////////
/// \ingroup  tag_NSLogger
/// \brief    extern FRAMEWORKUNIFIEDLOG parameter
///////////////////////////////////////////////////////////////////////////////
/// Global variable that's used by the Native Services Logger.
/// An application will setup this variable in their main,
/// values are user defined and provide user control of what
/// should and shouldn't get logged.
/// \code
/// FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams =
/// {
///   FRAMEWORKUNIFIEDLOGOPTIONS,
///     {
///       ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
///       ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
///       ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
///       ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
///       ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
///       ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
///     ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
///     ZONE_TEXT_31, ZONE_TEXT_32, ZONE_TEXT_33,
///     ZONE_TEXT_34, ZONE_TEXT_35, ZONE_TEXT_36,
///     ZONE_TEXT_37, ZONE_TEXT_38, ZONE_TEXT_39,
///     ZONE_TEXT_40, ZONE_TEXT_41, ZONE_TEXT_42,
///     ZONE_TEXT_43, ZONE_TEXT_44, ZONE_TEXT_45,
///     ZONE_TEXT_46, ZONE_TEXT_47, ZONE_TEXT_48,
///     ZONE_TEXT_49, ZONE_TEXT_50, ZONE_TEXT_51,
///     ZONE_TEXT_52, ZONE_TEXT_53, ZONE_TEXT_54,
///     ZONE_TEXT_55
///     },
///     FRAMEWORKUNIFIEDLOGZONES
/// };
/// \endcode
///

/// if FRAMEWORKUNIFIEDLOGZONES not defined in makefile
#ifndef FRAMEWORKUNIFIEDLOGZONES
///////////////////////////////////////////////////////////////////////////////
/// \ingroup  tag_NSLogger
/// \brief    g_FrameworkunifiedLogParams
/// if FRAMEWORKUNIFIEDLOGZONES not defined in makefile
///////////////////////////////////////////////////////////////////////////////
#define FRAMEWORKUNIFIEDLOGZONES {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

///////////////////////////////////////////////////////////////////////////////
/// \ingroup  FRAMEWORKUNIFIED_SET_ZONES
/// \~english @par Brief
///        This macro API register FRAMEWORKUNIFIEDLOGAPPZONES.
/// \~english @retval none
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///       - The internal state is not changed.
/// \~english @par Conditions of processing failure
///        - none
/// \~english @par Detail
///        in main() function use macro FRAMEWORKUNIFIED_SET_ZONES() before FrameworkunifiedDispatcher()
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        NsLogSetFrameworkunifiedLogParams
///////////////////////////////////////////////////////////////////////////////
#define FRAMEWORKUNIFIED_SET_ZONES() {UI_32 LogArr[] = {FRAMEWORKUNIFIEDLOGAPPZONES}; \
               NsLogParseZones(&g_FrameworkunifiedLogParams, (UI_32)_countof(LogArr), FRAMEWORKUNIFIEDLOGAPPZONES); \
               NsLogSetFrameworkunifiedLogParams(&g_FrameworkunifiedLogParams);}
#else
#warning "Zones defined by FRAMEWORKUNIFIEDLOGAPPZONES are overridden by FRAMEWORKUNIFIEDLOGZONES"
#define FRAMEWORKUNIFIED_SET_ZONES() NsLogSetFrameworkunifiedLogParams(&g_FrameworkunifiedLogParams)
#endif

#define ZONE_END UINT_MAX
// Unused API
// #define CHECK_SEVERITY_LEVEL(sev_level) ((sev_level) >= NsLogGetSeverity())
// If value of BITS_IN_TZONE changes in future then need to consider changes in the values 5 and 0x1F in below macros
// here 5 represents (sizeof(TFrameworkunifiedZone)+1) and 0x1F represents (BITS_IN_TZONE-1)
#define GET_ZONE_INDEX(zone) (((UI_32)zone) >> 5)
#define GET_ZONE_BIT_MASK(zone) ((TFrameworkunifiedZone)(1U << (((UI_32)zone) & 0x1F)))

///////////////////////////////////////////////////////////////////////////////
/// \ingroup  ZONEMASK
/// \~english @par Brief
///       the Macro for zone index mask
/// \~english @param [in] n
///        zone index
/// \~english @retval num
///        UI_32 - zone index
/// \~english @par Prerequisite
///         - none
/// \~english @par Change of internal state
///          - none
/// \~english @par Conditions of processing failure
///          - none
/// \~english @par Detail
///           mask the zone index
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        none
////////////////////////////////////////////////////////////////////////////////////////////////
#define ZONEMASK( n ) ((TFrameworkunifiedZone)( n ))

///////////////////////////////////////////////////////////////////////////////
/// \ingroup  IS_ZONE_SET
/// \~english @par Brief
///        check wheather the FRAMEWORKUNIFIEDLOG ZONE is set by your application process.
/// \~english @param [in] set_zone
///         UI_32 - checking zone_index
/// \~english @retval TRUE  zone is enable
/// \~english @retval FALSE zone is disable
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///       - The internal state is not changed.
/// \~english @par Conditions of processing failure
///        - none
/// \~english @par Detail
///        Checks if the FRAMEWORKUNIFIEDLOG ZONE can be configured by Application processes.
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        NsLogIsZoneSet
////////////////////////////////////////////////////////////////////////////////////////////////
#define IS_ZONE_SET(set_zone) (NsLogIsZoneSet(set_zone) == TRUE)

///////////////////////////////////////////////////////////////////////////////
/// \ingroup  FRAMEWORKUNIFIEDLOG
/// \~english @par Brief
///        Developers should use the FRAMEWORKUNIFIEDLOG for logging.
/// \~english @param [in] zone
///         Defined zone in a process (e.g. ZONE_FUNC)
/// \~english @param [in] funcname
///         Name of the class or method where the log was written (e.g. "main")
/// \~english @param [in] print_fmt
///          string similar to that of a printf statement
/// \~english @param [in] args
///          Data arguments(option)
/// \~english @retval none
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///       - The internal state is not changed.
/// \~english @par Conditions of processing failure
///        - If print_fmt is NULL, no operation is performed.
/// \~english @par Detail
///        FRAMEWORKUNIFIEDLOG is simple macro to make it easy to log messages from any point in your code.
///        This macro has smarts that does fast checks to determine if your log should or shouldn't be printed.
/// \~english @par Classification
///        Public
/// \~english @par Type
///        No match
/// \~english @see
///        ZONEMASK, IS_ZONE_SET, NsLog, NsLog0
///////////////////////////////////////////////////////////////////////////////
#ifndef _FRAMEWORKUNIFIEDLOG_ZONE_FUNC_ENABLE_
#define FRAMEWORKUNIFIEDLOG(zone, funcname, print_fmt, args...)\
  (zone != ZONEMASK(11))?((IS_ZONE_SET(zone))?TEXT_ZONE(zone, funcname, print_fmt, ## args):((void)0)):((void)(0))
#else  // _FRAMEWORKUNIFIEDLOG_ZONE_FUNC_ENABLE_
#define FRAMEWORKUNIFIEDLOG(zone, funcname, print_fmt, args...)\
  ((IS_ZONE_SET(zone)) ? TEXT_ZONE(zone, funcname, print_fmt, ## args) : ((void)0))
#endif  // _FRAMEWORKUNIFIEDLOG_ZONE_FUNC_ENABLE_

///////////////////////////////////////////////////////////////////////////////
/// \ingroup  tag_NSLogger
/// \~english @par Brief
///      This is the log output macro for clock display in milliseconds.
/// \~english @param [in] zone
///      Zone indexes to be checked
/// \~english @param [in] str
///      Log output string
/// \~english @retval none
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///       - The internal state is not changed.
/// \~english @par Conditions of processing failure
///        - none
/// \~english @par Detail
///     A simple macro for logging messages in milliseconds from any point in the source code.\n
///     The log is output in the following format. "Hours:Minutes:Seconds.Milliseconds/=log-output-string"
/// \~english @par Classification
///      Public
/// \~english @see
///      IS_ZONE_SET
///
////////////////////////////////////////////////////////////////////////////////////////////////
#define FRAMEWORKUNIFIEDLOG_TIME(zone, str)\
  ((IS_ZONE_SET(zone))?NsLogTime(zone, str):((void)(0)))

///////////////////////////////////////////////////////////////////////////////
/// \ingroup  tag_NSLogger
/// \~english @par Brief
///      This is a simplified version of the log output macro.
/// \~english @param [in] zone
///      Zone indexes to be checked
/// \~english @param [in] data
///      Log output data
/// \~english @param [in] size
///      Size of the log output data
/// \~english @retval none
/// \~english @par Prerequisite
///        - none
/// \~english @par Change of internal state
///       - The internal state is not changed.
/// \~english @par Conditions of processing failure
///        - none
/// \~english @par Detail
///     A simple macro for logging messages from any point in the source code.\n
///     \ref The macro FRAMEWORKUNIFIEDLOG can specify variable argument lists for log output data,
///     but the macro is a macro that specifies only data character strings.
/// \~english @par Classification
///      Public
/// \~english @see
///      IS_ZONE_SET, NsLogData
///
////////////////////////////////////////////////////////////////////////////////////////////////
#define FRAMEWORKUNIFIEDLOG_DATA(zone, data, size)\
  ((IS_ZONE_SET(zone))?NsLogData(zone, data, size):((void)(0)))

///////////////////////////////////////////////////////////////////////////////
/// \ingroup  tag_NSLogger
/// \brief    FRAMEWORKUNIFIEDLOG_EVTCNT
///////////////////////////////////////////////////////////////////////////////
/// Deprecated API. Not use.
#define FRAMEWORKUNIFIEDLOG_EVTCNT(zone, CntId, EvtId, n...) NsLog_EvtCnt(CntId, EvtId, ##n)

///////////////////////////////////////////////////////////////////////////////
/// \ingroup  tag_NSLogger
/// \brief    FRAMEWORKUNIFIEDLOG_EVT
///////////////////////////////////////////////////////////////////////////////
/// Event logger mechanism.(Send data to SS event logger Queue)
/// \note  The ZONE is not used.
///
/// \param [in] zone
///         Defined zone in a process (e.g. ZONE_FUNC)
/// \param [in] EvtId
///         UI_16 - ID of Event from comm layer
/// \param [in] n
///         UI_8 - number of variable arguments inputted
///////////////////////////////////////////////////////////////////////////////
/// Deprecated API. Not use.
#define FRAMEWORKUNIFIEDLOG_EVT(zone, EvtId, n...) NsLog_Evt(EvtId, ##n)

///////////////////////////////////////////////////////////////////////////////
/// \ingroup  tag_NSLogger
/// \brief    FRAMEWORKUNIFIEDLOG_CNT
///////////////////////////////////////////////////////////////////////////////
/// Counter logger mechanism.(Send data to SS event logger Queue)
/// \note  The ZONE is not used.
///
/// \param [in] zone
///         Defined zone in a process (e.g. ZONE_FUNC)
/// \param [in] CntId
///         UI_16 - ID of Event from comm layer
/// \param [in] n
///         UI_8 - number of variable arguments inputted
////////////////////////////////////////////////////////////////////////////////////////////
/// Deprecated API. Not use.
#define FRAMEWORKUNIFIEDLOG_CNT(zone, CntId, n...) NsLog_Cnt(CntId, ##n)  // Not to use

/// Deprecated API. Not use.
#define TEXT(funcname, args...) TEXT_ZONE(BITS_IN_ZONE_MASK, funcname, ## args)

// Unused API
// #define TEXT0(funcname, print_fmt ) NsLog(__LINE__, BITS_IN_ZONE_MASK, funcname, print_fmt)

#define GET_MACRO(_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, NAME, ...) NAME
#define NsLogFunc(...)\
  GET_MACRO(__VA_ARGS__, \
      NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
      NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
      NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
      NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
      NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
      NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
      NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, \
      NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog, NsLog0)
#define TEXT_ZONE(zone_index, funcname, ...)\
  NsLogFunc(__VA_ARGS__)(__LINE__, zone_index, funcname, __VA_ARGS__)

/// Deprecated API. Not use.
#define TEXT_EVTCNT(CntId, EvtId, n...) NsLog_EvtCnt(CntId, EvtId, ##n)
/// Deprecated API. Not use
#define TEXT_EVT(EvtID, n...) NsLog_Evt(EvtID, ##n)
/// Deprecated API. Not use.
#define TEXT_CNT(CntId, n...) NsLog_Cnt(CntId, ##n)
/// Used to log data that contains trailing arguments \n
/// Example: FRAMEWORKUNIFIEDLOG0(ZONE_INFO, __FUNCTION__, "testers return value is [%d]!", rtnValue);


/// Deprecated API. Use FRAMEWORKUNIFIEDLOG instead.
#define FRAMEWORKUNIFIEDLOG0 FRAMEWORKUNIFIEDLOG


/// Note: These bits are reserved for Framework logging and debugging
#define ZONE_NS_FUNC    ZONEMASK(0)
#define ZONE_NS_DIS       ZONEMASK(1)
#define ZONE_NS__CWORD77_       ZONEMASK(2)
#define ZONE_NS_IMP_INFO    ZONEMASK(3)
#define ZONE_NS_SM_DEV_INFO ZONEMASK(4)
#define ZONE_NS_SM_USR_INFO ZONEMASK(5)
#define ZONE_NS_INFO    ZONEMASK(6)
#define ZONE_NS_DEBUG_DUMP  ZONEMASK(7)
#define ZONE_NS_WAR         ZONEMASK(8)
#define ZONE_NS_ERR         ZONEMASK(9)
#define ZONE_DEBUG_DUMP   ZONE_NS_DEBUG_DUMP

#define ZONE_TEXT_0 "NS_Func"
#define ZONE_TEXT_1 "NS_Dispatcher"
#define ZONE_TEXT_2 "NS__CWORD77_"
#define ZONE_TEXT_3 "NS_Reserved"
#define ZONE_TEXT_4 "NS_StateMachine_Dev"
#define ZONE_TEXT_5 "NS_StateMachine_Usr"
#define ZONE_TEXT_6 "NS_Info"
#define ZONE_TEXT_7 "NS_Debug_Dump"
#define ZONE_TEXT_8 "NS_Warning"
#define ZONE_TEXT_9 "NS_Error"

////
// Following is old definitions. Only for compile.
// Specific ZONE to use the ns_logger_frameworkunifiedlog.cfg
// If possible, following Specific ZONE difinitions shall be delete.
////
// Special ZONE(64)-(95)
/// Note: These bits are reserved for special ZONE
#define ZONE_PERFORMANCE                  ZONEMASK(64)
#define ZONE_SCREEN_TRANS                 ZONEMASK(65)
#define ZONE_SWDL                         ZONEMASK(66)
#define ZONE_SYSTEMDATA                   ZONEMASK(67)
#define ZONE_LOG_SH                       ZONEMASK(68)
#define ZONE_LOG_SYS                      ZONEMASK(69)
#define ZONE_LOG__CWORD52_                    ZONEMASK(70)
#define ZONE_SECURE                       ZONEMASK(71)
#define ZONE_CAN_FILTER                   ZONEMASK(72)
#define ZONE_COMM_PROCESS                 ZONEMASK(73)
#define ZONE_CONNECT_DEVICE               ZONEMASK(74)
#define ZONE_SP_ZONE_75                   ZONEMASK(75)
#define ZONE_SP_ZONE_76                   ZONEMASK(76)
#define ZONE_SP_ZONE_77                   ZONEMASK(77)
#define ZONE_SP_ZONE_78                   ZONEMASK(78)
#define ZONE_SP_ZONE_79                   ZONEMASK(79)
#define ZONE_SP_ZONE_80                   ZONEMASK(80)
#define ZONE_SP_ZONE_81                   ZONEMASK(81)
#define ZONE_SP_ZONE_82                   ZONEMASK(82)
#define ZONE_SP_ZONE_83                   ZONEMASK(83)
#define ZONE_SP_ZONE_84                   ZONEMASK(84)
#define ZONE_SP_ZONE_85                   ZONEMASK(85)
#define ZONE_SP_ZONE_86                   ZONEMASK(86)
#define ZONE_SP_ZONE_87                   ZONEMASK(87)
#define ZONE_SP_ZONE_88                   ZONEMASK(88)
#define ZONE_SP_ZONE_89                   ZONEMASK(89)
#define ZONE_SP_ZONE_90                   ZONEMASK(90)
#define ZONE_SP_ZONE_91                   ZONEMASK(91)
#define ZONE_SP_ZONE_92                   ZONEMASK(92)
#define ZONE_SP_ZONE_93                   ZONEMASK(93)
#define ZONE_SP_ZONE_94                   ZONEMASK(94)
#define ZONE_SP_ZONE_95                   ZONEMASK(95)

// Special ZONE(96)-(127) (console off)
/// Note: These bits are reserved for special ZONE
#define ZONE_COMM_SYS                     ZONEMASK(96)
#define ZONE_COMM_SH                      ZONEMASK(97)
#define ZONE_COMM_USB                     ZONEMASK(98)
#define ZONE_SP_ZONE_99                   ZONEMASK(99)
#define ZONE_SP_ZONE_100                  ZONEMASK(100)
#define ZONE_SP_ZONE_101                  ZONEMASK(101)
#define ZONE_SP_ZONE_102                  ZONEMASK(102)
#define ZONE_SP_ZONE_103                  ZONEMASK(103)
#define ZONE_SP_ZONE_104                  ZONEMASK(104)
#define ZONE_SP_ZONE_105                  ZONEMASK(105)
#define ZONE_SP_ZONE_106                  ZONEMASK(106)
#define ZONE_SP_ZONE_107                  ZONEMASK(107)
#define ZONE_SP_ZONE_108                  ZONEMASK(108)
#define ZONE_SP_ZONE_109                  ZONEMASK(109)
#define ZONE_SP_ZONE_110                  ZONEMASK(110)
#define ZONE_SP_ZONE_111                  ZONEMASK(111)
#define ZONE_SP_ZONE_112                  ZONEMASK(112)
#define ZONE_SP_ZONE_113                  ZONEMASK(113)
#define ZONE_SP_ZONE_114                  ZONEMASK(114)
#define ZONE_SP_ZONE_115                  ZONEMASK(115)
#define ZONE_SP_ZONE_116                  ZONEMASK(116)
#define ZONE_SP_ZONE_117                  ZONEMASK(117)
#define ZONE_SP_ZONE_118                  ZONEMASK(118)
#define ZONE_SP_ZONE_119                  ZONEMASK(119)
#define ZONE_SP_ZONE_120                  ZONEMASK(120)
#define ZONE_SP_ZONE_121                  ZONEMASK(121)
#define ZONE_SP_ZONE_122                  ZONEMASK(122)
#define ZONE_SP_ZONE_123                  ZONEMASK(123)
#define ZONE_SP_ZONE_124                  ZONEMASK(124)
#define ZONE_SP_ZONE_125                  ZONEMASK(125)
#define ZONE_SP_ZONE_126                  ZONEMASK(126)
#define ZONE_SP_ZONE_127                  ZONEMASK(127)

#endif /* __NATIVESERVICES_LOGGER_H__ */  // NOLINT  (build/header_guard)
/** @}*/
/** @}*/
/** @}*/
/** @}*/