![Yoctopuce Yocto-GPS User Manual Download Page 119](http://html1.mh-extra.com/html/yoctopuce/yocto-gps/yocto-gps_user-manual_3415557119.webp)
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
{
YAPI.
UpdateDeviceList
()
;
// fixme
field =
(
TextView
)
findViewById
(
R.
id
.
logicalnamefield
)
;
field.
setText
(
module.
getLogicalName
())
;
}
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
saveName
(
View
view
)
{
if
(
module ==
null
)
return
;
EditText edit =
(
EditText
)
findViewById
(
R.
id
.
newname
)
;
String
newname = edit.
getText
()
.
toString
()
;
try
{
if
(
!YAPI.
CheckLogicalName
(
newname
))
{
Toast.
makeText
(
getApplicationContext
()
,
"Invalid name ("
+ n
")"
,
Toast.
LENGTH_LONG
)
.
show
()
;
return
;
}
module.
set_logicalName
(
newname
)
;
module.
saveToFlash
()
;
// do not forget this
edit.
setText
(
""
)
;
}
catch
(
YAPI_Exception ex
)
{
ex.
printStackTrace
()
;
}
DisplayModuleInfo
()
;
}
}
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
YModule.saveToFlash()
function only 100000 times in the life of the module.
Make sure you do not call this function within a loop.
16. Using the Yocto-GPS with Android
www.yoctopuce.com
113
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: ......