Slide 47
Slide 47 text
import com.mbientlab.metawear.api.characteristic;
//< Setup callback for receiving device information
mwCtrllr.addDeviceCallback(new DeviceCallbacks() {
@Override
public void receivedGATTCharacteristic(GATTCharacteristic characteristic,
byte[] data) {
Log.i("ExampleActivity", String.format("%s= %s", characteristic.toString(),
new String(data));
}
@Override
public void receivedRemoteRSSI(int rssi) {
log.i("ExampleActivity", String.format("RSSI= %d dBm", rssi));
}
});
//< Read characteristics from the device information service
//< GATT characteristics are from the DeviceInformation enum
mwCtrllr.readDeviceInfo();
//< Read battery level from the battery service
//< GATT characteristics are from the Battery enum
mwCtrllr.readBatteryLevel();
//< Read RSSI value
mwCtrllr.readRemoteRSSI();