Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for encoding/decoding messages using ADV_RPRT2 format with extra info: BLE primary/secondary PHY, BLE channel, Tx Power #64

Merged
merged 5 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMock
Submodule CMock updated 1 files
+23 −12 scripts/create_makefile.rb
47 changes: 43 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Source, copyright: https://github.com/viva64/pvs-studio-makefile-examples
# commit 82a0f0a, /example-1
# Modified for C on mac, added Doxygen
# Apache License
# Version 2.0, January 2004
# http://www.apache.org/licenses/
Expand Down Expand Up @@ -214,7 +211,7 @@ OFLAGS = -g3
LDFLAGS =
DFLAGS =

INCLUDES += src/
INCLUDES += src
INCLUDES += ./CMock/vendor/unity/src
INCLUDES += ./build/test/mocks
INC_PARAMS = $(foreach d, $(INCLUDES), -I$d)
Expand Down Expand Up @@ -242,13 +239,31 @@ UNITY_DIR = ${CMOCK_DIR}/vendor/unity
DISABLE_CMOCK_TEST_SUMMARY_PER_PROJECT=1

TEST_MAKEFILE = ${TEST_BUILD_DIR}/MakefileTestSupport
TEST_MAKEFILE_EXT_ADV_48 = ${BUILD_DIR}_ext_adv_48/MakefileTestSupport
TEST_MAKEFILE_EXT_ADV_MAX = ${BUILD_DIR}_ext_adv_max/MakefileTestSupport

-include ${TEST_MAKEFILE}
-include ${TEST_MAKEFILE_EXT_ADV_48}
-include ${TEST_MAKEFILE_EXT_ADV_MAX}

.PHONY: all clean doxygen sonar astyle

all: clean astyle doxygen sonar

# Specify all tests as dependencies of 'all' (workaround for JetBrains CLion)
# It is needed because on the first scan of Makefile the $(TEST_MAKEFILE) does not exist and it is not included.
all: test_ruuvi_endpoint_3 \
test_ruuvi_endpoint_5 \
test_ruuvi_endpoint_6 \
test_ruuvi_endpoint_8 \
test_ruuvi_endpoint_c5 \
test_ruuvi_endpoint_ca_uart \
test_ruuvi_endpoint_e0 \
test_ruuvi_endpoint_f0 \
test_ruuvi_endpoint_fa \
test_ruuvi_endpoint_ibeacon \
test_ruuvi_endpoints

doxygen: clean
doxygen

Expand All @@ -267,21 +282,31 @@ clean:
rm -rf $(DOXYGEN_DIR)/latex
rm -f *.gcov
rm -rf $(BUILD_DIR)
rm -rf $(BUILD_DIR)_ext_adv_48
rm -rf $(BUILD_DIR)_ext_adv_max
make setup_test
make generate_cmock_mocks_and_runners

test_all:
rm -rf build_ceedling
CEEDLING_MAIN_PROJECT_FILE=./project.yml ceedling test:all
CEEDLING_MAIN_PROJECT_FILE=./project_ext_adv_48.yml ceedling test:all
CEEDLING_MAIN_PROJECT_FILE=./project_ext_adv_max.yml ceedling test:all

