TMNextAlarm Code Example

long session_handle;
unsigned char state_buffer[15360];
short result, cnt = 0;

/* session_handle set from a call to TMExtendedStartSession */
...

/* attempt to find the first alarming device on 1-Wire network */
result = TMFirstAlarm(session_handle, state_buffer);

/* loop to count all of the alarming devices on the 1-Wire network */
while (result == 1)
{
   cnt++;

   /* find next alarming device */
   result = TMNextAlarm(session_handle, state_buffer);
}

/* close the session with a call to TMEndSession */
...