summaryrefslogtreecommitdiffstats
path: root/K2LABI/ABI/K2LABI.h
blob: 0fd1490f2c846a5c1ea5b825252cfa2ed3217c3d (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
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
/*=== K2L GmbH ===============================================================*/
/**
\file
            This file contains the API of the \ref ABI interface.

\ingroup    ABI

\par        COPYRIGHT (c) 2000-2011 by K2L GmbH
            All rights reserved.
*/
/*==============================================================================
            Alle Rechte an der Software verbleiben bei der K2L GmbH.

            Die K2L GmbH raeumt dem Lizenznehmer nach vollstaendiger
            Bezahlung der Lizenzgebuehr ein nicht ausschliessliches,
            unwiderrufliches, nicht uebertragbares, zeitlich und geografisch
            nicht beschraenktes Recht zur Nutzung der jeweils
            auftragsgegenstaendlichen Software innerhalb des Lizenznehmers ein.

            Die Weitergabe des Nutzungsrechts durch den Lizenznehmer ist auf
            dessen Zulieferer beschraenkt. Die Zulieferer sind zu verpflichten,
            die Software nur im Rahmen von Projekten fuer den Lizenznehmer
            zu verwenden; weitere Rechte der Zulieferer sind auszuschliessen.
===HEADER END=================================================================*/
//@{
#pragma once

#include "k2l-type.h"

/// \defgroup ABI Automotive Bus Interface
/// Detailed overview of the ABI library.

namespace K2L
{
    namespace Automotive
    {
        namespace ABI
        {
    
/// Bus types.
/// \ingroup ABI
typedef enum
{
    UnknownBusId = 0x00,        ///< Unknown channel.

    CAN1 = 0x10,                ///< CAN Channel 1.
    CAN2 = 0x11,                ///< CAN Channel 2.
    CAN3 = 0x12,                ///< CAN Channel 3.
    CAN4 = 0x13,                ///< CAN Channel 4.
    CAN5 = 0x14,                ///< CAN Channel 5.
    CAN6 = 0x15,                ///< CAN Channel 6.

    MOST1 = 0x20,               ///< MOST Channel 1 (DEPRECATED).
    MOST_CONTROL1_AMS = 0x20,   ///< MOST Channel 1 of control channel (AMS). It's also used for all MOST bus events.
    
    MOSTHIGH1 = 0x30,           ///< MOST High Channel 1 (DEPRECATED).
    MOST_ASYNC1_HIGH = 0x30,    ///< MOST Channel 1 of asynchronous channel (MOST HIGH).
    
    FLEXRAY1 = 0x40,            ///< FlexRay Channel 1.
    
    LIN1 = 0x50,                ///< LIN Channel 1.
    LIN2 = 0x51,                ///< LIN Channel 2.
    LIN3 = 0x52,                ///< LIN Channel 3.
    LIN4 = 0x53,                ///< LIN Channel 4.
    LIN5 = 0x54,                ///< LIN Channel 5.
    LIN6 = 0x55,                ///< LIN Channel 6.
    
    XCAN1 = 0x60,               ///< CAN Extended Channel 1.
    XCAN2 = 0x61,               ///< CAN Extended Channel 2.
    XCAN3 = 0x62,               ///< CAN Extended Channel 3.
    XCAN4 = 0x63,               ///< CAN Extended Channel 4.
    XCAN5 = 0x64,               ///< CAN Extended Channel 5.
    XCAN6 = 0x65,               ///< CAN Extended Channel 6.

    LINTP1 = 0x70,              ///< LIN TP Channel 1.
    LINTP2 = 0x71,              ///< LIN TP Channel 2. 
    LINTP3 = 0x72,              ///< LIN TP Channel 3.
    LINTP4 = 0x73,              ///< LIN TP Channel 4. 
    LINTP5 = 0x74,              ///< LIN TP Channel 5.
    LINTP6 = 0x75,              ///< LIN TP Channel 6.

    MOST_CONTROL1_RAW = 0x80,   ///< MOST Channel 1 of raw control channel (CMS).

    MOST_ASYNC1_RAW = 0x90,     ///< MOST Channel 1 of raw asynchronous channel (ADS).,

    MOST_SYNC1 = 0xA0,          ///< MOST Synchronous Channel 1.

    RELAY1 = 0xB0,              ///< Relay 1.

    LINRAW1 = 0xC0,             ///< LIN Raw Channel 1.
    LINRAW2 = 0xC1,             ///< LIN Raw Channel 2.
    LINRAW3 = 0xC2,             ///< LIN Raw Channel 3.
    LINRAW4 = 0xC3,             ///< LIN Raw Channel 4.
    LINRAW5 = 0xC4,             ///< LIN Raw Channel 3.
    LINRAW6 = 0xC5,             ///< LIN Raw Channel 4.
    
    MOST_ASYNC1_MEP = 0xD0      ///< MOST Channel 1 of asynchronous ethernet channel (MEP).
} Bus;

/// Bus types.
/// \ingroup ABI
typedef enum 
{
    CAN = 1,                ///< Controller Area Network.
    MOST = 2,               ///< MOST (DEPRECATED).
    MOST_CONTROL = 2,       ///< MOST control channel.
    MOSTHIGH = 3,           ///< MOST high (DEPRECATED).
    MOST_ASYNC = 3,         ///< MOST asynchronous channel.
    FLEXRAY = 4,            ///< FlexRay.
    LIN = 5,                ///< Local Interconnect Network.
    XCAN = 6,               ///< CAN Extended.
    LINTP = 7,              ///< LIN Transport Protocol. 
    MOST_CONTROL_RAW = 8,   ///< MOST raw control channel.
    MOST_ASYNC_RAW = 9,     ///< MOST raw asnychronous channel.
    MOST_SYNC = 10,         ///< MOST synchronous channel.
    RELAY = 11,             ///< Relay.
    LIN_RAW = 12,           ///< LIN raw channel.
    MOST_ASYNC_MEP = 13     ///< MOST MEP asnychronous channel.
} BusType;

/// Signal types for sweeping tx data.
/// \ingroup ABI
typedef enum
{
    sigLines = 0,   ///< The signal looks like sequence of ascending/descending values.
    sigZigzag = 1,  ///< The signals look like sequence of ascending and then descending values.
    sigBitShift = 2 ///< First sequence value of this signal type is 0, then goes value with all bit set to 1. And then goes values, that are degree of 2, i.e. 1, 2, 4, 8 and so on. After this the sequence repeats from the beginning.
} SignalType;

/// Object type of an ABI object.
/// \ingroup ABI
typedef enum
{
    NullObject = 0x00,              ///< NULL object.
    ReceiverObject = 0x01,          ///< Common receiver object.
    TransmitterObject = 0x02,       ///< Common transmitter object.
    CanTpReceiverObject = 0x03,     ///< CAN TP receiver object.
    CanTpTransmitterObject = 0x04   ///< CAN TP transmitter object.
} ObjectType;

/// Object state of an ABI object.
/// @ingroup ABI
typedef enum
{
    Created = 0x00, ///< Object has been created.
    Started = 0x01, ///< Object has been started.
    Stopped = 0x02, ///< Object has been stopped.
    Deleted = 0x03  ///< Object has been deleted.
} ObjectState;

/// Describes what kind of internal event occured.
/// \ingroup ABI
typedef enum
{
    paramTxMostQueueOverflow = 0,               ///< The MOST TX queue has overflowed.
    paramRxMostQueueOverflow = 1,               ///< The MOST RX queue has overflowed.
    paramTxCan1QueueOverflow = 2,               ///< The CAN1 TX queue has overflowed.
    paramTxCan2QueueOverflow = 3,               ///< The CAN2 TX queue has overflowed.
    paramTxCan3QueueOverflow = 4,               ///< The CAN3 TX queue has overflowed.
    paramTxCan4QueueOverflow = 5,               ///< The CAN4 TX queue has overflowed.
    paramRxCan1QueueOverflow = 6,               ///< The CAN1 RX queue has overflowed.
    paramRxCan2QueueOverflow = 7,               ///< The CAN2 RX queue has overflowed.
    paramRxCan3QueueOverflow = 8,               ///< The CAN3 RX queue has overflowed.
    paramRxCan4QueueOverflow = 9,               ///< The CAN4 RX queue has overflowed.
    paramTxIpcQueueOverflow = 10,               ///< The IPC TX (from ABI device to PC) queue has overflowed.
    paramOutOfMemory = 11,                      ///< The heap memory is full. This can happen if the PC is sending much faster, as the automotive bus can transport the data.
    paramTxFlexrayQueueOverflow = 12,           ///< The FlexRay TX queue has overflowed.
    paramRxFlexrayQueueOverflow = 13,           ///< The FlexRay RX queue has overflowed.
    paramTxCan5QueueOverflow = 14,              ///< The CAN5 TX queue has overflowed.
    paramTxCan6QueueOverflow = 15,              ///< The CAN6 RX queue has overflowed.
    paramRxCan5QueueOverflow = 16,              ///< The CAN5 TX queue has overflowed.
    paramRxCan6QueueOverflow = 17,              ///< The CAN6 RX queue has overflowed.
    paramTimingSynchronisationModeChanged = 18, ///< Timing synchronisation mode changed (param1: mode).
    paramTimeStampBaseChanged = 19              ///< TimeStamp base changed (param1: new timestamp (high) param2: new timestamp (low).
} Parameter;

/// Bus events.
/// \ingroup ABI
typedef enum
{
    beMOSTStressNicMode = 10,               ///< MOST StressNIC: Mode Changed (param1: mode).
    beMOSTNetOn = 11,                       ///< MOST: Net on.
    beMOSTNetOff = 12,                      ///< MOST: Net off.
    beMOSTMPRChanged = 13,                  ///< MOST: MPR changed (param1: new MPR param2: old MPR).
    beMOSTShortUnlock = 14,                 ///< MOST: Short unlock.
    beMOSTCriticalUnlock = 15,              ///< MOST: Critical unlock.
    beMOSTLock = 16,                        ///< MOST: Stable lock.
    beMOSTUnlock = 17,                      ///< MOST: Undefined unlock.
    beMOSTNPRChanged = 18,                  ///< MOST: NPR changed (param1: new NPR). 
    beMOSTSBCChanged = 19,                  ///< MOST: SBC changed (param1: 1Byte none 1Byte Preset 1Byte Current 1Byte Total param2: 2Byte Free 1Byte Packet 1Byte Used).
    beMOSTShutdownReasonChanged = 20,       ///< MOST: Shutdown reason (MOST 150) changed (param1: Shutdown Reason).

    beFlexRayOnline = 21,                   ///< FlexRay: Bus online.
    beFlexRayOffline = 22,                  ///< FlexRay: Bus offline.
    beFlexRayBadHardware = 23,              ///< FlexRay: Bad hardware.
    beFlexRayBadConfiguration = 24,         ///< FlexRay: Bad configuration.
    beFlexRayTxChanged = 25,                ///< FlexRay: Tx messages enabling changed (param1: enabled).

    beCANBusError = 31,                     ///< CAN: Bus error.
    
    beLINBusError = 41,                     ///< LIN: Bus error.
    
    beMOSTVolumeChanged = 50,               ///< MOST: MOST: Volume changed (param1: 1Byte connector type 1Byte isInput 1Byte modifyLeft 1Byte modifyRight param2: volume).
    beMOSTDiagnostic = 51,                  ///< MOST: Diagnostic event (param1: type param2: optional parameter).
    beMOSTInitError = 52,                   ///< MOST: Init error.
    beMOSTStartupFailed = 53,               ///< MOST: Startup failed.
    beMOSTStartupBusy = 54,                 ///< MOST: Startup busy.
    beMOSTShutdownFailed = 55,              ///< MOST: Shutdown failed.
    beMOSTShutdownBusy = 56,                ///< MOST: Shutdown busy.
    beMOSTNetworkInterface = 57,            ///< MOST: Network Interface status (param1: State).
    beMOSTSystemErrorMonitor = 58,          ///< MOST: System error monitor status (param1: Result).
    beMOSTGroupAddressChanged = 59,         ///< MOST: Group address changed (param1: New group address).
    beMOSTNodeAddressChanged = 61,          ///< MOST: Node Address changed (param1: New node address).
    beMOSTDeviceModeChanged = 62,           ///< MOST: Device Mode changed (param1: New device mode param2: Options).
    beMOSTFrequencyChanged = 63,            ///< MOST: MOST frequency changed (param1: new frequency).
    beMOSTLowLevelRetryCountChanged = 64,   ///< MOST: MOST low level retry count changed (param1: new count).
    beMOSTMidLevelRetryCountChanged = 65,   ///< MOST: MOST mid level retry count changed (param1: new count).
    beMOSTHighLevelRetryCountChanged = 66,  ///< MOST: MOST high level retry count changed (param1: new count).
    beMOSTMPREqual = 67,                    ///< MOST: Maximum position range (MPR) equal (param1: mpr).
    beMOSTIlluminationLevelChanged = 68,    ///< MOST: MOST illumination level changed (param1: level).
    beMOSTSpyChange = 69,                   ///< MOST SPY: State of MOST spy channels (param1: 1Byte status 1Byte control 1Byte async 1Byte sync (0 means false, >0 means true).
    
    beLINTPBusError = 70,                   ///< LINTP: Bus error.
    
    beCANTPRxConfigChanged = 80,            ///< CANTP: Rx config changed (param1: 1Byte block size 1Byte separation time 2Byte consecutive frame timeout).
    beCANTPTxConfigChanged = 81,            ///< CANTP: Tx config changed (param1: 2Byte flow control timeout 2Byte clear to send timeout).
    beCANTPPatternChanged = 82,             ///< CANTP: Pattern changed (param1: pattern param2: 1 if pattern generator is active; otherwise 0).
    
    beMOSTMuteStateChanged = 90,            ///< Audio: Mute state changed (param1: 1Byte connector type 1Byte isInput 1Byte reserved 1Byte reserved param2: muteState
} TBusEvent;

/// This errors are returned from \ref ABICommands 
/// and signalize if operation was executed successful.
/// \ingroup ABI
typedef enum
{
    tmRetValOk = 0,                     ///< Operation successful.
    tmRetValNotImplemented = 1,         ///< Function is not implemented.
    tmRetValSystemNotReady = 2,         ///< System is not ready.
    tmRetValObjectAlreadyExists = 3,    ///< Object already exists.
    tmRetValObjectNotFound = 4,         ///< Object not found.
    tmRetValCannotExecute = 5,          ///< Operation can not be executed.
    tmRetValTooManyObjects = 6,         ///< The maximum amount of transmitter / receiver objects are already allocated in the ABI device.
    tmRetValTooManySignals = 7,         ///< The maximum amount of sweep signals are already assigned to the transmitter in the ABI device.
    tmRetValBadBusId = 8,               ///< Bad bus ID.
    tmRetValBadDataLength = 9,          ///< Bad data length.
    tmRetValBadBitPosition = 10,        ///< Bad bit position.
    tmRetValBadSignalType = 11,         ///< Bad signal type.
    tmRetValBadStepsNumber = 12,        ///< Bad steps number.
    tmRetValOutOfMemory = 13,           ///< Device is out of memory.
    tmRetValBadRepetitionsNumber = 14,  ///< Bad repetition number.
    tmRetValBadHandle = 15,             ///< Bad handle passed.
    tmRetValBadMessageId = 16,          ///< Message ID was not correct.
    tmRetValFunctionObsolete = 17,      ///< Function is obsolete and not supported.
    tmRetValBadParameter1 = 21,         ///< Parameter 1 is not valid.
    tmRetValBadParameter2 = 22,         ///< Parameter 2 is not valid.
    tmRetValBadParameter3 = 23,         ///< Parameter 3 is not valid.
    tmRetValBadParameter4 = 24,         ///< Parameter 4 is not valid.
    tmRetValBadParameter5 = 25,         ///< Parameter 5 is not valid.
    tmRetValBadParameter6 = 26,         ///< Parameter 6 is not valid.
    tmRetValBadParameter7 = 27,         ///< Parameter 7 is not valid.
    tmRetValBadParameter8 = 28,         ///< Parameter 8 is not valid.
    tmRetValBadParameter9 = 29,         ///< Parameter 9 is not valid.
    tmRetErrorDuringExecution = 30,     ///< Error during executing the function.,
    tmRetErrorInvalidMessageFormat = 31 ///< Message format is invalid (e.g. CMS payload is malformed).
} TMErrorCode;

/// Enum to select the desired informations.
/// \ingroup ABI
typedef enum
{
    FirmwareVersion = 0x01u,        ///< Firmware version of MOCCA compact firmware.
    HardwareVersion = 0x02u,        ///< Hardware version of MOCCA compact.
    SerialNumber = 0x03u,           ///< Serialnumber of MOCCA compact mainboard.
    SupportedFeatures = 0x04u,      ///< Supported Features of abi firmware.
    MacAddress = 0x05u,             ///< MAC Address of MOCCA compact.
    FpgaVersion = 0x06u,            ///< FPGA firmware version.
    CpldVersion = 0x07u,            ///< CPLD firmware version.
    SerialNumberPhyBoard = 0x40u,   ///< Serialnumber of MOST phy board.
    InicFirmwareVersion = 0x41u,    ///< Firmware version of INIC.
    InicConfigString = 0x42u,       ///< Config string version of INIC firmware.
    NetServicesVersion = 0x43u,     ///< NetServices version.,
    SpynicFirmwareVersion = 0x44,   ///< Firmware version of SPYNIC.
    SpynicConfigString = 0x45,      ///< Config string version of SPYNIC firmware.  
    SpynicHardwareVersion = 0x46,   ///< Hardware version of SPYNIC.
    SpynicApiVersion = 0x47,        ///< API version of SPYNIC. 
    SpynicProductDate = 0x48,       ///< Product Date of SPYNIC.    
    StressnicFirmwareVersion = 0x49,///< Firmware version of StressNIC.
    StressnicConfigString = 0x4A,   ///< Config string version of StressNIC firmware.
    StressnicHardwareVersion = 0x4B,///< Hardware version of StressNIC.
    StressnicApiVersion = 0x4C,     ///< API version of StressNIC.
    StressnicProductDate = 0x4D,    ///< Product Date of StressNIC.
    StressnicApiVersionInic = 0x4E  ///< API version of StressNIC integrated INIC.
} BoardInformation;

/// Synchronisation mode of hardware timestamp synchronisation.
/// \ingroup ABI
typedef enum 
{
    SynchronisationStandalone = 0x00u,  ///< Standalone mode.
    SynchronisationMaster = 0x01u,      ///< Master mode.
    SynchronisationSlave = 0x02u        ///< Slave mode.
} TimingSynchronisationMode;

/// Absolute trigger command.
/// \ingroup ABI
typedef struct
{
    bool isActive;                  ///< Gets or sets a value indicating whether this instance is active.
    unsigned long long timeStamp;   ///< Gets or sets the timestamp when the command shall be executed (in ticks of 100ns).
} AbsoluteTriggerCommand;

/// Relative trigger command.
/// \ingroup ABI
typedef struct
{
    bool isActive;                  ///< Gets or sets a value indicating whether this instance is active.
    WORD delay;                     ///< Gets or sets the delay of the next command (in milliseconds).
} RelativeTriggerCommand;

/// FlexRay channels.
/// \ingroup ABI
typedef enum 
{
    A = 1,  ///< Channel A.
    B = 2,  ///< Channel B.
    AB = 3  ///< Channel A+B.
} FrChannel;

/// TX Status of FlexRay.
/// \ingroup ABI
typedef enum
{
    flexraySuccess = 0x00,  ///< Message was sent successful.
    flexrayFailed = 0x01    ///< Message sending has failed.
} FlexrayTxStatus;

/// MOST protocols.
/// \ingroup ABI
typedef enum 
{
    CMS,    ///< Control Message Service.
    AMS,    ///< Application Message Service.
    ADS,    ///< Asynchronous Data Service.
    HIGH    ///< MOST High protocol.
} MostProtocol;

/// MOST device mode.
/// \ingroup ABI
typedef enum
{
    mostSlave = 0,                  ///< Slave mode.
    mostStaticMaster = 1,           ///< Static master mode.
    mostBypass = 2,                 ///< Bypass mode.
    mostNormalMaster = 3,           ///< Master mode.
    mostConstantLightMaster = 4     ///< Static master mode with constant light (MOST 150 only).
} MostMode;

/// MOST device mode options.
/// @ingroup ABI
typedef enum
{
    NoOption = 0x00,        ///< No option.
    ForceDeviceMode = 0x01  ///< If the device is in a master mode and the network is in NetOn a Shutdown will be forced.
} DeviceModeOptions;

/// Role of device in MOST ring. 
/// \ingroup ABI
typedef enum
{
    bypassOff = 0,  ///< Device participate in MOST ring and switch to the last valid mode of device.
    bypassOn = 1    ///< Device is not participate in MOST ring.
} BypassMode;  

/// Determinates the destination addressing type of a received message.
/// \ingroup ABI
typedef enum
{
    logicaladdress = 0x00,  ///< Message was sent to a logical node address.
    nodeaddress = 0x01,     ///< Message was sent to a node position address (0x0400 - 0x043F).
    broadcast = 0x02,       ///< Message was sent to a broadcast address (0x03C8 or 0x03FF).
    groupcast = 0x03,       ///< Message was sent to a group address (0x0300 - 0x03FF).
    unknown = 0xFF          ///< Receiver type is not available.
} ReceiveType;

/// Bandwith of audio channel.
/// \ingroup ABI
typedef enum
{
    Mono16Bit   = 0x00, ///< 16 Bit mono channel.
    Stereo16Bit = 0x01, ///< 16 Bit stereo channel.
    Stereo24Bit = 0x02  ///< 24 Bit stereo channel.
} AudioBandwidth;

/// Frequency of MOST network.
/// \ingroup ABI
typedef enum
{
    Frequency44100Hz = 0x00,    ///< 44,1 kHz.
    Frequency48000Hz = 0x01     ///< 48 kHz.
} MostSamplingFrequency;

/// Type of audio streaming event.
/// \ingroup ABI
typedef enum
{
    txAllocate,             ///< Allocates new resources on MOST.
    txAllocateConnect,      ///< Allocates new resources on MOST and transmit the audio stream to them.
    txConnect,              ///< Transmits the audio stream on preallocated resources.
    rxConnect               ///< Receives an Audiostream from preallocated resources.
} AudioConnectionType;

/// Entry in allocation table.
/// \ingroup ABI
typedef struct
{
    WORD connectionLabel;   ///< Connection label.
    WORD channelWidth;      ///< Width of allocated channel in bytes.
} AllocationTableEntry;

/// Type of audio streaming connector.
/// @ingroup ABI
typedef enum
{
    AudioConnectorSpdif = 0x00,     ///< SPDIF connector.
    AudioConnectorAnalog = 0x01,    ///< Analog connector.
    AudioConnectorAll = 0xFF        ///< All supported connectors.
} AudioConnectorType;

/// Entry in local label table.
/// \ingroup ABI
typedef struct
{
    WORD connectionLabel;               ///< Connection label.
    AudioConnectorType connectorType;   ///< Audio connector type.
    BYTE dummy;                         ///< Unused byte.
} LabelEntry;

/// Delivers more detailed information, why the transmission of the MOST message failed.
/// \ingroup ABI
typedef enum
{
    mostControlWrongTarget = 0x0100,          ///< Transmission failed. No response under chosen target address.
    mostControlSuccess = 0x0110,              ///< Transmission of all telegrams successful.
    mostControlCrc = 0x0120,                  ///< Transmission of a telegram failed. Incorrect CRC. 
    mostControlBuf = 0x0121,                  ///< Transmission of a telegram failed. Receive buffer of target device was full.
    mostControlSuccessAndCrc = 0x0130,        ///< Combination in case of a group-/broadcast transmission. At least one device got the message correctly. At least one device rejected the message due to an incorrect CRC value.
    mostControlSuccessAndBuf = 0x0131,        ///< Combination in case of a group-/broadcast transmission. At least one device got the message correctly. At least one device didn not receive it due to a full receive buffer.
    mostControlTimeout = 0x0180,              ///< Timeout error. No response from lower layer.
    mostControlNetOff = 0x0181,               ///< Transmission failed, since MOST network is switched off.
    mostControlFrmt = 0x0182,                 ///< Protocol error in the Port Message.
    mostControlSync = 0x0183,                 ///< Transmission failed due to an synchronization failure between INIC and PMS. The PMS has been re-synchronized.
    mostControlInternal = 0x0184,             ///< Internal error. Undefined status identifier.
    mostControlNoIcm = 0x0185,                ///< You tried to send a ICM message (Tgt_Adr = 1 and FBlock INIC), which is reserved for the services of the MOST NetServices only.
    mostControlProtectedMode = 0x0187,        ///< You have called MsgSend() while the EHC is not attached to the INIC. It is not allowed to call any API function beside the Kernel function MostService() and the timer management functions until the re-initialization is completed.
    mostControlSuccessAndTimeout = 0x0190,    ///< Combination in case of a group-/broadcast transmission. Internal FBlocks received the message, while FBlocks on the network are not accessible due to a timeout error from the lower layer.
    mostControlSuccessAndNetOff = 0x0191,     ///< Combination in case of a group-/broadcast transmission. Internal FBlocks received the message, while FBlocks on the network are not accessible while the network is switched off.
    mostControlSuccessAndSync = 0x0193,       ///< Combination in case of a group-/broadcast transmission. Internal FBlocks received the message, while FBlocks on the network are not accessible due to a synchronization failure between INIC and PMS.
    mostControlInvalidMessage = 0x01A0,       ///< Not a valid CMS message.
    mostControlRetry = 0x01A1,                ///< Reserved.

    mostAsyncSuccess = 0x0200,                ///< The packet was delivered successfully. The connection is held on until timeout (MHP_TIME_DELAY _END) or until connection is terminated by application.
    mostAsyncErrorNac = 0x0201,               ///< Error during transmission: At least one frame was not acknowledged after considering timeouts and retries.  The connection was terminated automatically. 
    mostAsyncErrorKilled = 0x0202,            ///< Error during transmission: The receiver device terminated the connection, before the packet has been transmitted completely.
    mostAsyncErrorBuildCon = 0x0203,          ///< Error during establishing the connection: The Start Connection telegram was not received.
    mostAsyncErrorPrio = 0x0204,              ///< Error during establishing the connection: The connection was rejected by the receiver, because the priority is to minor. The returned priority can be read out of the connection list entry (field Priority).
    mostAsyncErrorScale = 0x0205,             ///< Error during establishing the connection: The receiver sent an invalid scale value (0x00).
    mostAsyncErrorNoBuf = 0x0206,             ///< Error during connection establishing or transmission: The connection was terminated because an internal error occurred. After MHP_BUF_RETRY retries no internal wADS buffer was available.
    mostAsyncKilledTx = 0x0208,               ///< The transmission was canceled by the application of the sender prematurely.
    mostAsyncErrorNdf = 0x0209,               ///< Error during establishing the connection: The receiver sent an invalid NDF value (0x00).
    mostAsyncLenZero = 0x0221,                ///< The order is denied ( MhpSend() ), since the packet length has been set to zero. The entry is removed from the connection list.
    mostAsyncEndReady = 0x0222,               ///< The entry is removed from the connection list. This is not an error report, but this event can be used to get the information, when the connection is closed.
    mostAsyncKilledRx = 0x0223,               ///< The receiver device terminated the connection, after the packet has been transmitted completely. The sender is in hold state currently.
    mostAsyncConfigNotOk = 0x0225,            ///< The connection is not established, or is going to be terminated, due to system state NotOK.
    mostAsyncLenTooBig = 0x0226,              ///< The total size of packet exceeds the upper limit. The entry is removed from the connection list.
    mostAsyncClose = 0x0227,                  ///< The connection is closed, due to transition from NetOn to NetOff or re-initialization of the MHP module while the connection was open.
    mostAsyncAddressHandlerBusy = 0x02A1,     ///< Function called failed, as the target address is 0xFFFF, and the Address Handler is busy.
    mostAsyncNcsNotOk = 0x02A2,               ///< Function called failed, as the System Configuration State is NotOK.
    mostAsyncTxLenZero = 0x02A3,              ///< Function called failed, as the Length field is zero. The entry is removed from the connection list.
    mostAsyncInvTotalPacketLength = 0x02A4    ///< Function called failed, as the TotalPacketLength field exceeds the maximum size or the TotalPacketLength field is smaller than the Length field and not zero. The entry is removed from the connection list.
} MostTxStatus;

/// Options to configure for MHP transmission.
/// @ingroup ABI
typedef enum
{
    DefaultMhpOptions = 0,      ///< Default option set: Block acknowledge.
    SingleBlockAcknowledge = 1  ///< Single block acknowledge.
} MostMhpOptions;

/// Delivers more detailed information, why the reception of the MOST message failed.
/// @ingroup ABI
typedef enum
{
    MhpSuccess = 0x0200,        ///< The receipt of one block was successfully.
    MhpErrorNFrame = 0x0201,    ///< Error during transmission: The required Null-Frame is missing.
    MhpErrorFrame = 0x0202,     ///< Error during transmission: Data frames are missing.
    MhpErrorNoReady = 0x0203,   ///< Error during transmission: After sending a "Start Connection" no "Ready for Data" received.
    MhpErrorKilled = 0x0204,    ///< Error during transmission: The sender device terminated the transmission prematurely.
    MhpErrorNoBuf = 0x0205,     ///< Error during transmission: The connection was terminated because an internal error occurred.
    MhpErrorKilledRx = 0x0206,  ///< The connection was canceled by receiver's application.
    MhpClose = 0x0210           ///< The connection is closed (No new data received since the last rx event).
} MostRxStatus;

/// Status of MOST illumination level.
/// @ingroup ABI
typedef enum
{
    IlluminationOff = 0,        ///< Light is switched off.
    IlluminationMinus3dB = 1,   ///< Light is on and dimmed with -3dB.
    IlluminationFull = 2        ///< Light is on.
} MostIlluminationLevel;

/// Device mode of StressNIC.
/// @ingroup ABI
typedef enum StressNicMode
{
    Off = 0,    ///< StressNIC is disconnected from MOST network.
    Bypass = 1, ///< StressNIC is in Bypass mode.
    Slave = 2   ///< StressNIC is in Slave mode.
} StressNicMode;

/// <summary>
/// Options of MEP bridge.
/// </summary>
/// @ingroup ABI
typedef enum MepBridgeOptions
{
    None = 0,           ///< No options activated.
    DmaOptimization = 1 ///<Improve speed of bridge by using DMA from LAN chip to/from MediaLB. (If enabled MOST High and ADS are ignored.)
} MepBridgeOptions;

/// CAN errors.
/// \ingroup ABI
typedef enum
{
    CanTxCounterNormal = 17,        ///< The TX error counter of the CAN cell is in the normal range.
    CanTxCounterWarning = 18,       ///< The TX error counter of the CAN cell is in the warning range.
    CanTxCounterErrorPassive = 19,  ///< The TX error counter of the CAN cell is in the passive range.
    CanTxCounterBusOff = 20,        ///< The TX error counter of the CAN cell is in the bus off range.
    CanRxCounterNormal = 33,        ///< The RX error counter of the CAN cell is in the normal range.
    CanRxCounterWarning = 34,       ///< The RX error counter of the CAN cell is in the warning range.
    CanRxCounterErrorPassive = 35,  ///< The RX error counter of the CAN cell is in the passive range.
    CanProtStuffError = 49,         ///< Signals that a protocol stuffing error occured.
    CanProtFormError = 50,          ///< Signals that a protocol form error occured.
    CanProtAckError = 51,           ///< Signals that a acknowledge error occured.
    CanProtBitError = 52,           ///< Signals that a bit error occured.
    CanProtCrcError = 53            ///< Signals that a CRC error occured.
} TCanError;

/// CAN transceiver.
/// \ingroup ABI
typedef enum
{
    canTransceiverSlow = 1,                 ///< Fault tolerant CAN transceiver (TJA 1080).
    canTransceiverFast = 2,                 ///< Highspeed CAN transceiver (TJA 1054).
    canTransceiverSingleWireNormal = 3,     ///< Signle wire CAN transceiver (NCV7356). Normal mode.
    canTransceiverSingleWireHighSpeed = 4,  ///< Signle wire CAN transceiver (NCV7356). High speed mode.
    canTransceiverSingleWireHighVoltage = 5 ///< Signle wire CAN transceiver (NCV7356). High voltage mode.
} CanTransceiver; 

/// CAN baudrate settings.
/// \ingroup ABI
typedef enum
{
    canSpeed83 = 1,             ///< Baudrate 83,3 kbps.
    canSpeed100 = 2,            ///< Baudrate 100 kbps.
    canSpeed125 = 3,            ///< Baudrate 125 kbps.
    canSpeed500 = 4,            ///< Baudrate 500 kbps.
    canSpeed33 = 5,             ///< Baudrate 33,3 kbps.
    canSpeed66 = 6,             ///< Baudrate 66,6 kbps.
    canSpeed1000 = 7,           ///< Baudrate 1000 kbps.
    canSpeed250 = 8,            ///< Baudrate 250 kbps.
    canSpeedIndividual = 0xFF   ///< Individual Baudrate.
}  CanSpeed;

/// TX Status of CAN.
/// \ingroup ABI
typedef enum {
    canSuccess = 0x00,  ///< Message was sent successful.
    canFailed = 0x01    ///< Message sending has failed.
} CanTxStatus;

/// Adressing type of CAN transport protocol.
/// \ingroup ABI
typedef enum
{
    tpNormal = 1,   ///< ISO CAN TP normal addressing.
    tpExtended = 2  ///< ISO CAN TP extended addressing.
} TPAddressingType;

/// CAN transport protocol errors.
/// \ingroup ABI
typedef enum
{
    tpSuccess = 0,                      ///< Successful TP operation.
    tpOutOfMemory = 1,                  ///< Out of memory during receiving of the first frame.
    tpBadSingleFrame = 2,               ///< Bad single frame.
    tpBadFirstFrameLength = 3,          ///< Bad length of the first frame.
    tpBadFirstFrame = 4,                ///< Bad first frame.
    tpBadConsecutiveFrameLength = 5,    ///< Bad length of the consecutive frame
    tpBadConsecutiveFrameSequence = 6,  ///< Bad sequence number of the consecutive frame.
    tpBadMessageLength = 7,             ///< Bad message length.
    tpBadFlowStatus = 8,                ///< Bad flow status of the TP driver.
    tpUnexpectedFrame = 9,              ///< Unexpected frame received.
    tpUnexpectedCtrlInfo = 10,          ///< Unexpected control information.
    tpConsecutiveFrameTimeout = 11,     ///< Timeout for the consecutive frame.
    tpFlowControlTimeout = 12,          ///< Timeout for the flow control.
    tpFlowControlCTSTimeout = 13        ///< Timeout for the control clear to send.
} TPOpResult;

/// LIN warnings and errors.
/// Members of this enum are used in event OnLinBusEvent().
/// \ingroup ABI
typedef enum
{
    LinUnknownError = 0xFF,                     ///< Unknown type of error.
    LinSyncHeaderError = 0x10,                  ///< No sync field after header.
    LinBreakHeaderError = 0x11,                 ///< Unexpected break in header.
    LinLowLevelFramingHeaderError = 0x21,       ///< Low level framing error in header.
    LinLowLevelOverflowHeaderError = 0x22,      ///< Low level overflow error in header.
    LinOverflowHeaderError = 0x23,              ///< New header started before previous has been read.
    LinParityHeaderError = 0x24,                ///< Header parity error.
    LinBreakResponseError = 0x31,               ///< Unexpected break in response.
    LinLowLevelFramingResponeError = 0x32,      ///< Low level framing error in response.
    LinLowLevelOverflowResponseError = 0x33,    ///< Low level overflow error in response.
    LinLengthResponseError = 0x34,              ///< Response length does not match expected length.
    LinChecksumResponseError = 0x35,            ///< Response checksum error.
    LinOverflowResponseError = 0x36,            ///< New response started before previous has been read.
    LinReadResponseError = 0x37                 ///< Error while try to read the response.
} TLinError;

/// LIN TP warnings and errors.
/// Members of this enum are used in event OnLinTpBusEvent().
/// \ingroup ABI
typedef enum
{
    LinTp_NoError = 0x50,               ///< No LIN-TP error was reported.
    LinTp_TxTimeOut = 0x51,             ///< LIN-TP Transmission timed out.
    LinTp_RxTimeOut = 0x52,             ///< LIN-TP Reception timed out.
    LinTp_TxBusy = 0x53,                ///< Can not send LIN-TP message, because TP communication is in progress.
    LinTp_NadError = 0x54,              ///< Received an other Node Address while a receiption was in progress.  
    LinTp_PciError = 0x55,              ///< Received an invalid Protocol Control Information (PCI) field.
    LinTp_InvalidLength = 0x56,         ///< Received an invalid length field or LIN frame was smaller than 8 Byte. 
    LinTp_InvalidFrameCounter = 0x57,   ///< Received an invalid frame counter value. This may happen if a frame was lost.
    LinTp_InvalidCfFrame = 0x58,        ///< Received an SF or FF frame. Expected to receive a CF frame.
    LinTp_RxStartWithCF = 0x59          ///< Received an CF frame at the begin of the reception.
} TLinTpError;

/// TX Status of LIN.
/// \ingroup ABI
typedef enum 
{
    linSuccess = 0x00,  ///< Message was sent successful.
    linFailed = 0x01    ///< Message sending has failed.
} LinTxStatus;

/// LIN spy event.
/// \ingroup ABI
typedef enum
{
    RxReady = 0x01,         ///< Data are available.
    RxFraming = 0x02,       ///< Frame error occured.
    RxBreak = 0x04,         ///< Break symbol received.
    RxOverrun = 0x08,       ///< Hardware queue overflow.
    RxPacketLength = 0x10   ///< LIN packet length is longer than allowed.
} TLinSpyEvent;

class IABI;

/*============================================================================*/
/// \brief Interface of ABI event listener.
/// \note Abstract base class. So it has to be implemented.
/// \ingroup ABI
/*============================================================================*/
class K2LABI_API IABIListener
{
public:
    virtual ~IABIListener() {}
    
    /// Called when error occured.
    /// \param[out] pAbi ABI instance that received event.
    virtual void OnError(IABI* pAbi) = 0;

    /// Called when message lost.
    /// \param[out] pAbi ABI instance that received event.
    virtual void OnMessageLost(IABI* pAbi) = 0;

    /// This event is raised on the first occurence (once), if a internal queue overflows. To read out the amount of occurrence and to clear the counter refer GetInternalState().
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] tEvent Enumeration identifying the source of problem.
    /// \param[out] param1 Reserved.
    /// \param[out] param2 Reserved.
    virtual void OnInternalEvent
        ( IABI* pAbi
        , unsigned long long timeStamp
        , Parameter tEvent
        , unsigned int param1
        , unsigned int param2
        ) = 0;

    /// This event can be raised for general purposes or costumer specific. The event will hold a string message, describing the event in human language.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] identifier Channel of the message. Delivers the possibility to group messages by their meanings.
    /// \param[out] payload The string which describes the event in human languange.
    /// \param[out] param2 Length of the string.
    virtual void OnGeneralEvent
        ( IABI* pAbi
        , unsigned long long timeStamp
        , BYTE identifier
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// This event will be raised, when state of bus is changed by another process.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method. (Bus context)
    /// \param[out] timeStamp The occurrence of the event, represented in steps of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] isStarted true: The bus has been started by another process. false: The bus has been stopped by another process.
    /// \param[out] param1 Parameter1.
    /// \param[out] param2 Parameter2.
    /// \note isStarted = false: param1 = 0; param2 = 0
    /// \note isStarted = true:
    /// \note LINx: param1 = 0; param2 = 0
    /// \note CANx: param1 = baudrate (type=CanSpeed); param2 = type of transceiver (type=CanTransceiver)
    /// \note FLEXRAYx: param1 = 0; param2 = 0
    /// \note MOST_CONTROL_AMSx: param1 = device mode (type=MostMode); param2 = 0
    virtual void OnBusRunningStateChanged
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , bool isStarted
        ) = 0;

    /// This event will be raised, when state of relay is changed by another process.
    /// \param[out] abi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method. (Bus context)
    /// \param[out] timeStamp The occurrence of the event, represented in steps of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] isClosed If true the relay is closed. 
    virtual void OnRelayStateChanged
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , bool isClosed
        ) = 0;

    
    /// This event will be raised, when state of tx payload filter is changed by another process.
    /// \param[out] abi ABI instance that received event.
    /// \param[out] context Delivers the object, which was stored by the RegisterBusContext() method. (Bus context)
    /// \param[out] timeStamp The occurrence of the event, represented in steps of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] isEnabled If true no payload is transmitted in tx events otherwise false.
    virtual void OnTxPayloadFilterChanged
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , bool isEnabled
        ) = 0;

    /// This event will be raised, when an object has changed its state.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] context Delivers the object, which was stored by the RegisterBusContext() method. (Bus context)
    /// \param[out] timeStamp The occurrence of the event, represented in steps of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] type The type of the object.
    /// \param[out] handle The handle.
    /// \param[out] groupId The group id.
    /// \param[out] state The state of the object.
    virtual  void OnObjectStateChanged
        ( IABI* pAbi
            , void* pContext
            , unsigned long long  timeStamp
            , Bus bus
            , ObjectType type
            , unsigned short handle
            , BYTE groupId
            , ObjectState state
            ) = 0;

    /// This event will be raised, when a CAN Message has been received.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method. (Bus context)
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] payload The payload which was attached to the message.
    /// \param[out] payloadLength The length of the attached payload.
    virtual void OnCanRxMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , unsigned int messageId
        , bool extended
        , BYTE* payload
        , int payloadLength
        ) = 0;
    
    /// This event will be raised, when a CAN Message has been succesful sent.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] extended Determinates if the CAN message used a CAN extended 29 bit identifier. True, if 29bit Identifier used. False if 11bit Identifier was used.
    /// \param[out] payload The payload which was attached to the message.
    /// \param[out] payloadLength The length of the attached payload.
    virtual void OnCanTxMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , unsigned short handle
        , Bus bus
        , unsigned int messageId
        , bool extended
        , BYTE* payload
        , int payloadLength
        ) = 0;
    
    /// This event will be raised, when a CAN Message was not transmitted, because of bus errors.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] extended Determinates if the CAN message used a CAN extended 29 bit identifier. True, if 29bit Identifier used. False if 11bit Identifier was used.
    /// \param[out] payload The payload which was attached to the message.
    /// \param[out] payloadLength The length of the attached payload.
    virtual void OnCanTxFailedMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , unsigned short handle
        , Bus bus
        , unsigned int messageId
        , bool extended
        , BYTE* payload
        , int payloadLength
        ) = 0;
    
    /// This event will be raised, when a CAN bus error has occured.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] evt Enumeration identifying the type of bus event.
    /// \param[out] error Enumeration identifying the type of bus error.
    virtual void OnCanBusError
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , TBusEvent evt
        , TCanError error
        ) = 0;

    /// This event will be raised, when a MOST Message has been received.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] rcvType Enumeration identifying the type of receive message.
    /// \param[out] source Address of source.
    /// \param[out] prot MOST protocol.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] fBlock The Function Block identifier.
    /// \param[out] instance The Function Block instance number.
    /// \param[out] function The function identifier of the FBlock.
    /// \param[out] opType The Function Block operation type identifier.
    /// \param[out] payload Message payload.
    /// \param[out] payloadLength Payload length.
    virtual void OnMostRxMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , ReceiveType rcvType
        , unsigned short source
        , MostProtocol prot
        , unsigned int messageId
        , BYTE fBlock
        , BYTE instance
        , unsigned short function
        , BYTE opType
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// This event will be raised, when a MOST Message has been received.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] status The status of reception.
    /// \param[out] rcvType Enumeration identifying the type of receive message.
    /// \param[out] source Address of source.
    /// \param[out] prot MOST protocol.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] fBlock The Function Block identifier.
    /// \param[out] instance The Function Block instance number.
    /// \param[out] function The function identifier of the FBlock.
    /// \param[out] opType The Function Block operation type identifier.
    /// \param[out] payload Message payload.
    /// \param[out] payloadLength Payload length.
    virtual void OnMostRxFailedMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , MostRxStatus status
        , ReceiveType rcvType
        , unsigned short source
        , MostProtocol prot
        , unsigned int messageId
        , BYTE fBlock
        , BYTE instance
        , unsigned short function
        , BYTE opType
        , BYTE* payload
        , int payloadLength) = 0;

    /// This event will be raised, when a MOST High Message has been received (>64kb).
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] status The status of reception.
    /// \param[out] rcvType Enumeration identifying the type of receive message.
    /// \param[out] source Address of source.
    /// \param[out] prot MOST protocol.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] fBlock The Function Block identifier.
    /// \param[out] instance The Function Block instance number.
    /// \param[out] function The function identifier of the FBlock.
    /// \param[out] opType The Function Block operation type identifier.
    /// \param[out] segmentationId The segmentation identifier of this data block.
    /// \param[out] blockCounter The relative block counter of the data block in this packet transmission.
    /// \param[out] payload Message payload.
    /// \param[out] payloadLength Payload length.
    virtual void OnMostHighExtRxMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , MostRxStatus status
        , ReceiveType rcvType
        , unsigned short source
        , MostProtocol prot
        , unsigned int messageId
        , BYTE fBlock
        , BYTE instance
        , unsigned short function
        , BYTE opType
        , BYTE segmentationId
        , unsigned short blockCounter
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// This event will be raised, when a MOST Message has been succesful sent.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] destination Address of destination.
    /// \param[out] prot MOST protocol.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] fBlock The Function Block identifier.
    /// \param[out] instance The Function Block instance number.
    /// \param[out] function The function identifier of the FBlock.
    /// \param[out] opType The Function Block operation type identifier.
    /// \param[out] payload Message payload.
    /// \param[out] payloadLength Payload length.
    virtual void OnMostTxMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , unsigned short handle
        , Bus bus
        , unsigned short destination
        , MostProtocol prot
        , unsigned int messageId
        , BYTE fBlock
        , BYTE instance
        , unsigned short function
        , BYTE opType
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// This event will be raised, when a MOST Message was not transmitted, because the receiver did not correctly acknowledge the message.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] destination Address of destination.
    /// \param[out] prot MOST protocol.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] fBlock The Function Block identifier.
    /// \param[out] instance The Function Block instance number.
    /// \param[out] function The function identifier of the FBlock.
    /// \param[out] opType The Function Block operation type identifier.
    /// \param[out] payload Message payload.
    /// \param[out] payloadLength Payload length.
    virtual void OnMostTxNAKMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , unsigned short handle
        , Bus bus
        , unsigned short destination
        , MostProtocol prot
        , unsigned int messageId
        , BYTE fBlock
        , BYTE instance
        , unsigned short function
        , BYTE opType
        , BYTE* payload
        , int payloadLength) = 0;

    /// This event will be raised, when a MOST Message was not transmitted, because of bus errors.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] status Result status of transmission.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] destination Address of destination.
    /// \param[out] prot MOST protocol.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] fBlock The Function Block identifier.
    /// \param[out] instance The Function Block instance number.
    /// \param[out] function The function identifier of the FBlock.
    /// \param[out] opType The Function Block operation type identifier.
    /// \param[out] payload Message payload.
    /// \param[out] payloadLength Payload length.
    virtual void OnMostTxFailedMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , MostTxStatus status
        , unsigned short handle
        , Bus bus
        , unsigned short destination
        , MostProtocol prot
        , unsigned int messageId
        , BYTE fBlock
        , BYTE instance
        , unsigned short function
        , BYTE opType
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// This event will be raised, when a MOST specific bus event has occured.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] evt Bus event identifier.
    /// \param[out] param1 Depending on the type of bus event (evt), this parameter holds the main value which belongs to this event. This value is used for MPR, NPR, preset SBC (value >> 16 & 0xff), current SBC (value >> 8 & 0xff), total SBC (value & 0xff), group address (value | 0x300), node address.
    /// \param[out] param2 Depending on the type of bus event (evt), this parameter holds the additional value which belongs to this event. This value is used for the free SBC (value >> 16 & 0xff), packet SBC (value >> 8 & 0xff), used SBC (value & 0xff).
    virtual void OnMostEventMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , TBusEvent evt
        , unsigned int param1
        , unsigned int param2
        ) = 0;

    /// This event will be raised, when a MOST High receive status event has occured.
    /// \param[out] abi Used IABI instance.
    /// \param[out] context Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp The occurrence of the event, represented in steps of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] status Status of event.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] fBlock The Function Block identifier.
    /// \param[out] instance The Function Block instance number.
    /// \param[out] function The function identifier of the FBlock.
    /// \param[out] opType The Function Block operation type identifier.
    /// \param[out] source Address of source.
    virtual void OnMostHighRxStatusEvent
        ( IABI* abi
        , void* context
        , unsigned long long timeStamp
        , Bus bus
        , MostRxStatus status
        , unsigned int messageId
        , BYTE fBlock
        , BYTE instance
        , unsigned short function
        , BYTE opType
        , unsigned short source
        ) = 0;

    /// This event will be raised, when a MOST High transmit status event has occured.
    /// \param[out] abi Used IABI instance.
    /// \param[out] context Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp The occurrence of the event, represented in steps of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] status Status of event.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] fBlock The Function Block identifier.
    /// \param[out] instance The Function Block instance number.
    /// \param[out] function The function identifier of the FBlock.
    /// \param[out] opType The Function Block operation type identifier.
    /// \param[out] destination Address of destination.
    virtual void OnMostHighTxStatusEvent
        ( IABI* abi
        , void* context
        , unsigned long long timeStamp
        , Bus bus
        , MostTxStatus status
        , unsigned int messageId
        , BYTE fBlock
        , BYTE instance
        , unsigned short function
        , BYTE opType
        , unsigned short destination
        ) = 0;

    /// Called when an action with the audio streaming interface was successful.
    /// \param[out] pAbi Used IABI instance.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] label The connection label.
    /// \param[out] type Type of event.
    /// \param[out] bandwith The bandwith.
    /// \param[out] isOpenEvent If true the action was an open action otherwise it was close.
    /// \param[out] connector The used audio connector.
    virtual void OnMostAudioStreamingEvent
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , unsigned int label
        , AudioConnectionType type
        , AudioBandwidth bandwith
        , bool isOpenEvent
        , AudioConnectorType connector
        ) = 0;

    /// Called when an action with the audio streaming interface has failed.
    /// \param[out] pAbi Used IABI instance.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] error The errorcode.
    /// \param[out] type Type of event.
    /// \param[out] bandwith The bandwith.
    /// \param[out] isOpenEvent If true the action was an open action otherwise it was close.
    /// \param[out] connector The used audio connector.
    virtual void OnMostAudioStreamingError
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , unsigned short error
        , AudioConnectionType type
        , AudioBandwidth bandwith
        , bool isOpenEvent
        , AudioConnectorType connector
        ) = 0;

    /// Called when the allocation table in SPYNIC changed.
    /// \param[out] pAbi Used IABI instance.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] length Length of the lists.
    /// \param[out] connectionLabels List of available connectionlabels.
    /// \param[out] channelWidths List of channel widths of connection labels.
    /// \remarks Only available for MOST50.
    virtual void OnMostAllocationTableChanged
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , unsigned short& length
        , AllocationTableEntry* allocationTable
        ) = 0;

    /// This event will be raised, when a MOST MEP Message has been transmitted.
    /// \param[out] abi Used IABI instance.
    /// \param[out] context Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp The occurrence of the event, represented in steps of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] destination The destination address.
    /// \param[out] payload The payload which was attached to the message.
    /// \param[out] payloadLength The length of the attached payload.
    virtual void OnMostMepTxMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , unsigned short handle
        , Bus bus
        , unsigned long long destination
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// This event will be raised, when a MOST MEP Message has been received.
    /// \param[out] abi Used IABI instance.
    /// \param[out] context Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp The occurrence of the event, represented in steps of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] source The source address.
    /// \param[out] payload The payload which was attached to the message.
    /// \param[out] payloadLength The length of the attached payload.
    virtual void OnMostMepRxMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , unsigned long long source
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// Called when MOST MEP bridge status changed.
    /// \param[out] abi Used IABI instance.
    /// \param[out] context Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp The occurrence of the event, represented in steps of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] isEnabled If set to <c>true</c> bridge is enabled otherwise <c>false</c>.
    /// \param[out] options Activated options.
    virtual void OnMostMepBridgeStatusChanged
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , bool isEnabled
        , MepBridgeOptions options
        ) = 0;

    /// Called when MOST MAC address changed.
    /// \param[out] abi Used IABI instance.
    /// \param[out] context Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp The occurrence of the event, represented in steps of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] macAddress The mac address that have been set.
    virtual void OnMostMacAddressChanged
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , unsigned long long macAddress
        ) = 0;

    /// This event will be raised, when a LIN Message has been received.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] sourceAddress The idententifier identifying the source device.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] payload The payload which was attached to the message.
    /// \param[out] payloadLength The length of the attached payload.
    virtual void OnLinRxMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , unsigned int sourceAddress
        , unsigned int messageId
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// This event will be raised, when a LIN Message has been succesful sent.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] targetAddress The idententifier addressing the target device.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] payload The payload which was attached to the message.
    /// \param[out] payloadLength The length of the attached payload.
    virtual void OnLinTxMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , unsigned short handle
        , Bus bus
        , unsigned int targetAddress
        , unsigned int messageId
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// This event will be raised, when a LIN Message was not transmitted, because of bus errors.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] targetAddress The idententifier addressing the target device.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] payload The payload which was attached to the message.
    /// \param[out] payloadLength The length of the attached payload.
    virtual void OnLinTxFailedMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , unsigned short handle
        , Bus bus
        , unsigned int targetAddress
        , unsigned int messageId
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// This event will be raised, when a LIN bus error has occured.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] evt Enumeration identifying the type of bus event.
    /// \param[out] error Enumeration identifying the type of bus error.
    virtual void OnLinBusError
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , TBusEvent evt
        , TLinError error
        ) = 0;

    /// This event will be raised, when a LIN TP Message has been received.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] frameId Identifier of message. Request is 60 and response is 61.
    /// \param[out] nodeAddress Address of the target node.
    /// \param[out] serviceId Identifier of the service.
    /// \param[out] payload The payload which was attached to the message.
    /// \param[out] payloadLength The length of the attached payload.
    virtual void OnLinTpRxMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , unsigned int messageId
        , BYTE frameId
        , BYTE nodeAddress
        , BYTE serviceid
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// This event will be raised, when a LIN TP Message has been succesful sent.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] frameId Identifier of message. Request is 60 and response is 61.
    /// \param[out] nodeAddress Address of the target node.
    /// \param[out] serviceId Identifier of the service.
    /// \param[out] payload The payload which was attached to the message.
    /// \param[out] payloadLength The length of the attached payload.
    virtual void OnLinTpTxMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , unsigned short handle
        , Bus bus
        , unsigned int messageId
        , BYTE frameId
        , BYTE nodeAddress
        , BYTE serviceid
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// This event will be raised, when a LIN TP Message was not transmitted, because of bus errors.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] frameId Identifier of message. Request is 60 and response is 61.
    /// \param[out] nodeAddress Address of the target node.
    /// \param[out] serviceId Identifier of the service.
    /// \param[out] payload The payload which was attached to the message.
    /// \param[out] payloadLength The length of the attached payload.
    virtual void OnLinTpTxFailedMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , unsigned short handle
        , Bus bus
        , unsigned int messageId
        , BYTE frameId
        , BYTE nodeAddress
        , BYTE serviceid
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// This event will be raised, when a LIN TP bus error has occured.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] evt Enumeration identifying the type of bus event.
    /// \param[out] error Enumeration identifying the type of bus error.
    virtual void OnLinTpBusError
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , TBusEvent evt
        , TLinTpError error
        ) = 0;

    /// This event will be raised, when a LIN Spy event has been received.
    /// \param[out] pAbi Used IABI instance.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp The occurrence of the event, represented in steps of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] evt Bitmask. Use TLinSpyEvent to decode it.
    virtual void OnLinSpyEvent
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , TLinSpyEvent evt
        ) = 0;

    /// This event will be raised, when a LIN Spy message has been received.
    /// \param[out] pAbi Used IABI instance.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp The occurrence of the event, represented in steps of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] payload The payload.
    virtual void OnLinSpyMessage
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , BYTE payload
        ) = 0;

    /// This event will be raised, when a FlexRay Message has been received.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] frameId The frame identifier.
    /// \param[out] offset The offset of the used frame cycle.
    /// \param[out] repetition The repetition of the used frame cycle.
    /// \param[out] frChannel The used FlexRay channel(s).
    /// \param[out] frCycle The cycle slot used for this message.
    /// \param[out] payload The payload which was attached to the message.
    /// \param[out] payloadLength The length of the attached payload.
    virtual void OnFlexrayRxMessage       
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , unsigned int messageId
        , unsigned short frameId
        , BYTE offset
        , BYTE repetition
        , FrChannel frChannel
        , unsigned short frCycle
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// This event will be raised, when a FlexRay Message has been succesful sent.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] frameId The frame identifier.
    /// \param[out] offset The offset of the used frame cycle.
    /// \param[out] repetition The repetition of the used frame cycle.
    /// \param[out] frChannel The used FlexRay channel(s).
    /// \param[out] frCycle The cycle slot used for this message.
    /// \param[out] payload The payload which was attached to the message.
    /// \param[out] payloadLength The length of the attached payload.
    virtual void OnFlexrayTxMessage       
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , unsigned short handle
        , Bus bus
        , unsigned int messageId
        , unsigned short frameId
        , BYTE offset
        , BYTE repetition
        , FrChannel frChannel
        , unsigned short frCycle
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// This event will be raised, when a FlexRay Message was not transmitted, because of bus errors.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] messageId The identifier of the message.
    /// \param[out] frameId The frame identifier.
    /// \param[out] offset The offset of the used frame cycle.
    /// \param[out] repetition The repetition of the used frame cycle.
    /// \param[out] frChannel The used FlexRay channel(s).
    /// \param[out] frCycle The cycle slot used for this message.
    /// \param[out] payload The payload which was attached to the message.
    /// \param[out] payloadLength The length of the attached payload.
    virtual void OnFlexrayTxFailedMessage 
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , unsigned short handle
        , Bus bus
        , unsigned int messageId
        , unsigned short frameId
        , BYTE offset
        , BYTE repetition
        , FrChannel frChannel
        , unsigned short frCycle
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// This event will be raised, when a FlexRay specific bus event has occured.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] param1 Depending on the type of bus event (evt), this parameter holds the main value which belongs to this event.
    /// \param[out] param2 Depending on the type of bus event (evt), this parameter holds the additional value which belongs to this event.
    virtual void OnFlexrayEventMessage    
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , TBusEvent evt
        ) = 0;

    /// This event will be raised, when a CAN TP Message has been received.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] srcmessageId The CAN TP source address.
    /// \param[out] destmessageId  The CAN TP destination address.
    /// \param[out] tpAddressingType Determinates the type of CAN TP protocol. 
    /// \param[out] tpOpResult Enumaration determinating the result of the CAN TP transmission.
    /// \param[out] payload The payload which was attached to the message.
    /// \param[out] payloadLength The length of the attached payload.
    virtual void OnCanTpRxMessage 
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , unsigned short handle
        , Bus bus
        , unsigned int srcMessageId
        , unsigned int destMessageId
        , TPAddressingType tpAddressingType
        , TPOpResult tpOpResult
        , BYTE* payload
        , int payloadLength
        ) = 0;

    /// This event will be raised, when a CAN TP Message has been succesful sent.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] handle The handle which was given to the correspondic transmitter / receiver.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] srcmessageId The CAN TP source address.
    /// \param[out] destmessageId  The CAN TP destination address.
    /// \param[out] tpAddressingType Determinates the type of CAN TP protocol. 
    /// \param[out] tpOpResult Enumaration determinating the result of the CAN TP transmission.
    virtual void OnCanTpTxMessage 
        ( IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , unsigned short handle
        , Bus bus
        , unsigned int srcMessageId
        , unsigned int destMessageId
        , TPAddressingType tpAddressingType
        , TPOpResult tpOpResult
        ) = 0;

    /// This event will be raised, when e.g the configuration of CAN TP has changed.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] pContext Delivers the object, which was stored by the RegisterBusContext() method.
    /// \param[out] timeStamp Timestamp of event in unit of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] evt Enumeration identifying the type of bus event.
    /// \param[out] param1 Depending on the type of bus event (evt), this parameter holds the main value which belongs to this event.
    /// \param[out] param2 Depending on the type of bus event (evt), this parameter holds the additional value which belongs to this event.
    virtual void OnCanEventMessage
        (IABI* pAbi
        , void* pContext
        , unsigned long long timeStamp
        , Bus bus
        , TBusEvent evt
        , unsigned int param1
        , unsigned int param2
        ) = 0;
            
    /// This event will be raised, when a message is received by the StressNIC.
    /// \param[out] pAbi ABI instance that received event.
    /// \param[out] context Delivers the object, which was stored by the RegisterBusContext() method. (Bus context)
    /// \param[out] timeStamp The occurrence of the event, represented in steps of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] deviceid The source device id.
    /// \param[out] fblockId The fblock identifier.
    /// \param[out] instanceId The instance identifier.
    /// \param[out] functionId The function identifier.
    /// \param[out] opType The operation type.
    /// \param[out] payload The payload.
    /// \param[out] payloadLength The payload length.
    virtual void OnStressNicMessageReceived
        (IABI* abi
        , void* context
        , unsigned long long timeStamp
        , Bus bus
        , unsigned short deviceid
        , BYTE fblockId
        , BYTE instanceId
        , unsigned short functionId
        , BYTE opType
        , BYTE* payload
        , int payloadLength) = 0;

    /// Called when trigger level changed.
    /// \param[out] abi ABI instance that received event.
    /// \param[out] context Delivers the object, which was stored by the RegisterBusContext() method. (Bus context)
    /// \param[out] timeStamp The occurrence of the event, represented in steps of 100 nanoseconds.
    /// \param[out] bus The type and instance number of the bus.
    /// \param[out] isActive true if the trigger level is active, otherwise false.
    /// \param[out] isTx true if the trigger level was changed by MOCCA compact, otherwise false.
    virtual void OnTriggerLevelChanged
        (IABI* abi
        , void* context
        , unsigned long long timeStamp
        , Bus bus
        , bool isActive
        , bool isTx) = 0;
};

