LtiMainLcChannelAgent constructor
- required Axi5SystemInterface sys,
- required LtiLcChannelInterface lc,
- required Component parent,
- String name = 'ltiMainLcChannelAgent',
- int? timeoutCycles,
- int? dropDelayCycles,
Constructs a new LtiMainLcChannelAgent.
Implementation
LtiMainLcChannelAgent({
required this.sys,
required this.lc,
required Component parent,
String name = 'ltiMainLcChannelAgent',
this.timeoutCycles,
this.dropDelayCycles,
}) : super(name, parent) {
// credit tracking per virtual channel
for (var i = 0; i < lc.vcCount; i++) {
_creditCounts.add(0);
}
sequencer =
Sequencer<LtiLcChannelPacket>('ltiMainLcChannelAgentSequencer', this);
driver = LtiLcChannelDriver(
parent: this,
sys: sys,
lc: lc,
sequencer: sequencer,
timeoutCycles: timeoutCycles,
dropDelayCycles: dropDelayCycles,
hasCredits: () => _creditCounts[0] > 0, // only 1 VC
updateCredits: () => _creditCounts[0]--,
);
monitor = LtiCreditMonitor(sys: sys, trans: lc, parent: this);
// credit returns
monitor.stream.listen((c) {
// only 1 VC
if (c.credit > 0) {
_creditCounts[0]++;
}
});
}