1
µTasker general / Re: coldstart trap on m5223x application
« on: June 08, 2011, 01:59:03 PM »
Hi Mark, thanks for the tips.
I looked the function fnRetry() and I saw that this function calls another function called fnResendSNMPTrap().
In fnResendSNMPTrap() I read the trap type and when the trap is coldstart one flag is increased and in the others iterations if the trap type is coldstart the function dont call the fnGenerateTrap() function.
Also I have included the guarda_trap variable because in the old way the function was called twice, sending out two traps despite the control.
The code is shown below:
Best Regards,
Marcel.
I looked the function fnRetry() and I saw that this function calls another function called fnResendSNMPTrap().
In fnResendSNMPTrap() I read the trap type and when the trap is coldstart one flag is increased and in the others iterations if the trap type is coldstart the function dont call the fnGenerateTrap() function.
Also I have included the guarda_trap variable because in the old way the function was called twice, sending out two traps despite the control.
The code is shown below:
Code: [Select]
static void fnResendSNMPTrap(void)
{
static char coldstart_control = 0;
int guarda_trap;
guarda_trap = fnGenerateTrap(trap_list[0].ucTrapType, trap_list[0].ucTrapSpecificCode, 0, 0);
// if (fnGenerateTrap(trap_list[0].ucTrapType, trap_list[0].ucTrapSpecificCode, 0, 0) == 0) {
if (guarda_trap == 0) {
int iTrapQueue = 1; // frame could be delivered this time so delete it from the queue
while (--ucTrapCnt != 0)
{ // any further in queue are also sent now
if(coldstart_control == 0 && trap_list[iTrapQueue].ucTrapType == SNMP_COLDSTART)
{
coldstart_control++;
guarda_trap;
// fnGenerateTrap(trap_list[iTrapQueue].ucTrapType, trap_list[iTrapQueue].ucTrapSpecificCode, 0, 0);
iTrapQueue++;
} else {
if(coldstart_control == 1 && trap_list[iTrapQueue].ucTrapType == SNMP_COLDSTART)
{
iTrapQueue++;
} else {
guarda_trap;
// fnGenerateTrap(trap_list[iTrapQueue].ucTrapType, trap_list[iTrapQueue].ucTrapSpecificCode, 0, 0);
iTrapQueue++;
}
}
}
}
}Thanks for your time MarkBest Regards,
Marcel.