![Yoctopuce Yocto-GPS Скачать руководство пользователя страница 117](http://html1.mh-extra.com/html/yoctopuce/yocto-gps/yocto-gps_user-manual_3415557117.webp)
@Override
protected
void
onStart
()
{
super
.
onStart
()
;
try
{
aa.
clear
()
;
YAPI.
EnableUSBHost
(this)
;
YAPI.
RegisterHub
(
"usb"
)
;
YModule r = YModule.
FirstModule
()
;
while
(
r !=
null
)
{
String
hwid = r.
get_hardwareId
()
;
aa.
add
(
hwid
)
;
r = r.
nextModule
()
;
}
}
catch
(
YAPI_Exception e
)
{
e.
printStackTrace
()
;
}
// refresh Spinner with detected relay
aa.
notifyDataSetChanged
()
;
}
@Override
protected
void
onStop
()
{
super
.
onStop
()
;
YAPI.
FreeAPI
()
;
}
private
void
DisplayModuleInfo
()
{
TextView field;
if
(
module ==
null
)
return
;
try
{
field =
(
TextView
)
findViewById
(
R.
id
.
serialfield
)
;
field.
setText
(
module.
getSerialNumber
())
;
field =
(
TextView
)
findViewById
(
R.
id
.
logicalnamefield
)
;
field.
setText
(
module.
getLogicalName
())
;
field =
(
TextView
)
findViewById
(
R.
id
.
luminosityfield
)
;
field.
setText
(
String
.
format
(
"%d%%"
, module.
getLuminosity
()))
;
field =
(
TextView
)
findViewById
(
R.
id
.
uptimefield
)
;
field.
setText
(
module.
getUpTime
()
/
1000
+
" sec"
)
;
field =
(
TextView
)
findViewById
(
R.
id
.
usbcurrentfield
)
;
field.
setText
(
module.
getUsbCurrent
()
+
" mA"
)
;
Switch
sw =
(Switch)
findViewById
(
R.
id
.
beaconswitch
)
;
sw.
setChecked
(
module.
getBeacon
()
== YModule.
BEACON_ON
)
;
field =
(
TextView
)
findViewById
(
R.
id
.
logs
)
;
field.
setText
(
module.
get_lastLogs
())
;
}
catch
(
YAPI_Exception e
)
{
e.
printStackTrace
()
;
}
}
@Override
public
void
onItemSelected
(
AdapterView<?> parent,
View
view,
int
pos,
long
id
)
{
String
hwid = parent.
getItemAtPosition
(
pos
)
.
toString
()
;
module = YModule.
FindModule
(
hwid
)
;
DisplayModuleInfo
()
;
}
@Override
public
void
onNothingSelected
(
AdapterView<?> arg0
)
{
}
public
void
refreshInfo
(
View
view
)
{
DisplayModuleInfo
()
;
}
public
void
toggleBeacon
(
View
view
)
{
if
(
module ==
null
)
return
;
boolean
on =
((Switch)
view
)
.
isChecked
()
;
16. Using the Yocto-GPS with Android
www.yoctopuce.com
111
Содержание 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: ......