Skip to content

Commit d2c0591

Browse files
committed
Adding aws-iot-device-sdk-embedded-c-mqtt-demo-plaintext, backoffalgorithm, coremqtt, corehttp, sigv4
The aws-iot-device-sdk-embedded-c-mqtt-demo-plaintext example will use standalone versions of backoffalgorithm, coremqtt.
1 parent e0652c8 commit d2c0591

File tree

16 files changed

+509
-0
lines changed

16 files changed

+509
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
cmake_minimum_required(VERSION 3.0)
2+
project(mqtt_demo_plaintext C)
3+
4+
# Find required packages
5+
find_package(core_mqtt REQUIRED)
6+
find_package(backoffalgorithm REQUIRED)
7+
8+
include(${CMAKE_CURRENT_SOURCE_DIR}/../../logging-stack/logging.cmake)
9+
10+
# Add source files
11+
add_executable(mqtt_demo_plaintext
12+
${CMAKE_CURRENT_SOURCE_DIR}/../../../platform/posix/clock_posix.c
13+
${CMAKE_CURRENT_SOURCE_DIR}/../../../platform/posix/transport/src/plaintext_posix.c
14+
${CMAKE_CURRENT_SOURCE_DIR}/../../../platform/posix/transport/src/sockets_posix.c
15+
mqtt_demo_plaintext.c
16+
)
17+
18+
# Add include directories for platform specific files
19+
target_include_directories(mqtt_demo_plaintext PRIVATE
20+
${CMAKE_CURRENT_SOURCE_DIR}
21+
${CMAKE_CURRENT_SOURCE_DIR}/../../../platform/posix/transport/include/
22+
${CMAKE_CURRENT_SOURCE_DIR}/../../../platform/include/
23+
PUBLIC
24+
${CMAKE_CURRENT_LIST_DIR}
25+
${LOGGING_INCLUDE_DIRS}
26+
)
27+
28+
29+
# Link libraries
30+
target_link_libraries(mqtt_demo_plaintext
31+
PRIVATE
32+
core_mqtt::core_mqtt
33+
backoffalgorithm::backoffalgorithm
34+
pthread
35+
)
36+
37+
# Add compile definitions
38+
target_compile_definitions(mqtt_demo_plaintext PRIVATE
39+
BROKER_ENDPOINT="localhost"
40+
CLIENT_IDENTIFIER="mqtt_demo_plaintext"
41+
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
rm -rf tests.log
4+
timeout 30s mqtt_demo_plaintext | tee -a tests.log
5+
grep "Demo completed successfully" tests.log
6+
RETVAL=$?
7+
if [ $RETVAL -eq 0 ] ; then
8+
echo "PASS: aws-iot-device-sdk-embedded-c: mqtt_demo_plaintext"
9+
else
10+
echo "FAIL: aws-iot-device-sdk-embedded-c: mqtt_demo_plaintext"
11+
fi
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
SUMMARY = "AWS IoT Device SDK for Embedded C - demo mqtt-demo-plaintext"
2+
DESCRIPTION = "SDK for connecting to AWS IoT from a device using embedded C - demo mqtt-demo-plaintext build from discrete lib packages instead of self contained libs"
3+
HOMEPAGE = "https://github.com/aws/aws-iot-device-sdk-embedded-C"
4+
LICENSE = "MIT"
5+
LIC_FILES_CHKSUM = "file://${UNPACKDIR}/${PN}-${PV}/LICENSE;md5=c8c19afab7f99fb196c9287cbd60a258 "
6+
7+
SRC_URI = "\
8+
git://github.com/aws/aws-iot-device-sdk-embedded-C.git;protocol=https;branch=main \
9+
file://CMakeLists.txt \
10+
file://run-ptest \
11+
"
12+
13+
SRCREV = "da99638ec373c791a45557b0cd91fc20968d492d"
14+
15+
DEPENDS = "\
16+
backoffalgorithm \
17+
coremqtt \
18+
"
19+
20+
RDEPENDS:${PN}-ptest += "\
21+
mosquitto \
22+
coreutils \
23+
"
24+
25+
inherit cmake ptest
26+
27+
S = "${UNPACKDIR}/${PN}-${PV}/demos/mqtt/mqtt_demo_plaintext"
28+
29+
do_configure:prepend () {
30+
cp ${UNPACKDIR}/CMakeLists.txt ${S}/
31+
}
32+
33+
do_install () {
34+
install -d ${D}${bindir}
35+
install -m 0755 ${B}/mqtt_demo_plaintext ${D}${bindir}
36+
}
37+
38+
# TODO fix properly
39+
INSANE_SKIP:${PN} += "buildpaths"
40+
INSANE_SKIP:${PN}-dbg += "buildpaths"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
LICENSE = "MIT"
2+
LIC_FILES_CHKSUM = "file://LICENSE;md5=7ae2be7fb1637141840314b51970a9f7"
3+
4+
SRC_URI = "gitsm://github.com/FreeRTOS/backoffAlgorithm.git;protocol=https;branch=main \
5+
file://CMakeLists.txt \
6+
file://Findbackoffalgorithm.cmake \
7+
"
8+
9+
SRCREV = "50e30d7d0aa0aa74e85134088a86f91978267d41"
10+
11+
DEPENDS = "cmake-native ruby-native"
12+
13+
inherit cmake
14+
15+
do_configure:prepend() {
16+
cp ${UNPACKDIR}/CMakeLists.txt ${S}/
17+
}
18+
19+
do_install:append() {
20+
install -d ${D}${datadir}/cmake/Modules
21+
install -m 0644 ${UNPACKDIR}/Findbackoffalgorithm.cmake ${D}${datadir}/cmake/Modules/
22+
}
23+
24+
FILES:${PN} += "${libdir}/libbackoffalgorithm.so.*"
25+
FILES:${PN}-dev += "\
26+
${libdir}/libbackoffalgorithm.so \
27+
${includedir}/backoffalgorithm/* \
28+
${datadir}/cmake/Modules/Findbackoffalgorithm.cmake \
29+
"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
cmake_minimum_required(VERSION 3.0)
2+
project(backoffalgorithm VERSION 1.0.0 LANGUAGES C)
3+
4+
# Include the file containing source definitions
5+
include(${CMAKE_CURRENT_SOURCE_DIR}/backoffAlgorithmFilePaths.cmake)
6+
7+
# Option to build shared libraries
8+
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
9+
10+
# Create backoffalgorithm library
11+
add_library(backoffalgorithm
12+
${BACKOFF_ALGORITHM_SOURCES}
13+
)
14+
15+
# Set library properties
16+
set_target_properties(backoffalgorithm PROPERTIES
17+
VERSION ${PROJECT_VERSION}
18+
SOVERSION ${PROJECT_VERSION_MAJOR}
19+
)
20+
21+
# Set include directories using the paths from backoffAlgorithmFilePaths.cmake
22+
target_include_directories(backoffalgorithm
23+
PUBLIC
24+
${BACKOFF_ALGORITHM_INCLUDE_PUBLIC_DIRS}
25+
)
26+
27+
# Installation rules
28+
include(GNUInstallDirs)
29+
30+
# Install the library and headers
31+
install(TARGETS backoffalgorithm
32+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
33+
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/backoffalgorithm
34+
)
35+
36+
# Install header files
37+
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/source/include/
38+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/backoffalgorithm
39+
FILES_MATCHING PATTERN "*.h"
40+
)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Findbackoffalgorithm.cmake
2+
find_path(BACKOFFALGORITHM_INCLUDE_DIR backoff_algorithm.h
3+
PATHS ${CMAKE_INSTALL_PREFIX}/include
4+
PATH_SUFFIXES backoffalgorithm)
5+
6+
find_library(BACKOFFALGORITHM_LIBRARY
7+
NAMES backoffalgorithm
8+
PATHS ${CMAKE_INSTALL_PREFIX}/lib)
9+
10+
include(FindPackageHandleStandardArgs)
11+
find_package_handle_standard_args(backoffalgorithm DEFAULT_MSG
12+
BACKOFFALGORITHM_LIBRARY BACKOFFALGORITHM_INCLUDE_DIR)
13+
14+
mark_as_advanced(BACKOFFALGORITHM_INCLUDE_DIR BACKOFFALGORITHM_LIBRARY)
15+
16+
if(backoffalgorithm_FOUND AND NOT TARGET backoffalgorithm::backoffalgorithm)
17+
add_library(backoffalgorithm::backoffalgorithm UNKNOWN IMPORTED)
18+
set_target_properties(backoffalgorithm::backoffalgorithm PROPERTIES
19+
IMPORTED_LOCATION "${BACKOFFALGORITHM_LIBRARY}"
20+
INTERFACE_INCLUDE_DIRECTORIES "${BACKOFFALGORITHM_INCLUDE_DIR}")
21+
endif()

recipes-sdk/corehttp/corehttp_git.bb

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
DESCRIPTION = "Client implementation of a subset of HTTP 1.1 protocol designed for embedded devices."
2+
LICENSE = "MIT"
3+
LIC_FILES_CHKSUM = "file://LICENSE;md5=7ae2be7fb1637141840314b51970a9f7 \
4+
file://source/dependency/3rdparty/llhttp/LICENSE-MIT;md5=f5e274d60596dd59be0a1d1b19af7978"
5+
6+
SRC_URI = "\
7+
gitsm://github.com/FreeRTOS/coreHTTP.git;protocol=https;branch=main \
8+
file://CMakeLists.txt \
9+
file://Findcore_http.cmake \
10+
"
11+
12+
SRCREV = "c08b1e1d27f1157d51ee9179d67645c43f05718e"
13+
14+
inherit cmake
15+
16+
EXTRA_OECMAKE:append = " -DCMAKE_C_FLAGS=-DHTTP_DO_NOT_USE_CUSTOM_CONFIG=ON"
17+
18+
do_configure:prepend() {
19+
cp ${UNPACKDIR}/CMakeLists.txt ${S}/
20+
}
21+
22+
do_install:append() {
23+
install -d ${D}${datadir}/cmake/Modules
24+
install -m 0644 ${UNPACKDIR}/Findcore_http.cmake ${D}${datadir}/cmake/Modules/
25+
}
26+
27+
FILES:${PN} += "${libdir}/libcore_http.so.*"
28+
FILES:${PN}-dev += "\
29+
${libdir}/libcore_http.so \
30+
${includedir}/libcore_http/* \
31+
${datadir}/cmake/Modules/Findcore_http.cmake \
32+
"
33+
34+
# nooelint: oelint.vars.insaneskip:INSANE_SKIP
35+
INSANE_SKIP:${PN} += "buildpaths"

recipes-sdk/corejson/corejson_git.bb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
SUMMARY = "A parser strictly enforcing the ECMA-404 JSON standard, suitable for microcontrollers"
2+
LICENSE = "MIT"
3+
LIC_FILES_CHKSUM = "file://LICENSE;md5=7ae2be7fb1637141840314b51970a9f7"
4+
5+
SRC_URI = "\
6+
gitsm://github.com/FreeRTOS/coreJSON.git;protocol=https;branch=main \
7+
file://CMakeLists.txt \
8+
file://Findcore_json.cmake \
9+
"
10+
11+
SRCREV = "40244174a1a71be54a7122b941d68f9298f2d67c"
12+
13+
inherit cmake
14+
15+
do_configure:prepend() {
16+
cp ${UNPACKDIR}/CMakeLists.txt ${S}/
17+
}
18+
19+
do_install:append() {
20+
install -d ${D}${datadir}/cmake/Modules
21+
install -m 0644 ${UNPACKDIR}/Findcore_json.cmake ${D}${datadir}/cmake/Modules/
22+
}
23+
24+
FILES:${PN} += "${libdir}/libcore_json.so.*"
25+
FILES:${PN}-dev += "\
26+
${libdir}/libcore_json.so \
27+
${includedir}/libcore_json/* \
28+
${datadir}/cmake/Modules/Findcore_json.cmake \
29+
"

recipes-sdk/coremqtt/coremqtt_git.bb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
LICENSE = "MIT"
2+
LIC_FILES_CHKSUM = "file://LICENSE;md5=7ae2be7fb1637141840314b51970a9f7"
3+
4+
SRC_URI = "gitsm://github.com/FreeRTOS/coreMQTT.git;protocol=https;branch=main \
5+
file://CMakeLists.txt \
6+
file://Findcore_mqtt.cmake \
7+
"
8+
9+
DEPENDS = "cmake-native"
10+
11+
SRCREV = "d7b04a13002496994d737eebaf56dbe1e56aaefb"
12+
13+
inherit cmake
14+
15+
do_configure:prepend() {
16+
cp ${UNPACKDIR}/CMakeLists.txt ${S}/
17+
}
18+
19+
do_install:append() {
20+
install -d ${D}${datadir}/cmake/Modules
21+
install -m 0644 ${UNPACKDIR}/Findcore_mqtt.cmake ${D}${datadir}/cmake/Modules/
22+
install ${S}/source/interface/transport_interface.h ${D}${includedir}/core_mqtt/
23+
}
24+
25+
FILES:${PN} += "${libdir}/libcore_mqtt.so.*"
26+
FILES:${PN}-dev += "\
27+
${libdir}/libcore_mqtt.so \
28+
${includedir}/core_mqtt/* \
29+
${datadir}/cmake/Modules/Findcore_mqtt.cmake \
30+
"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
cmake_minimum_required(VERSION 3.0)
2+
project(core_mqtt VERSION 1.0.0 LANGUAGES C)
3+
4+
# Include the file containing source definitions
5+
include(${CMAKE_CURRENT_SOURCE_DIR}/mqttFilePaths.cmake)
6+
7+
# Option to build shared libraries
8+
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
9+
10+
# Create MQTT core library
11+
add_library(core_mqtt
12+
${MQTT_SOURCES}
13+
${MQTT_SERIALIZER_SOURCES}
14+
)
15+
16+
# Add define to use default config
17+
target_compile_definitions(core_mqtt
18+
PUBLIC
19+
MQTT_DO_NOT_USE_CUSTOM_CONFIG
20+
)
21+
22+
# Set library properties
23+
set_target_properties(core_mqtt PROPERTIES
24+
VERSION ${PROJECT_VERSION}
25+
SOVERSION ${PROJECT_VERSION_MAJOR}
26+
)
27+
28+
# Set include directories using the paths from mqttFilePaths.cmake
29+
target_include_directories(core_mqtt
30+
PUBLIC
31+
${MQTT_INCLUDE_PUBLIC_DIRS}
32+
)
33+
34+
# Installation rules
35+
include(GNUInstallDirs)
36+
37+
# Install the library and headers
38+
install(TARGETS core_mqtt
39+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
40+
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/core_mqtt
41+
)
42+
43+
# Install header files
44+
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/source/include/
45+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/core_mqtt
46+
FILES_MATCHING PATTERN "*.h"
47+
)

0 commit comments

Comments
 (0)