Skip to content

Commit bcf9e64

Browse files
committed
Working example
the example is a ble hart rate device. Working with Linux, Windows, Android and ios and Ipados.
1 parent ad04b6a commit bcf9e64

File tree

14 files changed

+605
-248
lines changed

14 files changed

+605
-248
lines changed

CMakeLists.txt

100644100755
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# For more information about build system see
2-
# https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html
3-
# The following five lines of boilerplate have to be in your project's
1+
# The following lines of boilerplate have to be in your project's
42
# CMakeLists in this exact order for cmake to work correctly
53
cmake_minimum_required(VERSION 3.5)
64

75
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
8-
project(SimLinkSoftware)
6+
project(blehr)

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
3+
# project subdirectory.
4+
#
5+
6+
PROJECT_NAME := blehr
7+
8+
include $(IDF_PATH)/make/project.mk

main/CMakeLists.txt

100644100755
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
1-
set(srcs "main.cpp"
2-
"common.cpp"
3-
"gap.cpp"
4-
"gatt.cpp")
5-
6-
idf_component_register(SRCS "${srcs}"
1+
idf_component_register(SRCS "main.c" "gatt_svr.c"
72
INCLUDE_DIRS ".")
8-
9-
#hier muss kein required oder ähnliches rein, weil main alles required

main/blehr_sens.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
#ifndef H_BLEHR_SENSOR_
21+
#define H_BLEHR_SENSOR_
22+
23+
#include "nimble/ble.h"
24+
#include "modlog/modlog.h"
25+
26+
#ifdef __cplusplus
27+
extern "C" {
28+
#endif
29+
30+
/* Heart-rate configuration */
31+
#define GATT_HRS_UUID 0x180D
32+
#define GATT_HRS_MEASUREMENT_UUID 0x2A37
33+
#define GATT_HRS_BODY_SENSOR_LOC_UUID 0x2A38
34+
#define GATT_DEVICE_INFO_UUID 0x180A
35+
#define GATT_MANUFACTURER_NAME_UUID 0x2A29
36+
#define GATT_MODEL_NUMBER_UUID 0x2A24
37+
#define GATT_BATTERYS_UUID 0x180f
38+
#define GATT_BATTERY_LEVEL_UUID 0x2a19
39+
40+
extern uint16_t hrs_hrm_handle;
41+
42+
struct ble_hs_cfg;
43+
struct ble_gatt_register_ctxt;
44+
45+
void gatt_svr_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg);
46+
int gatt_svr_init(void);
47+
48+
#ifdef __cplusplus
49+
}
50+
#endif
51+
52+
#endif

main/common.cpp

Lines changed: 0 additions & 25 deletions
This file was deleted.

main/component.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#
2+
# "main" pseudo-component makefile.
3+
#
4+
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)

main/gap.cpp

Lines changed: 0 additions & 88 deletions
This file was deleted.

main/gatt.cpp

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)