Yoctopuce Yocto-GPS-V2 Mode D'emploi page 133

Table des Matières

Publicité

aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
my_spin.setAdapter(aa);
}
@Override
protected
void
{
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
www.yoctopuce.com
onStart()
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)
17. Utilisation du Yocto-GPS-V2 avec Android
module.getLuminosity()));
1000
+
"
sec");
"
mA");
parent,
View
view,
int
pos,
long
id)
127

Publicité

Table des Matières
loading

Table des Matières