bluetoe

所属分类:前端开发
开发工具:C++
文件大小:633KB
下载次数:1
上传日期:2023-05-25 10:09:06
上 传 者sh-1993
说明:  构建蓝牙LE服务器(GATT)的C++框架
(C++ Framework to build Bluetooth LE Server (GATT))

文件列表:
.editorconfig (41, 2023-07-06)
.travis.yml (2111, 2023-07-06)
CMakeLists.txt (1196, 2023-07-06)
CODE_OF_CONDUCT.md (3223, 2023-07-06)
Doxyfile (119863, 2023-07-06)
LICENSE (1084, 2023-07-06)
bluetoe (0, 2023-07-06)
bluetoe\adv_service_list.hpp (6837, 2023-07-06)
bluetoe\appearance.hpp (8805, 2023-07-06)
bluetoe\attribute_generator.hpp (4411, 2023-07-06)
bluetoe\attribute_handle.hpp (17299, 2023-07-06)
bluetoe\bindings (0, 2023-07-06)
bluetoe\bindings\CMakeLists.txt (24, 2023-07-06)
bluetoe\bindings\hci (0, 2023-07-06)
bluetoe\bindings\hci\include_libusb (0, 2023-07-06)
bluetoe\bindings\hci\include_libusb\bluetoe (0, 2023-07-06)
bluetoe\bindings\hci\include_libusb\bluetoe\device.hpp (327, 2023-07-06)
bluetoe\bindings\hci\include_libusb\bluetoe\libsub.hpp (231, 2023-07-06)
bluetoe\bindings\nordic (0, 2023-07-06)
bluetoe\bindings\nordic\CMakeLists.txt (368, 2023-07-06)
bluetoe\bindings\nordic\include (0, 2023-07-06)
bluetoe\bindings\nordic\include\bluetoe (0, 2023-07-06)
bluetoe\bindings\nordic\include\bluetoe\nrf.hpp (10034, 2023-07-06)
bluetoe\bindings\nordic\nrf51 (0, 2023-07-06)
bluetoe\bindings\nordic\nrf51\CMakeLists.txt (663, 2023-07-06)
bluetoe\bindings\nordic\nrf51\include (0, 2023-07-06)
bluetoe\bindings\nordic\nrf51\include\bluetoe (0, 2023-07-06)
bluetoe\bindings\nordic\nrf51\include\bluetoe\device.hpp (445, 2023-07-06)
bluetoe\bindings\nordic\nrf51\include\bluetoe\nrf51.hpp (17475, 2023-07-06)
bluetoe\bindings\nordic\nrf51\nrf51.cpp (53628, 2023-07-06)
bluetoe\bindings\nordic\nrf52 (0, 2023-07-06)
bluetoe\bindings\nordic\nrf52\CMakeLists.txt (713, 2023-07-06)
bluetoe\bindings\nordic\nrf52\include (0, 2023-07-06)
... ...