/*============================================================================*/
/// \brief Default implementation of IABIListener interface. To add custom functionality override the desired function with own code.
/// \ingroup ABI
/*============================================================================*/
class K2LABI_API CABIListener : public IABIListener
{
public:
    virtual ~CABIListener() {}

    virtual void OnError(IABI* pAbi) {}
    virtual void OnMessageLost(IABI* pAbi) {}

    virtual void OnInternalEvent (IABI* pAbi, unsigned long long timeStamp, Parameter tEvent, unsigned int param1, unsigned int param2){}
    virtual void OnGeneralEvent (IABI* pAbi, unsigned long long timeStamp, BYTE identifier, BYTE* payload, int payloadLength){}
    virtual void OnBusRunningStateChanged ( IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, bool isStarted){}
    virtual void OnRelayStateChanged( IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, bool isClosed){}
    virtual void OnTxPayloadFilterChanged( IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, bool isEnabled){}
    virtual void OnObjectStateChanged( IABI* pAbi, void* pContext, unsigned long long  timeStamp, Bus bus, ObjectType type, unsigned short handle, BYTE groupId, ObjectState state){}

    virtual void OnCanRxMessage       (IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, unsigned int messageId, bool extended, BYTE* payload, int payloadLength){}
    virtual void OnCanTxMessage       (IABI* pAbi, void* pContext, unsigned long long timeStamp, unsigned short handle, Bus bus, unsigned int messageId, bool extended, BYTE* payload, int payloadLength){}
    virtual void OnCanTxFailedMessage (IABI* pAbi, void* pContext, unsigned long long timeStamp, unsigned short handle, Bus bus, unsigned int messageId, bool extended, BYTE* payload, int payloadLength){}
    virtual void OnCanBusError        (IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, TBusEvent evt, TCanError error){}
    virtual void OnCanEventMessage    (IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, TBusEvent evt, unsigned int param1, unsigned int param2){}

