![Yoctopuce Yocto-GPS Скачать руководство пользователя страница 97](http://html1.mh-extra.com/html/yoctopuce/yocto-gps/yocto-gps_user-manual_3415557097.webp)
begin
writeln
(
'Module not connected (check identification and USB cable)'
)
;
exit
;
end
;
Writeln
(
'Current logical name : '
+module.
get_logicalName
())
;
Write
(
'Enter new name : '
)
;
Readln
(
newname
)
;
if
(not(
yCheckLogicalName
(
newname
)))
then
begin
Writeln
(
'invalid logical name'
)
;
exit
;
end
;
module.
set_logicalName
(
newname
)
;
module.
saveToFlash
()
;
yFreeAPI
()
;
Writeln
(
'logical name is now : '
+module.
get_logicalName
())
;
end
.
Warning: the number of write cycles of the nonvolatile memory of the module is limited. When this
limit is reached, nothing guaranties that the saving process is performed correctly. This limit, linked to
the technology employed by the module micro-processor, is located at about 100000 cycles. In short,
you can use the
saveToFlash()
function only 100000 times in the life of the module. Make sure
you do not call this function within a loop.
Listing the modules
Obtaining the list of the connected modules is performed with the
yFirstModule()
function which
returns the first module found. Then, you only need to call the
nextModule()
function of this
object to find the following modules, and this as long as the returned value is not
nil
. Below a short
example listing the connected modules.
program
inventory;
{$APPTYPE CONSOLE}
uses
SysUtils,
yocto_api;
var
module : TYModule;
errmsg :
string
;
begin
// Setup the API to use local USB devices
if
yRegisterHub
(
'usb'
, errmsg
)
<>YAPI_SUCCESS
then
begin
Write
(
'RegisterHub error: '
+errmsg
)
;
exit
;
end
;
Writeln
(
'Device list'
)
;
module := yFirstModule
()
;
while
module<>
nil
do
begin
Writeln
(
module.
get_serialNumber
()
+
' ('
+module.
get_productName
()
+
')'
)
;
module := module.
nextModule
()
;
end
;
yFreeAPI
()
;
end
.
13.4. Error handling
When you implement a program which must interact with USB modules, you cannot disregard error
handling. Inevitably, there will be a time when a user will have unplugged the device, either before
running the software, or even while the software is running. The Yoctopuce library is designed to help
you support this kind of behavior, but your code must nevertheless be conceived to interpret in the
best possible way the errors indicated by the library.
13. Using Yocto-GPS with Delphi
www.yoctopuce.com
91
Содержание Yocto-GPS
Страница 1: ...Yocto GPS User s guide...
Страница 2: ......
Страница 6: ...22 Characteristics 557 Blueprint 559 Index 561...
Страница 10: ...4 www yoctopuce com...
Страница 14: ...8 www yoctopuce com...
Страница 18: ...12 www yoctopuce com...
Страница 22: ...16 www yoctopuce com...
Страница 38: ...32 www yoctopuce com...
Страница 42: ...36 www yoctopuce com...
Страница 54: ...48 www yoctopuce com...
Страница 72: ...66 www yoctopuce com...
Страница 92: ...86 www yoctopuce com...
Страница 122: ...116 www yoctopuce com...
Страница 132: ...126 www yoctopuce com...
Страница 159: ...20 High level API Reference On failure throws an exception or returns a negative error code www yoctopuce com 153...
Страница 564: ...22 Characteristics 558 www yoctopuce com...
Страница 565: ......
Страница 566: ......