# Bluetoe [![Build Status](https://travis-ci.org/TorstenRobitzki/bluetoe.svg?branch=master)](https://travis-ci.org/TorstenRobitzki/bluetoe) [![Join the chat at https://gitter.im/TorstenRobitzki/bluetoe](https://badges.gitter.im/TorstenRobitzki/bluetoe.svg)](https://gitter.im/TorstenRobitzki/bluetoe?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/TorstenRobitzki/bluetoe.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/TorstenRobitzki/bluetoe/context:cpp) ![Bluetoe Logo](https://github.com/TorstenRobitzki/bluetoe/blob/master/documentation/Logo_Bluetoe.svg?raw=true) ## Putin's Invasion of Ukraine Please consider donating to one of the funds that help victims of the war in Ukraine: - https://spendenkonto-nothilfe.de ## Overview Bluetoe implements a GATT server with a very low memory footprint and a convenient C++ interface. Bluetoe makes things easy but gives you the opportunity to fiddle with all the low-level GATT details if necessary. Bluetoe's primary target is very small microcontrollers. Here is a complete example of a small GATT server that allows a client to controll an IO pin, running on a nRF52832: #include #include #include using namespace bluetoe; // LED1 on a nRF52 eval board static constexpr int io_pin = 17; static std::uint8_t io_pin_write_handler( bool state ) { // On an nRF52 eval board, the pin is connected to the LED's cathode. This inverts the logic. NRF_GPIO->OUT = state ? NRF_GPIO->OUT & ~( 1 << io_pin ) : NRF_GPIO->OUT | ( 1 << io_pin ); return error_codes::success; } using blinky_server = server< service< service_uuid< 0xC11169E1, 0x6252, 0x4450, 0x931C, 0x1B43A318783B >, characteristic< requires_encryption, free_write_handler< bool, io_pin_write_handler > > > >; blinky_server gatt; device< blinky_server > gatt_srv; int main() { // Init GPIO pin NRF_GPIO->PIN_CNF[ io_pin ] = ( GPIO_PIN_CNF_DRIVE_S0H1 << GPIO_PIN_CNF_DRIVE_Pos ) | ( GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos ); for ( ;; ) gatt_srv.run( gatt ); } ## Documentation http://torstenrobitzki.github.io/bluetoe/ ## L2CAP Bluetoe ships with its own fully-usable link layer based on the nRF52832. The link layer implementation is based and tested on an abstract device called a scheduled radio, and should be easy to port to similar hardware. As Bluetoe is a GATT server implementation, only parts of the link layer relevant to GATT have been implemented. Bluetoe can be easily adapted to any other existing L2CAP implementation (those based on HCI, for example). ## Current State The following table shows the list of supported GATT procedures, along with and their current and planned implementation status: Feature | Sub-Procedure | Status --------|---------------|------- Server Configuration|Exchange MTU|implemented Primary Service Discovery|Discover All Primary Services|implemented
|Discover Primary Service By Service UUID|implemented Relationship Discovery|Find Included Services|implemented
|Declare Secondary Services|implemented Characteristic Discovery|Discover All Characteristic of a Service|implemented
|Discover Characteristic by UUID|implemented Characteristic Descriptor Discovery|Discover All Characteristic Descriptors|implemented Characteristic Value Read|Read Characteristic Value|implemented
|Read Using Characteristic UUID|implemented
|Read Long Characteristic Value|implemented
|Read Multiple Characteristic Values|implemented Characteristic Value Write| Write Without Response|implemented
|Signed Write Without Response|not planned
|Write Characteristic Value|implemented
|Write Long Characteristic Values|implemented
|Characteristic Value Reliable Writes|implemented Characteristic Value Notification|Notifications|implemented Characteristic Value Indication|Indications|implemented Characteristic Descriptor Value Read|Read Characteristic Descriptors|implemented
|Read Long Characteristic Descriptors|implemented Characteristic Descriptor Value Write|Write Characteristic Descriptors|implemented
|Write Long Characteristic Descriptors|implemented Cryptography|Encryption|implemented
|Authentication|planned This is the current state of implemented Advertising Data: Advertising Data|Format|Status ----------------|------|------ Service UUID|Incomplete List of 16-bit Service UUIDs|implemented
|Complete List of 16-bit Service UUIDs|implemented
|Incomplete List of 32-bit Service UUIDs|not planned
|Complete List of 32-bit Service UUIDs|not planned
|Incomplete List of 128-bit Service UUIDs|implemented
|Complete List of 128-bit Service UUIDs|implemented Local Name|Shortened Local Name|implemented
|Complete Local Name|implemented Flags|Flags|implemented Manufacturer Specific Data|Manufacturer Specific Data|planned TX Power Level|TX Power Level|planned Secure Simple Pairing Out of Band||not planned Security Manager Out of Band||not planned Security Manager TK Value||not planned Slave Connection Interval Range||not planned Service Solicitation||not planned Service Data||not planned Appearance|Appearance|implemented LE Role|LE Role|planned This is the current state of the Link Layer implementation: Aspect | Feature | Status -------|---------|-------- Roles|Slave Role|implemented
|Master Role|not planned Advertising|connectable undirected advertising|implemented
|connectable directed advertising|implemented
|non-connectable undirected advertising|implemented
|scannable undirected advertising|implemented Device Filtering||implemented Connections|Single Connection|implemented
|Multiple Connection|not planned Connection|Slave Latency|planned Feature Support|LE Encryption|implemented
|Connection Parameters Request Procedure|implemented
|Extended Reject Indication|planned
|Slave-initiated Features Exchange|planned
|LE Ping|implemented
|LE Data Packet Length Extension|planned
|LL Privacy|not planned
|Extended Scanner Filter Policies|not planned
Pull requests are welcome. ## Dependencies - Boost for Unit tests - CMake for build - A decent C++ compiler supporting C++11 # Current Measurements All measurements were done without any traffic and a slave latency of 0. Average current was measured using various connection intervals. ## nRF52840 blinky without encryption - Calibrated RC Sleep Clock (500ppm) (13608 Bytes binary size) * 546μA average at 7.5ms * 283μA average at 15ms * 155μA average at 30ms - Crystal Oscilator Sleep Clock (20ppm) (133*** Bytes binary size) * 526μA average at 7.5ms * 207μA average at 15ms * 143μA average at 30ms * 22.4μA average at 660ms ## nRF52840 blinky with encryption - Calibrated RC Sleep Clock (500ppm) (22848 Bytes binary size) * 613μA average at 7.5ms * 211μA average at 30ms * 113μA average at 660ms - Crystal Oscilator Sleep Clock (20ppm) (22608 Bytes binary size) * 589μA average at 7.5ms * 197μA average at 30ms - Synthesized Sleep Clock (40ppm) (22596 Bytes binary size) * 1.09mA average at 7.5ms * 776μA average at 30ms - Old radio implementation (40ppm) (22212 Bytes binary size) * 1.08mA average at 7.5ms * 874μA average at 15ms * 770μA average at 30ms * 674μA average at 660ms ## nRF52820 blinky with encryption - Calibrated RC Sleep Clock (500ppm / 1ms HFXO startup time) (21880 Bytes binary size) * 347μA average at 15ms * 217μA average at 30ms * 94μA average at 660ms - Calibrated RC Sleep Clock (500ppm / 0.3ms HFXO startup time) (21880 Bytes binary size) * 316μA average at 15ms * 103μA average at 660ms

近期下载者

相关文件


收藏者