    virtual void OnMostRxMessage       (IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, ReceiveType rcvType, unsigned short source, MostProtocol prot, unsigned int messageId, BYTE fBlock, BYTE instance, unsigned short function, BYTE opType, BYTE* payload, int payloadLength){}
    virtual void OnMostRxFailedMessage       (IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, MostRxStatus status, ReceiveType rcvType, unsigned short source, MostProtocol prot, unsigned int messageId, BYTE fBlock, BYTE instance, unsigned short function, BYTE opType, BYTE* payload, int payloadLength){}
    virtual void OnMostHighExtRxMessage       (IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, MostRxStatus status, ReceiveType rcvType, unsigned short source, MostProtocol prot, unsigned int messageId, BYTE fBlock, BYTE instance, unsigned short function, BYTE opType, BYTE segmentationId, unsigned short blockCounter, BYTE* payload, int payloadLength){}
    virtual void OnMostTxMessage       (IABI* pAbi, void* pContext, unsigned long long timeStamp, unsigned short handle, Bus bus, unsigned short destination, MostProtocol prot, unsigned int messageId, BYTE fBlock, BYTE instance, unsigned short function, BYTE opType, BYTE* payload, int payloadLength){}
    virtual void OnMostTxNAKMessage       (IABI* pAbi, void* pContext, unsigned long long timeStamp, unsigned short handle, Bus bus, unsigned short destination, MostProtocol prot, unsigned int messageId, BYTE fBlock, BYTE instance, unsigned short function, BYTE opType, BYTE* payload, int payloadLength){}
    virtual void OnMostTxFailedMessage       (IABI* pAbi, void* pContext, unsigned long long timeStamp, MostTxStatus status, unsigned short handle, Bus bus, unsigned short destination, MostProtocol prot, unsigned int messageId, BYTE fBlock, BYTE instance, unsigned short function, BYTE opType, BYTE* payload, int payloadLength){}
    virtual void OnMostEventMessage    (IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, TBusEvent evt, unsigned int param1, unsigned int param2) {}
    virtual void OnMostHighRxStatusEvent(IABI* abi, void* context, unsigned long long timeStamp, Bus bus, MostRxStatus status, unsigned int messageId, BYTE fBlock, BYTE instance, unsigned short function, BYTE opType, unsigned short source) {}     
    virtual void OnMostHighTxStatusEvent(IABI* abi, void* context, unsigned long long timeStamp, Bus bus, MostTxStatus status, unsigned int messageId, BYTE fBlock, BYTE instance, unsigned short function, BYTE opType, unsigned short destination) {}

