From 67b5afd73a27e3a8605e65f708a68da014aa8e79 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Tue, 21 Jun 2016 11:17:34 -0700 Subject: [PATCH] integrating docs about "devices" namespace --- docs/reference.md | 6 +++--- docs/reference/devices.md | 19 +++++++++++++++++++ libs/microbit-bluetooth/bluetooth.cpp | 4 ++++ libs/microbit-devices/devices.cpp | 4 +++- libs/microbit-devices/shims.d.ts | 4 +++- 5 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 docs/reference/devices.md diff --git a/docs/reference.md b/docs/reference.md index c64b5d6a..823d3be7 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -26,11 +26,11 @@ control.inBackground(() => { ## Advanced ```namespaces -bluetooth.onBluetoothConnected(() => { - -}); +devices.tellCameraTo(MesCameraEvent.TakePhoto); +bluetooth.onBluetoothConnected(() => {}); ``` ```package +microbit-devices microbit-bluetooth ``` \ No newline at end of file diff --git a/docs/reference/devices.md b/docs/reference/devices.md new file mode 100644 index 00000000..c8b88d88 --- /dev/null +++ b/docs/reference/devices.md @@ -0,0 +1,19 @@ +# Devices + +Control a phone with the BBC micro:bit via Bluetooth. + +```cards +devices.tellCameraTo(MesCameraEvent.TakePhoto); +devices.tellRemoteControlTo(MesRemoteControlEvent.play); +devices.raiseAlertTo(MesAlertEvent.DisplayToast); +devices.onNotified(MesDeviceInfo.IncomingCall, () => { + +}); +devices.onGamepadButton(MesDpadButtonInfo.ADown, () => { + +}); +devices.signalStrength(); +devices.onSignalStrengthChanged(() => { + +}); +``` diff --git a/libs/microbit-bluetooth/bluetooth.cpp b/libs/microbit-bluetooth/bluetooth.cpp index ab995204..1ba1beed 100644 --- a/libs/microbit-bluetooth/bluetooth.cpp +++ b/libs/microbit-bluetooth/bluetooth.cpp @@ -2,6 +2,10 @@ #include "MESEvents.h" using namespace pxt; + +/** + * Support for additional Bluetooth services. + */ //% color=#0082FB weight=20 namespace bluetooth { /** diff --git a/libs/microbit-devices/devices.cpp b/libs/microbit-devices/devices.cpp index 3c1b51cf..9e672020 100644 --- a/libs/microbit-devices/devices.cpp +++ b/libs/microbit-devices/devices.cpp @@ -120,7 +120,9 @@ enum class MesDpadButtonInfo { _4Up = MES_DPAD_BUTTON_4_UP, }; - +/** + * Control a phone with the BBC micro:bit via Bluetooth. + */ //% color=156 weight=80 namespace devices { static void genEvent(int id, int event) { diff --git a/libs/microbit-devices/shims.d.ts b/libs/microbit-devices/shims.d.ts index 64fdb60c..9b152593 100644 --- a/libs/microbit-devices/shims.d.ts +++ b/libs/microbit-devices/shims.d.ts @@ -1,7 +1,9 @@ // Auto-generated. Do not edit. - + /** + * Control a phone with the BBC micro:bit via Bluetooth. + */ //% color=156 weight=80 declare namespace devices {