Yoctopuce Yocto-milliVolt-Rx-BNC Mode D'emploi page 95

Table des Matières

Publicité

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 {
YAPI.UpdateDeviceList();// fixme
field
field.setText(module.getLogicalName());
} 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
saveName(View
{
if
(module
return;
EditText edit
String
newname
try {
if (!YAPI.CheckLogicalName(newname)) {
Toast.makeText(getApplicationContext(),
Toast.LENGTH_LONG).show();
return;
}
module.set_logicalName(newname);
module.saveToFlash();
edit.setText("");
} catch
(YAPI_Exception
ex.printStackTrace();
}
DisplayModuleInfo();
}
}
www.yoctopuce.com
r
= YModule.FirstModule();
(r
!= null) {
hwid
= r.get_hardwareId();
= r.nextModule();
e) {
onStop()
== null)
= (TextView) findViewById(R.id.logicalnamefield);
e) {
= parent.getItemAtPosition(pos).toString();
view)
== null)
= (EditText) findViewById(R.id.newname);
= edit.getText().toString();
// do not forget this
ex) {
12. Utilisation du Yocto-milliVolt-Rx-BNC avec Android
parent,
View
view,
int
"Invalid name ("
pos,
long
id)
+
newname
+
")",
89

Publicité

Table des Matières
loading

Ce manuel est également adapté pour:

Yocto-0-10v-rx

Table des Matières