summaryrefslogtreecommitdiffstats
path: root/positioning_base_library/library/include/vehicle_service/WPF_STD.h
blob: 085640ab5925d433ff493d15e1a0e05c822d4474 (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
1647
1648
1649
1650
1651
1652
1653
/*
 * @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.
 */

#ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_WPF_STD_H_
#define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_WPF_STD_H_

/**
 * @file WPF_STD.h
 * @brief Header file for system standard definitions
 */

/** @addtogroup BaseSystem
 *  @{
 */
/** @addtogroup vehicle_service
 *  @ingroup BaseSystem
 *  @{
 */
/** @addtogroup positioning_base_library
 *  @ingroup vehicle_service
 *  @{
 */

/*---------------------------------------------------------------------------------*
 * Incluce                                                                         *
 *---------------------------------------------------------------------------------*/
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <unistd.h>
#include <pthread.h>
#include <wchar.h>
#include <sys/prctl.h>
#include <sys/stat.h>
#include <native_service/wpf_legacy.h>
#include <vehicle_service/std_types.h>
#include <vehicle_service/pos_message_header.h>
#include <vehicle_service/sys_timerapi.h>
#include <vehicle_service/positioning_positioningbaselibrarylog.h>

/*---------------------------------------------------------------------------------*
 * Definition                                                                      *
 *---------------------------------------------------------------------------------*/
#define POS_THREAD_NAME "Positioning"    //!< \~english Positioning thread name

#ifdef  UNICODE
#define __TEXT(quote)     L##quote
#else    /* UNICODE */
#define __TEXT(quote)    (quote)         /* r_winnt */
#endif    /* UNICODE */

#define D_LTEXT(x)  __TEXT(x)
#define LTEXT(x)    D_LTEXT(x)

#define DEBUG_DUMP_MAX_SIZE 4096
//!< \~english FrameworkunifiedOnDebugDump max size

/* Sensor Log Type */
#define POS_SENSLOG_TYPE_NONE 0        //!< \~english sensor log type NONE
#define POS_SENSLOG_TYPE_SYS  1        //!< \~english sensor log type SYS
#define POS_SENSLOG_TYPE_GPS  2        //!< \~english sensor log type GPS
#define POS_SENSLOG_TYPE_NAV  3        //!< \~english sensor log type NAV
#define POS_SENSLOG_TYPE_CMD  4        //!< \~english sensor log type CMD

#define POS_SENSLOG_GET_ZONE(typ) \
    (((typ) == (POS_SENSLOG_TYPE_SYS))?(ZONE_POS_SYS_IN):\
     ((typ) == (POS_SENSLOG_TYPE_GPS))?(ZONE_POS_GPS_IN):\
     ((typ) == (POS_SENSLOG_TYPE_NAV))?(ZONE_POS_NAV_IN):\
     ((typ) == (POS_SENSLOG_TYPE_CMD))?(ZONE_POS_CMD_IN):\
     (0))
//!< \~english get sensor log zone code

#define POS_WRITE_SENSLOG(zone, data, len) (((zone) != (0))?((void)((FRAMEWORKUNIFIEDLOG_DATA(zone, data, len)))):((void)(0)))
//!< \~english write sensor log output
#define POS_SENSLOG(typ, data, len) (POS_WRITE_SENSLOG(POS_SENSLOG_GET_ZONE(typ), data, len))

/* HW configuration type */
/*
 *  Note.
 *  This feature needs to be defined by the vendor.
 */
#define UNIT_TYPE_NONE          0x00000000UL    //!< \~english type none
#define UNIT_TYPE_UNKNOWN       0x00000001UL    //!< \~english type unknown
#define UNIT_TYPE_GRADE1        0x00000002UL    //!< \~english type Grade1
#define UNIT_TYPE_GRADE2        0x00000004UL    //!< \~english type Grade2 

#define MAX_NAME_LEN            32              //!< \~english name max length
#define _CWORD31__NO_SIZE       16              //!< \~english _CWORD31_ No size
#define RESERVE1_SIZE           16              //!< \~english reserve 1
#define HELPNET_ID_SIZE         21              //!< \~english helpnet ID size
#define RESERVE2_SIZE           11              //!< \~english reserve 2
#define DATE_SIZE               32              //!< \~english make time size
#define SERIAL_NO_SIZE          3               //!< \~english serial No size
#define PRODUCT_NAME_SIZE       1               //!< \~english product name size

#define _pb_memcpy                      memcpy
#define _pb_memset                      memset

/*  RET_API define */
#define  RET_NORMAL    0        //!< \~english normal return
#define RET_ERROR   (-1)        //!< \~english error return
#define RET_ERRPARAM  (-2)      //!< \~english parameter error

#define SAPI_EVSET_ABSOLUTE 1   //!< \~english absolute vale set
#define SAPI_EVWAIT_VAL     1   //!< \~english event wait value set

/* sys common commandID definition */
#define    CID_GPS_BASE      (CID)0xF030
//!< \~english GPS

#define    CID_TIMER_BASE    (CID)0xF040
//!< \~english timer management

#define    CID_INITIAL_BASE  (CID)0xF100
//!< \~english initial

/* ResourceManager/CID definition */
#define CID_GPS_SERIAL0   (CID)0x0100
//!< \~english GPS reset request func definition

#define CID_GPS_REQRESET  (CID)(CID_GPS_BASE | CID_GPS_SERIAL0)
//!< \~english GPS reset request CID


/* sys common commandID detail definition */
#define    CID_COM_SERIAL4   (CID)0x0004
//!< \~english serial command ID 4

#define    CID_COM_SERIAL6   (CID)0x0006
//!< \~english serial command ID 6

#define    CID_COM_SERIAL7   (CID)0x0007
//!< \~english serial command ID 7

/* initial CID definition */
#define  CID_INI_SYSTEMERR        (CID)(CID_INITIAL_BASE | CID_COM_SERIAL6)
//!< \~english system abnormality notify

#define CID_INI_INTERNAL_ACCOFF_START  (CID)(CID_INITIAL_BASE | CID_COM_SERIAL7)
//!< \~english internal ACC-OFF start Indication

/* timer control CID definition */
#define  CID_TIMER_TOUT        (CID)(CID_TIMER_BASE | CID_COM_SERIAL4)
//!< \~english timeout notify


/* PNO definition */
#define     PNO_NONE                         0x0000  //!< \~english initial value

#define     PNO__CWORD88___CWORD23_                  0x0100
//!< \~english _CWORD23_ primary thread
#define     PNO_GINI_MAIN                    0x0300
//!< \~english G initial
#define     PNO_CLK_GPS                      0x0316
//!< \~english clock GPS thread
#define     PNO_VEHICLE_SENSOR               0x0363
//!< \~english vehicle sensor thread
#define     PNO_LINE_SENS_DRV                0x0364
//!< \~english line sensor driver thread
#define     PNO_NAVI_GPS_MAIN                0x0440
//!< \~english GPS communication manager thread
#define     PNO_NAVI_GPS_RCV                 0x0441
//!< \~english GPS receive thread
#define     PNO__CWORD83_                          0x0900
//!< \~english _CWORD83_(Intersystem Communication Message)thread

#define     SYS_PNO_MIN                      PNO__CWORD88___CWORD23_
//!< \~english minimum PNO.(normal process)
#define     SYS_PNO_MAX                      PNO__CWORD83_
//!< \~english maximum PNO.(normal process)

/*---------------------------------------------------------------------------------*
 * Typedef declaration                                                             *
 *---------------------------------------------------------------------------------*/
typedef u_int32            EventID;
typedef int32              RET_API;   //!< \~english _CWORD64_API return code
typedef u_int32            event_id;
typedef event_id           SemID;     //!< \~english semaphore ID
typedef u_int16            CID;       //!< \~english command ID

typedef uint32_t           UNIT_TYPE;    //!< \~english unit type data type define
typedef int32              ANA_RET_API;

typedef char               TCHAR;

/**
 * @enum _RcvMsgMode
 * \~english  mode of receive message
 */
typedef enum {
    RM_WAIT,       //!< \~english wait until received message
    RM_CHECKRCV    //!< \~english do not wait message, return
} _RcvMsgMode;

/**
 * @enum
 * \~english definition of event reset mode
 */
enum {
    _CWORD64_EVENT_MANUALRESET_OFF = 0,              //!< \~english manual reset off
    _CWORD64_EVENT_MANUALRESET_ON,                   //!< \~english manual reset on
    _CWORD64_EVENT_MANUALRESET_MAX                   //!< \~english manual reset max value
};


/*---------------------------------------------------------------------------------*
 * Struct declaration                                                              *
 *---------------------------------------------------------------------------------*/
/**
 * @struct _SECURITY_ATTRIBUTES
 * \~english security attribute
 */
typedef struct _SECURITY_ATTRIBUTES {
  DWORD nLength;                         //!< \~english length
  LPVOID lpSecurityDescriptor;           //!< \~english data pointer
  BOOL bInheritHandle;                   //!< \~english inherited handle
} SECURITY_ATTRIBUTES;
typedef SECURITY_ATTRIBUTES *PSECURITY_ATTRIBUTES;   //!< \~english security attribute
typedef SECURITY_ATTRIBUTES *LPSECURITY_ATTRIBUTES;  //!< \~english security attribute

/*---------------------------------------------------------------------------------*
 * Prototype Declaration                                                           *
 *---------------------------------------------------------------------------------*/

#ifdef __cplusplus
extern "C" {
#endif

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Create event by specified name
///
/// \~english @param [in] ucManualReset
///     - u_int8  manual reset mode
/// \~english @param [in] lInitData
///     - int32  event value
/// \~english @param [in] cpEventName
///     - char*  event name
///
/// \~english @par
///     - manual reset mode(ucManualReset)
///       - _CWORD64_EVENT_MANUALRESET_OFF  manual reset OFF
///       - _CWORD64_EVENT_MANUALRESET_ON  manual reset ON
///
/// \~english @retval 0    event create failed
/// \~english @retval not 0 created event ID
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter cpEventName is NULL
///     - The parameter ucManualReset is more than or equal _CWORD64_EVENT_MANUALRESET_MAX
///     - The string of parameter cpEventName has no text
///     - The string length of parameter cpEventName is longer than MAX_EVENT_NAME_LEN
///     - The event is created in same process, but the count of thread reference to the event is reach to the max
///     - The event is created in system, but the count of process reference to the event is reach to the max
///     - Memory allocate failed for creating event table
///     - During create the event table, the event flag register failed
///     - The event table is full
///
/// \~english @par Detail
///     - Call this API to create event and return the created event ID.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
EventID _pb_CreateEvent(u_int8 ucManualReset, int32 lInitData, char *cpEventName);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Wait for the event specified by ID
///
/// \~english @param [in] eventID
///     - EventID  event ID
/// \~english @param [in] lWaitMode
///     - int32  event wait mode
/// \~english @param [in] lMinVal
///     - int32  event wait min value
/// \~english @param [in] lMaxVal
///     - int32  event wait max value
/// \~english @param [out] plEventVal
///     - int32*  event wait value output pointer
/// \~english @param [in] ulMillSecTime
///     - u_int32  timeout time(ms)
///
/// \~english @par
///     - event wait mode(lWaitMode)
///       - SAPI_EVWAIT_VAL
///
/// \~english @retval RET_NORMAL  normal return
/// \~english @retval RET_EV_NONE parameter error or specified event not exist
/// \~english @retval RET_ERRTIMEOUT timeout
/// \~english @retval RET_ERROR   other error
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter plEventVal is NULL
///     - The parameter eventID is more than MAX_PB_EVENTS
///     - The specified event has not been registered in event table
///     - The count of threads which is waiting this event is reach max
///     - The parameter ulMillSecTime is 0
///     - The parameter ulMillSecTime is INFINITE, and wait event flag failed
///     - The parameter ulMillSecTime is not INFINITE, and timeout
///     - The parameter ulMillSecTime is not INFINITE, and get event flag failed
///
/// \~english @par Detail
///     - Call this API to wait event.
///     - This API will return after timeout or this event been set.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
RET_API _pb_WaitEvent(EventID eventID, int32 lWaitMode, int32 lMinVal,
                        int32 lMaxVal, int32* plEventVal, u_int32 ulMillSecTime);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Set the value of event specified by ID
///
/// \~english @param [in] eventID
///     - EventID  event ID
/// \~english @param [in] lSetMode
///     - int32  event value set mode
/// \~english @param [in] iVal
///     - int32  event value
///
/// \~english @par
///     - event value set mode(lSetMode)
///       - SAPI_EVSET_ABSOLUTE  absolute value set(set parameter value)
///       - SAPI_EVSET_RELATE  offset set(offset of current value set)
///
/// \~english @retval RET_NORMAL  normal return
/// \~english @retval RET_ERRPARAM  parameter error
/// \~english @retval RET_EV_NONE specified event not exist
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter eventID is more than MAX_PB_EVENTS
///     - The specified event has not been registered in event table
///     - The parameter lSetMode is neither SAPI_EVSET_ABSOLUTE nor SAPI_EVSET_RELATE
///
/// \~english @par Detail
///     - Call this API to set event value.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
RET_API _pb_SetEvent(EventID eventID, int32 lSetMode, int32 lval);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Destroy the event specified by ID
///
/// \~english @param [in] eventID
///     - EventID  event ID
///
/// \~english @retval RET_NORMAL  normal return
/// \~english @retval RET_ERROR  event flag destroy failed
/// \~english @retval RET_EV_NONE specified event not exist
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///     (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter eventID is more than MAX_PB_EVENTS
///     - The specified event has not been registered in event table
///     - Event flag destroy failed
///
/// \~english @par Detail
///     - Call this API to destroy specified event.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
RET_API _pb_DeleteEvent(EventID eventID);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Initialization before call Base API(every process used Base API should call this API firstly).
///
/// \~english @param [in] hApp
///     - HANDLE  app Handle
///
/// \~english @retval RET_NORMAL normal return
///
/// \~english @par Precondition
///     - The creation/initialization(FrameworkunifiedCreateDispatcherWithoutLoop and etc.) of the dispatcher for App are completed.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to initialize Base API.
///     - Every process used Base API should call this API firstly.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
RET_API _pb_Setup_CWORD64_API(HANDLE hApp);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Terminate current thread.
///
/// \~english @param [in] dwExitCode
///     - DWORD  exit code(not used)
///
/// \~english @retval None
///
/// \~english @par Precondition
///     - None
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to terminate current thread.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
VOID  _pb_ExitThread(DWORD dwExitCode);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Create the message queue
///
/// \~english @param [in] eventID
///     - EventID  process No
///
/// \~english @retval RET_NORMAL  normal return
/// \~english @retval RET_ERRPARAM  parameter error
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///        (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter pno is 0
///     - The name length of thread called this API is longer than MAX_QUEUE_NAME_SIZE
///
/// \~english @par Detail
///     - Call this API to create the message queue.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
RET_API _pb_CreateMsg(PNO pno);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Send message in process
///
/// \~english @param [in] pno
///     - PNO  process No
/// \~english @param [in] size
///     - u_int16  message size
/// \~english @param [in] msgbuf
///     - void*  message buffer
/// \~english @param [in] mode
///     - u_int16  not used
///
/// \~english @retval RET_NORMAL  normal return
/// \~english @retval RET_ERRPARAM  parameter error
/// \~english @retval RET_ERROR  other error
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter msgbuf is NULL
///     - The parameter pno is 0
///     - The message queue specified by parameter pno has not been created
///     - Get sender Handle failed
///     - Send message failed
///
/// \~english @par Detail
///     - Call this API to send message in process.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
RET_API _pb_SndMsg(PNO pno, u_int16 size, void* msgbuf, u_int16 mode);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Send message between process
///
/// \~english @param [in] name
///     - PCSTR  destination process name
/// \~english @param [in] cid
///     - CID  command ID
/// \~english @param [in] size
///     - u_int16  message size
/// \~english @param [in] msgbuf
///     - const void*  message buffer
/// \~english @param [in] mode
///     - u_int16  not used
///
/// \~english @retval RET_NORMAL  normal return
/// \~english @retval RET_ERRPARAM  parameter error
/// \~english @retval RET_ERROR  other error
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter name is NULL
///     - The parameter msgbuf is NULL
///     - The length of parameter name is longer than MAX_QUEUE_NAME_SIZE
///     - Get sender Handle failed
///     - Send message failed
///
/// \~english @par Detail
///     - Call this API to send message between process.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
RET_API _pb_SndMsg_Ext(PCSTR name, CID cid, u_int16 size, const void* msgbuf, u_int16 mode);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Create semaphore by specified name
///
/// \~english @param [in] semName
///     - char*  semaphore name
///
/// \~english @retval 0    semaphore create failed
/// \~english @retval not 0 created semaphore ID
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter semName is NULL
///     - The string of parameter semName has no text
///     - The string length of parameter semName is longer than MAX_SEMAPHORE_NAME_LEN
///     - Memory allocate failed for creating semaphore table
///     - The semaphore table is full
///
/// \~english @par Detail
///     - Call this API to create semaphore and return the created semaphore ID.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
SemID   _pb_CreateSemaphore(char* semName);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Semaphore lock
///
/// \~english @param [in] semID
///     - SemID  semaphore ID
///
/// \~english @retval RET_NORMAL  normal return
/// \~english @retval RET_OSERROR  error return
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///      (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter semName is 0
///     - The parameter semName is more than MAX_PB_SEMAPHORES
///     - The specified semaphore has not been registered in semaphore table
///     - The specified semaphore's mutex has not been created
///     - The specified semaphore's mutex lock failed
///
/// \~english @par Detail
///     - Call this API to get semaphore.
///     - This API will return after got semaphore.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
RET_API _pb_SemLock(SemID semID);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Semaphore unlock
///
/// \~english @param [in] semID
///     - SemID  semaphore ID
///
/// \~english @retval RET_NORMAL  normal return
/// \~english @retval RET_OSERROR  error return
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter semName is 0
///     - The parameter semName is more than MAX_PB_SEMAPHORES
///     - The specified semaphore has not been registered in semaphore table
///     - The specified semaphore's mutex has not been created
///     - The specified semaphore's mutex release failed
///
/// \~english @par Detail
///     - Call this API to relesae semaphore.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
RET_API _pb_SemUnlock(SemID semID);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Create Share Data
///
/// \~english @param [in] area_name
///     - char*  share data name
/// \~english @param [in] size
///     - u_int32  data size
/// \~english @param [out] mem_ptr
///     - void**  share memory pointer
///
/// \~english @retval RET_NORMAL  normal return
/// \~english @retval RET_ERROR  error return
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter area_name is NULL
///     - The parameter mem_ptr is NULL
///     - The string of parameter area_name has no text
///     - The string length of parameter area_name is longer than MAX_AREA_NAME_LEN
///     - The parameter size is 0
///     - The specified share data has already been created
///     - Memory allocate failed for creating share data
///     - The specified share data file create failed
///
/// \~english @par Detail
///     - Call this API to create share data.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
RET_API _pb_CreateShareData(char* area_name, u_int32 size, void** mem_ptr);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Link Share Data
///
/// \~english @param [in] area_name
///     - char*  share data name
/// \~english @param [out] mem_ptr
///     - void**  share memory pointer
/// \~english @param [in] size
///     - u_int32*  data size
///
/// \~english @retval RET_NORMAL  normal return
/// \~english @retval RET_ERROR  error return
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter area_name is NULL
///     - The parameter mem_ptr is NULL
///     - The string of parameter area_name has no text
///     - The string length of parameter area_name is longer than MAX_AREA_NAME_LEN
///     - The parameter size is NULL
///     - Memory allocate failed for linking share data
///     - The specified share data file open failed
///
/// \~english @par Detail
///     - Call this API to link share data.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
RET_API _pb_LinkShareData(char* area_name, void** mem_ptr, u_int32* size);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Start timer
///
/// \~english @param [in] SndPno
///     - PNO  source process No
/// \~english @param [in] TimerSeq
///     - u_int16  timer sequence No
/// \~english @param [in] TimerType
///     - u_int8  timer type
/// \~english @param [in] TimeOut
///     - u_int32  timeout time
///
/// \~english @par
///     - timer type(TimerType)
///       - TIMER_TYPE_SYN  fixed term timer
///       - TIMER_TYPE_USN  asynchronous timer
///
/// \~english @retval RET_NORMAL  normal return
/// \~english @retval RET_ERRPARAM  parameter error
/// \~english @retval RET_ERROR  other error
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - Initialization of positioning_base_library has not been done in current process
///     - The parameter TimerType is neither TIMER_TYPE_SYN nor TIMER_TYPE_USN
///     - The parameter TimeOut is 0
///     - The same timer has already been started
///     - Timer start failed
///
/// \~english @par Detail
///     - Call this API to start timer.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
RET_API _pb_ReqTimerStart(PNO SndPno, u_int16 TimerSeq, u_int8 TimeType, u_int32 TimeOut);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Stop timer
///
/// \~english @param [in] SndPno
///     - PNO  source process No
/// \~english @param [in] TimerSeq
///     - u_int16  timer sequence No
/// \~english @param [in] TimerType
///     - u_int8  timer type
///
/// \~english @par
///     - timer type(TimerType)
///       - TIMER_TYPE_SYN  fixed term timer
///       - TIMER_TYPE_USN  asynchronous timer
///
/// \~english @retval RET_NORMAL  normal return
/// \~english @retval RET_ERROR  error return
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - Initialization of positioning_base_library has not been done in current process
///     - Timer stop failed
///
/// \~english @par Detail
///     - Call this API to stop timer.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
RET_API _pb_TimerStop(PNO SndPno, u_int16 TimerSeq, u_int8 TimeType);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Create mutex
///
/// \~english @param [in] lpMutexAttributes
///     - LPSECURITY_ATTRIBUTES  not used
/// \~english @param [in] bInitialOwner
///     - BOOL  not used
/// \~english @param [in] lpName
///     - LPCTSTR  mutex name
///
/// \~english @retval NULL  error return
/// \~english @retval Except NULL  created mutex Handle
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter lpName is NULL
///     - The string length of pamareter lpName is longer than NAME_MAX
///     - Mutex lock map failed
///
/// \~english @par Detail
///     - Call this API to create mutex.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
HANDLE _pb_CreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCTSTR lpName);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Get message management table dump info.
///
/// \~english @param [out] pBuf
///     - void*  output buffer
/// \~english @param [in/out] pLen
///     - uint8_t*  output buffer size
///
/// \~english @retval None
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to get message management table dump info.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
void _pb_GetDebugMsgMngTbl(void* pBuf, uint8_t* pLen);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Get mutex management table dump info.
///
/// \~english @param [out] pBuf
///     - void*  output buffer
/// \~english @param [in/out] pLen
///     - uint8_t*  output buffer size
///
/// \~english @retval None
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to get mutex management table dump info.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
void _pb_GetDebugMutexMngTbl(void* pBuf, uint8_t* pLen);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Get timer management table dump info.
///
/// \~english @param [out] pBuf
///     - void*  output buffer
///
/// \~english @retval None
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to get timer management table dump info.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
void _pb_GetDebugTimerMngTbl(void* pBuf);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Get event management table dump info.
///
/// \~english @param [out] pBuf
///     - void*  output buffer
/// \~english @param [in/out] pLen
///     - uint8_t*  output buffer size
///
/// \~english @retval None
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to get event management table dump info.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
void _pb_GetDebugEventMngTbl(void* pBuf, uint8_t* pLen);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Get memory management table dump info.
///
/// \~english @param [out] pBuf
///     - void*  output buffer
///
/// \~english @retval None
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to get memory management table dump info.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
void _pb_GetDebugMemoryMngTbl(void* pBuf);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Get common info management table dump info.
///
/// \~english @param [out] pBuf
///     - void*  output buffer
///
/// \~english @retval None
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to get common info management table dump info.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
void _pb_GetDebugOtherMngTbl(void* pBuf);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Get current app Handle.
///
/// \~english @param None
///
/// \~english @retval 0    get Handle failed
/// \~english @retval not 0 Handle
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - Current app Handle has not been registered
///
/// \~english @par Detail
///     - Call this API to get current app Handle.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
HANDLE  _pb_GetAppHandle(void);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Set current app Handle.
///
/// \~english @param [in] hApp
///     - HANDLE  app Handle
///
/// \~english @retval None
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to get common info management table dump info.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
void  _pb_SetAppHandle(HANDLE hApp);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Base API stop process(every process used Base API should call this API before stop).
///
/// \~english @param None
///
/// \~english @retval None
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to stop Base API.
///     - Every process used Base API should call this API before stop.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
void  _pb_Teardown_CWORD64_API(void);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Terminate current process.
///
/// \~english @param [in] pFunc
///     - char*  source function
/// \~english @param [in] line
///     - int  source line
///
/// \~english @retval None
///
/// \~english @par Precondition
///     - None
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to terminate current process.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
void  _pb_Exit_d(const char* pFunc, int line);
#define _pb_Exit() _pb_Exit_d(__func__, __LINE__)

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Receive message.
///
/// \~english @param [in] pno
///     - PNO  process No
/// \~english @param [in] size
///     - u_int16  message size
/// \~english @param [out] msgbuf
///     - void*  message buffer
/// \~english @param [in] mode
///     - u_int16  not used
///
/// \~english @retval RET_NORMAL  normal return
/// \~english @retval RET_ERRPARAM  parameter error
/// \~english @retval RET_ERROR  other error
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///       (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter msgbuf is NULL
///     - The parameter pno is 0
///     - The message queue specified by parameter pno has not been created
///     - Receive message failed
///     - Receive message successrully, but the received message size is longer than parameter size
///     - Get received message data failed
///
/// \~english @par Detail
///     - Call this API to receive message of specified pno.
///     - This API will return after received message.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
RET_API _pb_RcvMsg(PNO pno, u_int16 size, void** msgbuf, u_int16 mode);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Get send buffer for message transferring in process
///
/// \~english @param [in] pno
///     - PNO  process No
/// \~english @param [out] pSndBuf
///     - void**  send buffer
///
/// \~english @retval RET_NORMAL  normal return
/// \~english @retval RET_ERRPARAM  parameter error
/// \~english @retval RET_ERROR  other error
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
/// (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter pno is 0
///     - The message queue specified by parameter pno has not been created
///     - Get sender Handle failed
///     - Get send buffer failed
///
/// \~english @par Detail
///     - Call this API to get send buffer for message transferring in process.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
RET_API _pb_GetZcSndBuf(PNO pno, void** pSndBuf);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Send message in process
///
/// \~english @param [in] pno
///     - PNO  process No
/// \~english @param [in] size
///     - u_int16  message size
/// \~english @param [in] mode
///     - u_int16  not used
///
/// \~english @retval RET_NORMAL  normal return
/// \~english @retval RET_ERRPARAM  parameter error
/// \~english @retval RET_ERROR  other error
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
/// (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter pno is 0
///     - The message queue specified by parameter pno has not been created
///     - Get sender Handle failed
///     - Get send buffer failed
///     - Set send buffer failed
///     - Send message failed
///
/// \~english @par Detail
///     - Call this API to send message in process.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
RET_API _pb_ZcSndMsg(PNO pno, u_int16 size, u_int16 mode);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Convert process name to pno
///
/// \~english @param [in] name
///     - PCSTR  process name
///
/// \~english @retval 0    convert failed
/// \~english @retval not 0 converted PNO
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///  (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter name is NULL
///     - The size of parameter name is longer than THREAD_NAME_LEN_MAX
///
/// \~english @par Detail
///     - Call this API to convert process name to pno.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
PNO _pb_CnvName2Pno(PCSTR name);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Convert pno to process name
///
/// \~english @param [in] pno
///     - PNO  process No
///
/// \~english @retval NULL    convert failed
/// \~english @retval not NULL converted process name
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///  (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Failure condition
///     - The parameter pno has not been registered(not the return pno of _pb_CnvName2Pno).
///
/// \~english @par Detail
///     - Call this API to convert pno to process name.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Sync
///
////////////////////////////////////////////////////////////////////////////////////////////
PCSTR _pb_CnvPno2Name(PNO pno);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Get message resource
///
/// \~english @param None
///
/// \~english @retval TRUE    normal return
/// \~english @retval FALSE error(lack of resource)
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///  (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to get message resource.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
BOOL _pb_GetMsgResource(void);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Get mutex resource
///
/// \~english @param None
///
/// \~english @retval TRUE    normal return
/// \~english @retval FALSE error(lack of resource)
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///  (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to get mutex resource.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
BOOL _pb_GetMutexResource(void);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Get common resource
///
/// \~english @param None
///
/// \~english @retval TRUE    normal return
/// \~english @retval FALSE error(lack of resource)
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
/// (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to get common resource.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
BOOL _pb_GetOtherResource(void);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Release message resource
///
/// \~english @param None
///
/// \~english @retval None
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///  (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to release message resource.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
void _pb_ReleaseMsgResource(void);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Release mutex resource
///
/// \~english @param None
///
/// \~english @retval None
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///  (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to release mutex resource.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
void _pb_ReleaseMutexResource(void);

////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup positioning_base_library
/// \~english @par Brief
///     - Release common resource
///
/// \~english @param None
///
/// \~english @retval None
///
/// \~english @par Precondition
///     - positioning_base_library initialization are completed \n
///  (_pb_Setup_CWORD64_API has already been called) in current process.
///
/// \~english @par changes of the internal status
///     - There is no changes of the internal status by this API
///
/// \~english @par Detail
///     - Call this API to release common resource.
///        \n
///
/// \~english @par Classification
///        - Public
///
/// \~english @par Type
///        - Fire and Forget
///
////////////////////////////////////////////////////////////////////////////////////////////
void _pb_ReleaseOtherResource(void);

#ifdef __cplusplus
}
#endif

/** @}*/  // end of positioning_base_library
/** @}*/  // end of vehicle_service
/** @}*/  // end of BaseSystem
#endif  // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE_VEHICLE_SERVICE_WPF_STD_H_