aws-iot-sdk: remove the samples provided by Amazon
We have our own AWS IoT Device SDK demo application. https://jira.digi.com/browse/DEL-4339 Signed-off-by: Tatiana Leon <tatiana.leon@digi.com>
This commit is contained in:
parent
b0b0becc7a
commit
ab909175f0
|
|
@ -17,20 +17,10 @@
|
|||
#
|
||||
# ***************************************************************************
|
||||
|
||||
SAMPLES_SUBDIR := samples/linux
|
||||
|
||||
EXAMPLES := $(SAMPLES_SUBDIR)/shadow_sample \
|
||||
$(SAMPLES_SUBDIR)/shadow_sample_console_echo \
|
||||
$(SAMPLES_SUBDIR)/subscribe_publish_sample
|
||||
|
||||
SUBDIRS := src $(EXAMPLES)
|
||||
SUBDIRS := src
|
||||
|
||||
all: $(SUBDIRS)
|
||||
|
||||
$(SAMPLES_SUBDIR)/shadow_sample: src
|
||||
$(SAMPLES_SUBDIR)/shadow_sample_console_echo: src
|
||||
$(SAMPLES_SUBDIR)/subscribe_publish_sample: src
|
||||
|
||||
.PHONY: $(SUBDIRS)
|
||||
$(SUBDIRS):
|
||||
$(MAKE) -C $@
|
||||
|
|
|
|||
|
|
@ -10,11 +10,9 @@ DEPENDS = "mbedtls"
|
|||
|
||||
SRC_URI = " \
|
||||
https://github.com/aws/aws-iot-device-sdk-embedded-C/archive/v${PV}.tar.gz \
|
||||
file://0001-aws-iot-samples-modify-provided-samples-to-work-in-o.patch \
|
||||
file://aws_iot_config.h.template \
|
||||
file://awsiotsdk.pc \
|
||||
file://Makefile \
|
||||
file://Makefile.app \
|
||||
file://Makefile.lib \
|
||||
"
|
||||
|
||||
|
|
@ -48,17 +46,9 @@ do_configure() {
|
|||
sed -i -e "s,##AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL##,${AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL},g" "${S}/include/aws_iot_config.h"
|
||||
sed -i -e "s,##AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL##,${AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL},g" "${S}/include/aws_iot_config.h"
|
||||
|
||||
# Remove the examples header files.
|
||||
rm -f ${S}/samples/linux/shadow_sample/aws_iot_config.h
|
||||
rm -f ${S}/samples/linux/shadow_sample_console_echo/aws_iot_config.h
|
||||
rm -f ${S}/samples/linux/subscribe_publish_sample/aws_iot_config.h
|
||||
|
||||
# Copy the Makefiles.
|
||||
cp -f ${WORKDIR}/Makefile ${S}
|
||||
cp -f ${WORKDIR}/Makefile.lib ${S}/src/Makefile
|
||||
cp -f ${WORKDIR}/Makefile.app ${S}/samples/linux/shadow_sample/Makefile
|
||||
cp -f ${WORKDIR}/Makefile.app ${S}/samples/linux/shadow_sample_console_echo/Makefile
|
||||
cp -f ${WORKDIR}/Makefile.app ${S}/samples/linux/subscribe_publish_sample/Makefile
|
||||
}
|
||||
|
||||
do_install() {
|
||||
|
|
@ -89,13 +79,11 @@ do_install() {
|
|||
install -m 0644 ${AWS_IOT_CERTS_DIR}/${AWS_IOT_PRIVATE_KEY_FILENAME} ${D}${sysconfdir}/ssl/certs/
|
||||
}
|
||||
|
||||
PACKAGES =+ "${PN}-cert ${PN}-examples"
|
||||
PACKAGES =+ "${PN}-cert"
|
||||
|
||||
FILES_${PN}-cert = "${sysconfdir}/ssl/certs/"
|
||||
FILES_${PN}-examples = "${bindir}"
|
||||
|
||||
RDEPENDS_${PN} = "${PN}-cert"
|
||||
RDEPENDS_${PN}-examples = "${PN}-cert"
|
||||
|
||||
ALLOW_EMPTY_${PN} = "1"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,149 +0,0 @@
|
|||
From: Tatiana Leon <tatiana.leon@digi.com>
|
||||
Date: Wed, 3 May 2017 18:12:52 +0200
|
||||
Subject: [PATCH] aws-iot-samples: modify provided samples to work in our
|
||||
platforms
|
||||
|
||||
Signed-off-by: Tatiana Leon <tatiana.leon@digi.com>
|
||||
---
|
||||
samples/linux/shadow_sample/shadow_sample.c | 20 ++++++++++----------
|
||||
.../shadow_sample_console_echo/shadow_console_echo.c | 20 ++++++++++----------
|
||||
.../subscribe_publish_sample.c | 12 ++++++------
|
||||
3 files changed, 26 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/samples/linux/shadow_sample/shadow_sample.c b/samples/linux/shadow_sample/shadow_sample.c
|
||||
index 9a0b270..fc73a2d 100644
|
||||
--- a/samples/linux/shadow_sample/shadow_sample.c
|
||||
+++ b/samples/linux/shadow_sample/shadow_sample.c
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
#define MAX_LENGTH_OF_UPDATE_JSON_BUFFER 200
|
||||
|
||||
-static char certDirectory[PATH_MAX + 1] = "../../../certs";
|
||||
+static char certDirectory[PATH_MAX + 1] = "";
|
||||
static char HostAddress[255] = AWS_IOT_MQTT_HOST;
|
||||
static uint32_t port = AWS_IOT_MQTT_PORT;
|
||||
static uint8_t numPubs = 5;
|
||||
@@ -164,27 +164,27 @@ int main(int argc, char **argv) {
|
||||
char rootCA[PATH_MAX + 1];
|
||||
char clientCRT[PATH_MAX + 1];
|
||||
char clientKey[PATH_MAX + 1];
|
||||
- char CurrentWD[PATH_MAX + 1];
|
||||
|
||||
IOT_INFO("\nAWS IoT SDK Version %d.%d.%d-%s\n", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, VERSION_TAG);
|
||||
|
||||
- getcwd(CurrentWD, sizeof(CurrentWD));
|
||||
- snprintf(rootCA, PATH_MAX + 1, "%s/%s/%s", CurrentWD, certDirectory, AWS_IOT_ROOT_CA_FILENAME);
|
||||
- snprintf(clientCRT, PATH_MAX + 1, "%s/%s/%s", CurrentWD, certDirectory, AWS_IOT_CERTIFICATE_FILENAME);
|
||||
- snprintf(clientKey, PATH_MAX + 1, "%s/%s/%s", CurrentWD, certDirectory, AWS_IOT_PRIVATE_KEY_FILENAME);
|
||||
+ parseInputArgsForConnectParams(argc, argv);
|
||||
+
|
||||
+ if (certDirectory[0] == '\0')
|
||||
+ snprintf(certDirectory, PATH_MAX + 1, "%s", "/etc/ssl/certs");
|
||||
+ snprintf(rootCA, PATH_MAX + 1, "%s/%s", certDirectory, AWS_IOT_ROOT_CA_FILENAME);
|
||||
+ snprintf(clientCRT, PATH_MAX + 1, "%s/%s", certDirectory, AWS_IOT_CERTIFICATE_FILENAME);
|
||||
+ snprintf(clientKey, PATH_MAX + 1, "%s/%s", certDirectory, AWS_IOT_PRIVATE_KEY_FILENAME);
|
||||
|
||||
IOT_DEBUG("rootCA %s", rootCA);
|
||||
IOT_DEBUG("clientCRT %s", clientCRT);
|
||||
IOT_DEBUG("clientKey %s", clientKey);
|
||||
|
||||
- parseInputArgsForConnectParams(argc, argv);
|
||||
-
|
||||
// initialize the mqtt client
|
||||
AWS_IoT_Client mqttClient;
|
||||
|
||||
ShadowInitParameters_t sp = ShadowInitParametersDefault;
|
||||
- sp.pHost = AWS_IOT_MQTT_HOST;
|
||||
- sp.port = AWS_IOT_MQTT_PORT;
|
||||
+ sp.pHost = HostAddress;
|
||||
+ sp.port = port;
|
||||
sp.pClientCRT = clientCRT;
|
||||
sp.pClientKey = clientKey;
|
||||
sp.pRootCA = rootCA;
|
||||
diff --git a/samples/linux/shadow_sample_console_echo/shadow_console_echo.c b/samples/linux/shadow_sample_console_echo/shadow_console_echo.c
|
||||
index 1c491fb..e333094 100644
|
||||
--- a/samples/linux/shadow_sample_console_echo/shadow_console_echo.c
|
||||
+++ b/samples/linux/shadow_sample_console_echo/shadow_console_echo.c
|
||||
@@ -53,7 +53,7 @@
|
||||
* @note Ensure the buffer sizes in aws_iot_config.h are big enough to receive the delta message. The delta message will also contain the metadata with the timestamps
|
||||
*/
|
||||
|
||||
-char certDirectory[PATH_MAX + 1] = "../../../certs";
|
||||
+char certDirectory[PATH_MAX + 1] = "";
|
||||
char HostAddress[255] = AWS_IOT_MQTT_HOST;
|
||||
uint32_t port = AWS_IOT_MQTT_PORT;
|
||||
bool messageArrivedOnDelta = false;
|
||||
@@ -80,27 +80,27 @@ int main(int argc, char** argv) {
|
||||
char rootCA[PATH_MAX + 1];
|
||||
char clientCRT[PATH_MAX + 1];
|
||||
char clientKey[PATH_MAX + 1];
|
||||
- char CurrentWD[PATH_MAX + 1];
|
||||
|
||||
IOT_INFO("\nAWS IoT SDK Version %d.%d.%d-%s\n", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, VERSION_TAG);
|
||||
|
||||
- getcwd(CurrentWD, sizeof(CurrentWD));
|
||||
- snprintf(rootCA, PATH_MAX + 1, "%s/%s/%s", CurrentWD, certDirectory, AWS_IOT_ROOT_CA_FILENAME);
|
||||
- snprintf(clientCRT, PATH_MAX + 1, "%s/%s/%s", CurrentWD, certDirectory, AWS_IOT_CERTIFICATE_FILENAME);
|
||||
- snprintf(clientKey, PATH_MAX + 1, "%s/%s/%s", CurrentWD, certDirectory, AWS_IOT_PRIVATE_KEY_FILENAME);
|
||||
+ parseInputArgsForConnectParams(argc, argv);
|
||||
+
|
||||
+ if (certDirectory[0] == '\0')
|
||||
+ snprintf(certDirectory, PATH_MAX + 1, "%s", "/etc/ssl/certs");
|
||||
+ snprintf(rootCA, PATH_MAX + 1, "%s/%s", certDirectory, AWS_IOT_ROOT_CA_FILENAME);
|
||||
+ snprintf(clientCRT, PATH_MAX + 1, "%s/%s", certDirectory, AWS_IOT_CERTIFICATE_FILENAME);
|
||||
+ snprintf(clientKey, PATH_MAX + 1, "%s/%s", certDirectory, AWS_IOT_PRIVATE_KEY_FILENAME);
|
||||
|
||||
IOT_DEBUG("rootCA %s", rootCA);
|
||||
IOT_DEBUG("clientCRT %s", clientCRT);
|
||||
IOT_DEBUG("clientKey %s", clientKey);
|
||||
|
||||
- parseInputArgsForConnectParams(argc, argv);
|
||||
-
|
||||
// initialize the mqtt client
|
||||
AWS_IoT_Client mqttClient;
|
||||
|
||||
ShadowInitParameters_t sp = ShadowInitParametersDefault;
|
||||
- sp.pHost = AWS_IOT_MQTT_HOST;
|
||||
- sp.port = AWS_IOT_MQTT_PORT;
|
||||
+ sp.pHost = HostAddress;
|
||||
+ sp.port = port;
|
||||
sp.pClientCRT = clientCRT;
|
||||
sp.pClientKey = clientKey;
|
||||
sp.pRootCA = rootCA;
|
||||
diff --git a/samples/linux/subscribe_publish_sample/subscribe_publish_sample.c b/samples/linux/subscribe_publish_sample/subscribe_publish_sample.c
|
||||
index 4f92645..d0fef05 100644
|
||||
--- a/samples/linux/subscribe_publish_sample/subscribe_publish_sample.c
|
||||
+++ b/samples/linux/subscribe_publish_sample/subscribe_publish_sample.c
|
||||
@@ -40,7 +40,7 @@
|
||||
/**
|
||||
* @brief Default cert location
|
||||
*/
|
||||
-char certDirectory[PATH_MAX + 1] = "../../../certs";
|
||||
+char certDirectory[PATH_MAX + 1] = "";
|
||||
|
||||
/**
|
||||
* @brief Default MQTT HOST URL is pulled from the aws_iot_config.h
|
||||
@@ -132,7 +132,6 @@ int main(int argc, char **argv) {
|
||||
char rootCA[PATH_MAX + 1];
|
||||
char clientCRT[PATH_MAX + 1];
|
||||
char clientKey[PATH_MAX + 1];
|
||||
- char CurrentWD[PATH_MAX + 1];
|
||||
char cPayload[100];
|
||||
|
||||
int32_t i = 0;
|
||||
@@ -150,10 +149,11 @@ int main(int argc, char **argv) {
|
||||
|
||||
IOT_INFO("\nAWS IoT SDK Version %d.%d.%d-%s\n", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, VERSION_TAG);
|
||||
|
||||
- getcwd(CurrentWD, sizeof(CurrentWD));
|
||||
- snprintf(rootCA, PATH_MAX + 1, "%s/%s/%s", CurrentWD, certDirectory, AWS_IOT_ROOT_CA_FILENAME);
|
||||
- snprintf(clientCRT, PATH_MAX + 1, "%s/%s/%s", CurrentWD, certDirectory, AWS_IOT_CERTIFICATE_FILENAME);
|
||||
- snprintf(clientKey, PATH_MAX + 1, "%s/%s/%s", CurrentWD, certDirectory, AWS_IOT_PRIVATE_KEY_FILENAME);
|
||||
+ if (certDirectory[0] == '\0')
|
||||
+ snprintf(certDirectory, PATH_MAX + 1, "%s", "/etc/ssl/certs");
|
||||
+ snprintf(rootCA, PATH_MAX + 1, "%s/%s", certDirectory, AWS_IOT_ROOT_CA_FILENAME);
|
||||
+ snprintf(clientCRT, PATH_MAX + 1, "%s/%s", certDirectory, AWS_IOT_CERTIFICATE_FILENAME);
|
||||
+ snprintf(clientKey, PATH_MAX + 1, "%s/%s", certDirectory, AWS_IOT_PRIVATE_KEY_FILENAME);
|
||||
|
||||
IOT_DEBUG("rootCA %s", rootCA);
|
||||
IOT_DEBUG("clientCRT %s", clientCRT);
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
# ***************************************************************************
|
||||
# Copyright (c) 2017 Digi International Inc.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
# Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
|
||||
#
|
||||
# ***************************************************************************
|
||||
# Use GNU C Compiler.
|
||||
CC ?= gcc
|
||||
|
||||
# Generated Executable Name.
|
||||
EXECUTABLE = $(notdir $(CURDIR))
|
||||
|
||||
# Location of Source Code.
|
||||
SRC = .
|
||||
|
||||
#IoT client directory.
|
||||
IOT_CLIENT_DIR = ../../..
|
||||
|
||||
PLATFORM_DIR = $(IOT_CLIENT_DIR)/platform/linux/mbedtls
|
||||
PLATFORM_COMMON_DIR = $(IOT_CLIENT_DIR)/platform/linux/common
|
||||
|
||||
CFLAGS += -I $(SRC)
|
||||
CFLAGS += -I $(IOT_CLIENT_DIR)/include
|
||||
CFLAGS += -I $(IOT_CLIENT_DIR)/external_libs/jsmn
|
||||
CFLAGS += -I $(PLATFORM_COMMON_DIR)
|
||||
CFLAGS += -I $(PLATFORM_DIR)
|
||||
CFLAGS += -Wall -g
|
||||
CFLAGS += $(LOG_FLAGS)
|
||||
|
||||
# Libraries to Link
|
||||
LIBS += $(shell PKG_CONFIG_PATH=../../..:$${PKG_CONFIG_PATH} pkg-config --libs --static awsiotsdk)
|
||||
|
||||
# Linking Flags.
|
||||
LDFLAGS += -L$(IOT_CLIENT_DIR)/src $(DFLAGS)
|
||||
|
||||
# Target output to generate.
|
||||
SRCS = $(wildcard $(SRC)/*.c)
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
.PHONY: all
|
||||
all: $(EXECUTABLE)
|
||||
|
||||
$(EXECUTABLE): $(OBJS)
|
||||
$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
|
||||
|
||||
.PHONY: install
|
||||
install: $(EXECUTABLE)
|
||||
install -d $(DESTDIR)/usr/bin
|
||||
install -m 0755 $< $(DESTDIR)/usr/bin/
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f $(EXECUTABLE) $(OBJS)
|
||||
|
||||
Loading…
Reference in New Issue