test_all_gcov:
rm -rf build_ceedling
CEEDLING_MAIN_PROJECT_FILE=./project.yml ceedling test:all
CEEDLING_MAIN_PROJECT_FILE=./project.yml ceedling gcov:all utils:gcov
CEEDLING_MAIN_PROJECT_FILE=./project_ext_adv_48.yml ceedling test:all
CEEDLING_MAIN_PROJECT_FILE=./project_ext_adv_48.yml ceedling gcov:all utils:gcov
CEEDLING_MAIN_PROJECT_FILE=./project_ext_adv_max.yml ceedling test:all
CEEDLING_MAIN_PROJECT_FILE=./project_ext_adv_max.yml ceedling gcov:all utils:gcov
gcov -b -c build_ceedling/gcov/out/*.gcno

test:
@UNITY_DIR=${UNITY_DIR} BUILD_DIR=${BUILD_DIR} TEST_BUILD_DIR= ruby ${CMOCK_DIR}/scripts/test_summary.rb
@UNITY_DIR=${UNITY_DIR} BUILD_DIR=${BUILD_DIR}_ext_adv_48 TEST_BUILD_DIR= ruby ${CMOCK_DIR}/scripts/test_summary.rb
@UNITY_DIR=${UNITY_DIR} BUILD_DIR=${BUILD_DIR}_ext_adv_max TEST_BUILD_DIR= ruby ${CMOCK_DIR}/scripts/test_summary.rb

setup_test:
mkdir -p ${BUILD_DIR}
Expand All @@ -291,3 +316,17 @@ setup_test:
TEST_OUT_DIR=${TEST_OUT_DIR} \
TEST_MAKEFILE=${TEST_MAKEFILE} \
ruby ${CMOCK_DIR}/scripts/create_makefile.rb
mkdir -p ${BUILD_DIR}_ext_adv_48
CEEDLING_MAIN_PROJECT_FILE=./project_ext_adv_48.yml \
BUILD_DIR=${BUILD_DIR}_ext_adv_48 \
TEST_BUILD_DIR=${BUILD_DIR}_ext_adv_48/test \
TEST_OUT_DIR=${BUILD_DIR}_ext_adv_48/out \
TEST_MAKEFILE=${TEST_MAKEFILE_EXT_ADV_48} \
ruby ${CMOCK_DIR}/scripts/create_makefile.rb
mkdir -p ${BUILD_DIR}_ext_adv_max
CEEDLING_MAIN_PROJECT_FILE=./project_ext_adv_max.yml \
BUILD_DIR=${BUILD_DIR}_ext_adv_max \
TEST_BUILD_DIR=${BUILD_DIR}_ext_adv_max/test \
TEST_OUT_DIR=${BUILD_DIR}_ext_adv_max/out \
TEST_MAKEFILE=${TEST_MAKEFILE_EXT_ADV_MAX} \
ruby ${CMOCK_DIR}/scripts/create_makefile.rb
5 changes: 5 additions & 0 deletions project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@
- *common_defines
- TEST
- RE_6_ENABLED
:test_ruuvi_endpoint_ca_uart:
- *common_defines
- TEST
# - RI_ADV_EXTENDED_ENABLED=0
# - RI_COMM_BLE_PAYLOAD_MAX_LENGTH=31

:cmock:
:mock_prefix: mock_
Expand Down
139 changes: 139 additions & 0 deletions project_ext_adv_48.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---

# Notes:
# Sample project C code is not presently written to produce a release artifact.
# As such, release build options are disabled.
# This sample, therefore, only demonstrates running a collection of unit tests.

:project:
:use_exceptions: FALSE
:use_test_preprocessor: TRUE
:use_auxiliary_dependencies: TRUE
:build_root: build_ceedling
# :release_build: TRUE
:test_file_prefix: test_
:which_ceedling: gem
:default_tasks:
- test:all

#:test_build:
# :use_assembly: TRUE

#:release_build:
# :output: MyApp.out
# :use_assembly: FALSE

:environment:

:extension:
:executable: .out

:tools:
# Ceedling defaults to using gcc for compiling, linking, etc.
# As [:tools] is blank, gcc will be used (so long as it's in your system path)
# See documentation to configure a given toolchain for use
:test_linker:
:executable: gcc #absolute file path
:name: 'gcc linker'
:arguments:
- ${1} #list of object files to link (Ruby method call param list sub)
- -lm #link with math header
- -o ${2} #executable file output (Ruby method call param list sub)

:tools_gcov_linker:
:arguments:
- -lm

:paths:
:test:
- +:test/**
- -:test/support
:source:
- src/**
:support:
- test/support

:defines:
# in order to add common defines:
# 1) remove the trailing [] from the :common: section
# 2) add entries to the :common: section (e.g. :test: has TEST defined)
:common: &common_defines []
:test:
- *common_defines
- TEST
:test_preprocess:
- *common_defines
- TEST
:test_ruuvi_endpoint_6:
- *common_defines
- TEST
- RE_6_ENABLED
:test_ruuvi_endpoint_ca_uart:
- *common_defines
- TEST
- RI_ADV_EXTENDED_ENABLED=1
- RI_COMM_BLE_PAYLOAD_MAX_LENGTH=48

:cmock:
:mock_prefix: mock_
:when_no_prototypes: :warn
:enforce_strict_ordering: TRUE
:plugins:
- :ignore
- :ignore_arg
- :callback
- :return_thru_ptr
- :array
- :expect_any_args
:treat_as:
uint8: HEX8
uint16: HEX16
uint32: UINT32
int8: INT8
bool: UINT8

# Add -gcov to the plugins list to make sure of the gcov plugin
# You will need to have gcov and gcovr both installed to make it work.
# For more information on these options, see docs in plugins/gcov
:gcov:
:html_report: TRUE
:html_report_type: detailed
:html_medium_threshold: 75
:html_high_threshold: 90
:xml_report: FALSE

#:tools:
# Ceedling defaults to using gcc for compiling, linking, etc.
# As [:tools] is blank, gcc will be used (so long as it's in your system path)
# See documentation to configure a given toolchain for use

# LIBRARIES
# These libraries are automatically injected into the build process. Those specified as
# common will be used in all types of builds. Otherwise, libraries can be injected in just
# tests or releases. These options are MERGED with the options in supplemental yaml files.
:libraries:
:placement: :end
:flag: "${1}" # or "-L ${1}" for example
:test: []
:release: []

:plugins:
:load_paths:
- "#{Ceedling.load_path}"
:enabled:
- stdout_pretty_tests_report
- module_generator
- gcov

:flags:
:test:
:compile:
:*:
- -Wall
- -std=c11
:gcov:
:compile:
:*:
- -Wall
- -std=c11
...
139 changes: 139 additions & 0 deletions project_ext_adv_max.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---

# Notes:
# Sample project C code is not presently written to produce a release artifact.
# As such, release build options are disabled.
# This sample, therefore, only demonstrates running a collection of unit tests.

:project:
:use_exceptions: FALSE
:use_test_preprocessor: TRUE
:use_auxiliary_dependencies: TRUE
:build_root: build_ceedling
# :release_build: TRUE
:test_file_prefix: test_
:which_ceedling: gem
:default_tasks:
- test:all

#:test_build:
# :use_assembly: TRUE

#:release_build:
# :output: MyApp.out
# :use_assembly: FALSE

:environment:

:extension:
:executable: .out

:tools:
# Ceedling defaults to using gcc for compiling, linking, etc.
# As [:tools] is blank, gcc will be used (so long as it's in your system path)
# See documentation to configure a given toolchain for use
:test_linker:
:executable: gcc #absolute file path
:name: 'gcc linker'
:arguments:
- ${1} #list of object files to link (Ruby method call param list sub)
- -lm #link with math header
- -o ${2} #executable file output (Ruby method call param list sub)

:tools_gcov_linker:
:arguments:
- -lm

:paths:
:test:
- +:test/**
- -:test/support
:source:
- src/**
:support:
- test/support

:defines:
# in order to add common defines:
# 1) remove the trailing [] from the :common: section
# 2) add entries to the :common: section (e.g. :test: has TEST defined)
:common: &common_defines []
:test:
- *common_defines
- TEST
:test_preprocess:
- *common_defines
- TEST
:test_ruuvi_endpoint_6:
- *common_defines
- TEST
- RE_6_ENABLED
:test_ruuvi_endpoint_ca_uart:
- *common_defines
- TEST
- RI_ADV_EXTENDED_ENABLED=1
- RI_COMM_BLE_PAYLOAD_MAX_LENGTH=235

:cmock:
:mock_prefix: mock_
:when_no_prototypes: :warn
:enforce_strict_ordering: TRUE
:plugins:
- :ignore
- :ignore_arg
- :callback
- :return_thru_ptr
- :array
- :expect_any_args
:treat_as:
uint8: HEX8
uint16: HEX16
uint32: UINT32
int8: INT8
bool: UINT8

# Add -gcov to the plugins list to make sure of the gcov plugin
# You will need to have gcov and gcovr both installed to make it work.
# For more information on these options, see docs in plugins/gcov
:gcov:
:html_report: TRUE
:html_report_type: detailed
:html_medium_threshold: 75
:html_high_threshold: 90
:xml_report: FALSE

#:tools:
# Ceedling defaults to using gcc for compiling, linking, etc.
# As [:tools] is blank, gcc will be used (so long as it's in your system path)
# See documentation to configure a given toolchain for use

# LIBRARIES
# These libraries are automatically injected into the build process. Those specified as
# common will be used in all types of builds. Otherwise, libraries can be injected in just
# tests or releases. These options are MERGED with the options in supplemental yaml files.
:libraries:
:placement: :end
:flag: "${1}" # or "-L ${1}" for example
:test: []
:release: []

:plugins:
:load_paths:
- "#{Ceedling.load_path}"
:enabled:
- stdout_pretty_tests_report
- module_generator
- gcov

:flags:
:test:
:compile:
:*:
- -Wall
- -std=c11
:gcov:
:compile:
:*:
- -Wall
- -std=c11
...
Loading
Loading