|
Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
|
This _dbt_peripheral00__ C++ peripheral ::BTRole::Slave GATT server example uses an event driven workflow. More...
#include <cstring>#include <string>#include <memory>#include <cstdint>#include <fstream>#include <iostream>#include <cinttypes>#include <pthread.h>#include <csignal>#include <jau/cpp_lang_util.hpp>#include <jau/dfa_utf8_decode.hpp>#include <jau/basic_algos.hpp>#include <jau/darray.hpp>#include <direct_bt/DirectBT.hpp>#include <unistd.h>#include "dbt_constants.hpp"#include <cstdio>Go to the source code of this file.
Classes | |
| class | MyAdapterStatusListener |
| class | MyGATTServerListener |
Functions | |
| DBGattServerRef | dbGattServer (new DBGattServer(jau::make_darray(std::make_shared< DBGattService >(true, std::make_unique< const jau::uuid16_t >(GattServiceType::GENERIC_ACCESS), jau::make_darray(std::make_shared< DBGattChar >(std::make_unique< const jau::uuid16_t >(GattCharacteristicType::DEVICE_NAME), BTGattChar::PropertyBitVal::Read, jau::darray< DBGattDescRef >(), make_gvalue(adapter_name.c_str(), 128), true), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid16_t >(GattCharacteristicType::APPEARANCE), BTGattChar::PropertyBitVal::Read, jau::darray< DBGattDescRef >(), make_gvalue((uint16_t) 0)))), std::make_shared< DBGattService >(true, std::make_unique< const jau::uuid16_t >(GattServiceType::DEVICE_INFORMATION), jau::make_darray(std::make_shared< DBGattChar >(std::make_unique< const jau::uuid16_t >(GattCharacteristicType::MANUFACTURER_NAME_STRING), BTGattChar::PropertyBitVal::Read, jau::darray< DBGattDescRef >(), make_gvalue("Gothel Software")), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid16_t >(GattCharacteristicType::MODEL_NUMBER_STRING), BTGattChar::PropertyBitVal::Read, jau::darray< DBGattDescRef >(), make_gvalue("2.4.0-pre")), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid16_t >(GattCharacteristicType::SERIAL_NUMBER_STRING), BTGattChar::PropertyBitVal::Read, jau::darray< DBGattDescRef >(), make_gvalue("sn:0123456789")), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid16_t >(GattCharacteristicType::HARDWARE_REVISION_STRING), BTGattChar::PropertyBitVal::Read, jau::darray< DBGattDescRef >(), make_gvalue("hw:0123456789")), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid16_t >(GattCharacteristicType::FIRMWARE_REVISION_STRING), BTGattChar::PropertyBitVal::Read, jau::darray< DBGattDescRef >(), make_gvalue("fw:0123456789")), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid16_t >(GattCharacteristicType::SOFTWARE_REVISION_STRING), BTGattChar::PropertyBitVal::Read, jau::darray< DBGattDescRef >(), make_gvalue("sw:0123456789")))), std::make_shared< DBGattService >(true, std::make_unique< const jau::uuid128_t >(DataServiceUUID), jau::make_darray(std::make_shared< DBGattChar >(std::make_unique< const jau::uuid128_t >(StaticDataUUID), BTGattChar::PropertyBitVal::Read, jau::make_darray(std::make_shared< DBGattDesc >(BTGattDesc::TYPE_USER_DESC, make_gvalue("DATA_STATIC"))), make_gvalue("Proprietary Static Data 0x00010203")), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid128_t >(CommandUUID), BTGattChar::PropertyBitVal::WriteNoAck|BTGattChar::PropertyBitVal::WriteWithAck, jau::make_darray(std::make_shared< DBGattDesc >(BTGattDesc::TYPE_USER_DESC, make_gvalue("COMMAND"))), make_gvalue(128, 64), true), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid128_t >(ResponseUUID), BTGattChar::PropertyBitVal::Notify|BTGattChar::PropertyBitVal::Indicate, jau::make_darray(std::make_shared< DBGattDesc >(BTGattDesc::TYPE_USER_DESC, make_gvalue("RESPONSE")), DBGattDesc::createClientCharConfig()), make_gvalue((uint16_t) 0)), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid128_t >(PulseDataUUID), BTGattChar::PropertyBitVal::Notify|BTGattChar::PropertyBitVal::Indicate, jau::make_darray(std::make_shared< DBGattDesc >(BTGattDesc::TYPE_USER_DESC, make_gvalue("DATA_PULSE")), DBGattDesc::createClientCharConfig()), make_gvalue("Synthethic Sensor 01"))))))) |
| static BTDeviceRef | getDevice () |
| static bool | initAdapter (std::shared_ptr< BTAdapter > &adapter) |
| int | main (int argc, char *argv[]) |
| static bool | matches (const BTDeviceRef &device) |
| static void | myChangedAdapterSetFunc (const bool added, std::shared_ptr< BTAdapter > &adapter) |
| static void | processDisconnectedDevice (BTDeviceRef device) |
| static void | setDevice (const BTDeviceRef &cd) |
| static bool | startAdvertising (BTAdapter *a, std::string msg) |
| static bool | stopAdvertising (BTAdapter *a, std::string msg) |
| void | test () |
Variables | |
| static std::string | adapter_name = "TestDev001_N" |
| static SMPIOCapability | adapter_sec_io_cap = SMPIOCapability::UNSET |
| static BTSecurityLevel | adapter_sec_level = BTSecurityLevel::UNSET |
| static std::string | adapter_short_name = "TDev001N" |
| static const uint8_t | adv_chan_map =0x07 |
| static const uint16_t | adv_interval_max =480 |
| static const uint16_t | adv_interval_min =160 |
| static const AD_PDU_Type | adv_type =AD_PDU_Type::ADV_IND |
| static BTMode | btMode = BTMode::DUAL |
| static std::shared_ptr< BTAdapter > | chosenAdapter = nullptr |
| static const jau::uuid128_t | CommandUUID = jau::uuid128_t("d0ca6bf3-3d52-4760-98e5-fc5883e93712") |
| static BTDeviceRef | connectedDevice = nullptr |
| static const jau::uuid128_t | DataServiceUUID = jau::uuid128_t("d0ca6bf3-3d50-4760-98e5-fc5883e93712") |
| static const uint8_t | filter_policy =0x00 |
| static const jau::uuid128_t | PulseDataUUID = jau::uuid128_t("d0ca6bf3-3d54-4760-98e5-fc5883e93712") |
| static const jau::uuid128_t | ResponseUUID = jau::uuid128_t("d0ca6bf3-3d53-4760-98e5-fc5883e93712") |
| static bool | RUN_ONLY_ONCE = false |
| static jau::relaxed_atomic_nsize_t | servedConnections = 0 |
| static bool | SHOW_UPDATE_EVENTS = false |
| static const jau::uuid128_t | StaticDataUUID = jau::uuid128_t("d0ca6bf3-3d51-4760-98e5-fc5883e93712") |
| static jau::sc_atomic_bool | sync_data |
| static uint64_t | timestamp_t0 |
| static bool | use_SC = true |
| static EUI48 | useAdapter = EUI48::ALL_DEVICE |
This _dbt_peripheral00__ C++ peripheral ::BTRole::Slave GATT server example uses an event driven workflow.
Using scripts/run-dbt_peripheral00.sh from dist directory:
TestDevice001 using adapter 00:1A:7D:DA:71:03; Using ENC_ONLY (JUST_WORKS) encryption. Definition in file dbt_peripheral00.cpp.
|
static |
Definition at line 536 of file dbt_peripheral00.cpp.
|
static |
Definition at line 586 of file dbt_peripheral00.cpp.
|
static |
Definition at line 596 of file dbt_peripheral00.cpp.
|
static |
Definition at line 88 of file dbt_peripheral00.cpp.
|
static |
Definition at line 93 of file dbt_peripheral00.cpp.
|
static |
Definition at line 98 of file dbt_peripheral00.cpp.
| DBGattServerRef dbGattServer | ( | new | DBGattServerjau::make_darray(std::make_shared< DBGattService >(true, std::make_unique< const jau::uuid16_t >(GattServiceType::GENERIC_ACCESS), jau::make_darray(std::make_shared< DBGattChar >(std::make_unique< const jau::uuid16_t >(GattCharacteristicType::DEVICE_NAME), BTGattChar::PropertyBitVal::Read, jau::darray< DBGattDescRef >(), make_gvalue(adapter_name.c_str(), 128), true), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid16_t >(GattCharacteristicType::APPEARANCE), BTGattChar::PropertyBitVal::Read, jau::darray< DBGattDescRef >(), make_gvalue((uint16_t) 0)))), std::make_shared< DBGattService >(true, std::make_unique< const jau::uuid16_t >(GattServiceType::DEVICE_INFORMATION), jau::make_darray(std::make_shared< DBGattChar >(std::make_unique< const jau::uuid16_t >(GattCharacteristicType::MANUFACTURER_NAME_STRING), BTGattChar::PropertyBitVal::Read, jau::darray< DBGattDescRef >(), make_gvalue("Gothel Software")), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid16_t >(GattCharacteristicType::MODEL_NUMBER_STRING), BTGattChar::PropertyBitVal::Read, jau::darray< DBGattDescRef >(), make_gvalue("2.4.0-pre")), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid16_t >(GattCharacteristicType::SERIAL_NUMBER_STRING), BTGattChar::PropertyBitVal::Read, jau::darray< DBGattDescRef >(), make_gvalue("sn:0123456789")), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid16_t >(GattCharacteristicType::HARDWARE_REVISION_STRING), BTGattChar::PropertyBitVal::Read, jau::darray< DBGattDescRef >(), make_gvalue("hw:0123456789")), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid16_t >(GattCharacteristicType::FIRMWARE_REVISION_STRING), BTGattChar::PropertyBitVal::Read, jau::darray< DBGattDescRef >(), make_gvalue("fw:0123456789")), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid16_t >(GattCharacteristicType::SOFTWARE_REVISION_STRING), BTGattChar::PropertyBitVal::Read, jau::darray< DBGattDescRef >(), make_gvalue("sw:0123456789")))), std::make_shared< DBGattService >(true, std::make_unique< const jau::uuid128_t >(DataServiceUUID), jau::make_darray(std::make_shared< DBGattChar >(std::make_unique< const jau::uuid128_t >(StaticDataUUID), BTGattChar::PropertyBitVal::Read, jau::make_darray(std::make_shared< DBGattDesc >(BTGattDesc::TYPE_USER_DESC, make_gvalue("DATA_STATIC"))), make_gvalue("Proprietary Static Data 0x00010203")), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid128_t >(CommandUUID), BTGattChar::PropertyBitVal::WriteNoAck|BTGattChar::PropertyBitVal::WriteWithAck, jau::make_darray(std::make_shared< DBGattDesc >(BTGattDesc::TYPE_USER_DESC, make_gvalue("COMMAND"))), make_gvalue(128, 64), true), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid128_t >(ResponseUUID), BTGattChar::PropertyBitVal::Notify|BTGattChar::PropertyBitVal::Indicate, jau::make_darray(std::make_shared< DBGattDesc >(BTGattDesc::TYPE_USER_DESC, make_gvalue("RESPONSE")), DBGattDesc::createClientCharConfig()), make_gvalue((uint16_t) 0)), std::make_shared< DBGattChar >(std::make_unique< const jau::uuid128_t >(PulseDataUUID), BTGattChar::PropertyBitVal::Notify|BTGattChar::PropertyBitVal::Indicate, jau::make_darray(std::make_shared< DBGattDesc >(BTGattDesc::TYPE_USER_DESC, make_gvalue("DATA_PULSE")), DBGattDesc::createClientCharConfig()), make_gvalue("Synthethic Sensor 01"))))) | ) |
|
static |
Definition at line 613 of file dbt_peripheral00.cpp.
|
static |
Definition at line 682 of file dbt_peripheral00.cpp.
| void test | ( | ) |
Definition at line 705 of file dbt_peripheral00.cpp.
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 737 of file dbt_peripheral00.cpp.
|
static |
Definition at line 67 of file dbt_peripheral00.cpp.
|
static |
Definition at line 69 of file dbt_peripheral00.cpp.
|
static |
Definition at line 70 of file dbt_peripheral00.cpp.
|
static |
Definition at line 71 of file dbt_peripheral00.cpp.
|
static |
Definition at line 72 of file dbt_peripheral00.cpp.
|
static |
Definition at line 73 of file dbt_peripheral00.cpp.
|
static |
Definition at line 74 of file dbt_peripheral00.cpp.
|
static |
Definition at line 75 of file dbt_peripheral00.cpp.
|
static |
Definition at line 76 of file dbt_peripheral00.cpp.
|
static |
Definition at line 77 of file dbt_peripheral00.cpp.
|
static |
Definition at line 78 of file dbt_peripheral00.cpp.
|
static |
Definition at line 79 of file dbt_peripheral00.cpp.
|
static |
Definition at line 80 of file dbt_peripheral00.cpp.
|
static |
Definition at line 82 of file dbt_peripheral00.cpp.
|
static |
Definition at line 103 of file dbt_peripheral00.cpp.
|
static |
Definition at line 104 of file dbt_peripheral00.cpp.
|
static |
Definition at line 105 of file dbt_peripheral00.cpp.
|
static |
Definition at line 106 of file dbt_peripheral00.cpp.
|
static |
Definition at line 107 of file dbt_peripheral00.cpp.
|
static |
Definition at line 530 of file dbt_peripheral00.cpp.
|
static |
Definition at line 531 of file dbt_peripheral00.cpp.
|
static |
Definition at line 532 of file dbt_peripheral00.cpp.
|
static |
Definition at line 533 of file dbt_peripheral00.cpp.
|
static |
Definition at line 534 of file dbt_peripheral00.cpp.