support for exposing device name

This commit is contained in:
Peli de Halleux
2016-04-26 13:43:02 -07:00
parent 512e40fae3
commit 55859b1237
4 changed files with 22 additions and 1 deletions

View File

@ -155,4 +155,12 @@ namespace control {
void onEvent(int src, int value, Action handler) {
registerWithDal(src, value, handler);
}
/**
* Gets a friendly name for the device derived from the its serial number
*/
//% blockId="control_device_name" block="device name" weight=10
StringData* deviceName() {
return ManagedString(microbit_friendly_name()).leakData();
}
}