EasyManua.ls Logo

PICO USB TC-08 - Usb_Tc08_Open_Unit_Progress

PICO USB TC-08
43 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Technical reference
18
© 2005 Pico Technology Limited. All rights reserved.
USBTC08044-2
case
USBTC08_PROGRESS_FAIL:
// enum equates to: -1
error_code =
usb_tc08_get_last_error
(
0
);
printf(
"Unit failed to open\nThe error code is %d"
, error_code);
// could terminate the application here
break
;
case
USBTC08_PROGRESS_PENDING:
// enum equates to: 0
printf(
"\nThe unit is %d percent enumerated"
, progress);
Sleep(
500
);
// wait for approx. half a second
break
;
case
USBTC08_PROGRESS_COMPLETE:
// enum equates to: 1
printf(
"\n\nThe unit with handle '%d', opened successfully"
,
handle);
break
;
}
}
while
(result == USBTC08_PROGRESS_PENDING);
//
// Start using the open unit
//
3.3.2.3
usb_tc08_open_unit_progress
short usb_tc08_open_unit_progress( short * handle,
short * progress)
Call this function after
usb_tc08_open_unit_async
. Repeatedly call it to determine
the state of the background enumeration process. For an example of usage, see
usb_tc08_open_unit_async
.
Arguments:
handle
(Out) A handle (positive short) to the unit if the enumeration
is completed. Handle will always be 0 if the enumeration is
incomplete.
progress
(Out) (Optional - can pass NULL) returns a number from 0 to
100 representing the percentage completion of the
enumeration of one unit.
Returns:
-1 (USBTC08_PROGRESS_FAIL)
An error occurred, call
usb_tc08_get_last_error
with a
handle of 0 to obtain the error
code.
0 (USBTC08_PROGRESS_PENDING)
Enumeration has not completed
(keep calling
usb_tc08_open_unit_progres
s
).
1 (USBTC08_PROGRESS_COMPLETE)
Enumeration has completed and
the handle is now valid.