From 0c8ec59744e2c4bdd2632ebc8e151f4fae90e53b Mon Sep 17 00:00:00 2001 From: Jelani Date: Mon, 29 Jan 2018 09:13:26 -0800 Subject: [PATCH] Made additions to e2e test and samples to iothub client --- build_all/tizenRT/Make.defs | 2 +- build_all/windows/build.cmd | 26 +- build_all/windowsce/build.cmd | 9 +- iothub_client/build/mbed/build.cmd | 28 +- iothub_client/samples/CMakeLists.txt | 8 +- .../iothub_client_sample_amqp/CMakeLists.txt | 42 --- .../freertos/.gitignore | 2 - .../freertos/Makefile | 332 ----------------- .../freertos/project.xml | 134 ------- .../iothub_client_sample_amqp.c | 269 -------------- .../iothub_client_sample_amqp.h | 17 - .../linux/CMakeLists.txt | 35 -- .../mbed/CMakeLists.txt | 8 - .../iothub_client_sample_amqp_filelist.txt | 6 - .../iothub_client_sample_amqp/mbed/readme.md | 3 - .../windows/iothub_client_sample_amqp.sln | 28 -- .../windows/iothub_client_sample_amqp.vcxproj | 178 ---------- .../iothub_client_sample_http/CMakeLists.txt | 49 --- .../freertos/.gitignore | 2 - .../freertos/Makefile | 333 ------------------ .../freertos/project.xml | 135 ------- .../iothub_client_sample_http.c | 263 -------------- .../iothub_client_sample_http.h | 17 - .../linux/CMakeLists.txt | 34 -- .../mbed/CMakeLists.txt | 8 - .../iothub_client_sample_http_filelist.txt | 6 - .../iothub_client_sample_http/mbed/readme.md | 3 - .../windows/iothub_client_sample_http.sln | 28 -- .../windows/iothub_client_sample_http.vcxproj | 173 --------- .../windows/packages.config | 5 - .../windowsce/iothub_client_sample_http.sln | 22 -- .../iothub_client_sample_http.vcxproj | 96 ----- .../windowsce/main.c | 10 - .../iothub_client_sample_mqtt/CMakeLists.txt | 41 --- .../iothub_client_sample_mqtt.c | 241 ------------- .../iothub_client_sample_mqtt.h | 17 - .../windows/packages.config | 6 - .../CMakeLists.txt | 38 -- .../iothub_client_sample_mqtt_ws.c | 212 ----------- .../iothub_ll_telemetry_sample/CMakeLists.txt | 44 +++ .../iothub_ll_telemetry_sample.c | 132 +++++++ .../linux/CMakeLists.txt | 17 +- .../mbed/CMakeLists.txt | 2 +- .../iothub_ll_telemetry_sample_filelist.txt} | 0 .../mbed/readme.md | 0 .../windows/iothub_ll_telemetry_sample.sln} | 2 +- .../iothub_ll_telemetry_sample.vcxproj} | 38 +- .../windows/packages.config | 6 +- iothub_client/samples/readme.md | 21 +- .../common_e2e/iothubclient_common_e2e.c | 150 +++++--- .../common_e2e/iothubclient_common_e2e.h | 11 +- .../iothubclient_amqp_e2e.c | 2 +- .../iothubclient_amqp_e2e_sfc.c | 2 +- .../iothubclient_amqp_ws_e2e.c | 2 +- .../iothubclient_amqp_ws_e2e_sfc.c | 2 +- .../iothubclient_mqtt_e2e.c | 2 +- .../iothubclient_mqtt_e2e_sfc.c | 2 +- .../iothubclient_mqtt_ws_e2e.c | 2 +- .../iothubclient_mqtt_ws_e2e_sfc.c | 2 +- jenkins/inteledison_c.sh | 6 +- jenkins/raspberrypi_c.sh | 6 +- .../src/prov_transport_http_client.c | 1 + 62 files changed, 370 insertions(+), 2948 deletions(-) delete mode 100644 iothub_client/samples/iothub_client_sample_amqp/CMakeLists.txt delete mode 100644 iothub_client/samples/iothub_client_sample_amqp/freertos/.gitignore delete mode 100644 iothub_client/samples/iothub_client_sample_amqp/freertos/Makefile delete mode 100644 iothub_client/samples/iothub_client_sample_amqp/freertos/project.xml delete mode 100644 iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp.c delete mode 100644 iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp.h delete mode 100644 iothub_client/samples/iothub_client_sample_amqp/linux/CMakeLists.txt delete mode 100644 iothub_client/samples/iothub_client_sample_amqp/mbed/CMakeLists.txt delete mode 100644 iothub_client/samples/iothub_client_sample_amqp/mbed/iothub_client_sample_amqp_filelist.txt delete mode 100644 iothub_client/samples/iothub_client_sample_amqp/mbed/readme.md delete mode 100644 iothub_client/samples/iothub_client_sample_amqp/windows/iothub_client_sample_amqp.sln delete mode 100644 iothub_client/samples/iothub_client_sample_amqp/windows/iothub_client_sample_amqp.vcxproj delete mode 100644 iothub_client/samples/iothub_client_sample_http/CMakeLists.txt delete mode 100644 iothub_client/samples/iothub_client_sample_http/freertos/.gitignore delete mode 100644 iothub_client/samples/iothub_client_sample_http/freertos/Makefile delete mode 100644 iothub_client/samples/iothub_client_sample_http/freertos/project.xml delete mode 100644 iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c delete mode 100644 iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.h delete mode 100644 iothub_client/samples/iothub_client_sample_http/linux/CMakeLists.txt delete mode 100644 iothub_client/samples/iothub_client_sample_http/mbed/CMakeLists.txt delete mode 100644 iothub_client/samples/iothub_client_sample_http/mbed/iothub_client_sample_http_filelist.txt delete mode 100644 iothub_client/samples/iothub_client_sample_http/mbed/readme.md delete mode 100644 iothub_client/samples/iothub_client_sample_http/windows/iothub_client_sample_http.sln delete mode 100644 iothub_client/samples/iothub_client_sample_http/windows/iothub_client_sample_http.vcxproj delete mode 100644 iothub_client/samples/iothub_client_sample_http/windows/packages.config delete mode 100644 iothub_client/samples/iothub_client_sample_http/windowsce/iothub_client_sample_http.sln delete mode 100644 iothub_client/samples/iothub_client_sample_http/windowsce/iothub_client_sample_http.vcxproj delete mode 100644 iothub_client/samples/iothub_client_sample_http/windowsce/main.c delete mode 100644 iothub_client/samples/iothub_client_sample_mqtt/CMakeLists.txt delete mode 100644 iothub_client/samples/iothub_client_sample_mqtt/iothub_client_sample_mqtt.c delete mode 100644 iothub_client/samples/iothub_client_sample_mqtt/iothub_client_sample_mqtt.h delete mode 100644 iothub_client/samples/iothub_client_sample_mqtt/windows/packages.config delete mode 100644 iothub_client/samples/iothub_client_sample_mqtt_websockets/CMakeLists.txt delete mode 100644 iothub_client/samples/iothub_client_sample_mqtt_websockets/iothub_client_sample_mqtt_ws.c create mode 100644 iothub_client/samples/iothub_ll_telemetry_sample/CMakeLists.txt create mode 100644 iothub_client/samples/iothub_ll_telemetry_sample/iothub_ll_telemetry_sample.c rename iothub_client/samples/{iothub_client_sample_mqtt => iothub_ll_telemetry_sample}/linux/CMakeLists.txt (63%) rename iothub_client/samples/{iothub_client_sample_mqtt => iothub_ll_telemetry_sample}/mbed/CMakeLists.txt (78%) rename iothub_client/samples/{iothub_client_sample_mqtt/mbed/iothub_client_sample_mqtt_filelist.txt => iothub_ll_telemetry_sample/mbed/iothub_ll_telemetry_sample_filelist.txt} (100%) rename iothub_client/samples/{iothub_client_sample_mqtt => iothub_ll_telemetry_sample}/mbed/readme.md (100%) rename iothub_client/samples/{iothub_client_sample_mqtt/windows/iothub_client_sample_mqtt.sln => iothub_ll_telemetry_sample/windows/iothub_ll_telemetry_sample.sln} (90%) rename iothub_client/samples/{iothub_client_sample_mqtt/windows/iothub_client_sample_mqtt.vcxproj => iothub_ll_telemetry_sample/windows/iothub_ll_telemetry_sample.vcxproj} (76%) rename iothub_client/samples/{iothub_client_sample_amqp => iothub_ll_telemetry_sample}/windows/packages.config (58%) diff --git a/build_all/tizenRT/Make.defs b/build_all/tizenRT/Make.defs index 46fdb24dd7..e45673bb4a 100644 --- a/build_all/tizenRT/Make.defs +++ b/build_all/tizenRT/Make.defs @@ -38,7 +38,7 @@ $(AZURE_UTIL_DIR)/adapters/tickcounter_linux.c $(AZURE_UTIL_DIR)/adapters/httpap CSRCS += $(wildcard $(AZURE_SERIAL_DIR)/src/*.c) ifeq ($(CONFIG_CLOUD_AZURE_SAMPLES),y) -CSRCS += $(AZURE_CLIENT_DIR)/samples/iothub_client_sample_http/iothub_client_sample_http.c +CSRCS += $(AZURE_CLIENT_DIR)/samples/iothub_ll_telemetry_sample/iothub_ll_telemetry_sample.c CSRCS += $(AZURE_SERIAL_DIR)/samples/simplesample_http/simplesample_http.c endif diff --git a/build_all/windows/build.cmd b/build_all/windows/build.cmd index ed1ac340e8..7e265f70f3 100644 --- a/build_all/windows/build.cmd +++ b/build_all/windows/build.cmd @@ -155,11 +155,7 @@ if %build-samples%==yes ( ) ) - rem call nuget restore -config "%current-path%\NuGet.Config" "%build-root%\iothub_client\samples\iothub_client_sample_amqp\windows\iothub_client_sample_amqp.sln" - if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL! - call nuget restore -config "%current-path%\NuGet.Config" "%build-root%\iothub_client\samples\iothub_client_sample_http\windows\iothub_client_sample_http.sln" - if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL! - call nuget restore -config "%current-path%\NuGet.Config" "%build-root%\iothub_client\samples\iothub_client_sample_mqtt\windows\iothub_client_sample_mqtt.sln" + call nuget restore -config "%current-path%\NuGet.Config" "%build-root%\iothub_client\samples\iothub_ll_telemetry_sample\windows\iothub_ll_telemetry_sample.sln" if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL! call nuget restore -config "%current-path%\NuGet.Config" "%build-root%\serializer\samples\simplesample_http\windows\simplesample_http.sln" @@ -180,17 +176,9 @@ rem ---------------------------------------------------------------------------- if %build-clean%==1 ( if %build-samples%==yes ( - rem call nuget restore "%build-root%\iothub_client\samples\iothub_client_sample_amqp\windows\iothub_client_sample_amqp.sln" - rem call :clean-a-solution "%build-root%\iothub_client\samples\iothub_client_sample_amqp\windows\iothub_client_sample_amqp.sln" - rem if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL! - - call nuget restore "%build-root%\iothub_client\samples\iothub_client_sample_http\windows\iothub_client_sample_http.sln" - call :clean-a-solution "%build-root%\iothub_client\samples\iothub_client_sample_http\windows\iothub_client_sample_http.sln" + call nuget restore "%build-root%\iothub_client\samples\iothub_ll_telemetry_sample\windows\iothub_ll_telemetry_sample.sln" + call :clean-a-solution "%build-root%\iothub_client\samples\iothub_ll_telemetry_sample\windows\iothub_ll_telemetry_sample.sln" if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL! - - rem call nuget restore "%build-root%\iothub_client\samples\iothub_client_sample_mqtt\windows\iothub_client_sample_mqtt.sln" - rem call :clean-a-solution "%build-root%\iothub_client\samples\iothub_client_sample_mqtt\windows\iothub_client_sample_mqtt.sln" - rem if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL! call :clean-a-solution "%build-root%\serializer\samples\simplesample_http\windows\simplesample_http.sln" if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL! @@ -214,15 +202,9 @@ rem -- build solutions rem ----------------------------------------------------------------------------- if %build-samples%==yes ( - rem call :build-a-solution "%build-root%\iothub_client\samples\iothub_client_sample_amqp\windows\iothub_client_sample_amqp.sln" - rem if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL! - - call :build-a-solution "%build-root%\iothub_client\samples\iothub_client_sample_http\windows\iothub_client_sample_http.sln" + call :build-a-solution "%build-root%\iothub_client\samples\iothub_ll_telemetry_sample\windows\iothub_ll_telemetry_sample.sln" if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL! - rem call :build-a-solution "%build-root%\iothub_client\samples\iothub_client_sample_mqtt\windows\iothub_client_sample_mqtt.sln" - rem if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL! - rem call :build-a-solution "%build-root%\serializer\samples\simplesample_amqp\windows\simplesample_amqp.sln" rem if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL! diff --git a/build_all/windowsce/build.cmd b/build_all/windowsce/build.cmd index aacb959c05..20480c18b3 100644 --- a/build_all/windowsce/build.cmd +++ b/build_all/windowsce/build.cmd @@ -41,7 +41,7 @@ rem no error checking pushd "%USERPROFILE%\cmake_ce8" -rem if you plan to use a different SDK you need to change SDKNAME to the name of your SDK. Ensure that this is also changed in the sample solutions iothub_client_sample_http, simplesample_http and remote_monitoring +rem if you plan to use a different SDK you need to change SDKNAME to the name of your SDK. Ensure that this is also changed in the sample solutions iothub_ll_telemetry_sample, simplesample_http and remote_monitoring set SDKNAME=TORADEX_CE800 set PROCESSOR=arm @@ -50,8 +50,5 @@ cmake -DWINCE=TRUE -DCMAKE_SYSTEM_NAME=WindowsCE -DCMAKE_SYSTEM_VERSION=8.0 -DCM if not %errorlevel%==0 exit /b %errorlevel% rem Currently, only building of HTTP sample is supported -msbuild "%USERPROFILE%\cmake_ce8\iothub_client\samples\iothub_client_sample_http\iothub_client_sample_http.vcxproj -if not %errorlevel%==0 exit /b %errorlevel% - - - +rem msbuild "%USERPROFILE%\cmake_ce8\iothub_client\samples\iothub_ll_telemetry_sample\iothub_ll_telemetry_sample.vcxproj +rem if not %errorlevel%==0 exit /b %errorlevel% diff --git a/iothub_client/build/mbed/build.cmd b/iothub_client/build/mbed/build.cmd index 3f261c5dd6..90ae20f43d 100644 --- a/iothub_client/build/mbed/build.cmd +++ b/iothub_client/build/mbed/build.cmd @@ -28,7 +28,7 @@ goto args-done :longhaul_tests_download_bin_path shift if NOT "%1" equ "" ( - set longhaul_tests_download_bin_path=%1 + set longhaul_tests_download_bin_path=%1 ) goto args-continue @@ -72,25 +72,19 @@ call %build-root%\..\c-utility\tools\mbed_build_scripts\release_mbed_project.cmd if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL! if %skip_samples%==0 ( - rem ----------------------------------------------------------------------------- - rem -- build iothub client samples - rem ----------------------------------------------------------------------------- + rem ----------------------------------------------------------------------------- + rem -- build iothub client samples + rem ----------------------------------------------------------------------------- - call :compile iothub_client_sample_amqp %build-root%\samples\iothub_client_sample_amqp\mbed - if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL! + call :compile iothub_client_sample_http %build-root%\samples\iothub_ll_telemetry_sample\mbed + if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL! - call :compile iothub_client_sample_http %build-root%\samples\iothub_client_sample_http\mbed - if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL! + rem ----------------------------------------------------------------------------- + rem -- build a serializer client sample + rem ----------------------------------------------------------------------------- - call :compile iothub_client_sample_mqtt %build-root%\samples\iothub_client_sample_mqtt\mbed - if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL! - - rem ----------------------------------------------------------------------------- - rem -- build a serializer client sample - rem ----------------------------------------------------------------------------- - - call :compile simplesample_amqp %build-root%\..\serializer\samples\simplesample_amqp\mbed - if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL! + call :compile simplesample_amqp %build-root%\..\serializer\samples\simplesample_amqp\mbed + if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL! ) rem ----------------------------------------------------------------------------- diff --git a/iothub_client/samples/CMakeLists.txt b/iothub_client/samples/CMakeLists.txt index 4656631dd8..f2d7a45817 100644 --- a/iothub_client/samples/CMakeLists.txt +++ b/iothub_client/samples/CMakeLists.txt @@ -12,8 +12,10 @@ function(add_sample_directory whatIsBuilding) FOLDER "IoTHub_Samples") endfunction() + +add_sample_directory(iothub_ll_telemetry_sample) + if(${use_http}) - add_sample_directory(iothub_client_sample_http) add_sample_directory(iothub_client_sample_http_shared) if(NOT ${dont_use_uploadtoblob}) add_sample_directory(iothub_client_sample_upload_to_blob) @@ -22,7 +24,6 @@ if(${use_http}) endif() if(${use_mqtt}) - add_sample_directory(iothub_client_sample_mqtt) add_sample_directory(iothub_client_sample_mqtt_esp8266) if(${use_amqp}) add_sample_directory(iothub_client_sample_device_method) @@ -30,15 +31,12 @@ if(${use_mqtt}) if(LINUX) add_sample_directory(iothub_client_sample_mqtt_dm) endif() - add_sample_directory(iothub_client_sample_mqtt_websockets) endif() if(${use_amqp}) - add_sample_directory(iothub_client_sample_amqp) add_sample_directory(iothub_client_sample_amqp_shared) add_sample_directory(iothub_ll_client_sample_amqp_shared) - add_sample_directory(iothub_client_sample_amqp_websockets) add_sample_directory(iothub_client_sample_amqp_websockets_shared) add_sample_directory(iothub_client_sample_amqp_shared_ws_methods) endif() diff --git a/iothub_client/samples/iothub_client_sample_amqp/CMakeLists.txt b/iothub_client/samples/iothub_client_sample_amqp/CMakeLists.txt deleted file mode 100644 index 7ccf633815..0000000000 --- a/iothub_client/samples/iothub_client_sample_amqp/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -#Copyright (c) Microsoft. All rights reserved. -#Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#this is CMakeLists.txt for iothub_client_sample_amqp - -compileAsC99() - -if(NOT ${use_amqp}) - message(FATAL_ERROR "iothub_client_sample_amqp being generated without uamqp support") -endif() - -set(iothub_client_sample_amqp_c_files - iothub_client_sample_amqp.c -) - -set(iothub_client_sample_amqp_h_files - iothub_client_sample_amqp.h -) - -IF(WIN32) - #windows needs this define - add_definitions(-D_CRT_SECURE_NO_WARNINGS) - add_definitions(-DGB_MEASURE_MEMORY_FOR_THIS -DGB_DEBUG_ALLOC) -ENDIF(WIN32) - -#Conditionally use the SDK trusted certs in the samples -if(${set_trusted_cert_in_samples}) - add_definitions(-DSET_TRUSTED_CERT_IN_SAMPLES) - include_directories(${PROJECT_SOURCE_DIR}/certs) - set(samples_cert_file ${PROJECT_SOURCE_DIR}/certs/certs.c) -endif() - -include_directories(.) - -add_executable(iothub_client_sample_amqp ${iothub_client_sample_amqp_c_files} ${iothub_client_sample_amqp_h_files} ${samples_cert_file}) - -target_link_libraries(iothub_client_sample_amqp - iothub_client - iothub_client_amqp_transport) - -linkSharedUtil(iothub_client_sample_amqp) -linkUAMQP(iothub_client_sample_amqp) diff --git a/iothub_client/samples/iothub_client_sample_amqp/freertos/.gitignore b/iothub_client/samples/iothub_client_sample_amqp/freertos/.gitignore deleted file mode 100644 index cd42ee34e8..0000000000 --- a/iothub_client/samples/iothub_client_sample_amqp/freertos/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -bin/ -obj/ diff --git a/iothub_client/samples/iothub_client_sample_amqp/freertos/Makefile b/iothub_client/samples/iothub_client_sample_amqp/freertos/Makefile deleted file mode 100644 index 6fce8fe8fe..0000000000 --- a/iothub_client/samples/iothub_client_sample_amqp/freertos/Makefile +++ /dev/null @@ -1,332 +0,0 @@ -# -# Copyright (C) Firmwave Ltd., All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. -# - -# Toolchain executables -CROSS_COMPILE = /opt/arm-gnu-toolchain-5.3.1.487-linux.any.x86_64/bin/arm-none-eabi- -CC = $(CROSS_COMPILE)gcc -LD = $(CROSS_COMPILE)ld -OBJDUMP = $(CROSS_COMPILE)objdump -OBJCOPY = $(CROSS_COMPILE)objcopy -SIZE = $(CROSS_COMPILE)size -NM = $(CROSS_COMPILE)nm - -# Include files -INCLUDES = \ - -I../ \ - -I../../../../c-utility/inc \ - -I../../../../iothub_client/inc \ - -I../../../../uamqp/inc \ - -I../../../../c-utility/adapters \ - -I../../../../deps/parson \ - -I../../../../certs \ - -I/opt/CycloneTCP_SSL_Crypto_Open_1_7_4/inc \ - -I/opt/CycloneTCP_SSL_Crypto_Open_1_7_4/common \ - -I/opt/CycloneTCP_SSL_Crypto_Open_1_7_4/demo/common/atmel/boards/same70_xplained \ - -I/opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto \ - -I/opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl \ - -I/opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Source/include \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1 \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils/cmsis/same70/include \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/thirdparty/CMSIS/Include \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils/cmsis/same70/source/templates \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils/fpu \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils/preprocessor \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils/header_files \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/common/utils \ - -# Global defines -CFLAGS += \ - -DBOARD=SAME70_XPLAINED \ - -DMBED_BUILD_TIMESTAMP \ - -DTRACE_LEVEL=4 \ - -DUSE_SAME70_XPLAINED \ - -D_WINSOCK_H \ - -D__SAME70Q21__ \ - -Dprintf=iprintf \ - -# Global C flags -CFLAGS += -std=gnu99 -O0 -g \ --march=armv7e-m -mthumb -mfloat-abi=softfp -mfpu=fpv5-sp-d16 \ --ffunction-sections \ --Wall -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int \ --Wmain -Wparentheses \ --Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs \ --Wuninitialized -Wunknown-pragmas -Wfloat-equal \ --Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings \ --Waggregate-return -Wstrict-prototypes \ --Wmissing-prototypes -Wmissing-declarations \ --Wformat -Wmissing-format-attribute -Wno-deprecated-declarations \ --Wredundant-decls -Wnested-externs \ --Wunreachable-code - -# Global linker flags -LDFLAGS += -march=armv7e-m -mthumb -mfloat-abi=softfp -mfpu=fpv5-sp-d16 \ --Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler \ --Wl,--unresolved-symbols=report-all -Wl,--warn-common \ --Wl,--defsym=malloc_getpagesize_P=0x80 \ --L/opt/CycloneTCP_SSL_Crypto_Open_1_7_4/linker \ --T"same70_flash.ld" \ --Wl,--start-group -lgcc -lc -lm -Wl,--end-group --specs=nosys.specs - -# Global libraries - -OBJECTS = $(patsubst %.c, obj/%.o, $(SOURCES)) -THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST)) -CFLAGS += $(INCLUDES) - -SOURCES_iothub_client_sample_amqp = \ - iothub_client_sample_amqp.c \ - c-utility/src/base64.c \ - c-utility/src/buffer.c \ - c-utility/src/consolelogger.c \ - c-utility/src/constbuffer.c \ - c-utility/src/constmap.c \ - c-utility/src/crt_abstractions.c \ - c-utility/src/doublylinkedlist.c \ - c-utility/src/gb_stdio.c \ - c-utility/src/gb_time.c \ - c-utility/src/gballoc.c \ - c-utility/src/hmac.c \ - c-utility/src/hmacsha256.c \ - c-utility/src/httpapiex.c \ - c-utility/src/httpapiexsas.c \ - c-utility/src/httpheaders.c \ - c-utility/src/map.c \ - c-utility/src/optionhandler.c \ - c-utility/src/sastoken.c \ - c-utility/src/sha1.c \ - c-utility/src/sha224.c \ - c-utility/src/sha384-512.c \ - c-utility/src/singlylinkedlist.c \ - c-utility/src/string_tokenizer.c \ - c-utility/src/strings.c \ - c-utility/src/tlsio_cyclonessl.c \ - c-utility/src/tlsio_cyclonessl_socket.c \ - c-utility/src/urlencode.c \ - c-utility/src/usha.c \ - c-utility/src/vector.c \ - c-utility/src/xio.c \ - c-utility/src/xlogging.c \ - certs/certs.c \ - iothub_client/src/blob.c \ - iothub_client/src/iothub_client.c \ - iothub_client/src/iothub_client_ll.c \ - iothub_client/src/iothub_client_ll_uploadtoblob.c \ - iothub_client/src/iothub_message.c \ - iothub_client/src/iothubtransport.c \ - iothub_client/src/iothubtransportamqp.c \ - iothub_client/src/uamqp_messaging.c \ - iothub_client/src/version.c \ - deps/parson/parson.c \ - uamqp/src/amqp_definitions.c \ - uamqp/src/amqp_frame_codec.c \ - uamqp/src/amqp_management.c \ - uamqp/src/amqpalloc.c \ - uamqp/src/amqpvalue.c \ - uamqp/src/amqpvalue_to_string.c \ - uamqp/src/cbs.c \ - uamqp/src/connection.c \ - uamqp/src/frame_codec.c \ - uamqp/src/header_detect_io.c \ - uamqp/src/link.c \ - uamqp/src/message.c \ - uamqp/src/message_receiver.c \ - uamqp/src/message_sender.c \ - uamqp/src/messaging.c \ - uamqp/src/sasl_anonymous.c \ - uamqp/src/sasl_frame_codec.c \ - uamqp/src/sasl_mechanism.c \ - uamqp/src/sasl_mssbcbs.c \ - uamqp/src/sasl_plain.c \ - uamqp/src/saslclientio.c \ - uamqp/src/session.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/aes.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/aria.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/asn1.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/base64.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/camellia.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/chacha.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/chacha20_poly1305.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/cipher_mode_cbc.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/cipher_mode_ccm.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/cipher_mode_cfb.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/cipher_mode_ctr.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/cipher_mode_ecb.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/cipher_mode_gcm.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/cipher_mode_ofb.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/des.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/des3.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/dh.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/dsa.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/ec.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/ec_curves.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/ecdh.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/ecdsa.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/hmac.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/idea.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/keccak.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/md2.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/md4.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/md5.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/mpi.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/oid.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/pem.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/pkcs5.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/poly1305.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/rc4.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/rc6.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/ripemd128.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/ripemd160.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/rsa.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/seed.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha1.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha224.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha256.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha384.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha3_224.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha3_256.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha3_384.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha3_512.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha512.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha512_224.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha512_256.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/tiger.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/whirlpool.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/x509.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/yarrow.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/ssl_common.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/tls.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/tls_cache.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/tls_cipher_suites.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/tls_client.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/tls_common.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/tls_io.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/tls_misc.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/tls_record.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/ethernet.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/ip.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/net.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/net_mem.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/nic.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/ping.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/raw_socket.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/socket.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/tcp.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/tcp_fsm.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/tcp_misc.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/tcp_timer.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/udp.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/dhcp/dhcp_client.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/dhcp/dhcp_common.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/dhcp/dhcp_debug.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/dns/dns_cache.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/dns/dns_client.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/dns/dns_common.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/dns/dns_debug.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv4/arp.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv4/auto_ip.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv4/icmp.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv4/igmp.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv4/ipv4.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv4/ipv4_frag.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/icmpv6.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ipv6.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ipv6_frag.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ipv6_misc.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ipv6_pmtu.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ipv6_routing.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/mld.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ndp.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ndp_cache.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ndp_misc.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ndp_router_adv.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/slaac.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/netbios/nbns_client.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/netbios/nbns_common.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/netbios/nbns_responder.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/src/debug.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/src/ext_int_driver.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/src/rtc.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/src/startup_same70.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/src/syscalls.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/src/system_same70.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/common/utils/interrupt/interrupt_sam_nvic.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Source/croutine.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Source/event_groups.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Source/list.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Source/queue.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Source/tasks.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Source/timers.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1/port.c \ - c-utility/adapters/platform_freertos.c \ - c-utility/adapters/tickcounter_freertos.c \ - c-utility/adapters/agenttime.c \ - c-utility/adapters/threadapi_freertos.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/common/os_port_freertos.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/common/endian.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/common/str.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/common/date_time.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/demo/common/atmel/boards/same70_xplained/sdram.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/drivers/ksz8081.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/drivers/same70_eth.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Source/portable/MemMang/heap_3.c \ - -OBJECTS_iothub_client_sample_amqp = $(patsubst %.c, obj/%.o, $(SOURCES_iothub_client_sample_amqp)) - -VPATH += \ - ../ \ - ../../../../ \ - -V ?= 0 -Q_0 := @ -Q_1 := -Q = $(Q_$(V)) - -.SUFFIXES: -.PHONY: all clean - -define loginfo - $(Q)echo "[INFO] $1" -endef - -define logerror - $(Q)echo "[ERR ] $1" -endef - -all: build - -build: iothub_client_sample_amqp - -iothub_client_sample_amqp: $(OBJECTS_iothub_client_sample_amqp) $(THIS_MAKEFILE) - $(call loginfo,"Linking exec" $@) - $(Q)$(CC) $(LDFLAGS) -Wl,-M=bin/$@.map $(CFLAGS) $(OBJECTS_iothub_client_sample_amqp) $(LIBS) -o bin/$@.elf - $(Q)$(NM) bin/$@.elf >bin/$@.elf.txt - $(Q)$(OBJCOPY) -O binary bin/$@.elf bin/$@.bin - $(Q)$(SIZE) $(OBJECTS_iothub_client_sample_amqp) bin/$@.elf - -$(OBJECTS): | bin obj - -bin: - $(Q)mkdir -p $@ - -obj: - $(Q)mkdir -p $@ - -obj/%.o: %.c $(THIS_MAKEFILE) - $(call loginfo,"Compiling file" $<) - $(Q)mkdir -p $(dir $@) - $(Q)$(CC) -MT $@ -MMD -MP -MF obj/$*.Td $(CFLAGS) -c $< -o $@ - $(Q)mv -f obj/$*.Td obj/$*.d - -clean: - $(Q)rm -R bin - $(Q)rm -R obj - -obj/%.d: ; -.PRECIOUS: obj/%.d - --include $(patsubst %,obj/%.d,$(basename $(SOURCES))) diff --git a/iothub_client/samples/iothub_client_sample_amqp/freertos/project.xml b/iothub_client/samples/iothub_client_sample_amqp/freertos/project.xml deleted file mode 100644 index a6274c1871..0000000000 --- a/iothub_client/samples/iothub_client_sample_amqp/freertos/project.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - -std=gnu99 -O0 -g \ - -march=armv7e-m -mthumb -mfloat-abi=softfp -mfpu=fpv5-sp-d16 \ - -ffunction-sections \ - -Wall -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int \ - -Wmain -Wparentheses \ - -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs \ - -Wuninitialized -Wunknown-pragmas -Wfloat-equal \ - -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings \ - -Waggregate-return -Wstrict-prototypes \ - -Wmissing-prototypes -Wmissing-declarations \ - -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations \ - -Wredundant-decls -Wnested-externs \ - -Wunreachable-code - - - -march=armv7e-m -mthumb -mfloat-abi=softfp -mfpu=fpv5-sp-d16 \ - -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler \ - -Wl,--unresolved-symbols=report-all -Wl,--warn-common \ - -Wl,--defsym=malloc_getpagesize_P=0x80 \ - -L/opt/CycloneTCP_SSL_Crypto_Open_1_7_4/linker \ - -T"same70_flash.ld" \ - -Wl,--start-group -lgcc -lc -lm -Wl,--end-group --specs=nosys.specs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp.c b/iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp.c deleted file mode 100644 index 6329fab3d1..0000000000 --- a/iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp.c +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include -#include - -#include "azure_c_shared_utility/platform.h" -#include "azure_c_shared_utility/threadapi.h" -#include "azure_c_shared_utility/crt_abstractions.h" -#include "azure_c_shared_utility/shared_util_options.h" -#include "iothub_client.h" -#include "iothub_client_options.h" -#include "iothub_message.h" -#include "iothubtransportamqp.h" - -#ifdef MBED_BUILD_TIMESTAMP -#define SET_TRUSTED_CERT_IN_SAMPLES -#endif // MBED_BUILD_TIMESTAMP - -#ifdef SET_TRUSTED_CERT_IN_SAMPLES -#include "certs.h" -#endif // SET_TRUSTED_CERT_IN_SAMPLES - -/*String containing Hostname, Device Id & Device Key in the format: */ -/* "HostName=;DeviceId=;SharedAccessKey=" */ -/* "HostName=;DeviceId=;SharedAccessSignature=" */ -static const char* connectionString = "[device connection string]"; - -static int callbackCounter; -static bool g_continueRunning; -static char msgText[1024]; -static char propText[1024]; -#define MESSAGE_COUNT 5 -#define DOWORK_LOOP_NUM 3 - -typedef struct EVENT_INSTANCE_TAG -{ - IOTHUB_MESSAGE_HANDLE messageHandle; - size_t messageTrackingId; // For tracking the messages within the user callback. -} EVENT_INSTANCE; - -static IOTHUBMESSAGE_DISPOSITION_RESULT ReceiveMessageCallback(IOTHUB_MESSAGE_HANDLE message, void* userContextCallback) -{ - int* counter = (int*)userContextCallback; - const unsigned char* buffer = NULL; - size_t size = 0; - const char* messageId; - const char* correlationId; - const char* userDefinedContentType; - const char* userDefinedContentEncoding; - - // Message properties - if ((messageId = IoTHubMessage_GetMessageId(message)) == NULL) - { - messageId = ""; - } - - if ((correlationId = IoTHubMessage_GetCorrelationId(message)) == NULL) - { - correlationId = ""; - } - - if ((userDefinedContentType = IoTHubMessage_GetContentTypeSystemProperty(message)) == NULL) - { - userDefinedContentType = ""; - } - - if ((userDefinedContentEncoding = IoTHubMessage_GetContentEncodingSystemProperty(message)) == NULL) - { - userDefinedContentEncoding = ""; - } - - // Message content - IOTHUBMESSAGE_CONTENT_TYPE contentType = IoTHubMessage_GetContentType(message); - - if (contentType == IOTHUBMESSAGE_BYTEARRAY) - { - if (IoTHubMessage_GetByteArray(message, &buffer, &size) == IOTHUB_MESSAGE_OK) - { - (void)printf("Received Message [%d]\r\n Message ID: %s\r\n Correlation ID: %s\r\n Content-Type: %s\r\n Content-Encoding: %s\r\n BINARY Data: <<<%.*s>>> & Size=%d\r\n", - *counter, messageId, correlationId, userDefinedContentType, userDefinedContentEncoding, (int)size, buffer, (int)size); - } - else - { - (void)printf("Failed getting the BINARY body of the message received.\r\n"); - } - } - else if (contentType == IOTHUBMESSAGE_STRING) - { - if ((buffer = (const unsigned char*)IoTHubMessage_GetString(message)) != NULL && (size = strlen((const char*)buffer)) > 0) - { - (void)printf("Received Message [%d]\r\n Message ID: %s\r\n Correlation ID: %s\r\n Content-Type: %s\r\n Content-Encoding: %s\r\n STRING Data: <<<%.*s>>> & Size=%d\r\n", - *counter, messageId, correlationId, userDefinedContentType, userDefinedContentEncoding, (int)size, buffer, (int)size); - - // If we receive the work 'quit' then we stop running - } - else - { - (void)printf("Failed getting the STRING body of the message received.\r\n"); - } - } - else - { - (void)printf("Failed getting the body of the message received (type %i).\r\n", contentType); - } - - // Retrieve properties from the message - MAP_HANDLE mapProperties = IoTHubMessage_Properties(message); - if (mapProperties != NULL) - { - const char*const* keys; - const char*const* values; - size_t propertyCount = 0; - if (Map_GetInternals(mapProperties, &keys, &values, &propertyCount) == MAP_OK) - { - if (propertyCount > 0) - { - size_t index; - - printf(" Message Properties:\r\n"); - for (index = 0; index < propertyCount; index++) - { - printf("\tKey: %s Value: %s\r\n", keys[index], values[index]); - } - printf("\r\n"); - } - } - } - - if (size == (strlen("quit") * sizeof(char)) && memcmp(buffer, "quit", size) == 0) - { - g_continueRunning = false; - } - - /* Some device specific action code goes here... */ - (*counter)++; - return IOTHUBMESSAGE_ACCEPTED; -} - -static void SendConfirmationCallback(IOTHUB_CLIENT_CONFIRMATION_RESULT result, void* userContextCallback) -{ - EVENT_INSTANCE* eventInstance = (EVENT_INSTANCE*)userContextCallback; - (void)printf("Confirmation[%d] received for message tracking id = %zu with result = %s\r\n", callbackCounter, eventInstance->messageTrackingId, ENUM_TO_STRING(IOTHUB_CLIENT_CONFIRMATION_RESULT, result)); - /* Some device specific action code goes here... */ - callbackCounter++; - IoTHubMessage_Destroy(eventInstance->messageHandle); -} - -void iothub_client_sample_amqp_run(void) -{ - IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle; - - EVENT_INSTANCE messages[MESSAGE_COUNT]; - - g_continueRunning = true; - srand((unsigned int)time(NULL)); - double avgWindSpeed = 10.0; - - callbackCounter = 0; - int receiveContext = 0; - - (void)printf("Starting the IoTHub client sample AMQP...\r\n"); - - if (platform_init() != 0) - { - printf("Failed to initialize the platform.\r\n"); - } - else - { - if ((iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, AMQP_Protocol)) == NULL) - { - (void)printf("ERROR: iotHubClientHandle is NULL!\r\n"); - } - else - { - bool traceOn = true; - IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_LOG_TRACE, &traceOn); - - // Set keep alive is optional. If it is not set the default (240 secs) will be used. - uint32_t svc2cl_keep_alive_timeout_secs = 120; // service will send pings at 120 x 7/8 = 105 seconds. Higher the value, lesser the frequency of service side pings. - IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_SERVICE_SIDE_KEEP_ALIVE_FREQ_SECS, &svc2cl_keep_alive_timeout_secs); - - // Set keep alive for remote idle is optional. If it is not set the default ratio of 1/2 will be used. For default value of 4 minutes, it will be 2 minutes (120 seconds) - double cl2svc_keep_alive_send_ratio = 7.0 / 8.0; // Set it to 210 seconds (240 x 7/8 = 210 seconds) for 4 minutes remote idle. Set it to 21 minutes for 25 minutes remote idle increased on per-hub basis via Support Request (SR) - if (IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_REMOTE_IDLE_TIMEOUT_RATIO, &cl2svc_keep_alive_send_ratio) != IOTHUB_CLIENT_OK) // client will send pings to service at 210 second interval for 4 minutes remote idle. For 25 minutes remote idle, it will be set to 21 minutes. - { - (void)printf("ERROR: IoTHubClient_remote_idle_timeout_ratio..........FAILED!\r\n"); - } - -#ifdef SET_TRUSTED_CERT_IN_SAMPLES - // For mbed add the certificate information - if (IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_TRUSTED_CERT, certificates) != IOTHUB_CLIENT_OK) - { - printf("failure to set option \"TrustedCerts\"\r\n"); - } -#endif // SET_TRUSTED_CERT_IN_SAMPLES - - /* Setting Message call back, so we can receive Commands. */ - if (IoTHubClient_LL_SetMessageCallback(iotHubClientHandle, ReceiveMessageCallback, &receiveContext) != IOTHUB_CLIENT_OK) - { - (void)printf("ERROR: IoTHubClient_SetMessageCallback..........FAILED!\r\n"); - } - else - { - (void)printf("IoTHubClient_SetMessageCallback...successful.\r\n"); - - /* Now that we are ready to receive commands, let's send some messages */ - size_t iterator = 0; - do - { - if (iterator < MESSAGE_COUNT) - { - sprintf_s(msgText, sizeof(msgText), "{\"deviceId\":\"myFirstDevice\",\"windSpeed\":%.2f}", avgWindSpeed + (rand() % 4 + 2)); - if ((messages[iterator].messageHandle = IoTHubMessage_CreateFromByteArray((const unsigned char*)msgText, strlen(msgText))) == NULL) - { - (void)printf("ERROR: iotHubMessageHandle is NULL!\r\n"); - } - else - { - messages[iterator].messageTrackingId = iterator; - - MAP_HANDLE propMap = IoTHubMessage_Properties(messages[iterator].messageHandle); - (void)sprintf_s(propText, sizeof(propText), "PropMsg_%zu", iterator); - if (Map_AddOrUpdate(propMap, "PropName", propText) != MAP_OK) - { - (void)printf("ERROR: Map_AddOrUpdate Failed!\r\n"); - } - - // Setting messages with the same UUID values just for example. - (void)IoTHubMessage_SetMessageId(messages[iterator].messageHandle, "dec14a98-c5fc-430e-b4e3-33c1c434dcaf"); - (void)IoTHubMessage_SetCorrelationId(messages[iterator].messageHandle, "33c1c434dcaf-c5fc-430e-b4e3-dec14a98"); - - (void)IoTHubMessage_SetContentTypeSystemProperty(messages[iterator].messageHandle, "application/json"); - (void)IoTHubMessage_SetContentEncodingSystemProperty(messages[iterator].messageHandle, "utf-8"); - - if (IoTHubClient_LL_SendEventAsync(iotHubClientHandle, messages[iterator].messageHandle, SendConfirmationCallback, &messages[iterator]) != IOTHUB_CLIENT_OK) - { - (void)printf("ERROR: IoTHubClient_SendEventAsync..........FAILED!\r\n"); - } - else - { - (void)printf("IoTHubClient_SendEventAsync accepted data for transmission to IoT Hub.\r\n"); - } - } - } - IoTHubClient_LL_DoWork(iotHubClientHandle); - ThreadAPI_Sleep(1); - - iterator++; - } while (g_continueRunning); - - (void)printf("iothub_client_sample_amqp has gotten quit message, call DoWork %d more time to complete final sending...\r\n", DOWORK_LOOP_NUM); - for (size_t index = 0; index < DOWORK_LOOP_NUM; index++) - { - IoTHubClient_LL_DoWork(iotHubClientHandle); - ThreadAPI_Sleep(1); - } - } - IoTHubClient_LL_Destroy(iotHubClientHandle); - } - platform_deinit(); - } -} - -int main(void) -{ - iothub_client_sample_amqp_run(); - return 0; -} diff --git a/iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp.h b/iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp.h deleted file mode 100644 index d41eb9ab2c..0000000000 --- a/iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#ifndef IOTHUB_CLIENT_SAMPLE_AMQP_H -#define IOTHUB_CLIENT_SAMPLE_AMQP_H - -#ifdef __cplusplus -extern "C" { -#endif - - void iothub_client_sample_amqp_run(void); - -#ifdef __cplusplus -} -#endif - -#endif /* IOTHUB_CLIENT_SAMPLE_AMQP_H */ diff --git a/iothub_client/samples/iothub_client_sample_amqp/linux/CMakeLists.txt b/iothub_client/samples/iothub_client_sample_amqp/linux/CMakeLists.txt deleted file mode 100644 index b481d03eb7..0000000000 --- a/iothub_client/samples/iothub_client_sample_amqp/linux/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -#Copyright (c) Microsoft. All rights reserved. -#Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#this is CMakeLists.txt for iothub_client_sample_amqp -cmake_minimum_required(VERSION 2.8.11) - -if(WIN32) - message(FATAL_ERROR "This CMake file is only support Linux builds!") -endif() - -set(AZUREIOT_INC_FOLDER ".." "/usr/include/azureiot" "/usr/include/azureiot/inc") - -include_directories(${AZUREIOT_INC_FOLDER}) - -set(iothub_client_sample_amqp_c_files - ../iothub_client_sample_amqp.c -) - -set(iothub_client_sample_amqp_h_files - ../iothub_client_sample_amqp.h -) - -add_executable(iothub_client_sample_amqp ${iothub_client_sample_amqp_c_files} ${iothub_client_sample_amqp_h_files}) - -target_link_libraries(iothub_client_sample_amqp - iothub_client - iothub_client_amqp_transport - aziotsharedutil - uamqp - pthread - curl - ssl - crypto - m -) diff --git a/iothub_client/samples/iothub_client_sample_amqp/mbed/CMakeLists.txt b/iothub_client/samples/iothub_client_sample_amqp/mbed/CMakeLists.txt deleted file mode 100644 index d8cd49ca3d..0000000000 --- a/iothub_client/samples/iothub_client_sample_amqp/mbed/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -#Copyright (c) Microsoft. All rights reserved. -#Licensed under the MIT license. See LICENSE file in the project root for full license information. - -cmake_minimum_required(VERSION 2.8.11) - -set(shared_util_base_path ../../../../c-utility) -set(mbed_project_base "iothub_client_sample_amqp" CACHE STRING "The item being built") -include (${shared_util_base_path}/tools/mbed_build_scripts/mbedbldtemplate.txt) diff --git a/iothub_client/samples/iothub_client_sample_amqp/mbed/iothub_client_sample_amqp_filelist.txt b/iothub_client/samples/iothub_client_sample_amqp/mbed/iothub_client_sample_amqp_filelist.txt deleted file mode 100644 index 091665e804..0000000000 --- a/iothub_client/samples/iothub_client_sample_amqp/mbed/iothub_client_sample_amqp_filelist.txt +++ /dev/null @@ -1,6 +0,0 @@ -set(mbed_project_files - ${CMAKE_CURRENT_SOURCE_DIR}/../*.c - ${CMAKE_CURRENT_SOURCE_DIR}/../*.h - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../certs/certs.h - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../certs/certs.c - ) diff --git a/iothub_client/samples/iothub_client_sample_amqp/mbed/readme.md b/iothub_client/samples/iothub_client_sample_amqp/mbed/readme.md deleted file mode 100644 index ceb33ac1d1..0000000000 --- a/iothub_client/samples/iothub_client_sample_amqp/mbed/readme.md +++ /dev/null @@ -1,3 +0,0 @@ -# To build the iothub_client_sample_amqp sample - -Follow the instructions [here](../../../../../doc/get_started/mbed-freescale-k64f-c.md). \ No newline at end of file diff --git a/iothub_client/samples/iothub_client_sample_amqp/windows/iothub_client_sample_amqp.sln b/iothub_client/samples/iothub_client_sample_amqp/windows/iothub_client_sample_amqp.sln deleted file mode 100644 index 8b6038b66d..0000000000 --- a/iothub_client/samples/iothub_client_sample_amqp/windows/iothub_client_sample_amqp.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iothub_client_sample_amqp", "iothub_client_sample_amqp.vcxproj", "{C64545E6-8CA6-49B2-8301-72525D65DF35}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C64545E6-8CA6-49B2-8301-72525D65DF35}.Debug|x64.ActiveCfg = Debug|x64 - {C64545E6-8CA6-49B2-8301-72525D65DF35}.Debug|x64.Build.0 = Debug|x64 - {C64545E6-8CA6-49B2-8301-72525D65DF35}.Debug|x86.ActiveCfg = Debug|Win32 - {C64545E6-8CA6-49B2-8301-72525D65DF35}.Debug|x86.Build.0 = Debug|Win32 - {C64545E6-8CA6-49B2-8301-72525D65DF35}.Release|x64.ActiveCfg = Release|x64 - {C64545E6-8CA6-49B2-8301-72525D65DF35}.Release|x64.Build.0 = Release|x64 - {C64545E6-8CA6-49B2-8301-72525D65DF35}.Release|x86.ActiveCfg = Release|Win32 - {C64545E6-8CA6-49B2-8301-72525D65DF35}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/iothub_client/samples/iothub_client_sample_amqp/windows/iothub_client_sample_amqp.vcxproj b/iothub_client/samples/iothub_client_sample_amqp/windows/iothub_client_sample_amqp.vcxproj deleted file mode 100644 index 51cee510a0..0000000000 --- a/iothub_client/samples/iothub_client_sample_amqp/windows/iothub_client_sample_amqp.vcxproj +++ /dev/null @@ -1,178 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {C64545E6-8CA6-49B2-8301-72525D65DF35} - Win32Proj - iothub_client_sample_amqp - 8.1 - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - true - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - false - - - - - - Level3 - Disabled - GB_MEASURE_MEMORY_FOR_THIS;GB_DEBUG_ALLOC;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - ..\ - - - Console - true - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - ..\ - - - Console - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - ..\ - - - Console - true - true - true - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - ..\ - - - Console - true - true - true - - - - - - - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - \ No newline at end of file diff --git a/iothub_client/samples/iothub_client_sample_http/CMakeLists.txt b/iothub_client/samples/iothub_client_sample_http/CMakeLists.txt deleted file mode 100644 index f735ffbb5b..0000000000 --- a/iothub_client/samples/iothub_client_sample_http/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -#Copyright (c) Microsoft. All rights reserved. -#Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#this is CMakeLists.txt for iothub_client_sample_http - -compileAsC99() - -if(NOT ${use_http}) - message(FATAL_ERROR "iothub_client_sample_http being generated without HTTP support") -endif() - -set(iothub_client_sample_http_c_files -iothub_client_sample_http.c -) - -set(iothub_client_sample_http_h_files -iothub_client_sample_http.h -) - -IF(WIN32) - #windows needs this define - add_definitions(-D_CRT_SECURE_NO_WARNINGS) - add_definitions(-DGB_MEASURE_MEMORY_FOR_THIS -DGB_DEBUG_ALLOC) - -if (WINCE) # Use C++ as mitigation for C99 - SET_SOURCE_FILES_PROPERTIES(iothub_client_sample_http.c PROPERTIES LANGUAGE CXX) -ENDIF() - -ENDIF(WIN32) - -#Conditionally use the SDK trusted certs in the samples -if(${set_trusted_cert_in_samples}) - add_definitions(-DSET_TRUSTED_CERT_IN_SAMPLES) - include_directories(${PROJECT_SOURCE_DIR}/certs) - set(samples_cert_file ${PROJECT_SOURCE_DIR}/certs/certs.c) -endif() - -include_directories(.) - -add_executable(iothub_client_sample_http ${iothub_client_sample_http_c_files} ${iothub_client_sample_http_h_files} ${samples_cert_file}) - -target_link_libraries(iothub_client_sample_http -#iothubclient is here only because locking... in gballoc no less. - iothub_client - iothub_client_http_transport -) - -linkSharedUtil(iothub_client_sample_http) -linkHttp(iothub_client_sample_http) \ No newline at end of file diff --git a/iothub_client/samples/iothub_client_sample_http/freertos/.gitignore b/iothub_client/samples/iothub_client_sample_http/freertos/.gitignore deleted file mode 100644 index cd42ee34e8..0000000000 --- a/iothub_client/samples/iothub_client_sample_http/freertos/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -bin/ -obj/ diff --git a/iothub_client/samples/iothub_client_sample_http/freertos/Makefile b/iothub_client/samples/iothub_client_sample_http/freertos/Makefile deleted file mode 100644 index a238475172..0000000000 --- a/iothub_client/samples/iothub_client_sample_http/freertos/Makefile +++ /dev/null @@ -1,333 +0,0 @@ -# -# Copyright (C) Firmwave Ltd., All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. -# - -# Toolchain executables -CROSS_COMPILE = /opt/arm-gnu-toolchain-5.3.1.487-linux.any.x86_64/bin/arm-none-eabi- -CC = $(CROSS_COMPILE)gcc -LD = $(CROSS_COMPILE)ld -OBJDUMP = $(CROSS_COMPILE)objdump -OBJCOPY = $(CROSS_COMPILE)objcopy -SIZE = $(CROSS_COMPILE)size -NM = $(CROSS_COMPILE)nm - -# Include files -INCLUDES = \ - -I../ \ - -I../../../../c-utility/inc \ - -I../../../../iothub_client/inc \ - -I../../../../uamqp/inc \ - -I../../../../c-utility/adapters \ - -I../../../../deps/parson \ - -I../../../../certs \ - -I/opt/CycloneTCP_SSL_Crypto_Open_1_7_4/inc \ - -I/opt/CycloneTCP_SSL_Crypto_Open_1_7_4/common \ - -I/opt/CycloneTCP_SSL_Crypto_Open_1_7_4/demo/common/atmel/boards/same70_xplained \ - -I/opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto \ - -I/opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl \ - -I/opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Source/include \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1 \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils/cmsis/same70/include \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/thirdparty/CMSIS/Include \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils/cmsis/same70/source/templates \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils/fpu \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils/preprocessor \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils/header_files \ - -I/opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/common/utils \ - -# Global defines -CFLAGS += \ - -DBOARD=SAME70_XPLAINED \ - -DMBED_BUILD_TIMESTAMP \ - -DTRACE_LEVEL=4 \ - -DUSE_SAME70_XPLAINED \ - -D_WINSOCK_H \ - -D__SAME70Q21__ \ - -Dprintf=iprintf \ - -# Global C flags -CFLAGS += -std=gnu99 -O0 -g \ --march=armv7e-m -mthumb -mfloat-abi=softfp -mfpu=fpv5-sp-d16 \ --ffunction-sections \ --Wall -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int \ --Wmain -Wparentheses \ --Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs \ --Wuninitialized -Wunknown-pragmas -Wfloat-equal \ --Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings \ --Waggregate-return -Wstrict-prototypes \ --Wmissing-prototypes -Wmissing-declarations \ --Wformat -Wmissing-format-attribute -Wno-deprecated-declarations \ --Wredundant-decls -Wnested-externs \ --Wunreachable-code - -# Global linker flags -LDFLAGS += -march=armv7e-m -mthumb -mfloat-abi=softfp -mfpu=fpv5-sp-d16 \ --Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler \ --Wl,--unresolved-symbols=report-all -Wl,--warn-common \ --Wl,--defsym=malloc_getpagesize_P=0x80 \ --L/opt/CycloneTCP_SSL_Crypto_Open_1_7_4/linker \ --T"same70_flash.ld" \ --Wl,--start-group -lgcc -lc -lm -Wl,--end-group --specs=nosys.specs - -# Global libraries - -OBJECTS = $(patsubst %.c, obj/%.o, $(SOURCES)) -THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST)) -CFLAGS += $(INCLUDES) - -SOURCES_iothub_client_sample_http = \ - iothub_client_sample_http.c \ - c-utility/src/base64.c \ - c-utility/src/buffer.c \ - c-utility/src/consolelogger.c \ - c-utility/src/constbuffer.c \ - c-utility/src/constmap.c \ - c-utility/src/crt_abstractions.c \ - c-utility/src/doublylinkedlist.c \ - c-utility/src/gb_stdio.c \ - c-utility/src/gb_time.c \ - c-utility/src/gballoc.c \ - c-utility/src/hmac.c \ - c-utility/src/hmacsha256.c \ - c-utility/src/httpapiex.c \ - c-utility/src/httpapiexsas.c \ - c-utility/src/httpheaders.c \ - c-utility/src/map.c \ - c-utility/src/optionhandler.c \ - c-utility/src/sastoken.c \ - c-utility/src/sha1.c \ - c-utility/src/sha224.c \ - c-utility/src/sha384-512.c \ - c-utility/src/singlylinkedlist.c \ - c-utility/src/string_tokenizer.c \ - c-utility/src/strings.c \ - c-utility/src/tlsio_cyclonessl.c \ - c-utility/src/tlsio_cyclonessl_socket.c \ - c-utility/src/urlencode.c \ - c-utility/src/usha.c \ - c-utility/src/vector.c \ - c-utility/src/xio.c \ - c-utility/src/xlogging.c \ - certs/certs.c \ - iothub_client/src/blob.c \ - iothub_client/src/iothub_client.c \ - iothub_client/src/iothub_client_ll.c \ - iothub_client/src/iothub_client_ll_uploadtoblob.c \ - iothub_client/src/iothub_message.c \ - iothub_client/src/iothubtransport.c \ - iothub_client/src/iothubtransporthttp.c \ - iothub_client/src/uamqp_messaging.c \ - iothub_client/src/version.c \ - deps/parson/parson.c \ - uamqp/src/amqp_definitions.c \ - uamqp/src/amqp_frame_codec.c \ - uamqp/src/amqp_management.c \ - uamqp/src/amqpalloc.c \ - uamqp/src/amqpvalue.c \ - uamqp/src/amqpvalue_to_string.c \ - uamqp/src/cbs.c \ - uamqp/src/connection.c \ - uamqp/src/frame_codec.c \ - uamqp/src/header_detect_io.c \ - uamqp/src/link.c \ - uamqp/src/message.c \ - uamqp/src/message_receiver.c \ - uamqp/src/message_sender.c \ - uamqp/src/messaging.c \ - uamqp/src/sasl_anonymous.c \ - uamqp/src/sasl_frame_codec.c \ - uamqp/src/sasl_mechanism.c \ - uamqp/src/sasl_mssbcbs.c \ - uamqp/src/sasl_plain.c \ - uamqp/src/saslclientio.c \ - uamqp/src/session.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/aes.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/aria.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/asn1.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/base64.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/camellia.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/chacha.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/chacha20_poly1305.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/cipher_mode_cbc.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/cipher_mode_ccm.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/cipher_mode_cfb.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/cipher_mode_ctr.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/cipher_mode_ecb.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/cipher_mode_gcm.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/cipher_mode_ofb.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/des.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/des3.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/dh.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/dsa.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/ec.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/ec_curves.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/ecdh.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/ecdsa.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/hmac.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/idea.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/keccak.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/md2.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/md4.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/md5.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/mpi.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/oid.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/pem.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/pkcs5.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/poly1305.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/rc4.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/rc6.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/ripemd128.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/ripemd160.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/rsa.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/seed.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha1.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha224.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha256.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha384.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha3_224.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha3_256.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha3_384.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha3_512.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha512.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha512_224.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/sha512_256.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/tiger.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/whirlpool.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/x509.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_crypto/yarrow.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/ssl_common.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/tls.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/tls_cache.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/tls_cipher_suites.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/tls_client.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/tls_common.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/tls_io.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/tls_misc.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_ssl/tls_record.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/ethernet.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/ip.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/net.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/net_mem.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/nic.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/ping.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/raw_socket.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/socket.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/tcp.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/tcp_fsm.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/tcp_misc.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/tcp_timer.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/core/udp.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/dhcp/dhcp_client.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/dhcp/dhcp_common.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/dhcp/dhcp_debug.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/dns/dns_cache.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/dns/dns_client.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/dns/dns_common.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/dns/dns_debug.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv4/arp.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv4/auto_ip.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv4/icmp.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv4/igmp.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv4/ipv4.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv4/ipv4_frag.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/icmpv6.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ipv6.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ipv6_frag.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ipv6_misc.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ipv6_pmtu.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ipv6_routing.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/mld.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ndp.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ndp_cache.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ndp_misc.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/ndp_router_adv.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/ipv6/slaac.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/netbios/nbns_client.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/netbios/nbns_common.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/netbios/nbns_responder.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/src/debug.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/src/ext_int_driver.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/src/rtc.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/src/startup_same70.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/src/syscalls.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/src/system_same70.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/common/utils/interrupt/interrupt_sam_nvic.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Source/croutine.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Source/event_groups.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Source/list.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Source/queue.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Source/tasks.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Source/timers.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1/port.c \ - c-utility/adapters/platform_freertos.c \ - c-utility/adapters/tickcounter_freertos.c \ - c-utility/adapters/agenttime.c \ - c-utility/adapters/threadapi_freertos.c \ - c-utility/adapters/httpapi_compact.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/common/os_port_freertos.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/common/endian.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/common/str.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/common/date_time.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/demo/common/atmel/boards/same70_xplained/sdram.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/drivers/ksz8081.c \ - /opt/CycloneTCP_SSL_Crypto_Open_1_7_4/cyclone_tcp/drivers/same70_eth.c \ - /opt/FreeRTOSv9.0.0/FreeRTOS/Source/portable/MemMang/heap_3.c \ - -OBJECTS_iothub_client_sample_http = $(patsubst %.c, obj/%.o, $(SOURCES_iothub_client_sample_http)) - -VPATH += \ - ../ \ - ../../../../ \ - -V ?= 0 -Q_0 := @ -Q_1 := -Q = $(Q_$(V)) - -.SUFFIXES: -.PHONY: all clean - -define loginfo - $(Q)echo "[INFO] $1" -endef - -define logerror - $(Q)echo "[ERR ] $1" -endef - -all: build - -build: iothub_client_sample_http - -iothub_client_sample_http: $(OBJECTS_iothub_client_sample_http) $(THIS_MAKEFILE) - $(call loginfo,"Linking exec" $@) - $(Q)$(CC) $(LDFLAGS) -Wl,-M=bin/$@.map $(CFLAGS) $(OBJECTS_iothub_client_sample_http) $(LIBS) -o bin/$@.elf - $(Q)$(NM) bin/$@.elf >bin/$@.elf.txt - $(Q)$(OBJCOPY) -O binary bin/$@.elf bin/$@.bin - $(Q)$(SIZE) $(OBJECTS_iothub_client_sample_http) bin/$@.elf - -$(OBJECTS): | bin obj - -bin: - $(Q)mkdir -p $@ - -obj: - $(Q)mkdir -p $@ - -obj/%.o: %.c $(THIS_MAKEFILE) - $(call loginfo,"Compiling file" $<) - $(Q)mkdir -p $(dir $@) - $(Q)$(CC) -MT $@ -MMD -MP -MF obj/$*.Td $(CFLAGS) -c $< -o $@ - $(Q)mv -f obj/$*.Td obj/$*.d - -clean: - $(Q)rm -R bin - $(Q)rm -R obj - -obj/%.d: ; -.PRECIOUS: obj/%.d - --include $(patsubst %,obj/%.d,$(basename $(SOURCES))) diff --git a/iothub_client/samples/iothub_client_sample_http/freertos/project.xml b/iothub_client/samples/iothub_client_sample_http/freertos/project.xml deleted file mode 100644 index 5eb6c0bbb3..0000000000 --- a/iothub_client/samples/iothub_client_sample_http/freertos/project.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - -std=gnu99 -O0 -g \ - -march=armv7e-m -mthumb -mfloat-abi=softfp -mfpu=fpv5-sp-d16 \ - -ffunction-sections \ - -Wall -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int \ - -Wmain -Wparentheses \ - -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs \ - -Wuninitialized -Wunknown-pragmas -Wfloat-equal \ - -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings \ - -Waggregate-return -Wstrict-prototypes \ - -Wmissing-prototypes -Wmissing-declarations \ - -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations \ - -Wredundant-decls -Wnested-externs \ - -Wunreachable-code - - - -march=armv7e-m -mthumb -mfloat-abi=softfp -mfpu=fpv5-sp-d16 \ - -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler \ - -Wl,--unresolved-symbols=report-all -Wl,--warn-common \ - -Wl,--defsym=malloc_getpagesize_P=0x80 \ - -L/opt/CycloneTCP_SSL_Crypto_Open_1_7_4/linker \ - -T"same70_flash.ld" \ - -Wl,--start-group -lgcc -lc -lm -Wl,--end-group --specs=nosys.specs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c b/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c deleted file mode 100644 index ed7939bfaa..0000000000 --- a/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c +++ /dev/null @@ -1,263 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include -#include - -/* This sample uses the _LL APIs of iothub_client for example purposes. -That does not mean that HTTP only works with the _LL APIs. -Simply changing the using the convenience layer (functions not having _LL) -and removing calls to _DoWork will yield the same results. */ - -#include "azure_c_shared_utility/threadapi.h" -#include "azure_c_shared_utility/crt_abstractions.h" -#include "azure_c_shared_utility/platform.h" -#include "azure_c_shared_utility/shared_util_options.h" -#include "iothub_client_ll.h" -#include "iothub_message.h" -#include "iothubtransporthttp.h" - -#ifdef MBED_BUILD_TIMESTAMP -#define SET_TRUSTED_CERT_IN_SAMPLES -#endif // MBED_BUILD_TIMESTAMP - -#ifdef SET_TRUSTED_CERT_IN_SAMPLES -#include "certs.h" -#endif // SET_TRUSTED_CERT_IN_SAMPLES - -/*String containing Hostname, Device Id & Device Key in the format: */ -/* "HostName=;DeviceId=;SharedAccessKey=" */ -/* "HostName=;DeviceId=;SharedAccessSignature=" */ -static const char* connectionString = "[device connection string]"; - - -static int callbackCounter; -static bool g_continueRunning; -static char msgText[1024]; -static char propText[1024]; -#define MESSAGE_COUNT 5 -#define DOWORK_LOOP_NUM 3 - - -typedef struct EVENT_INSTANCE_TAG -{ - IOTHUB_MESSAGE_HANDLE messageHandle; - size_t messageTrackingId; // For tracking the messages within the user callback. -} EVENT_INSTANCE; - -static IOTHUBMESSAGE_DISPOSITION_RESULT ReceiveMessageCallback(IOTHUB_MESSAGE_HANDLE message, void* userContextCallback) -{ - int* counter = (int*)userContextCallback; - const char* buffer; - size_t size; - MAP_HANDLE mapProperties; - const char* messageId; - const char* correlationId; - const char* contentType; - const char* contentEncoding; - - // Message properties - if ((messageId = IoTHubMessage_GetMessageId(message)) == NULL) - { - messageId = ""; - } - - if ((correlationId = IoTHubMessage_GetCorrelationId(message)) == NULL) - { - correlationId = ""; - } - - if ((contentType = IoTHubMessage_GetContentTypeSystemProperty(message)) == NULL) - { - contentType = ""; - } - - if ((contentEncoding = IoTHubMessage_GetContentEncodingSystemProperty(message)) == NULL) - { - contentEncoding = ""; - } - - // Message content - if (IoTHubMessage_GetByteArray(message, (const unsigned char**)&buffer, &size) != IOTHUB_MESSAGE_OK) - { - printf("unable to retrieve the message data\r\n"); - } - else - { - (void)printf("Received Message [%d]\r\n Message ID: %s\r\n Correlation ID: %s\r\n Content-Type: %s\r\n Content-Encoding: %s\r\n Data: <<<%.*s>>> & Size=%d\r\n", - *counter, messageId, correlationId, contentType, contentEncoding, (int)size, buffer, (int)size); - if (size == (strlen("quit") * sizeof(char)) && memcmp(buffer, "quit", size) == 0) - { - g_continueRunning = false; - } - } - - // Retrieve properties from the message - mapProperties = IoTHubMessage_Properties(message); - if (mapProperties != NULL) - { - const char*const* keys; - const char*const* values; - size_t propertyCount = 0; - if (Map_GetInternals(mapProperties, &keys, &values, &propertyCount) == MAP_OK) - { - if (propertyCount > 0) - { - size_t index; - - printf(" Message Properties:\r\n"); - for (index = 0; index < propertyCount; index++) - { - printf("\tKey: %s Value: %s\r\n", keys[index], values[index]); - } - printf("\r\n"); - } - } - } - - /* Some device specific action code goes here... */ - (*counter)++; - return IOTHUBMESSAGE_ACCEPTED; -} - -static void SendConfirmationCallback(IOTHUB_CLIENT_CONFIRMATION_RESULT result, void* userContextCallback) -{ - EVENT_INSTANCE* eventInstance = (EVENT_INSTANCE*)userContextCallback; - - (void)printf("Confirmation[%d] received for message tracking id = %zu with result = %s\r\n", callbackCounter, eventInstance->messageTrackingId, ENUM_TO_STRING(IOTHUB_CLIENT_CONFIRMATION_RESULT, result)); - - /* Some device specific action code goes here... */ - callbackCounter++; - IoTHubMessage_Destroy(eventInstance->messageHandle); -} - -void iothub_client_sample_http_run(void) -{ - IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle; - - EVENT_INSTANCE messages[MESSAGE_COUNT]; - double avgWindSpeed = 10.0; - double minTemperature = 20.0; - double minHumidity = 60.0; - int receiveContext = 0; - - g_continueRunning = true; - - srand((unsigned int)time(NULL)); - - callbackCounter = 0; - - if (platform_init() != 0) - { - printf("Failed to initialize the platform.\r\n"); - } - else - { - (void)printf("Starting the IoTHub client sample HTTP...\r\n"); - - if ((iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, HTTP_Protocol)) == NULL) - { - (void)printf("ERROR: iotHubClientHandle is NULL!\r\n"); - } - else - { - unsigned int timeout = 241000; - // Because it can poll "after 9 seconds" polls will happen effectively // at ~10 seconds. - // Note that for scalabilty, the default value of minimumPollingTime - // is 25 minutes. For more information, see: - // https://azure.microsoft.com/documentation/articles/iot-hub-devguide/#messaging - unsigned int minimumPollingTime = 9; - if (IoTHubClient_LL_SetOption(iotHubClientHandle, "timeout", &timeout) != IOTHUB_CLIENT_OK) - { - printf("failure to set option \"timeout\"\r\n"); - } - - if (IoTHubClient_LL_SetOption(iotHubClientHandle, "MinimumPollingTime", &minimumPollingTime) != IOTHUB_CLIENT_OK) - { - printf("failure to set option \"MinimumPollingTime\"\r\n"); - } - -#ifdef SET_TRUSTED_CERT_IN_SAMPLES - // For mbed add the certificate information - if (IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_TRUSTED_CERT, certificates) != IOTHUB_CLIENT_OK) - { - printf("failure to set option \"TrustedCerts\"\r\n"); - } -#endif // SET_TRUSTED_CERT_IN_SAMPLES - - /* Setting Message call back, so we can receive Commands. */ - if (IoTHubClient_LL_SetMessageCallback(iotHubClientHandle, ReceiveMessageCallback, &receiveContext) != IOTHUB_CLIENT_OK) - { - (void)printf("ERROR: IoTHubClient_LL_SetMessageCallback..........FAILED!\r\n"); - } - else - { - (void)printf("IoTHubClient_LL_SetMessageCallback...successful.\r\n"); - - /* Now that we are ready to receive commands, let's send some messages */ - size_t iterator = 0; - double temperature = 0; - double humidity = 0; - do - { - if (iterator < MESSAGE_COUNT) - { - temperature = minTemperature + (rand() % 10); - humidity = minHumidity + (rand() % 20); - sprintf_s(msgText, sizeof(msgText), "{\"deviceId\":\"myFirstDevice\",\"windSpeed\":%.2f,\"temperature\":%.2f,\"humidity\":%.2f}", avgWindSpeed + (rand() % 4 + 2), temperature, humidity); - if ((messages[iterator].messageHandle = IoTHubMessage_CreateFromByteArray((const unsigned char*)msgText, strlen(msgText))) == NULL) - { - (void)printf("ERROR: iotHubMessageHandle is NULL!\r\n"); - } - else - { - MAP_HANDLE propMap; - - messages[iterator].messageTrackingId = iterator; - - propMap = IoTHubMessage_Properties(messages[iterator].messageHandle); - (void)sprintf_s(propText, sizeof(propText), temperature > 28 ? "true" : "false"); - if (Map_AddOrUpdate(propMap, "temperatureAlert", propText) != MAP_OK) - { - (void)printf("ERROR: Map_AddOrUpdate Failed!\r\n"); - } - - (void)IoTHubMessage_SetContentTypeSystemProperty(messages[iterator].messageHandle, "application/json"); - (void)IoTHubMessage_SetContentEncodingSystemProperty(messages[iterator].messageHandle, "utf-8"); - - if (IoTHubClient_LL_SendEventAsync(iotHubClientHandle, messages[iterator].messageHandle, SendConfirmationCallback, &messages[iterator]) != IOTHUB_CLIENT_OK) - { - (void)printf("ERROR: IoTHubClient_LL_SendEventAsync..........FAILED!\r\n"); - } - else - { - (void)printf("IoTHubClient_LL_SendEventAsync accepted message [%zu] for transmission to IoT Hub.\r\n", iterator); - - } - - } - } - IoTHubClient_LL_DoWork(iotHubClientHandle); - ThreadAPI_Sleep(1); - - iterator++; - } while (g_continueRunning); - - (void)printf("iothub_client_sample_http has gotten quit message, call DoWork %d more time to complete final sending...\r\n", DOWORK_LOOP_NUM); - for (size_t index = 0; index < DOWORK_LOOP_NUM; index++) - { - IoTHubClient_LL_DoWork(iotHubClientHandle); - ThreadAPI_Sleep(1); - } - } - IoTHubClient_LL_Destroy(iotHubClientHandle); - } - platform_deinit(); - } -} - -int main(void) -{ - iothub_client_sample_http_run(); - return 0; -} diff --git a/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.h b/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.h deleted file mode 100644 index da1f6c5a76..0000000000 --- a/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#ifndef SENDEVENTASYNC_H -#define SENDEVENTASYNC_H - -#ifdef __cplusplus -extern "C" { -#endif - - void iothub_client_sample_http_run(void); - -#ifdef __cplusplus -} -#endif - -#endif /* SENDEVENTASYNC_H */ diff --git a/iothub_client/samples/iothub_client_sample_http/linux/CMakeLists.txt b/iothub_client/samples/iothub_client_sample_http/linux/CMakeLists.txt deleted file mode 100644 index 05e38c4007..0000000000 --- a/iothub_client/samples/iothub_client_sample_http/linux/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -#Copyright (c) Microsoft. All rights reserved. -#Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#this is CMakeLists.txt for iothub_client_sample_mqtt -cmake_minimum_required(VERSION 2.8.11) - -if(WIN32) - message(FATAL_ERROR "This CMake file is only support Linux builds!") -endif() - -set(AZUREIOT_INC_FOLDER ".." "/usr/include/azureiot" "/usr/include/azureiot/inc") - -include_directories(${AZUREIOT_INC_FOLDER}) - -set(iothub_client_sample_http_c_files - ../iothub_client_sample_http.c -) - -set(iothub_client_sample_http_h_files - ../iothub_client_sample_http.h -) - -add_executable(iothub_client_sample_http ${iothub_client_sample_http_c_files} ${iothub_client_sample_http_h_files}) - -target_link_libraries(iothub_client_sample_http - iothub_client - iothub_client_http_transport - aziotsharedutil - pthread - curl - ssl - crypto - m -) diff --git a/iothub_client/samples/iothub_client_sample_http/mbed/CMakeLists.txt b/iothub_client/samples/iothub_client_sample_http/mbed/CMakeLists.txt deleted file mode 100644 index ee545b567c..0000000000 --- a/iothub_client/samples/iothub_client_sample_http/mbed/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -#Copyright (c) Microsoft. All rights reserved. -#Licensed under the MIT license. See LICENSE file in the project root for full license information. - -cmake_minimum_required(VERSION 2.8.11) - -set(shared_util_base_path ../../../../c-utility) -set(mbed_project_base "iothub_client_sample_http" CACHE STRING "The item being built") -include (${shared_util_base_path}/tools/mbed_build_scripts/mbedbldtemplate.txt) diff --git a/iothub_client/samples/iothub_client_sample_http/mbed/iothub_client_sample_http_filelist.txt b/iothub_client/samples/iothub_client_sample_http/mbed/iothub_client_sample_http_filelist.txt deleted file mode 100644 index 091665e804..0000000000 --- a/iothub_client/samples/iothub_client_sample_http/mbed/iothub_client_sample_http_filelist.txt +++ /dev/null @@ -1,6 +0,0 @@ -set(mbed_project_files - ${CMAKE_CURRENT_SOURCE_DIR}/../*.c - ${CMAKE_CURRENT_SOURCE_DIR}/../*.h - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../certs/certs.h - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../certs/certs.c - ) diff --git a/iothub_client/samples/iothub_client_sample_http/mbed/readme.md b/iothub_client/samples/iothub_client_sample_http/mbed/readme.md deleted file mode 100644 index 0593b48a45..0000000000 --- a/iothub_client/samples/iothub_client_sample_http/mbed/readme.md +++ /dev/null @@ -1,3 +0,0 @@ -# To build the sample - -Follow the instructions [here](https://github.com/Azure/azure-iot-device-ecosystem/blob/master/get_started/mbed-freescale-k64f-c.md). diff --git a/iothub_client/samples/iothub_client_sample_http/windows/iothub_client_sample_http.sln b/iothub_client/samples/iothub_client_sample_http/windows/iothub_client_sample_http.sln deleted file mode 100644 index 0582fe3130..0000000000 --- a/iothub_client/samples/iothub_client_sample_http/windows/iothub_client_sample_http.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iothub_client_sample_http", "iothub_client_sample_http.vcxproj", "{8BE6464E-75F3-4748-B33D-85598A74B18B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8BE6464E-75F3-4748-B33D-85598A74B18B}.Debug|Win32.ActiveCfg = Debug|Win32 - {8BE6464E-75F3-4748-B33D-85598A74B18B}.Debug|Win32.Build.0 = Debug|Win32 - {8BE6464E-75F3-4748-B33D-85598A74B18B}.Debug|x64.ActiveCfg = Debug|x64 - {8BE6464E-75F3-4748-B33D-85598A74B18B}.Debug|x64.Build.0 = Debug|x64 - {8BE6464E-75F3-4748-B33D-85598A74B18B}.Release|Win32.ActiveCfg = Release|Win32 - {8BE6464E-75F3-4748-B33D-85598A74B18B}.Release|Win32.Build.0 = Release|Win32 - {8BE6464E-75F3-4748-B33D-85598A74B18B}.Release|x64.ActiveCfg = Release|x64 - {8BE6464E-75F3-4748-B33D-85598A74B18B}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/iothub_client/samples/iothub_client_sample_http/windows/iothub_client_sample_http.vcxproj b/iothub_client/samples/iothub_client_sample_http/windows/iothub_client_sample_http.vcxproj deleted file mode 100644 index ad136e8dd5..0000000000 --- a/iothub_client/samples/iothub_client_sample_http/windows/iothub_client_sample_http.vcxproj +++ /dev/null @@ -1,173 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {8BE6464E-75F3-4748-B33D-85598A74B18B} - Win32Proj - iothub_client_sample_http - - - - Application - true - v140 - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - true - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - false - - - - - - Level3 - Disabled - GB_MEASURE_MEMORY_FOR_THIS;GB_DEBUG_ALLOC;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - ..\; - - - Console - true - - - - - - - Level3 - Disabled - GB_MEASURE_MEMORY_FOR_THIS;GB_DEBUG_ALLOC;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - ..\; - - - Console - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - ..\; - - - Console - true - true - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - ..\; - - - Console - true - true - true - - - - - - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - \ No newline at end of file diff --git a/iothub_client/samples/iothub_client_sample_http/windows/packages.config b/iothub_client/samples/iothub_client_sample_http/windows/packages.config deleted file mode 100644 index dcb14d2b1c..0000000000 --- a/iothub_client/samples/iothub_client_sample_http/windows/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/iothub_client/samples/iothub_client_sample_http/windowsce/iothub_client_sample_http.sln b/iothub_client/samples/iothub_client_sample_http/windowsce/iothub_client_sample_http.sln deleted file mode 100644 index 6624cb90d4..0000000000 --- a/iothub_client/samples/iothub_client_sample_http/windowsce/iothub_client_sample_http.sln +++ /dev/null @@ -1,22 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iothub_client_sample_http", "iothub_client_sample_http.vcxproj", "{CE8A16FE-6DF9-4F51-B5B4-39853AF1E878}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|TORADEX_CE800 = Debug|TORADEX_CE800 - Release|TORADEX_CE800 = Release|TORADEX_CE800 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CE8A16FE-6DF9-4F51-B5B4-39853AF1E878}.Debug|TORADEX_CE800.ActiveCfg = Debug|TORADEX_CE800 - {CE8A16FE-6DF9-4F51-B5B4-39853AF1E878}.Debug|TORADEX_CE800.Build.0 = Debug|TORADEX_CE800 - {CE8A16FE-6DF9-4F51-B5B4-39853AF1E878}.Release|TORADEX_CE800.ActiveCfg = Release|TORADEX_CE800 - {CE8A16FE-6DF9-4F51-B5B4-39853AF1E878}.Release|TORADEX_CE800.Build.0 = Release|TORADEX_CE800 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/iothub_client/samples/iothub_client_sample_http/windowsce/iothub_client_sample_http.vcxproj b/iothub_client/samples/iothub_client_sample_http/windowsce/iothub_client_sample_http.vcxproj deleted file mode 100644 index 6d83a870d3..0000000000 --- a/iothub_client/samples/iothub_client_sample_http/windowsce/iothub_client_sample_http.vcxproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - - Debug - TORADEX_CE800 - - - Release - TORADEX_CE800 - - - - {CE8A16FE-6DF9-4F51-B5B4-39853AF1E878} - Win32Proj - TORADEX_CE800 - iothub_client_sample_http - - - - Application - false - MultiByte - CE800 - - - Application - false - MultiByte - CE800 - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - - - - Level3 - Disabled - GB_MEASURE_MEMORY_FOR_THIS;GB_DEBUG_ALLOC;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - ..\;..\..\..\inc;..\..\..\..\common\inc;..\..\..\..\common\inc\windowsce;..\..\..\..\iothub_client\inc - - - Console - true - ..\..\..\..\build_output\c\wec2013\Debug - coredll.lib;%(AdditionalDependencies);common.lib;serializer.lib;iothub_client.lib;iothub_client_http_transport.lib;ws2.lib;crypt32.lib - - - - - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - ..\;..\..\..\inc;..\..\..\..\common\inc;..\..\..\..\common\inc\windowsce;..\..\..\..\iothub_client\inc - - - Console - true - true - true - ..\..\..\..\build_output\c\wec2013\Debug - coredll.lib;%(AdditionalDependencies);common.lib;serializer.lib;iothub_client.lib;iothub_client_http_transport.lib;ws2.lib;crypt32.lib - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/iothub_client/samples/iothub_client_sample_http/windowsce/main.c b/iothub_client/samples/iothub_client_sample_http/windowsce/main.c deleted file mode 100644 index 8c57944809..0000000000 --- a/iothub_client/samples/iothub_client_sample_http/windowsce/main.c +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include "iothub_client_sample_http.h" - -int main(void) -{ - iothub_client_sample_http_run(); - return 0; -} diff --git a/iothub_client/samples/iothub_client_sample_mqtt/CMakeLists.txt b/iothub_client/samples/iothub_client_sample_mqtt/CMakeLists.txt deleted file mode 100644 index e7536aee9c..0000000000 --- a/iothub_client/samples/iothub_client_sample_mqtt/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -#Copyright (c) Microsoft. All rights reserved. -#Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#this is CMakeLists.txt for iothub_client_sample_mqtt - -if(NOT ${use_mqtt}) - message(FATAL_ERROR "iothub_client_sample_mqtt being generated without mqtt support") -endif() - -compileAsC99() - -set(iothub_client_sample_mqtt_c_files - iothub_client_sample_mqtt.c -) - -set(iothub_client_sample_mqtt_h_files - iothub_client_sample_mqtt.h -) - -IF(WIN32) - #windows needs this define - add_definitions(-D_CRT_SECURE_NO_WARNINGS) - add_definitions(-DGB_MEASURE_MEMORY_FOR_THIS -DGB_DEBUG_ALLOC) -ENDIF(WIN32) - -#Conditionally use the SDK trusted certs in the samples -if(${set_trusted_cert_in_samples}) - add_definitions(-DSET_TRUSTED_CERT_IN_SAMPLES) - include_directories(${PROJECT_SOURCE_DIR}/certs) - set(samples_cert_file ${PROJECT_SOURCE_DIR}/certs/certs.c) -endif() - -include_directories(.) - -add_executable(iothub_client_sample_mqtt ${iothub_client_sample_mqtt_c_files} ${iothub_client_sample_mqtt_h_files} ${samples_cert_file}) - -target_link_libraries(iothub_client_sample_mqtt - iothub_client_mqtt_transport - iothub_client -) - diff --git a/iothub_client/samples/iothub_client_sample_mqtt/iothub_client_sample_mqtt.c b/iothub_client/samples/iothub_client_sample_mqtt/iothub_client_sample_mqtt.c deleted file mode 100644 index 20510370fc..0000000000 --- a/iothub_client/samples/iothub_client_sample_mqtt/iothub_client_sample_mqtt.c +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include -#include - -#include "iothub_client.h" -#include "iothub_message.h" -#include "azure_c_shared_utility/threadapi.h" -#include "azure_c_shared_utility/crt_abstractions.h" -#include "azure_c_shared_utility/platform.h" -#include "azure_c_shared_utility/shared_util_options.h" -#include "iothubtransportmqtt.h" -#include "iothub_client_options.h" - -#ifdef MBED_BUILD_TIMESTAMP -#define SET_TRUSTED_CERT_IN_SAMPLES -#endif // MBED_BUILD_TIMESTAMP - -#ifdef SET_TRUSTED_CERT_IN_SAMPLES -#include "certs.h" -#endif // SET_TRUSTED_CERT_IN_SAMPLES - -/*String containing Hostname, Device Id & Device Key in the format: */ -/* "HostName=;DeviceId=;SharedAccessKey=" */ -/* "HostName=;DeviceId=;SharedAccessSignature=" */ -static const char* connectionString = "[device connection string]"; - -static int callbackCounter; -static char msgText[1024]; -static char propText[1024]; -static bool g_continueRunning; -#define MESSAGE_COUNT 5 -#define DOWORK_LOOP_NUM 3 - - -typedef struct EVENT_INSTANCE_TAG -{ - IOTHUB_MESSAGE_HANDLE messageHandle; - size_t messageTrackingId; // For tracking the messages within the user callback. -} EVENT_INSTANCE; - -static IOTHUBMESSAGE_DISPOSITION_RESULT ReceiveMessageCallback(IOTHUB_MESSAGE_HANDLE message, void* userContextCallback) -{ - int* counter = (int*)userContextCallback; - const char* buffer; - size_t size; - MAP_HANDLE mapProperties; - const char* messageId; - const char* correlationId; - const char* userDefinedContentType; - const char* userDefinedContentEncoding; - - // Message properties - if ((messageId = IoTHubMessage_GetMessageId(message)) == NULL) - { - messageId = ""; - } - - if ((correlationId = IoTHubMessage_GetCorrelationId(message)) == NULL) - { - correlationId = ""; - } - - if ((userDefinedContentType = IoTHubMessage_GetContentTypeSystemProperty(message)) == NULL) - { - userDefinedContentType = ""; - } - - if ((userDefinedContentEncoding = IoTHubMessage_GetContentEncodingSystemProperty(message)) == NULL) - { - userDefinedContentEncoding = ""; - } - - // Message content - if (IoTHubMessage_GetByteArray(message, (const unsigned char**)&buffer, &size) != IOTHUB_MESSAGE_OK) - { - (void)printf("unable to retrieve the message data\r\n"); - } - else - { - (void)printf("Received Message [%d]\r\n Message ID: %s\r\n Correlation ID: %s\r\n Content-Type: %s\r\n Content-Encoding: %s\r\n Data: <<<%.*s>>> & Size=%d\r\n", - *counter, messageId, correlationId, userDefinedContentType, userDefinedContentEncoding, (int)size, buffer, (int)size); - // If we receive the work 'quit' then we stop running - if (size == (strlen("quit") * sizeof(char)) && memcmp(buffer, "quit", size) == 0) - { - g_continueRunning = false; - } - } - - // Retrieve properties from the message - mapProperties = IoTHubMessage_Properties(message); - if (mapProperties != NULL) - { - const char*const* keys; - const char*const* values; - size_t propertyCount = 0; - if (Map_GetInternals(mapProperties, &keys, &values, &propertyCount) == MAP_OK) - { - if (propertyCount > 0) - { - size_t index; - - printf(" Message Properties:\r\n"); - for (index = 0; index < propertyCount; index++) - { - (void)printf("\tKey: %s Value: %s\r\n", keys[index], values[index]); - } - (void)printf("\r\n"); - } - } - } - - /* Some device specific action code goes here... */ - (*counter)++; - return IOTHUBMESSAGE_ACCEPTED; -} - -static void SendConfirmationCallback(IOTHUB_CLIENT_CONFIRMATION_RESULT result, void* userContextCallback) -{ - EVENT_INSTANCE* eventInstance = (EVENT_INSTANCE*)userContextCallback; - (void)printf("Confirmation[%d] received for message tracking id = %zu with result = %s\r\n", callbackCounter, eventInstance->messageTrackingId, ENUM_TO_STRING(IOTHUB_CLIENT_CONFIRMATION_RESULT, result)); - /* Some device specific action code goes here... */ - callbackCounter++; - IoTHubMessage_Destroy(eventInstance->messageHandle); -} - -void iothub_client_sample_mqtt_run(void) -{ - IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle; - - EVENT_INSTANCE messages[MESSAGE_COUNT]; - - g_continueRunning = true; - srand((unsigned int)time(NULL)); - double avgWindSpeed = 10.0; - double minTemperature = 20.0; - double minHumidity = 60.0; - - callbackCounter = 0; - int receiveContext = 0; - - if (platform_init() != 0) - { - (void)printf("Failed to initialize the platform.\r\n"); - } - else - { - if ((iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, MQTT_Protocol)) == NULL) - { - (void)printf("ERROR: iotHubClientHandle is NULL!\r\n"); - } - else - { - bool traceOn = true; - IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_LOG_TRACE, &traceOn); - -#ifdef SET_TRUSTED_CERT_IN_SAMPLES - // For mbed add the certificate information - if (IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_TRUSTED_CERT, certificates) != IOTHUB_CLIENT_OK) - { - printf("failure to set option \"TrustedCerts\"\r\n"); - } -#endif // SET_TRUSTED_CERT_IN_SAMPLES - - /* Setting Message call back, so we can receive Commands. */ - if (IoTHubClient_LL_SetMessageCallback(iotHubClientHandle, ReceiveMessageCallback, &receiveContext) != IOTHUB_CLIENT_OK) - { - (void)printf("ERROR: IoTHubClient_LL_SetMessageCallback..........FAILED!\r\n"); - } - else - { - (void)printf("IoTHubClient_LL_SetMessageCallback...successful.\r\n"); - - /* Now that we are ready to receive commands, let's send some messages */ - size_t iterator = 0; - double temperature = 0; - double humidity = 0; - do - { - if (iterator < MESSAGE_COUNT) - { - temperature = minTemperature + (rand() % 10); - humidity = minHumidity + (rand() % 20); - sprintf_s(msgText, sizeof(msgText), "{\"deviceId\":\"myFirstDevice\",\"windSpeed\":%.2f,\"temperature\":%.2f,\"humidity\":%.2f}", avgWindSpeed + (rand() % 4 + 2), temperature, humidity); - if ((messages[iterator].messageHandle = IoTHubMessage_CreateFromByteArray((const unsigned char*)msgText, strlen(msgText))) == NULL) - { - (void)printf("ERROR: iotHubMessageHandle is NULL!\r\n"); - } - else - { - - (void)IoTHubMessage_SetMessageId(messages[iterator].messageHandle, "MSG_ID"); - (void)IoTHubMessage_SetCorrelationId(messages[iterator].messageHandle, "CORE_ID"); - (void)IoTHubMessage_SetContentTypeSystemProperty(messages[iterator].messageHandle, "application%2Fjson"); - (void)IoTHubMessage_SetContentEncodingSystemProperty(messages[iterator].messageHandle, "utf-8"); - - messages[iterator].messageTrackingId = iterator; - MAP_HANDLE propMap = IoTHubMessage_Properties(messages[iterator].messageHandle); - (void)sprintf_s(propText, sizeof(propText), temperature > 28 ? "true" : "false"); - if (Map_AddOrUpdate(propMap, "temperatureAlert", propText) != MAP_OK) - { - (void)printf("ERROR: Map_AddOrUpdate Failed!\r\n"); - } - - if (IoTHubClient_LL_SendEventAsync(iotHubClientHandle, messages[iterator].messageHandle, SendConfirmationCallback, &messages[iterator]) != IOTHUB_CLIENT_OK) - { - (void)printf("ERROR: IoTHubClient_LL_SendEventAsync..........FAILED!\r\n"); - } - else - { - (void)printf("IoTHubClient_LL_SendEventAsync accepted message [%d] for transmission to IoT Hub.\r\n", (int)iterator); - } - } - - } - IoTHubClient_LL_DoWork(iotHubClientHandle); - ThreadAPI_Sleep(1); - - iterator++; - } while (g_continueRunning); - - (void)printf("iothub_client_sample_mqtt has gotten quit message, call DoWork %d more time to complete final sending...\r\n", DOWORK_LOOP_NUM); - size_t index = 0; - for (index = 0; index < DOWORK_LOOP_NUM; index++) - { - IoTHubClient_LL_DoWork(iotHubClientHandle); - ThreadAPI_Sleep(1); - } - } - IoTHubClient_LL_Destroy(iotHubClientHandle); - } - platform_deinit(); - } -} - -int main(void) -{ - iothub_client_sample_mqtt_run(); - return 0; -} diff --git a/iothub_client/samples/iothub_client_sample_mqtt/iothub_client_sample_mqtt.h b/iothub_client/samples/iothub_client_sample_mqtt/iothub_client_sample_mqtt.h deleted file mode 100644 index 47f94de207..0000000000 --- a/iothub_client/samples/iothub_client_sample_mqtt/iothub_client_sample_mqtt.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#ifndef IOTHUB_CLIENT_SAMPLE_MQTT_H -#define IOTHUB_CLIENT_SAMPLE_MQTT_H - -#ifdef __cplusplus -extern "C" { -#endif - - void iothub_client_sample_mqtt_run(void); - -#ifdef __cplusplus -} -#endif - -#endif /* IOTHUB_CLIENT_SAMPLE_MQTT_H */ diff --git a/iothub_client/samples/iothub_client_sample_mqtt/windows/packages.config b/iothub_client/samples/iothub_client_sample_mqtt/windows/packages.config deleted file mode 100644 index 3d0fadd73f..0000000000 --- a/iothub_client/samples/iothub_client_sample_mqtt/windows/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/iothub_client/samples/iothub_client_sample_mqtt_websockets/CMakeLists.txt b/iothub_client/samples/iothub_client_sample_mqtt_websockets/CMakeLists.txt deleted file mode 100644 index 463a5fe9c0..0000000000 --- a/iothub_client/samples/iothub_client_sample_mqtt_websockets/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -#Copyright (c) Microsoft. All rights reserved. -#Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#this is CMakeLists.txt for iothub_client_sample_mqtt - -if(NOT ${use_mqtt}) - message(FATAL_ERROR "iothub_client_sample_mqtt being generated without mqtt support") -endif() - -compileAsC99() - -set(iothub_client_sample_mqtt_c_files - iothub_client_sample_mqtt_ws.c - ${CMAKE_CURRENT_SOURCE_DIR}/../../../certs/certs.c -) - -set(iothub_client_sample_mqtt_h_files - ${CMAKE_CURRENT_SOURCE_DIR}/../../../certs/certs.h -) - -IF(WIN32) - #windows needs this define - add_definitions(-D_CRT_SECURE_NO_WARNINGS) - add_definitions(-DGB_MEASURE_MEMORY_FOR_THIS -DGB_DEBUG_ALLOC) -ENDIF(WIN32) - -include_directories(.) - -add_executable(iothub_client_sample_mqtt_websockets ${iothub_client_sample_mqtt_c_files} ${iothub_client_sample_mqtt_h_files}) - -target_link_libraries(iothub_client_sample_mqtt_websockets - iothub_client_mqtt_ws_transport - iothub_client -) - -linkSharedUtil(iothub_client_sample_mqtt_websockets) -linkMqttLibrary(iothub_client_sample_mqtt_websockets) - diff --git a/iothub_client/samples/iothub_client_sample_mqtt_websockets/iothub_client_sample_mqtt_ws.c b/iothub_client/samples/iothub_client_sample_mqtt_websockets/iothub_client_sample_mqtt_ws.c deleted file mode 100644 index fabd5fd23c..0000000000 --- a/iothub_client/samples/iothub_client_sample_mqtt_websockets/iothub_client_sample_mqtt_ws.c +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#include -#include - -#include "iothub_client.h" -#include "iothub_message.h" -#include "azure_c_shared_utility/threadapi.h" -#include "azure_c_shared_utility/crt_abstractions.h" -#include "azure_c_shared_utility/platform.h" -#include "azure_c_shared_utility/shared_util_options.h" -#include "iothub_client_options.h" - -#include "iothubtransportmqtt_websockets.h" -#include "../../../certs/certs.h" - -/*String containing Hostname, Device Id & Device Key in the format: */ -/* "HostName=;DeviceId=;SharedAccessKey=" */ -/* "HostName=;DeviceId=;SharedAccessSignature=" */ -static const char* connectionString = "[device connection string]"; - -static int callbackCounter; -static char msgText[1024]; -static char propText[1024]; -static bool g_continueRunning; -#define MESSAGE_COUNT 5 -#define DOWORK_LOOP_NUM 10 - - -typedef struct EVENT_INSTANCE_TAG -{ - IOTHUB_MESSAGE_HANDLE messageHandle; - size_t messageTrackingId; // For tracking the messages within the user callback. -} EVENT_INSTANCE; - -static IOTHUBMESSAGE_DISPOSITION_RESULT ReceiveMessageCallback(IOTHUB_MESSAGE_HANDLE message, void* userContextCallback) -{ - int* counter = (int*)userContextCallback; - const char* buffer; - size_t size; - MAP_HANDLE mapProperties; - const char* messageId; - const char* correlationId; - - // Message properties - if ((messageId = IoTHubMessage_GetMessageId(message)) == NULL) - { - messageId = ""; - } - - if ((correlationId = IoTHubMessage_GetCorrelationId(message)) == NULL) - { - correlationId = ""; - } - - // Message content - if (IoTHubMessage_GetByteArray(message, (const unsigned char**)&buffer, &size) != IOTHUB_MESSAGE_OK) - { - (void)printf("unable to retrieve the message data\r\n"); - } - else - { - (void)printf("Received Message [%d]\r\n Message ID: %s\r\n Correlation ID: %s\r\n Data: <<<%.*s>>> & Size=%d\r\n", *counter, messageId, correlationId, (int)size, buffer, (int)size); - // If we receive the work 'quit' then we stop running - if (size == (strlen("quit") * sizeof(char)) && memcmp(buffer, "quit", size) == 0) - { - g_continueRunning = false; - } - } - - // Retrieve properties from the message - mapProperties = IoTHubMessage_Properties(message); - if (mapProperties != NULL) - { - const char*const* keys; - const char*const* values; - size_t propertyCount = 0; - if (Map_GetInternals(mapProperties, &keys, &values, &propertyCount) == MAP_OK) - { - if (propertyCount > 0) - { - size_t index; - - printf(" Message Properties:\r\n"); - for (index = 0; index < propertyCount; index++) - { - (void)printf("\tKey: %s Value: %s\r\n", keys[index], values[index]); - } - (void)printf("\r\n"); - } - } - } - - /* Some device specific action code goes here... */ - (*counter)++; - return IOTHUBMESSAGE_ACCEPTED; -} - -static void SendConfirmationCallback(IOTHUB_CLIENT_CONFIRMATION_RESULT result, void* userContextCallback) -{ - EVENT_INSTANCE* eventInstance = (EVENT_INSTANCE*)userContextCallback; - (void)printf("Confirmation[%d] received for message tracking id = %zu with result = %s\r\n", callbackCounter, eventInstance->messageTrackingId, ENUM_TO_STRING(IOTHUB_CLIENT_CONFIRMATION_RESULT, result)); - /* Some device specific action code goes here... */ - callbackCounter++; - IoTHubMessage_Destroy(eventInstance->messageHandle); -} - -void iothub_client_sample_mqtt_run(void) -{ - IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle; - - EVENT_INSTANCE messages[MESSAGE_COUNT]; - - g_continueRunning = true; - srand((unsigned int)time(NULL)); - double avgWindSpeed = 10.0; - double minTemperature = 20.0; - double minHumidity = 60.0; - - callbackCounter = 0; - int receiveContext = 0; - - if (platform_init() != 0) - { - (void)printf("Failed to initialize the platform.\r\n"); - } - else - { - if ((iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, MQTT_WebSocket_Protocol)) == NULL) - { - (void)printf("ERROR: iotHubClientHandle is NULL!\r\n"); - } - else - { - bool traceOn = false; - IoTHubClient_LL_SetOption(iotHubClientHandle, "logtrace", &traceOn); - - // For mbed add the certificate information - if (IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_TRUSTED_CERT, certificates) != IOTHUB_CLIENT_OK) - { - printf("failure to set option \"TrustedCerts\"\r\n"); - } - - /* Setting Message call back, so we can receive Commands. */ - if (IoTHubClient_LL_SetMessageCallback(iotHubClientHandle, ReceiveMessageCallback, &receiveContext) != IOTHUB_CLIENT_OK) - { - (void)printf("ERROR: IoTHubClient_LL_SetMessageCallback..........FAILED!\r\n"); - } - else - { - (void)printf("IoTHubClient_LL_SetMessageCallback...successful.\r\n"); - - /* Now that we are ready to receive commands, let's send some messages */ - size_t iterator = 0; - double temperature = 0; - double humidity = 0; - do - { - if (iterator < MESSAGE_COUNT) - { - temperature = minTemperature + (rand() % 10); - humidity = minHumidity + (rand() % 20); - sprintf_s(msgText, sizeof(msgText), "{\"deviceId\":\"myFirstDevice\",\"windSpeed\":%.2f,\"temperature\":%.2f,\"humidity\":%.2f}", avgWindSpeed + (rand() % 4 + 2), temperature, humidity); - if ((messages[iterator].messageHandle = IoTHubMessage_CreateFromByteArray((const unsigned char*)msgText, strlen(msgText))) == NULL) - { - (void)printf("ERROR: iotHubMessageHandle is NULL!\r\n"); - } - else - { - messages[iterator].messageTrackingId = iterator; - MAP_HANDLE propMap = IoTHubMessage_Properties(messages[iterator].messageHandle); - (void)sprintf_s(propText, sizeof(propText), temperature > 28 ? "true" : "false"); - if (Map_AddOrUpdate(propMap, "temperatureAlert", propText) != MAP_OK) - { - (void)printf("ERROR: Map_AddOrUpdate Failed!\r\n"); - } - - if (IoTHubClient_LL_SendEventAsync(iotHubClientHandle, messages[iterator].messageHandle, SendConfirmationCallback, &messages[iterator]) != IOTHUB_CLIENT_OK) - { - (void)printf("ERROR: IoTHubClient_LL_SendEventAsync..........FAILED!\r\n"); - } - else - { - (void)printf("IoTHubClient_LL_SendEventAsync accepted message [%d] for transmission to IoT Hub.\r\n", (int)iterator); - } - } - } - IoTHubClient_LL_DoWork(iotHubClientHandle); - ThreadAPI_Sleep(1); - - iterator++; - } while (g_continueRunning); - - (void)printf("iothub_client_sample_mqtt has gotten quit message, call DoWork %d more time to complete final sending...\r\n", DOWORK_LOOP_NUM); - for (size_t index = 0; index < DOWORK_LOOP_NUM; index++) - { - IoTHubClient_LL_DoWork(iotHubClientHandle); - ThreadAPI_Sleep(1); - } - } - IoTHubClient_LL_Destroy(iotHubClientHandle); - } - platform_deinit(); - } -} - -int main(void) -{ - iothub_client_sample_mqtt_run(); - return 0; -} diff --git a/iothub_client/samples/iothub_ll_telemetry_sample/CMakeLists.txt b/iothub_client/samples/iothub_ll_telemetry_sample/CMakeLists.txt new file mode 100644 index 0000000000..c396ac8683 --- /dev/null +++ b/iothub_client/samples/iothub_ll_telemetry_sample/CMakeLists.txt @@ -0,0 +1,44 @@ +#Copyright (c) Microsoft. All rights reserved. +#Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#this is CMakeLists.txt for iothub_client_sample_mqtt + +if(NOT ${use_mqtt} AND NOT ${use_amqp} AND NOT ${use_http}) + message(FATAL_ERROR "iothub_ll_telemetry_sample being generated without protocol support") +endif() + +compileAsC99() + +set(iothub_c_files + iothub_ll_telemetry_sample.c + ${PROJECT_SOURCE_DIR}/certs/certs.c +) + +IF(WIN32) + #windows needs this define + add_definitions(-D_CRT_SECURE_NO_WARNINGS) +ENDIF(WIN32) + +include_directories(${PROJECT_SOURCE_DIR}/certs) + +include_directories(.) + +add_executable(iothub_ll_telemetry_sample ${iothub_c_files}) +target_link_libraries(iothub_ll_telemetry_sample iothub_client) + +if(${use_http}) + target_link_libraries(iothub_ll_telemetry_sample iothub_client_http_transport) + add_definitions(-DUSE_HTTP) +endif() + +if(${use_amqp}) + target_link_libraries(iothub_ll_telemetry_sample iothub_client_amqp_transport iothub_client_amqp_ws_transport) + linkUAMQP(iothub_ll_telemetry_sample) + add_definitions(-DUSE_AMQP) +endif() + +if(${use_mqtt}) + target_link_libraries(iothub_ll_telemetry_sample iothub_client_mqtt_transport iothub_client_mqtt_ws_transport) + linkMqttLibrary(iothub_ll_telemetry_sample) + add_definitions(-DUSE_MQTT) +endif() diff --git a/iothub_client/samples/iothub_ll_telemetry_sample/iothub_ll_telemetry_sample.c b/iothub_client/samples/iothub_ll_telemetry_sample/iothub_ll_telemetry_sample.c new file mode 100644 index 0000000000..76622e4b3c --- /dev/null +++ b/iothub_client/samples/iothub_ll_telemetry_sample/iothub_ll_telemetry_sample.c @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +#include +#include + +#include "iothub_client.h" +#include "iothub_message.h" +#include "azure_c_shared_utility/threadapi.h" +#include "azure_c_shared_utility/crt_abstractions.h" +#include "azure_c_shared_utility/platform.h" +#include "azure_c_shared_utility/shared_util_options.h" + +#ifdef USE_MQTT + #include "iothubtransportmqtt.h" + #ifdef USE_WEBSOCKETS + #include "iothubtransportmqtt_websockets.h" + #endif +#endif +#ifdef USE_AMQP + #include "iothubtransportamqp.h" + #ifdef USE_WEBSOCKETS + #include "iothubtransportamqp_websockets.h" + #endif +#endif +#ifdef USE_HTTP + #include "iothubtransporthttp.h" +#endif + +#include "iothub_client_options.h" +#include "certs.h" + +/* String containing Hostname, Device Id & Device Key in the format: */ +/* Paste in the your iothub connection string */ +static const char* connectionString = "[device connection string]"; + +#define MESSAGE_COUNT 5 +static bool g_continueRunning = true; +static size_t g_message_count_send_confirmations = 0; + +static void send_confirm_callback(IOTHUB_CLIENT_CONFIRMATION_RESULT result, void* userContextCallback) +{ + (void)userContextCallback; + // When a message is sent this callback will get envoked + g_message_count_send_confirmations++; + (void)printf("Confirmation callback received for message %zu with result %s\r\n", g_message_count_send_confirmations, ENUM_TO_STRING(IOTHUB_CLIENT_CONFIRMATION_RESULT, result)); +} + +int main(void) +{ + IOTHUB_CLIENT_TRANSPORT_PROVIDER protocol; + IOTHUB_MESSAGE_HANDLE message_handle; + size_t messages_sent = 0; + const char* telemetry_msg = "test_message"; + + // Select the Protocol to use with the connection +#ifdef USE_AMQP + //protocol = AMQP_Protocol_over_WebSocketsTls; + protocol = AMQP_Protocol; +#endif +#ifdef USE_MQTT + //protocol = MQTT_Protocol; + //protocol = MQTT_WebSocket_Protocol; +#endif +#ifdef USE_HTTP + //protocol = HTTP_Protocol; +#endif + + IOTHUB_CLIENT_LL_HANDLE iothub_ll_handle; + + // Used to initialize IoTHub SDK subsystem + (void)platform_init(); + + (void)printf("Creating IoTHub handle\r\n"); + // Create the iothub handle here + iothub_ll_handle = IoTHubClient_LL_CreateFromConnectionString(connectionString, protocol); + + // Set any option that are neccessary. + // For available options please see the iothub_sdk_options.md documentation + //bool traceOn = true; + //IoTHubClient_LL_SetOption(iothub_ll_handle, OPTION_LOG_TRACE, &traceOn); + // Setting the Trusted Certificate. This is only necessary on system with without + // built in certificate stores. + IoTHubClient_LL_SetOption(iothub_ll_handle, OPTION_TRUSTED_CERT, certificates); + + do + { + if (messages_sent < MESSAGE_COUNT) + { + // Construct the iothub message from a string or a byte array + message_handle = IoTHubMessage_CreateFromString(telemetry_msg); + //message_handle = IoTHubMessage_CreateFromByteArray((const unsigned char*)msgText, strlen(msgText))); + + // Set Message property + (void)IoTHubMessage_SetMessageId(message_handle, "MSG_ID"); + (void)IoTHubMessage_SetCorrelationId(message_handle, "CORE_ID"); + (void)IoTHubMessage_SetContentTypeSystemProperty(message_handle, "application%2Fjson"); + (void)IoTHubMessage_SetContentEncodingSystemProperty(message_handle, "utf-8"); + + // Add custom properties to message + MAP_HANDLE propMap = IoTHubMessage_Properties(message_handle); + Map_AddOrUpdate(propMap, "property_key", "property_value"); + + (void)printf("Sending message %d to IoTHub\r\n", (int)(messages_sent+1) ); + IoTHubClient_LL_SendEventAsync(iothub_ll_handle, message_handle, send_confirm_callback, NULL); + + // The message is copied to the sdk so the we can destroy it + IoTHubMessage_Destroy(message_handle); + + messages_sent++; + } + else if (g_message_count_send_confirmations >= MESSAGE_COUNT) + { + // After all messages are all received stop running + g_continueRunning = false; + } + + IoTHubClient_LL_DoWork(iothub_ll_handle); + ThreadAPI_Sleep(1); + + } while (g_continueRunning); + + // Clean up the iothub sdk handle + IoTHubClient_LL_Destroy(iothub_ll_handle); + + // Free all the sdk subsystem + platform_deinit(); + + printf("Press any key to continue"); + getchar(); + + return 0; +} diff --git a/iothub_client/samples/iothub_client_sample_mqtt/linux/CMakeLists.txt b/iothub_client/samples/iothub_ll_telemetry_sample/linux/CMakeLists.txt similarity index 63% rename from iothub_client/samples/iothub_client_sample_mqtt/linux/CMakeLists.txt rename to iothub_client/samples/iothub_ll_telemetry_sample/linux/CMakeLists.txt index ef74cfe9c5..c84fc16247 100644 --- a/iothub_client/samples/iothub_client_sample_mqtt/linux/CMakeLists.txt +++ b/iothub_client/samples/iothub_ll_telemetry_sample/linux/CMakeLists.txt @@ -12,19 +12,18 @@ set(AZUREIOT_INC_FOLDER ".." "/usr/include/azureiot" "/usr/include/azureiot/inc" include_directories(${AZUREIOT_INC_FOLDER}) -set(iothub_client_sample_mqtt_c_files - ../iothub_client_sample_mqtt.c +set(iothub_c_files + iothub_ll_telemetry_sample.c + ${PROJECT_SOURCE_DIR}/certs/certs.c ) -set(iothub_client_sample_mqtt_h_files - ../iothub_client_sample_mqtt.h -) - -add_executable(iothub_client_sample_mqtt ${iothub_client_sample_mqtt_c_files} ${iothub_client_sample_mqtt_h_files}) +add_executable(iothub_ll_telemetry_sample ${iothub_c_files}) -target_link_libraries(iothub_client_sample_mqtt - iothub_client +target_link_libraries(iothub_ll_telemetry_sample iothub_client_mqtt_transport + iothub_client_amqp_transport + iothub_client_http_transport + iothub_client aziotsharedutil umqtt pthread diff --git a/iothub_client/samples/iothub_client_sample_mqtt/mbed/CMakeLists.txt b/iothub_client/samples/iothub_ll_telemetry_sample/mbed/CMakeLists.txt similarity index 78% rename from iothub_client/samples/iothub_client_sample_mqtt/mbed/CMakeLists.txt rename to iothub_client/samples/iothub_ll_telemetry_sample/mbed/CMakeLists.txt index c1c7afd465..8ed3a4695d 100644 --- a/iothub_client/samples/iothub_client_sample_mqtt/mbed/CMakeLists.txt +++ b/iothub_client/samples/iothub_ll_telemetry_sample/mbed/CMakeLists.txt @@ -4,5 +4,5 @@ cmake_minimum_required(VERSION 2.8.11) set(shared_util_base_path ../../../../c-utility) -set(mbed_project_base "iothub_client_sample_mqtt" CACHE STRING "The item being built") +set(mbed_project_base "iothub_ll_telemetry_sample" CACHE STRING "The item being built") include (${shared_util_base_path}/tools/mbed_build_scripts/mbedbldtemplate.txt) diff --git a/iothub_client/samples/iothub_client_sample_mqtt/mbed/iothub_client_sample_mqtt_filelist.txt b/iothub_client/samples/iothub_ll_telemetry_sample/mbed/iothub_ll_telemetry_sample_filelist.txt similarity index 100% rename from iothub_client/samples/iothub_client_sample_mqtt/mbed/iothub_client_sample_mqtt_filelist.txt rename to iothub_client/samples/iothub_ll_telemetry_sample/mbed/iothub_ll_telemetry_sample_filelist.txt diff --git a/iothub_client/samples/iothub_client_sample_mqtt/mbed/readme.md b/iothub_client/samples/iothub_ll_telemetry_sample/mbed/readme.md similarity index 100% rename from iothub_client/samples/iothub_client_sample_mqtt/mbed/readme.md rename to iothub_client/samples/iothub_ll_telemetry_sample/mbed/readme.md diff --git a/iothub_client/samples/iothub_client_sample_mqtt/windows/iothub_client_sample_mqtt.sln b/iothub_client/samples/iothub_ll_telemetry_sample/windows/iothub_ll_telemetry_sample.sln similarity index 90% rename from iothub_client/samples/iothub_client_sample_mqtt/windows/iothub_client_sample_mqtt.sln rename to iothub_client/samples/iothub_ll_telemetry_sample/windows/iothub_ll_telemetry_sample.sln index 2e1836ca31..75d2dd6442 100644 --- a/iothub_client/samples/iothub_client_sample_mqtt/windows/iothub_client_sample_mqtt.sln +++ b/iothub_client/samples/iothub_ll_telemetry_sample/windows/iothub_ll_telemetry_sample.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iothub_client_sample_mqtt", "iothub_client_sample_mqtt.vcxproj", "{6015311A-361A-4849-BF7B-1D3E461FE6B7}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iothub_ll_telemetry_sample", "iothub_ll_telemetry_sample.vcxproj", "{6015311A-361A-4849-BF7B-1D3E461FE6B7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/iothub_client/samples/iothub_client_sample_mqtt/windows/iothub_client_sample_mqtt.vcxproj b/iothub_client/samples/iothub_ll_telemetry_sample/windows/iothub_ll_telemetry_sample.vcxproj similarity index 76% rename from iothub_client/samples/iothub_client_sample_mqtt/windows/iothub_client_sample_mqtt.vcxproj rename to iothub_client/samples/iothub_ll_telemetry_sample/windows/iothub_ll_telemetry_sample.vcxproj index 44d972ee52..d224439b7e 100644 --- a/iothub_client/samples/iothub_client_sample_mqtt/windows/iothub_client_sample_mqtt.vcxproj +++ b/iothub_client/samples/iothub_ll_telemetry_sample/windows/iothub_ll_telemetry_sample.vcxproj @@ -21,7 +21,7 @@ {6015311A-361A-4849-BF7B-1D3E461FE6B7} Win32Proj - iothub_client_sample_mqtt + iothub_ll_telemetry_sample @@ -89,12 +89,13 @@ Level3 Disabled - GB_MEASURE_MEMORY_FOR_THIS;GB_DEBUG_ALLOC;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - ..\ + WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions);USE_AMQP;USE_MQTT;USE_HTTP + ..\;..\..\..\..\certs Console true + rpcrt4.lib;%(AdditionalDependencies) @@ -111,13 +112,13 @@ Level3 Disabled - GB_MEASURE_MEMORY_FOR_THIS;GB_DEBUG_ALLOC;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - ..\; + WIN32;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions);USE_AMQP;USE_MQTT;USE_HTTP + ..\;..\..\..\..\certs Console true - %(AdditionalDependencies) + rpcrt4.lib;%(AdditionalDependencies) @@ -132,15 +133,15 @@ MaxSpeed true true - WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - ..\; + WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions);USE_AMQP;USE_MQTT;USE_HTTP + ..\;..\..\..\..\certs Console true true true - %(AdditionalDependencies) + rpcrt4.lib;%(AdditionalDependencies) @@ -159,15 +160,15 @@ MaxSpeed true true - WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - ..\; + WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions);USE_AMQP;USE_MQTT;USE_HTTP + ..\;..\..\..\..\certs Console true true true - %(AdditionalDependencies) + rpcrt4.lib;%(AdditionalDependencies) @@ -175,13 +176,14 @@ - + + - + - + @@ -189,6 +191,9 @@ + + + @@ -198,5 +203,8 @@ + + + \ No newline at end of file diff --git a/iothub_client/samples/iothub_client_sample_amqp/windows/packages.config b/iothub_client/samples/iothub_ll_telemetry_sample/windows/packages.config similarity index 58% rename from iothub_client/samples/iothub_client_sample_amqp/windows/packages.config rename to iothub_client/samples/iothub_ll_telemetry_sample/windows/packages.config index 25a6cc1d0f..c1ef4a6cf1 100644 --- a/iothub_client/samples/iothub_client_sample_amqp/windows/packages.config +++ b/iothub_client/samples/iothub_ll_telemetry_sample/windows/packages.config @@ -1,6 +1,10 @@ - + + + + + \ No newline at end of file diff --git a/iothub_client/samples/readme.md b/iothub_client/samples/readme.md index 46fd790f54..29bad2581f 100644 --- a/iothub_client/samples/readme.md +++ b/iothub_client/samples/readme.md @@ -5,24 +5,20 @@ This folder contains simple samples showing how to use the various features of t ## List of samples * Simple send and receive messages: - * **iothub_client_sample_mqtt**: send and receive messages from a single device over an MQTT connection - * **iothub_client_sample_mqtt_websockets**: send and receive messages from a single device over an MQTT over WebSockets connection - * **iothub_client_sample_amqp**: send and receive messages from a single device over an AMQP connection - * **iothub_client_sample_amqp_websockets**: send and receive messages from a single device over an AMQP over WebSockets connection - * **iothub_client_sample_http**: send and receive messages from a single device over an HTTP connection + * **iothub_ll_telemetry_sample**: sends messages from a single device * Multiplexing send and receive of several devices over a single connection (useful in Gateway scenarios where multiplexing might be needed): - * **iothub_client_sample_amqp_shared**: send and receive messages from 2 devices over a single AMQP connection - * **iothub_ll_client_sample_amqp_shared**: send and receive messages from 2 devices over a single AMQP connection using the lower level API set of the SDK - * **iothub_client_sample_amqp_websockets_shared**: send and receive messages from 2 devices over a single AMQP over Websockets connection - * **iothub_client_sample_http_shared**: send and receive messages from 2 devices over a single HTTP connection (multiplexing) (useful in Gateway scenarios) + * **iothub_client_sample_amqp_shared**: send and receive messages from 2 devices over a single AMQP connection + * **iothub_ll_client_sample_amqp_shared**: send and receive messages from 2 devices over a single AMQP connection using the lower level API set of the SDK + * **iothub_client_sample_amqp_websockets_shared**: send and receive messages from 2 devices over a single AMQP over Websockets connection + * **iothub_client_sample_http_shared**: send and receive messages from 2 devices over a single HTTP connection (multiplexing) (useful in Gateway scenarios) * Device services samples (Device Twins, Methods, and Device Management): - * **iothub_client_sample_device_method**: Implements a simple Cloud to Device Direct Method - * **iothub_client_sample_mqtt_dm**: Shows the implementation of a firmware update of a device (Raspberry Pi 3) + * **iothub_client_sample_device_method**: Implements a simple Cloud to Device Direct Method + * **iothub_client_sample_mqtt_dm**: Shows the implementation of a firmware update of a device (Raspberry Pi 3) * Uploading blob to Azure: - * **iothub_client_sample_upload_to_blob**: Uploads a blob to Azure through IoT Hub + * **iothub_client_sample_upload_to_blob**: Uploads a blob to Azure through IoT Hub ## How to compile and run the samples @@ -32,7 +28,6 @@ It is recommended to leverage the library packages when available to run the sam [This document][devbox-setup] describes in detail how to prepare your development environment as well as how to run the samples on Linux, Windows or other platforms. - [devbox-setup]: ../../doc/devbox_setup.md [lnk-setup-iot-hub]: https://aka.ms/howtocreateazureiothub [lnk-manage-iot-hub]: https://aka.ms/manageiothub diff --git a/iothub_client/tests/common_e2e/iothubclient_common_e2e.c b/iothub_client/tests/common_e2e/iothubclient_common_e2e.c index a9ae964813..2c4cef2b1c 100644 --- a/iothub_client/tests/common_e2e/iothubclient_common_e2e.c +++ b/iothub_client/tests/common_e2e/iothubclient_common_e2e.c @@ -25,6 +25,7 @@ #include "testrunnerswitcher.h" #include "iothub_client.h" +#include "iothub_client_ll.h" #include "iothub_client_options.h" #include "iothub_message.h" #include "iothub_messaging.h" @@ -43,6 +44,7 @@ #include "iothubclient_common_e2e.h" static bool g_callbackRecv = false; +static TEST_PROTOCOL_TYPE test_protocol_type; const char* TEST_EVENT_DATA_FMT = "{\"data\":\"%.24s\",\"id\":\"%d\"}"; @@ -67,6 +69,7 @@ E2E_TEST_OPTIONS g_e2e_test_options; TEST_DEFINE_ENUM_TYPE(IOTHUB_TEST_CLIENT_RESULT, IOTHUB_TEST_CLIENT_RESULT_VALUES); TEST_DEFINE_ENUM_TYPE(IOTHUB_CLIENT_RESULT, IOTHUB_CLIENT_RESULT_VALUES); +DEFINE_ENUM_STRINGS(IOTHUB_CLIENT_CONNECTION_STATUS_REASON, IOTHUB_CLIENT_CONNECTION_STATUS_REASON_VALUES); typedef struct EXPECTED_SEND_DATA_TAG { @@ -141,6 +144,35 @@ static int IoTHubCallback(void* context, const char* data, size_t size) return result; } +// Invoked when a connection status changes. Tests poll the status in the connection_status_info to make sure expected transitions occur. +static void connection_status_callback(IOTHUB_CLIENT_CONNECTION_STATUS status, IOTHUB_CLIENT_CONNECTION_STATUS_REASON reason, void* userContextCallback) +{ + LogInfo("connection_status_callback: status=<%d>, reason=<%s>", status, ENUM_TO_STRING(IOTHUB_CLIENT_CONNECTION_STATUS_REASON, reason)); + + CONNECTION_STATUS_INFO* connection_status_info = (CONNECTION_STATUS_INFO*)userContextCallback; + if (Lock(connection_status_info->lock) != LOCK_OK) + { + ASSERT_FAIL("unable to lock"); + } + else + { + if ((connection_status_info->currentStatus == IOTHUB_CLIENT_CONNECTION_AUTHENTICATED) && + (status == IOTHUB_CLIENT_CONNECTION_UNAUTHENTICATED)) + { + connection_status_info->connFaultHappened = true; + } + if ((connection_status_info->currentStatus == IOTHUB_CLIENT_CONNECTION_UNAUTHENTICATED) && + (status == IOTHUB_CLIENT_CONNECTION_AUTHENTICATED)) + { + connection_status_info->connRestored = true; + } + connection_status_info->currentStatus = status; + connection_status_info->currentStatusReason = reason; + + (void)Unlock(connection_status_info->lock); + } +} + static void ReceiveConfirmationCallback(IOTHUB_CLIENT_CONFIRMATION_RESULT result, void* userContextCallback) { LogInfo("ReceiveConfirmationCallback invoked, result=<%s>, userContextCallback=<%p>", ENUM_TO_STRING(IOTHUB_CLIENT_CONFIRMATION_RESULT, result), userContextCallback); @@ -422,7 +454,7 @@ static char* get_target_mac_address() #endif //AZIOT_LINUX -void e2e_init(void) +void e2e_init(TEST_PROTOCOL_TYPE protocol_type) { int result = platform_init(); ASSERT_ARE_EQUAL_WITH_MSG(int, 0, result, "Platform init failed"); @@ -434,6 +466,7 @@ void e2e_init(void) g_e2e_test_options.set_mac_address = false; g_connection_status_info.lock = Lock_Init(); + test_protocol_type = protocol_type; } void e2e_deinit(void) @@ -464,19 +497,25 @@ IOTHUB_CLIENT_HANDLE client_connect_to_hub(IOTHUB_PROVISIONED_DEVICE* deviceToUs // Turn on Log bool trace = true; (void)IoTHubClient_SetOption(iotHubClientHandle, OPTION_LOG_TRACE, &trace); - (void)IoTHubClient_SetOption(iotHubClientHandle, "TrustedCerts", certificates); + (void)IoTHubClient_SetOption(iotHubClientHandle, OPTION_TRUSTED_CERT, certificates); (void)IoTHubClient_SetOption(iotHubClientHandle, OPTION_PRODUCT_INFO, "MQTT_E2E/1.1.12"); - unsigned int svc2cl_keep_alive_timeout_secs = 120; // service will send pings at 120 x 7/8 = 105 seconds. Higher the value, lesser the frequency of service side pings. - (void)IoTHubClient_SetOption(iotHubClientHandle, OPTION_SERVICE_SIDE_KEEP_ALIVE_FREQ_SECS, &svc2cl_keep_alive_timeout_secs); + // Set connection status change callback + result = IoTHubClient_SetConnectionStatusCallback(iotHubClientHandle, connection_status_callback, &g_connection_status_info); + ASSERT_ARE_EQUAL_WITH_MSG(IOTHUB_CLIENT_RESULT, IOTHUB_CLIENT_OK, result, "Failure setting connection status callback"); - // Set keep alive for remote idle is optional. If it is not set the default ratio of 1/2 will be used. For default value of 4 minutes, it will be 2 minutes (120 seconds) - double cl2svc_keep_alive_send_ratio = 1.0 / 2.0; // Set it to 120 seconds (240 x 1/2 = 120 seconds) for 4 minutes remote idle. + if (test_protocol_type == TEST_AMQP || test_protocol_type == TEST_AMQP_WEBSOCKETS) + { + unsigned int svc2cl_keep_alive_timeout_secs = 120; // service will send pings at 120 x 7/8 = 105 seconds. Higher the value, lesser the frequency of service side pings. + (void)IoTHubClient_SetOption(iotHubClientHandle, OPTION_SERVICE_SIDE_KEEP_ALIVE_FREQ_SECS, &svc2cl_keep_alive_timeout_secs); - // client will send pings to service at 210 second interval for 4 minutes remote idle. For 25 minutes remote idle, it will be set to 21 minutes. - IoTHubClient_SetOption(iotHubClientHandle, OPTION_REMOTE_IDLE_TIMEOUT_RATIO, &cl2svc_keep_alive_send_ratio); - + // Set keep alive for remote idle is optional. If it is not set the default ratio of 1/2 will be used. For default value of 4 minutes, it will be 2 minutes (120 seconds) + double cl2svc_keep_alive_send_ratio = 1.0 / 2.0; // Set it to 120 seconds (240 x 1/2 = 120 seconds) for 4 minutes remote idle. + + // client will send pings to service at 210 second interval for 4 minutes remote idle. For 25 minutes remote idle, it will be set to 21 minutes. + IoTHubClient_SetOption(iotHubClientHandle, OPTION_REMOTE_IDLE_TIMEOUT_RATIO, &cl2svc_keep_alive_send_ratio); + } #ifdef AZIOT_LINUX if (g_e2e_test_options.set_mac_address) { @@ -575,7 +614,7 @@ bool client_received_confirmation(D2C_MESSAGE_HANDLE d2cMessage, IOTHUB_CLIENT_C if (sendData->dataWasRecv == true) { ASSERT_ARE_EQUAL_WITH_MSG(int, expectedClientResult, sendData->result, "Result from callback does not match expected"); - } + } (void)Unlock(sendData->lock); } @@ -611,35 +650,6 @@ D2C_MESSAGE_HANDLE send_error_injection_message(IOTHUB_CLIENT_HANDLE iotHubClien return (D2C_MESSAGE_HANDLE)sendData; } -// Invoked when a connection status changes. Tests poll the status in the connection_status_info to make sure expected transitions occur. -static void connection_status_callback(IOTHUB_CLIENT_CONNECTION_STATUS status, IOTHUB_CLIENT_CONNECTION_STATUS_REASON reason, void* userContextCallback) -{ - LogInfo("connection_status_callback: status=<%d>, reason=<%d>", status, reason); - - CONNECTION_STATUS_INFO* connection_status_info = (CONNECTION_STATUS_INFO*)userContextCallback; - if (Lock(connection_status_info->lock) != LOCK_OK) - { - ASSERT_FAIL("unable to lock"); - } - else - { - if ((connection_status_info->currentStatus == IOTHUB_CLIENT_CONNECTION_AUTHENTICATED) && - (status == IOTHUB_CLIENT_CONNECTION_UNAUTHENTICATED)) - { - connection_status_info->connFaultHappened = true; - } - if ((connection_status_info->currentStatus == IOTHUB_CLIENT_CONNECTION_UNAUTHENTICATED) && - (status == IOTHUB_CLIENT_CONNECTION_AUTHENTICATED)) - { - connection_status_info->connRestored = true; - } - connection_status_info->currentStatus = status; - connection_status_info->currentStatusReason = reason; - - (void)Unlock(connection_status_info->lock); - } -} - bool client_wait_for_connection_fault() { time_t beginOperation, nowTime; @@ -676,6 +686,37 @@ bool client_status_fault_happened() return result; } +bool wait_for_client_authenticated(size_t wait_time) +{ + bool result = false; + time_t beginOperation, nowTime; + + beginOperation = time(NULL); + while ( + (nowTime = time(NULL)), + (difftime(nowTime, beginOperation) < wait_time) // time box + ) + { + + if (Lock(g_connection_status_info.lock) != LOCK_OK) + { + ASSERT_FAIL("unable to lock"); + } + else + { + result = (g_connection_status_info.currentStatus == IOTHUB_CLIENT_CONNECTION_AUTHENTICATED); + (void)Unlock(g_connection_status_info.lock); + + if (result) + { + break; + } + } + ThreadAPI_Sleep(500); + } + return result; +} + bool client_wait_for_connection_restored() { time_t beginOperation, nowTime; @@ -873,10 +914,6 @@ void e2e_d2c_with_svc_fault_ctrl_with_transport_status(IOTHUB_CLIENT_TRANSPORT_P // Create the IoT Hub Data iotHubClientHandle = client_connect_to_hub(deviceToUse, protocol); - // Set connection status change callback - IOTHUB_CLIENT_RESULT setConnResult = IoTHubClient_SetConnectionStatusCallback(iotHubClientHandle, connection_status_callback, &g_connection_status_info); - ASSERT_ARE_EQUAL_WITH_MSG(IOTHUB_CLIENT_RESULT, IOTHUB_CLIENT_OK, setConnResult, "Failure setting connection status callback"); - if ((0 == strcmp(faultOperationType, "KillAmqpCBSLinkReq")) || (0 == strcmp(faultOperationType, "KillAmqpCBSLinkResp"))) { // We will only detect errors in CBS link when we attempt to refresh the token, which usually is quite long (see DEFAULT_SAS_TOKEN_REFRESH_TIME_SECS). @@ -962,10 +999,6 @@ void e2e_d2c_with_svc_fault_ctrl_error_message_callback(IOTHUB_CLIENT_TRANSPORT_ // Create the IoT Hub Data iotHubClientHandle = client_connect_to_hub(deviceToUse, protocol); - // Set connection status change callback - IOTHUB_CLIENT_RESULT setConnResult = IoTHubClient_SetConnectionStatusCallback(iotHubClientHandle, connection_status_callback, &g_connection_status_info); - ASSERT_ARE_EQUAL_WITH_MSG(IOTHUB_CLIENT_RESULT, IOTHUB_CLIENT_OK, setConnResult, "Failure setting connection status callback"); - if (setTimeoutOption) { IOTHUB_CLIENT_RESULT setOptionResult = IoTHubClient_SetOption(iotHubClientHandle, "event_send_timeout_secs", "30"); @@ -1099,9 +1132,12 @@ static void recv_message_test(IOTHUB_PROVISIONED_DEVICE* deviceToUse, IOTHUB_CLI IOTHUB_MESSAGING_RESULT iotHubMessagingResult; IOTHUB_CLIENT_RESULT result; + size_t client_conn_wait_time = 4000; EXPECTED_RECEIVE_DATA* receiveUserContext; + clear_connection_status_info_flags(); + // Create device client iotHubClientHandle = client_connect_to_hub(deviceToUse, protocol); @@ -1112,6 +1148,24 @@ static void recv_message_test(IOTHUB_PROVISIONED_DEVICE* deviceToUse, IOTHUB_CLI result = IoTHubClient_SetMessageCallback(iotHubClientHandle, ReceiveMessageCallback, receiveUserContext); ASSERT_ARE_EQUAL_WITH_MSG(IOTHUB_CLIENT_RESULT, IOTHUB_CLIENT_OK, result, "Setting message callback failed"); + if (test_protocol_type == TEST_HTTP) + { + // Http protocol does not have a connection callback, so we just need to wait here + ThreadAPI_Sleep(2000); + } + else + { + // Let the iothub client establish the connection + if (!wait_for_client_authenticated(client_conn_wait_time)) + { + // In some situations this will pass due to the device already being connected + // Or being amqp. Make sure we flag this as a possible situation and continue + LogInfo("Did not recieve the client connection callback within the alloted time <%d> seconds", client_conn_wait_time); + } + // Make sure we subscribe to all the events + ThreadAPI_Sleep(3000); + } + // Create Service Client iotHubServiceClientHandle = IoTHubServiceClientAuth_CreateFromConnectionString(IoTHubAccount_GetIoTHubConnString(g_iothubAcctInfo)); ASSERT_IS_NOT_NULL_WITH_MSG(iotHubServiceClientHandle, "Could not initialize IoTHubServiceClient to send C2D messages to the device"); @@ -1122,8 +1176,6 @@ static void recv_message_test(IOTHUB_PROVISIONED_DEVICE* deviceToUse, IOTHUB_CLI iotHubMessagingResult = IoTHubMessaging_Open(iotHubMessagingHandle, openCompleteCallback, (void*)"Context string for open"); ASSERT_ARE_EQUAL (int, IOTHUB_MESSAGING_OK, iotHubMessagingResult); - ThreadAPI_Sleep(5000); - // Send message service_send_c2d(iotHubMessagingHandle, receiveUserContext, deviceToUse); diff --git a/iothub_client/tests/common_e2e/iothubclient_common_e2e.h b/iothub_client/tests/common_e2e/iothubclient_common_e2e.h index 48cffeb109..26de60630a 100644 --- a/iothub_client/tests/common_e2e/iothubclient_common_e2e.h +++ b/iothub_client/tests/common_e2e/iothubclient_common_e2e.h @@ -22,11 +22,19 @@ typedef enum TEST_MESSAGE_CREATION_MECHANISM_TAG TEST_MESSAGE_CREATE_STRING } TEST_MESSAGE_CREATION_MECHANISM; +typedef enum TEST_PROTOCOL_TYPE_TAG +{ + TEST_MQTT, + TEST_MQTT_WEBSOCKETS, + TEST_AMQP, + TEST_AMQP_WEBSOCKETS, + TEST_HTTP +} TEST_PROTOCOL_TYPE; extern E2E_TEST_OPTIONS g_e2e_test_options; extern IOTHUB_ACCOUNT_INFO_HANDLE g_iothubAcctInfo; -extern void e2e_init(void); +extern void e2e_init(TEST_PROTOCOL_TYPE protocol_type); extern void e2e_deinit(void); extern void e2e_send_event_test_sas(IOTHUB_CLIENT_TRANSPORT_PROVIDER protocol); @@ -78,6 +86,7 @@ extern bool client_status_fault_happened(); extern void clear_connection_status_info_flags(); extern bool client_wait_for_connection_restored(); extern bool client_status_restored(); +extern bool wait_for_client_authenticated(size_t wait_time); extern void service_wait_for_d2c_event_arrival(IOTHUB_PROVISIONED_DEVICE* deviceToUse, D2C_MESSAGE_HANDLE d2cMessage); extern bool service_received_the_message(D2C_MESSAGE_HANDLE d2cMessage); diff --git a/iothub_client/tests/iothubclient_amqp_e2e/iothubclient_amqp_e2e.c b/iothub_client/tests/iothubclient_amqp_e2e/iothubclient_amqp_e2e.c index df454b8c68..ece79c286d 100644 --- a/iothub_client/tests/iothubclient_amqp_e2e/iothubclient_amqp_e2e.c +++ b/iothub_client/tests/iothubclient_amqp_e2e/iothubclient_amqp_e2e.c @@ -12,7 +12,7 @@ BEGIN_TEST_SUITE(iothubclient_amqp_e2e) TEST_SUITE_INITIALIZE(TestClassInitialize) { TEST_INITIALIZE_MEMORY_DEBUG(g_dllByDll); - e2e_init(); + e2e_init(TEST_AMQP); } TEST_SUITE_CLEANUP(TestClassCleanup) diff --git a/iothub_client/tests/iothubclient_amqp_e2e_sfc/iothubclient_amqp_e2e_sfc.c b/iothub_client/tests/iothubclient_amqp_e2e_sfc/iothubclient_amqp_e2e_sfc.c index 39f9a1edb3..a3aa782bdc 100644 --- a/iothub_client/tests/iothubclient_amqp_e2e_sfc/iothubclient_amqp_e2e_sfc.c +++ b/iothub_client/tests/iothubclient_amqp_e2e_sfc/iothubclient_amqp_e2e_sfc.c @@ -12,7 +12,7 @@ BEGIN_TEST_SUITE(iothubclient_amqp_e2e_sfc) TEST_SUITE_INITIALIZE(TestClassInitialize) { TEST_INITIALIZE_MEMORY_DEBUG(g_dllByDll); - e2e_init(); + e2e_init(TEST_AMQP); } TEST_SUITE_CLEANUP(TestClassCleanup) diff --git a/iothub_client/tests/iothubclient_amqp_ws_e2e/iothubclient_amqp_ws_e2e.c b/iothub_client/tests/iothubclient_amqp_ws_e2e/iothubclient_amqp_ws_e2e.c index da82550229..f5eea1e288 100644 --- a/iothub_client/tests/iothubclient_amqp_ws_e2e/iothubclient_amqp_ws_e2e.c +++ b/iothub_client/tests/iothubclient_amqp_ws_e2e/iothubclient_amqp_ws_e2e.c @@ -12,7 +12,7 @@ BEGIN_TEST_SUITE(iothubclient_amqp_ws_e2e) TEST_SUITE_INITIALIZE(TestClassInitialize) { TEST_INITIALIZE_MEMORY_DEBUG(g_dllByDll); - e2e_init(); + e2e_init(TEST_AMQP_WEBSOCKETS); } TEST_SUITE_CLEANUP(TestClassCleanup) diff --git a/iothub_client/tests/iothubclient_amqp_ws_e2e_sfc/iothubclient_amqp_ws_e2e_sfc.c b/iothub_client/tests/iothubclient_amqp_ws_e2e_sfc/iothubclient_amqp_ws_e2e_sfc.c index 172fe0d09f..78b0122003 100644 --- a/iothub_client/tests/iothubclient_amqp_ws_e2e_sfc/iothubclient_amqp_ws_e2e_sfc.c +++ b/iothub_client/tests/iothubclient_amqp_ws_e2e_sfc/iothubclient_amqp_ws_e2e_sfc.c @@ -12,7 +12,7 @@ BEGIN_TEST_SUITE(iothubclient_amqp_ws_e2e_sfc) TEST_SUITE_INITIALIZE(TestClassInitialize) { TEST_INITIALIZE_MEMORY_DEBUG(g_dllByDll); - e2e_init(); + e2e_init(TEST_AMQP_WEBSOCKETS); } TEST_SUITE_CLEANUP(TestClassCleanup) diff --git a/iothub_client/tests/iothubclient_mqtt_e2e/iothubclient_mqtt_e2e.c b/iothub_client/tests/iothubclient_mqtt_e2e/iothubclient_mqtt_e2e.c index 4f7cb8decd..6b20dc64f1 100644 --- a/iothub_client/tests/iothubclient_mqtt_e2e/iothubclient_mqtt_e2e.c +++ b/iothub_client/tests/iothubclient_mqtt_e2e/iothubclient_mqtt_e2e.c @@ -12,7 +12,7 @@ BEGIN_TEST_SUITE(iothubclient_mqtt_e2e) TEST_SUITE_INITIALIZE(TestClassInitialize) { TEST_INITIALIZE_MEMORY_DEBUG(g_dllByDll); - e2e_init(); + e2e_init(TEST_MQTT); } TEST_SUITE_CLEANUP(TestClassCleanup) diff --git a/iothub_client/tests/iothubclient_mqtt_e2e_sfc/iothubclient_mqtt_e2e_sfc.c b/iothub_client/tests/iothubclient_mqtt_e2e_sfc/iothubclient_mqtt_e2e_sfc.c index 7e28b51ec1..6c769b2e33 100644 --- a/iothub_client/tests/iothubclient_mqtt_e2e_sfc/iothubclient_mqtt_e2e_sfc.c +++ b/iothub_client/tests/iothubclient_mqtt_e2e_sfc/iothubclient_mqtt_e2e_sfc.c @@ -12,7 +12,7 @@ BEGIN_TEST_SUITE(iothubclient_mqtt_e2e_sfc) TEST_SUITE_INITIALIZE(TestClassInitialize) { TEST_INITIALIZE_MEMORY_DEBUG(g_dllByDll); - e2e_init(); + e2e_init(TEST_MQTT); } TEST_SUITE_CLEANUP(TestClassCleanup) diff --git a/iothub_client/tests/iothubclient_mqtt_ws_e2e/iothubclient_mqtt_ws_e2e.c b/iothub_client/tests/iothubclient_mqtt_ws_e2e/iothubclient_mqtt_ws_e2e.c index 65f3452e32..98e4dd474c 100644 --- a/iothub_client/tests/iothubclient_mqtt_ws_e2e/iothubclient_mqtt_ws_e2e.c +++ b/iothub_client/tests/iothubclient_mqtt_ws_e2e/iothubclient_mqtt_ws_e2e.c @@ -12,7 +12,7 @@ BEGIN_TEST_SUITE(iothubclient_mqtt_ws_e2e) TEST_SUITE_INITIALIZE(TestClassInitialize) { TEST_INITIALIZE_MEMORY_DEBUG(g_dllByDll); - e2e_init(); + e2e_init(TEST_MQTT_WEBSOCKETS); } TEST_SUITE_CLEANUP(TestClassCleanup) diff --git a/iothub_client/tests/iothubclient_mqtt_ws_e2e_sfc/iothubclient_mqtt_ws_e2e_sfc.c b/iothub_client/tests/iothubclient_mqtt_ws_e2e_sfc/iothubclient_mqtt_ws_e2e_sfc.c index a732d4b8f5..665220f4b7 100644 --- a/iothub_client/tests/iothubclient_mqtt_ws_e2e_sfc/iothubclient_mqtt_ws_e2e_sfc.c +++ b/iothub_client/tests/iothubclient_mqtt_ws_e2e_sfc/iothubclient_mqtt_ws_e2e_sfc.c @@ -12,7 +12,7 @@ BEGIN_TEST_SUITE(iothubclient_mqtt_ws_e2e_sfc) TEST_SUITE_INITIALIZE(TestClassInitialize) { TEST_INITIALIZE_MEMORY_DEBUG(g_dllByDll); - e2e_init(); + e2e_init(TEST_MQTT_WEBSOCKETS); } TEST_SUITE_CLEANUP(TestClassCleanup) diff --git a/jenkins/inteledison_c.sh b/jenkins/inteledison_c.sh index ea2e4ab2a2..be00df6793 100755 --- a/jenkins/inteledison_c.sh +++ b/jenkins/inteledison_c.sh @@ -101,11 +101,11 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) EOM # ----------------------------------------------------------------------------- -# -- Modify iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c +# -- Modify iothub_client/samples/iothub_ll_telemetry_sample/iothub_ll_telemetry_sample.c # ----------------------------------------------------------------------------- -echo ---------- Modifying iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c file ---------- +echo ---------- Modifying iothub_client/samples/iothub_ll_telemetry_sample/iothub_ll_telemetry_sample.c file ---------- cd $build_root -sed -i 's/\[device connection string\]/'$IOTHUB_DEVICE_CONN_STR'/g' iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c +sed -i 's/\[device connection string\]/'$IOTHUB_DEVICE_CONN_STR'/g' iothub_client/samples/iothub_ll_telemetry_sample/iothub_ll_telemetry_sample.c # ----------------------------------------------------------------------------- # -- Build the SDK diff --git a/jenkins/raspberrypi_c.sh b/jenkins/raspberrypi_c.sh index ebfeec229d..4ccc3e74eb 100755 --- a/jenkins/raspberrypi_c.sh +++ b/jenkins/raspberrypi_c.sh @@ -75,11 +75,11 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) EOM # ----------------------------------------------------------------------------- -# -- Modify iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c +# -- Modify iothub_client/samples/iothub_ll_telemetry_sample/iothub_ll_telemetry_sample.c # ----------------------------------------------------------------------------- -echo ---------- Modifying iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c file ---------- +echo ---------- Modifying iothub_client/samples/iothub_ll_telemetry_sample/iothub_ll_telemetry_sample.c file ---------- cd $build_root -sed -i 's/\[device connection string\]/'$IOTHUB_DEVICE_CONN_STR'/g' iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c +sed -i 's/\[device connection string\]/'$IOTHUB_DEVICE_CONN_STR'/g' iothub_client/samples/iothub_ll_telemetry_sample/iothub_ll_telemetry_sample.c # ----------------------------------------------------------------------------- # -- Build the SDK diff --git a/provisioning_client/src/prov_transport_http_client.c b/provisioning_client/src/prov_transport_http_client.c index 46ef5a7911..57e8738435 100644 --- a/provisioning_client/src/prov_transport_http_client.c +++ b/provisioning_client/src/prov_transport_http_client.c @@ -102,6 +102,7 @@ typedef struct PROV_TRANSPORT_HTTP_INFO_TAG static void on_http_error(void* callback_ctx, HTTP_CALLBACK_REASON error_result) { + (void)error_result; if (callback_ctx != NULL) { PROV_TRANSPORT_HTTP_INFO* http_info = (PROV_TRANSPORT_HTTP_INFO*)callback_ctx;