Our library follows these two rules and can therefore use the
await
notation.
For you not to have to wonder wether a function is asynchronous or not, there is the following
convention:
all the public methods
of the UWP library
are asynchronous
, that is that you must call
them with the
await
keyword,
except
:
•
GetTickCount()
, because measuring time in an asynchronous manner does not make a
lot of sense...
•
FindModule()
,
FirstModule()
,
nextModule()
, ...
because
detecting
and
enumerating modules is performed as a background task on internal structures which are
managed transparently. It is therefore not necessary to use blocking functions while going
though the lists of modules.
15.2. Installation
Download the Yoctopuce library for $LANG$ from the Yoctopuce web site
2
. There is no installation
software, simply copy the content of the zip file in a directory of your choice. You essentially need the
content of the
Sources
directory. The other directories contain documentation and a few sample
programs. Sample projects are Visual Studio 2017 projects. Visual Studio 2017 is available on the
Microsoft web site
3
.
15.3. Using the Yoctopuce API in a Visual Studio project
Start by creating your project. Then, from the
Solution Explorer
panel right click on your project and
select
Add
then
Existing element
.
A file chooser opens: select all the files in the library
Sources
directory.
You then have the choice between simply adding the files to your project or adding them as a link
(the
Add
button is actually a drop-down menu). In the first case, Visual Studio copies the selected
files into your project. In the second case, Visual Studio simply creates a link to the original files. We
recommend to use links, as a potential library update is thus much easier.
The Package.appxmanifest file
By default a Universal Windows application doesn't have access rights to the USB ports. If you want
to access USB devices, you must imperatively declare it in the
Package.appxmanifest
file.
Unfortunately, the edition window of this file doesn't allow this operation and you must modify the
Package.appxmanifest
file by hand. In the "Solution Explorer" panel, right click on the
Package.appxmanifest
and select "View Code".
In this XML file, we must add a
DeviceCapability
node in the
Capabilities
node. This
node must have a "Name" attribute with a "humaninterfacedevice" value.
Inside this node, you must declare all the modules that can be used. Concretely, for each module,
you must add a "Device" node with an "Id" attribute, which has for value a character string
"vidpid:
USB_VENDORID
USB_DEVICE_ID
". The Yoctopuce
USB_VENDORID
is 24e0 and you can
find the
USB_DEVICE_ID
of each Yoctopuce device in the documentation in the "Characteristics"
section. Finally, the "Device" node must contain a "Function" node with the "Type" attribute with a
value of "usage:ff00 0001".
For the Yocto-Display, here is what you must add in the "Capabilities" node:
<DeviceCapability Name="humaninterfacedevice">
<!-- Yocto-Display -->
<Device Id="vidpid:24e0 002D">
<Function Type="usage:ff00 0001" />
2
www.yoctopuce.com/EN/libraries.php
3
https://www.visualstudio.com/downloads/
15. Using the Yocto-Display with Universal Windows Platform
88
www.yoctopuce.com
Содержание 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...