parameter must point to a 255 character buffer to retrieve a potential error message. This pointer can
also point to
null
. The function returns a negative integer in case of error, zero otherwise.
The
yapiGetDeviceInfo
function retrieves the information related to a module from its handle.
devdesc
is a 32-bit integer representing the module and which was obtained through
yapiGetAllDevices
.
infos
points to a data structure in which the result is stored. This data structure
has the following format:
Name
Type
Size
(bytes)
Description
vendorid
int
4
Yoctopuce USB ID
deviceid
int
4
Module USB ID
devrelease
int
4
Module version
nbinbterfaces int
4
Number of USB interfaces used by the module
manufacturer
char[]
20
Yoctopuce (null terminated)
productname
char[]
28
Model (null terminated)
serial
char[]
20
Serial number (null terminated)
logicalname
char[]
20
Logical name (null terminated)
firmware
char[]
22
Firmware version (null terminated)
beacon
byte
1
Beacon state (0/1)
The
errmsg
parameter must point to a 255 character buffer to retrieve a potential error message.
Here is a sample program written in pascal using the
yapi.dll
DLL to list the connected modules.
// device description structure
type
yDeviceSt =
packed
record
vendorid :
word
;
deviceid :
word
;
devrelease :
word
;
nbinbterfaces :
word
;
manufacturer :
array
[
0
..
19
]
of
ansichar
;
productname :
array
[
0
..
27
]
of
ansichar
;
serial :
array
[
0
..
19
]
of
ansichar
;
logicalname :
array
[
0
..
19
]
of
ansichar
;
firmware :
array
[
0
..
21
]
of
ansichar
;
beacon :
byte
;
end
;
// Dll function import
function
yapiInitAPI
(
mode:
integer
;
errmsg :
pansichar
)
:
integer
;
cdecl
;
external
'yapi.dll'
name
'yapiInitAPI'
;
function
yapiUpdateDeviceList
(
force:
integer
;errmsg :
pansichar
)
:
integer
;
cdecl
;
external
'yapi.dll'
name
'yapiUpdateDeviceList'
;
function
yapiGetAllDevices
(
buffer:
pointer
;
maxsize:
integer
;
var
neededsize:
integer
;
errmsg :
pansichar
)
:
integer
;
cdecl
;
external
'yapi.dll'
name
'yapiGetAllDevices'
;
function
apiGetDeviceInfo
(
d:
integer
;
var
infos:yDeviceSt;
errmsg :
pansichar
)
:
integer
;
cdecl
;
external
'yapi.dll'
name
'yapiGetDeviceInfo'
;
var
errmsgBuffer :
array
[
0
..
256
]
of
ansichar
;
dataBuffer :
array
[
0
..
127
]
of
integer
;
// max of 128 USB devices
errmsg,data :
pansichar
;
neededsize,i :
integer
;
devinfos : yDeviceSt;
begin
errmsg := @errmsgBuffer;
// API initialization
if(
yapiInitAPI
(
1
,errmsg
)
<
0
)
then
begin
writeln
(
errmsg
)
;
21. Using with unsupported languages
www.yoctopuce.com
131
Содержание Yocto-Display
Страница 1: ...Yocto Display User Manual...
Страница 2: ......
Страница 40: ...34 www yoctopuce com...
Страница 52: ...46 www yoctopuce com...
Страница 84: ...78 www yoctopuce com...
Страница 92: ...86 www yoctopuce com...
Страница 130: ...124 www yoctopuce com...
Страница 158: ...22 High level API Reference 152 www yoctopuce com On failure throws an exception or returns a negative error code...
Страница 422: ...416 www yoctopuce com...
Страница 424: ...24 Characteristics 418 www yoctopuce com...