    virtual void OnMostAudioStreamingEvent(IABI* pAbi, void* pContext, unsigned long long timeStamp, unsigned int label, AudioConnectionType type, AudioBandwidth bandwith, bool isOpenEvent, AudioConnectorType connector){}
    virtual void OnMostAudioStreamingError(IABI* pAbi, void* pContext, unsigned long long timeStamp, unsigned short error, AudioConnectionType type, AudioBandwidth bandwith, bool isOpenEvent, AudioConnectorType connector){}
    virtual void OnMostAllocationTableChanged( IABI* pAbi, void* pContext, unsigned long long timeStamp, unsigned short& length, AllocationTableEntry* allocationTable){}

    virtual void OnLinRxMessage(IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, unsigned int sourceAddress, unsigned int messageId, BYTE* payload, int payloadLength){}
    virtual void OnLinTxMessage(IABI* pAbi, void* pContext, unsigned long long timeStamp, unsigned short handle, Bus bus, unsigned int targetAddress, unsigned int messageId, BYTE* payload, int payloadLength){}
    virtual void OnLinTxFailedMessage(IABI* pAbi, void* pContext, unsigned long long timeStamp, unsigned short handle, Bus bus, unsigned int targetAddress, unsigned int messageId, BYTE* payload, int payloadLength){}
    virtual void OnLinBusError(IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, TBusEvent evt, TLinError error){}
    virtual void OnLinTpRxMessage( IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, unsigned int messageId, BYTE frameId, BYTE nodeAddress, BYTE serviceid, BYTE* payload, int payloadLength) {}
    virtual void OnLinTpTxMessage( IABI* pAbi, void* pContext, unsigned long long timeStamp, unsigned short handle, Bus bus, unsigned int messageId, BYTE frameId, BYTE nodeAddress, BYTE serviceid, BYTE* payload, int payloadLength) {}
    virtual void OnLinTpTxFailedMessage( IABI* pAbi, void* pContext, unsigned long long timeStamp, unsigned short handle, Bus bus, unsigned int messageId, BYTE frameId, BYTE nodeAddress, BYTE serviceid, BYTE* payload, int payloadLength) {}
    virtual void OnLinTpBusError( IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, TBusEvent evt, TLinTpError error) {}
    virtual void OnLinSpyEvent( IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, TLinSpyEvent evt) {}
    virtual void OnLinSpyMessage( IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, BYTE payload) {}

