Skip to content

Commit

Permalink
#63 - lwip/sntp mocked.
Browse files Browse the repository at this point in the history
  • Loading branch information
PerMalmberg committed Aug 31, 2019
1 parent 0dc1b3d commit 7ea3964
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,15 @@ set(SMOOTH_SOURCES
${CMAKE_CURRENT_LIST_DIR}/smooth/include/smooth/core/io/Input.h
${CMAKE_CURRENT_LIST_DIR}/smooth/core/io/Output.cpp
${CMAKE_CURRENT_LIST_DIR}/smooth/core/filesystem/MMCSDCard.cpp

${CMAKE_CURRENT_LIST_DIR}/smooth/application/io/wiegand/Wiegand.cpp
${CMAKE_CURRENT_LIST_DIR}/smooth/core/sntp/Sntp.cpp
$ENV{IDF_PATH}/components/json/cJSON/cJSON.c
$ENV{IDF_PATH}/components/json/cJSON/cJSON.h
)

if (${ESP_PLATFORM})
list(APPEND SMOOTH_SOURCES
${CMAKE_CURRENT_LIST_DIR}/smooth/core/sntp/Sntp.cpp

${CMAKE_CURRENT_LIST_DIR}/smooth/core/logging/idf/idf_log.cpp
${CMAKE_CURRENT_LIST_DIR}/smooth/core/io/i2c/I2CCommandLink.cpp
${CMAKE_CURRENT_LIST_DIR}/smooth/core/io/i2c/I2CMasterDevice.cpp
Expand All @@ -163,7 +164,7 @@ if (${ESP_PLATFORM})
${CMAKE_CURRENT_LIST_DIR}/smooth/application/io/i2c/ADS1115.cpp
${CMAKE_CURRENT_LIST_DIR}/smooth/application/io/i2c/MCP23017.cpp
${CMAKE_CURRENT_LIST_DIR}/smooth/application/io/i2c/BME280.cpp
${CMAKE_CURRENT_LIST_DIR}/smooth/application/io/wiegand/Wiegand.cpp

)
else()
list(APPEND SMOOTH_SOURCES
Expand Down
1 change: 0 additions & 1 deletion lib/smooth/core/sntp/Sntp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#include <lwip/apps/sntp.h>
#include <ctime>
#include <iostream>
#include <utility>

namespace smooth::core::sntp
Expand Down
14 changes: 14 additions & 0 deletions mock-idf/components/lwip/include/lwip/apps/sntp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include <lwip/arch.h>

#define SNTP_OPMODE_POLL 0
#define SNTP_OPMODE_LISTENONLY 1

void sntp_setoperatingmode(u8_t operating_mode);

void sntp_init();

void sntp_stop();

void sntp_setservername(u8_t idx, const char* server);
5 changes: 5 additions & 0 deletions mock-idf/components/lwip/include/lwip/arch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

#include <cstdint>

typedef uint8_t u8_t;
17 changes: 17 additions & 0 deletions mock-idf/components/lwip/sntp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <lwip/apps/sntp.h>

void sntp_setoperatingmode(u8_t /*operating_mode*/)
{
}

void sntp_init()
{
}

void sntp_stop()
{
}

void sntp_setservername(u8_t idx, const char*/*server*/)
{
}

0 comments on commit 7ea3964

Please sign in to comment.