Skip to content

Commit 075332b

Browse files
rajkan01paul-szczepanek-arm
authored andcommitted
Add BLE gattclient examples with CMakeList and travis file
1 parent d38108d commit 075332b

File tree

6 files changed

+98
-4
lines changed

6 files changed

+98
-4
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright (c) 2020 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
5+
6+
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "")
7+
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.mbedbuild CACHE INTERNAL "")
8+
set(APP_TARGET BLE_GattClient_CharacteristicUpdates)
9+
10+
include(${MBED_PATH}/tools/cmake/app.cmake)
11+
12+
add_subdirectory(${MBED_PATH})
13+
14+
add_subdirectory(mbed-os-ble-utils)
15+
16+
add_executable(${APP_TARGET})
17+
18+
mbed_configure_app_target(${APP_TARGET})
19+
20+
mbed_set_mbed_target_linker_script(${APP_TARGET})
21+
22+
project(${APP_TARGET})
23+
24+
target_include_directories(${APP_TARGET}
25+
PRIVATE
26+
./source
27+
)
28+
29+
target_sources(${APP_TARGET}
30+
PRIVATE
31+
source/main.cpp
32+
)
33+
34+
target_link_libraries(${APP_TARGET}
35+
PRIVATE
36+
mbed-os
37+
mbed-events
38+
mbed-ble
39+
mbed-ble-utils
40+
)
41+
42+
mbed_set_post_build(${APP_TARGET})
43+
44+
option(VERBOSE_BUILD "Have a verbose build process")
45+
if(VERBOSE_BUILD)
46+
set(CMAKE_VERBOSE_MAKEFILE ON)
47+
endif()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
https://github.com/ARMmbed/mbed-os-ble-utils/#fdb54c0dd8056aaa24e59256b86b237773d07e70
1+
https://github.com/ARMmbed/mbed-os-ble-utils/#5a87e640383b2a1465e19ea6c052f80459314670

BLE_GattClient_CharacteristicUpdates/source/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#include "ble/GattClient.h"
2222

23-
#include "mbed-os-ble-utils/gatt_client_process.h"
23+
#include "gatt_client_process.h"
2424

2525
/**
2626
* Handle discovery of the GATT server.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright (c) 2020 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
5+
6+
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "")
7+
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.mbedbuild CACHE INTERNAL "")
8+
set(APP_TARGET BLE_GattClient_CharacteristicWrite)
9+
10+
include(${MBED_PATH}/tools/cmake/app.cmake)
11+
12+
add_subdirectory(${MBED_PATH})
13+
14+
add_subdirectory(mbed-os-ble-utils)
15+
16+
add_executable(${APP_TARGET})
17+
18+
mbed_configure_app_target(${APP_TARGET})
19+
20+
mbed_set_mbed_target_linker_script(${APP_TARGET})
21+
22+
project(${APP_TARGET})
23+
24+
target_include_directories(${APP_TARGET}
25+
PRIVATE
26+
./source
27+
)
28+
29+
target_sources(${APP_TARGET}
30+
PRIVATE
31+
source/main.cpp
32+
)
33+
34+
target_link_libraries(${APP_TARGET}
35+
PRIVATE
36+
mbed-os
37+
mbed-events
38+
mbed-ble
39+
mbed-ble-utils
40+
)
41+
42+
mbed_set_post_build(${APP_TARGET})
43+
44+
option(VERBOSE_BUILD "Have a verbose build process")
45+
if(VERBOSE_BUILD)
46+
set(CMAKE_VERBOSE_MAKEFILE ON)
47+
endif()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
https://github.com/ARMmbed/mbed-os-ble-utils/#fdb54c0dd8056aaa24e59256b86b237773d07e70
1+
https://github.com/ARMmbed/mbed-os-ble-utils/#5a87e640383b2a1465e19ea6c052f80459314670

BLE_GattClient_CharacteristicWrite/source/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include <events/mbed_events.h>
1818
#include "ble/BLE.h"
19-
#include "mbed-os-ble-utils/gatt_client_process.h"
19+
#include "gatt_client_process.h"
2020

2121
static EventQueue event_queue(/* event count */ 10 * EVENTS_EVENT_SIZE);
2222

0 commit comments

Comments
 (0)