TMFirst Code Example

long session_handle;
unsigned char state_buffer[15360];
short result;

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

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

if (result == 1)
{
   /* device ROM number found, call TMRom to get number */
   ...
}
else 
{
   /* no device on 1-Wire network at this time or error */
   ...
}

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