    virtual void OnFlexrayRxMessage       (IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, unsigned int messageId, unsigned short frameId, BYTE offset, BYTE repetition, FrChannel frChannel, unsigned short frCycle, BYTE* payload, int payloadLength){}
    virtual void OnFlexrayTxMessage       (IABI* pAbi, void* pContext, unsigned long long timeStamp, unsigned short handle, Bus bus, unsigned int messageId, unsigned short frameId, BYTE offset, BYTE repetition, FrChannel frChannel, unsigned short frCycle, BYTE* payload, int payloadLength){}
    virtual void OnFlexrayTxFailedMessage (IABI* pAbi, void* pContext, unsigned long long timeStamp, unsigned short handle, Bus bus, unsigned int messageId, unsigned short frameId, BYTE offset, BYTE repetition, FrChannel frChannel, unsigned short frCycle, BYTE* payload, int payloadLength){}
    virtual void OnFlexrayEventMessage    (IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, TBusEvent evt){}

    virtual void OnCanTpRxMessage (IABI* pAbi, void* pContext, unsigned long long timeStamp, unsigned short handle, Bus bus, unsigned int srcMessageId, unsigned int destMessageId, TPAddressingType tpAddressingType, TPOpResult tpOpResult, BYTE* payload, int payloadLength){}
    virtual void OnCanTpTxMessage (IABI* pAbi, void* pContext, unsigned long long timeStamp, unsigned short handle, Bus bus, unsigned int srcMessageId, unsigned int destMessageId, TPAddressingType tpAddressingType, TPOpResult tpOpResult){}

