Receiving data using new API (2.0.0-beta.01)
I've successfully received DeviceInformation and BatteryLevel values through the new manner using AsyncResult, as well as switch presses using the routeData() and subscribe() as shown at the bottom of (https://github.com/mbientlab/Metawear-AndroidAPI/wiki/MetaWearBoard-Class)
However, can't get the same to work for GPIO (analog abs read) or Temperature. Here is my temp method:
public void startTemp() {
mwBoard.routeData().fromTemperature().subscribe(new DataSignal.MessageProcessor() {
@Override
public void process(final Message msg) {
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
tVtempVal.setText(msg.getData(Float.class).toString());
}
});
}
}).commit();
}
It never seems to run the process() part within the MessageProcessor...
However, can't get the same to work for GPIO (analog abs read) or Temperature. Here is my temp method:
public void startTemp() {
mwBoard.routeData().fromTemperature().subscribe(new DataSignal.MessageProcessor() {
@Override
public void process(final Message msg) {
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
tVtempVal.setText(msg.getData(Float.class).toString());
}
});
}
}).commit();
}
It never seems to run the process() part within the MessageProcessor...
This discussion has been closed.
Comments
http://oi60.tinypic.com/fjdhdi.jpg
One strange behavior was that for some time neither the new example app (MetaWearTest) or my code could get GPIO (analog abs) or Temp data until I issued a RESET from the app. - It is apparently problematic to connect to the metawear from two different apps at the same time?
I have reviewed (http://developer.android.com/guide/components/bound-services.html) where it is stated "Multiple clients can connect to the service at once. However, the system calls your service's onBind() method to retrieve the IBinder only when the first client binds. The system then delivers the same IBinder to any additional clients that bind". - Does this mean more than one app can or can not bind to the same ble service and use the metawear?
About reset:
Is calling resetDevice() the same as reset by removing power to PCB & pressing pushbutton while connecting USB cable? Does reset clear the board to its initial state? I assume this would clear the flash (logs) as well? stored macros ?
Thanks