ELEC-C7222
Libraries for ELEC C7222 Course Work
Loading...
Searching...
No Matches
main_ble_security_manager.cpp File Reference

BLE Security Manager example demonstrating encrypted GATT access. More...

#include <cassert>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <vector>
#include "../common/gap_event_handler.hpp"
#include "../common/security_event_handler.hpp"
#include "advertisement_data.hpp"
#include "attribute_server.hpp"
#include "ble.hpp"
#include "freertos_task.hpp"
#include "gap.hpp"
#include "platform.hpp"
#include "security_manager.hpp"
#include "app_profile.h"
Include dependency graph for main_ble_security_manager.cpp:

Functions

int main ()
 Main entry point for the BLE Security Manager example.
 

Detailed Description

BLE Security Manager example demonstrating encrypted GATT access.

This example exposes a custom vendor service with two characteristics:

  • PublicValue (READ): readable without pairing.
  • SecureValue (READ_ENCRYPTED): read requires an encrypted link.

The goal is to demonstrate how the Security Manager integrates with the Attribute Server and how GATT security flags behave in practice.


How to test (nRF Connect / LightBlue)

  1. Connect to the device ("c7222-sec-demo")
  2. Read "PublicValue" -> succeeds immediately
  3. Read "SecureValue" -> fails before pairing and/or triggers pairing
  4. Pair (Just Works) and read again -> succeeds

Notes

  • The secure behavior is enforced by the characteristic flags in the .gatt file (READ_ENCRYPTED).
  • This example uses "Just Works" pairing (NoInputNoOutput) for simplicity.

Function Documentation

◆ main()

int main ( void  )

Main entry point for the BLE Security Manager example.

Here is the call graph for this function: