diff --git a/libs/eddystone/eddystone.cpp b/libs/eddystone/eddystone.cpp index 879a0a84..c5ecf11a 100644 --- a/libs/eddystone/eddystone.cpp +++ b/libs/eddystone/eddystone.cpp @@ -1,5 +1,4 @@ #include "pxt.h" -#include "Microbit.h" #include "MicroBitEddystone.h" using namespace pxt; @@ -13,12 +12,14 @@ namespace eddystone { /** * Advertise an Eddystone URL + * @param url the url to transmit. Must be no longer than the supported eddystone url length + * @param power power level between 0 and 7, e.g.: 7 + * @param connectable true to keep bluetooth connectable for other services, false otherwise */ //% blockId=eddystone_advertise_url block="eddystone advertise url %url|power %powerLevel" - void advertiseUrl(StringData* url, int powerLevel) { - int power = CALIBRATED_POWERS[min(7, max(0, powerLevel))]; - ManagedString murl(url) - uBit.bleManager.advertiseEddystoneUrl(murl, power, false); + void advertiseUrl(StringData* url, int power, bool connectable) { + int8_t level = CALIBRATED_POWERS[min(7, max(0, power))]; + uBit.bleManager.advertiseEddystoneUrl(ManagedString(url), level, connectable); } /** diff --git a/libs/eddystone/eddystone.ts b/libs/eddystone/eddystone.ts index efc810ad..12c902b1 100644 --- a/libs/eddystone/eddystone.ts +++ b/libs/eddystone/eddystone.ts @@ -4,7 +4,7 @@ //% color=#0082FB weight=19 namespace eddystone { //% shim=eddystone::advertiseUrl - export function advertiseUrl(url: string, powerLevel: number) { + export function advertiseUrl(url: string, powerLevel: number, connectable: boolean) { } //% shim=eddystone::stopAdvertising diff --git a/libs/eddystone/shims.d.ts b/libs/eddystone/shims.d.ts index 09cd073e..7db54b41 100644 --- a/libs/eddystone/shims.d.ts +++ b/libs/eddystone/shims.d.ts @@ -9,9 +9,12 @@ declare namespace eddystone { /** * Advertise an Eddystone URL + * @param url the url to transmit. Must be no longer than the supported eddystone url length + * @param power power level between 0 and 7, e.g.: 7 + * @param connectable true to keep bluetooth connectable for other services, false otherwise */ //% blockId=eddystone_advertise_url block="eddystone advertise url %url|power %powerLevel" shim=eddystone::advertiseUrl - function advertiseUrl(url: string, powerLevel: number): void; + function advertiseUrl(url: string, power: number, connectable: boolean): void; /** * Stops advertising Eddystone end points