    virtual void OnStressNicMessageReceived (IABI* abi, void* context, unsigned long long timeStamp, Bus bus, unsigned short deviceId, BYTE fblockId, BYTE instanceId, unsigned short functionId, BYTE opType, BYTE* payload, int payloadLength) {}

    virtual void OnMostMepTxMessage ( IABI* pAbi, void* pContext, unsigned long long timeStamp, unsigned short handle, Bus bus, unsigned long long destination, BYTE* payload, int payloadLength ) {}
    virtual void OnMostMepRxMessage( IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, unsigned long long source, BYTE* payload, int payloadLength) {}
    virtual void OnMostMepBridgeStatusChanged( IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, bool isEnabled, MepBridgeOptions options ) {}
    virtual void OnMostMacAddressChanged( IABI* pAbi, void* pContext, unsigned long long timeStamp, Bus bus, unsigned long long macAddress ) {}
    
    virtual void OnTriggerLevelChanged (IABI* abi, void* context, unsigned long long timeStamp, Bus bus, bool isActive, bool isTx) {}
};

/*============================================================================*/
/// \brief Helper class to initialize the ABI device.
/// \ingroup ABI
/*============================================================================*/

typedef void (AbiIpcDevice_RxCB_t)( const uint8_t * data, uint32_t dataLength, void *cbArg);
            
