Skip to content

Commit

Permalink
Merge pull request #4 from shishir-dey/chore/refactor
Browse files Browse the repository at this point in the history
Restructure project to make it easier to contribute
  • Loading branch information
shishir-dey authored Nov 26, 2024
2 parents d6a9a43 + 9147eb5 commit 77c5aef
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 383 deletions.
58 changes: 29 additions & 29 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

# Define the SDK library
add_library(iot_firmware_sdk STATIC
src/stream.c
src/mqtt_client.c
src/mqtt_client_port.c
src/data/internet_object.c
src/connectivity/mqtt_client.c
src/connectivity/mqtt_client_port.c
)

# iot-firmware-sdk include directories
Expand Down Expand Up @@ -62,35 +62,35 @@ install(TARGETS iot_firmware_sdk
)

# Build the examples if host is Windows
if(WIN32)
set(PLATFORM_SOURCES
platform/Win32/platform_win32_port_clock.c
platform/Win32/platform_win32_port_transport.c
external/cJSON/cJSON.c
)
# if(WIN32)
# set(PLATFORM_SOURCES
# platform/Win32/platform_win32_port_clock.c
# platform/Win32/platform_win32_port_transport.c
# external/cJSON/cJSON.c
# )

target_include_directories(iot_firmware_sdk PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/platform/Win32
${CMAKE_CURRENT_SOURCE_DIR}/portable
${CMAKE_CURRENT_SOURCE_DIR}/include/iot
${CMAKE_CURRENT_SOURCE_DIR}/external/cJSON
)
# target_include_directories(iot_firmware_sdk PUBLIC
# ${CMAKE_CURRENT_SOURCE_DIR}/platform/Win32
# ${CMAKE_CURRENT_SOURCE_DIR}/portable
# ${CMAKE_CURRENT_SOURCE_DIR}/include/iot
# ${CMAKE_CURRENT_SOURCE_DIR}/external/cJSON
# )

add_executable(stream_publish
examples/stream_publish.c
${PLATFORM_SOURCES}
)
# add_executable(stream_publish
# examples/stream_publish.c
# ${PLATFORM_SOURCES}
# )

target_link_libraries(stream_publish iot_firmware_sdk)
# target_link_libraries(stream_publish iot_firmware_sdk)

set_target_properties(stream_publish PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples"
)
# set_target_properties(stream_publish PROPERTIES
# RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples"
# )

install(TARGETS stream_publish
RUNTIME DESTINATION bin
)
# install(TARGETS stream_publish
# RUNTIME DESTINATION bin
# )

else()
set(PLATFORM_SOURCES "")
endif()
# else()
# set(PLATFORM_SOURCES "")
# endif()
File renamed without changes.
63 changes: 0 additions & 63 deletions examples/stream_publish.c

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define IOT_MQTT_CLIENT_H

#include "core_mqtt.h"
#include "iot/custom_types.h"
#include "mbedtls/ctr_drbg.h"
#include "mbedtls/debug.h"
#include "mbedtls/entropy.h"
Expand Down Expand Up @@ -64,7 +63,7 @@ int mqtt_disconnect();
* @param qos Quality of Service level (0, 1, or 2)
* @return int 0 on success, negative value on error
*/
int mqtt_publish(const char* topic, const bb_uint8_t* payload, size_t payload_length, bb_uint8_t qos);
int mqtt_publish(const char* topic, const uint8_t* payload, size_t payload_length, uint8_t qos);

/**
* @brief Subscribe to an MQTT topic
Expand All @@ -73,7 +72,7 @@ int mqtt_publish(const char* topic, const bb_uint8_t* payload, size_t payload_le
* @param qos Quality of Service level (0, 1, or 2)
* @return int 0 on success, negative value on error
*/
int mqtt_subscribe(const char* topic, bb_uint8_t qos);
int mqtt_subscribe(const char* topic, uint8_t qos);

/**
* @brief Set the root CA certificate for SSL/TLS connection
Expand Down
File renamed without changes.
File renamed without changes.
24 changes: 0 additions & 24 deletions include/iot/custom_types.h

This file was deleted.

148 changes: 0 additions & 148 deletions include/iot/stream.h

This file was deleted.

File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/mqtt_client.c → src/connectivity/mqtt_client.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "iot/mqtt_client.h"
#include "iot/mqtt_client_port.h"
#include "connectivity/mqtt_client.h"
#include "connectivity/mqtt_client_port.h"
#include "transport.h"
#include <stdio.h>
#include <string.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "iot/mqtt_client_port.h"
#include "iot/mqtt_client.h"
#include "connectivity/mqtt_client_port.h"
#include "connectivity/mqtt_client.h"

MQTTClientContext* get_mqtt_client_context();

Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 77c5aef

Please sign in to comment.