![Yoctopuce Yocto-GPS User Manual Download Page 88](http://html1.mh-extra.com/html/yoctopuce/yocto-gps/yocto-gps_user-manual_3415557088.webp)
YAPI.
FreeAPI
()
;
}
}
}
12.4. Control of the module part
Each module can be controlled in a similar manner, you can find below a simple sample program
displaying the main parameters of the module and enabling you to activate the localization beacon.
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
ConsoleApplication1
{
class
Program
{
static
void
usage
()
{
string
execname =
System
.
AppDomain
.
CurrentDomain
.
FriendlyName
;
Console
.
WriteLine
(
"Usage:"
)
;
Console
.
WriteLine
(
ex
" <serial or logical name> [ON/OFF]"
)
;
System.
Threading
.
Thread
.
Sleep
(
2500
)
;
Environment
.
Exit
(
0
)
;
}
static
void
Main
(
string
[]
args
)
{
YModule m;
string
errmsg =
""
;
if
(
YAPI.
RegisterHub
(
"usb"
,
ref
errmsg
)
!= YAPI.
SUCCESS
)
{
Console
.
WriteLine
(
"RegisterHub error: "
+ errmsg
)
;
Environment
.
Exit
(
0
)
;
}
if
(
args.
Length
<
1
)
usage
()
;
m = YModule.
FindModule
(
args
[
0
])
;
// use serial or logical name
if
(
m.
isOnline
())
{
if
(
args.
Length
>=
2
)
{
if
(
args
[
1
]
.
ToUpper
()
==
"ON"
)
{
m.
set_beacon
(
YModule.
BEACON_ON
)
;
}
if
(
args
[
1
]
.
ToUpper
()
==
"OFF"
)
{
m.
set_beacon
(
YModule.
BEACON_OFF
)
;
}
}
Console
.
WriteLine
(
"serial: "
+ m.
get_serialNumber
())
;
Console
.
WriteLine
(
"logical name: "
+ m.
get_logicalName
())
;
Console
.
WriteLine
(
"luminosity: "
+ m.
get_luminosity
()
.
ToString
())
;
Console
.
Write
(
"beacon: "
)
;
if
(
m.
get_beacon
()
== YModule.
BEACON_ON
)
Console
.
WriteLine
(
"ON"
)
;
else
Console
.
WriteLine
(
"OFF"
)
;
Console
.
WriteLine
(
"upTime: "
+
(
m.
get_upTime
()
/
1000
)
.
ToString
()
+
" sec"
)
;
Console
.
WriteLine
(
"USB current: "
+ m.
get_usbCurrent
()
.
ToString
()
+
" mA"
)
;
Console
.
WriteLine
(
"Logs:
\r\n
"
+ m.
get_lastLogs
())
;
}
else
{
Console
.
WriteLine
(
args
[
0
]
+
" not connected (check identification and USB cable)"
)
;
}
YAPI.
FreeAPI
()
;
}
}
}
12. Using Yocto-GPS with C#
82
www.yoctopuce.com
Summary of Contents for Yocto-GPS
Page 1: ...Yocto GPS User s guide...
Page 2: ......
Page 6: ...22 Characteristics 557 Blueprint 559 Index 561...
Page 10: ...4 www yoctopuce com...
Page 14: ...8 www yoctopuce com...
Page 18: ...12 www yoctopuce com...
Page 22: ...16 www yoctopuce com...
Page 38: ...32 www yoctopuce com...
Page 42: ...36 www yoctopuce com...
Page 54: ...48 www yoctopuce com...
Page 72: ...66 www yoctopuce com...
Page 92: ...86 www yoctopuce com...
Page 122: ...116 www yoctopuce com...
Page 132: ...126 www yoctopuce com...
Page 564: ...22 Characteristics 558 www yoctopuce com...
Page 565: ......
Page 566: ......