class K2LABI_API AbiIpcDevice
{
public:
    virtual ~AbiIpcDevice() {}
    virtual int Send( const BYTE *data, DWORD length ) { return 0; }
    virtual void SetReceivePriority( int prio ) {};
    virtual void SetReceiveCallback( AbiIpcDevice_RxCB_t receiveCB, void *cbArg ) {};
};
            
/*============================================================================*/
/// \brief Interface of ABI.
/// \ingroup ABI
/*============================================================================*/
class K2LABI_API IABI
{
public:
    virtual ~IABI() { }

    /// Initialize ABI client instance.
    /// \param[in] pInitData Device that should be connected to.
    /// \return Status message if operation succeeded. For more informations see \ref TMErrorCode.
    virtual int Init(AbiIpcDevice* abiDevice) = 0;

    /// Initialize ABI client instance.
    /// \param[in] pInitData Device that should be connected to.
    /// \param[in] priority Priority of the receive thread.
    /// \return Status message if operation succeeded. For more informations see \ref TMErrorCode.
    virtual int Init(AbiIpcDevice* abiDevice, int priority) = 0;
    
    /// Deinitialize ABI client instance.
    /// \return Status message if operation succeeded. For more informations see \ref TMErrorCode.
    virtual int Deinit(void) = 0;
    
