Yoctopuce Yocto-VOC-V3 Mode D'emploi page 95

Table des Matières

Publicité

{
super.onStart();
try {
aa.clear();
YAPI.EnableUSBHost(this);
YAPI.RegisterHub("usb");
YModule
while
String
aa.add(hwid);
r
}
} catch
(YAPI_Exception
e.printStackTrace();
}
// refresh Spinner with detected relay
aa.notifyDataSetChanged();
}
@Override
protected
void
{
super.onStop();
YAPI.FreeAPI();
}
private
void
DisplayModuleInfo()
{
TextView
field;
if
(module
return;
try {
field
field.setText(module.getSerialNumber());
field
field.setText(module.getLogicalName());
field
field.setText(String.format("%d%%",
field
field.setText(module.getUpTime() /
field
field.setText(module.getUsbCurrent() +
Switch
sw.setChecked(module.getBeacon() == YModule.BEACON_ON);
field
field.setText(module.get_lastLogs());
} catch
(YAPI_Exception
e.printStackTrace();
}
}
@Override
public
void
onItemSelected(AdapterView<?>
{
String
hwid
module
= YModule.FindModule(hwid);
DisplayModuleInfo();
}
@Override
public
void
onNothingSelected(AdapterView<?> arg0)
{
}
public
void
refreshInfo(View
{
DisplayModuleInfo();
}
public
void
toggleBeacon(View
{
if
(module
return;
boolean
on
try {
www.yoctopuce.com
r
= YModule.FirstModule();
(r
!= null) {
hwid
= r.get_hardwareId();
= r.nextModule();
e) {
onStop()
== null)
= (TextView) findViewById(R.id.serialfield);
= (TextView) findViewById(R.id.logicalnamefield);
= (TextView) findViewById(R.id.luminosityfield);
= (TextView) findViewById(R.id.uptimefield);
= (TextView) findViewById(R.id.usbcurrentfield);
sw
= (Switch) findViewById(R.id.beaconswitch);
= (TextView) findViewById(R.id.logs);
e) {
= parent.getItemAtPosition(pos).toString();
view)
view)
== null)
= ((Switch) view).isChecked();
12. Utilisation du Yocto-VOC-V3 avec Android
module.getLuminosity()));
1000
+
"
sec");
"
mA");
parent,
View
view,
int
pos,
long
id)
89

Publicité

Table des Matières
loading

Table des Matières