theCore C++ embedded framework
|
HM10 synchronous BT driver. More...
#include </home/travis/build/forGGe/theCore/dev/hm10/export/dev/hm10.hpp>
Static Public Member Functions | |
static constexpr auto | cmd_timeout () |
Defines internal timeout in milliseconds during which module has to respond to commands. More... | |
static constexpr auto | retry_timeout () |
Defines internal timeout in milliseconds between retries to send or receive data. More... | |
static err | init () |
Initializes BT module. More... | |
static err | set_pin (uint32_t pin) |
Sets pin code for connecting to the bluetooth device. More... | |
static err | get_pin (uint32_t &pin) |
Gets pin code from the device. More... | |
static err | set_immediate (bool state=true) |
Sets immediate mode of operation. More... | |
static err | get_immediate (bool &state) |
Gets immediate mode state. More... | |
static err | disconnect () |
Send disconnect command. More... | |
static err | start () |
Manually Starts communication. More... | |
static err | data_send (const uint8_t *buf, size_t &sz) |
Sends data to the module. More... | |
static err | data_recv (uint8_t *buf, size_t &sz, std::chrono::milliseconds ms=std::chrono::milliseconds::max()) |
Receives data from the module with given timeout. More... | |
HM10 synchronous BT driver.
This HM10 driver is simple and low-functional API to send and receive data from BT module. It lacks connection status detection and does not escape potential AT commands found in payload (yet). No flow control is used whatsoever. External protocol is required to control whether other end is ready to receive or send a data. Great advantage of this particular driver is its API. Straitforward and blocking it can be used for simple demo implementations.
Uart | instance of the UART platform driver. |
Serial | instance attached to the UART bus to work with. Provided for mock injection in unit tests. |
|
inlinestatic |
Defines internal timeout in milliseconds during which module has to respond to commands.
|
inlinestatic |
Defines internal timeout in milliseconds between retries to send or receive data.
|
static |
Manually Starts communication.
Sends AT+START command
err::inval | Module responded with invalid data. |
err::timedout | Module did not respond at all. |
err::ok | Module now can send and receive data. |