    /// Start event processing of the ABI client.
    /// \param[in] Listener that should be process incoming events.
    virtual void Start(IABIListener* pListener) = 0;
    
    /// Stop event processing of the ABI client.
    virtual void Stop(void) = 0;
    
    /// Gives the possibility to assign a object to a specific bus. This object will be given back in every callback which the specific bus was involved.
    virtual void RegisterBusContext(Bus bus, void* context) = 0;
    
    /// Removes a assigned a object from a specific bus.
    virtual void UnregisterBusContext(Bus bus) = 0;
    
    /// Returns the assigned object for the given bus.
    /// \return The assigned object for the given bus, or NULL if there is was nothing registered.
    virtual void* GetBusContext(Bus bus) = 0;
    
    /// Raw send method, which is internaly used by ABI to comunicate with ABI hardware.
    /// \param[in] ifc Addresses the internal processing unit in the ABI device.
    /// \param[in] function Function id which addresses the ABI command.
    /// \param[in] data The request data, which will be send to the ABI device.
    /// \param[in] len The length of the request data.
    /// \param[in] resultLen The length of the response, which was answered from the ABI device.
    /// \param[in] errorCode Errorcode, 0 if successful.
    /// \return Byte array containing the response from the ABI device.
    /// \remarks After this command a EndRequest call is required. 
    virtual BYTE* SendRequest(BYTE ifc, BYTE function, BYTE* data, int len, int& resultLen, BYTE& errorCode) = 0;
    
    /// Raw send method, which is internaly used by ABI to comunicate with ABI hardware.
    /// \param[in] ifc Addresses the internal processing unit in the ABI device.
    /// \param[in] function Function id which addresses the ABI command.
    /// \param[in] data The request data, which will be send to the ABI device.
    /// \param[in] len The length of the request data.
    /// \param[in] resultLen The length of the response, which was answered from the ABI device.
    /// \param[in] errorCode Errorcode, 0 if successful.
    /// \param[in] timeout Timespan to wait for an answer of this request (in milliseconds).
    /// \return Byte array containing the response from the ABI device.
    /// \remarks After this command a EndRequest call is required. 
    virtual BYTE* SendRequest(BYTE ifc, BYTE function, BYTE* data, int len, int& resultLen, BYTE& errorCode, int timeout) = 0;
     
    /// Ends the request.
    /// \remarks This call is required after analyzing the return value of SendRequest. Otherwise next Requests will be blocked.
    /// </remarks>
    virtual void EndRequest(void) = 0;

    /// Determinates if the ABI client is set into spy mode. When active, only harmless ABI commands are accepted. So no influence to the automotive buses is granted.
    /// \return TRUE if spy is active, otherwise FALSE.
    virtual bool  IsSpyMode(void) = 0;
    
    /// Sets the ABI client into spy mode. When active, only harmless ABI commands are accepted. So no influence to the automotive buses is granted.
    /// \param[in] bSpyMode Mode that should be set.
    virtual void  SetSpyMode(bool bSpyMode) = 0;

    /// Adds the id interval filter.
    /// \param[in] bus The bus on that the filter should set.
    /// \param[in] handle The handle that represents the filter.
    /// \param[in] minId The min id.
    /// \param[in] maxId The max id.
    virtual void AddIdIntervalFilter(Bus bus, unsigned short handle, unsigned int minId, unsigned int maxId) = 0;

    /// Adds the masked id filter.
    /// \param[in] bus The bus on that the filter should set.
    /// \param[in] handle The handle that represents the filter.
    /// \param[in] id The id.
    /// \param[in] mask The mask.
    virtual void AddMaskedIdFilter(Bus bus, unsigned short handle, unsigned int id, unsigned int mask) = 0;

    /// Deletes a selected filter.
    /// \param[in] handle The handle that represents the filter.
    virtual void RemoveFilter(unsigned short handle) = 0;
};

/*============================================================================*/
/// \brief Factory to create new ABI instances.
/// \ingroup ABI
/*============================================================================*/
class K2LABI_API CABIFactory
{
public:
    /// Creates new instance of ABI.
    /// \return New ABI instance.
    static IABI* CreateAbi();

    /// Destroys instance of ABI.
    /// \param[in] pAbi ABI instance to destroy.
    static void DestroyAbi(IABI* pAbi);

};

        }
    }
}

/*============================================================================*/
/* C Interface                                                                */
/*============================================================================*/

extern "C"
{
    K2LABI_API K2L::Automotive::ABI::IABI* CreateABI (void);
    K2LABI_API void  DestroyABI (K2L::Automotive::ABI::IABI* pAbi);
}

//@}
/*============================================================================*/
/* END OF FILE                                                                */
/*============================================================================*/