LRemote
LRemote is a singleton object that allows user to design a remote control UI. It's main purpose is to hold the UI control settings and convert them to LBLE GATT attributes.
LRemote initializes and uses LBLE library implicitly. Therefore, we suggest preventing mixing calls to LRemote and LBLE library.
To use it,
#include <LRemote.h>in your LinkIt 7697 Arduino sketch.Call setName(), setGrid() and setOrientation() to configure the device and remote UI canvas grid first.
Add control objects with addControls() API.
Call begin() to initiate the device and start advertisement to LinkIt Remote mobile app.
Use connected() to check if the mobile app has connected.
Call process() periodically to update control status and value.
Methods
setName()
setGrid()
setOrientation()
addControl()
begin()
connected()
process()
Set the device name. Note that BLE advertisement have length limitation, so this name may be truncated when being advertised.
Syntax
Parameters
name: a String representing the name of the device.
Returns
none
Set the canvas grid as a referencing coordinate for control position and size.
Syntax
Parameters
column: number of columns in the grid
row: number of rows in the grid
Returns
none
Set desired UI orientation for the remote UI.
Syntax
Parameters
orientation: can be RC_PORTRAIT or RC_LANDSCAPE. The default value for orientation is portrait.
Returns
none
Add a UI control element to the canvas
Syntax
Parameters
control: an instance of the UI control classes, including:
LRemoteButton
LRemoteSlider
LRemoteLabel
LRemoteSwitch
LRemoteCircleButton
Note that the control instance must have the same life span as LRemote - so these instances should be defined in global scope
Don't define UI control objects such as LRemoteButton in the local scope, e.g. inside the function body of setup() and loop()
Returns
none
Initialize the underlying BLE device and start advertisement. This API implicitly calls LBLE.begin()
Syntax
none
Returns
none
Check if the LinkIt Remote app has connected.
Syntax
none
Returns
true if the LinkIt Remote app has connected to this device. false otherwise.
Processes incoming commands from the LinkIt Remote mobile app. Call this API periodically in the loop() function.
Syntax
none
Returns
none
Failing to call this API will cause incorrect state and value of the UI controls.
Last updated