Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
Doorcode
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Guardians of the Kretschmar Elock System
Doorcode
Commits
cc0ef9e6
Commit
cc0ef9e6
authored
Apr 15, 2020
by
Jacob Priddy
👌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New file layout to be testable etc
parent
4c1102fc
Pipeline
#6245
passed with stages
in 3 minutes and 56 seconds
Changes
15
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
91 additions
and
25 deletions
+91
-25
docker-compose.yml.example
docker-compose.yml.example
+4
-1
src/embedded/CMakeLists.txt
src/embedded/CMakeLists.txt
+27
-2
src/embedded/Dockerfile
src/embedded/Dockerfile
+21
-0
src/embedded/main/.gitignore
src/embedded/main/.gitignore
+1
-1
src/embedded/main/CMakeLists.txt
src/embedded/main/CMakeLists.txt
+9
-2
src/embedded/main/include/app/api.h
src/embedded/main/include/app/api.h
+0
-0
src/embedded/main/include/app/config.h.example
src/embedded/main/include/app/config.h.example
+0
-0
src/embedded/main/include/connectors/http.h
src/embedded/main/include/connectors/http.h
+0
-0
src/embedded/main/include/connectors/wifi.h
src/embedded/main/include/connectors/wifi.h
+2
-0
src/embedded/main/main.c
src/embedded/main/main.c
+8
-3
src/embedded/main/src/app/api.c
src/embedded/main/src/app/api.c
+3
-3
src/embedded/main/src/connectors/esp32/esp_http.c
src/embedded/main/src/connectors/esp32/esp_http.c
+4
-3
src/embedded/main/src/connectors/esp32/esp_wifi.c
src/embedded/main/src/connectors/esp32/esp_wifi.c
+10
-10
src/embedded/main/test_main.c
src/embedded/main/test_main.c
+1
-0
src/embedded/version.txt
src/embedded/version.txt
+1
-0
No files found.
docker-compose.yml.example
View file @
cc0ef9e6
...
...
@@ -95,10 +95,13 @@ services:
networks:
- doorcode
esp32:
image: espressif/idf:latest
build:
context: src/embedded
dockerfile: Dockerfile
tty: true
container_name: esp32
volumes:
- ./src/embedded:/project
# uncomment if you are going to be flashing a board from the container
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
src/embedded/CMakeLists.txt
View file @
cc0ef9e6
...
...
@@ -2,5 +2,30 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required
(
VERSION 3.5
)
include
(
$ENV{IDF_PATH}/tools/cmake/project.cmake
)
project
(
door-controller
)
if
(
COMPILE_UNIVERSAL_TESTS
)
set
(
PROJECT_NAME door-controller-universal-tests
)
set
(
CMAKE_C_STANDARD 11
)
set
(
CMAKE_CXX_STANDARD 17
)
project
(
${
PROJECT_NAME
}
C CXX
)
find_package
(
Catch2 REQUIRED
)
set
(
INCLUDE_DIR main/include
)
set
(
APP_SRC main/src/app
)
set
(
CONNECTOR_TEST main/src/connectors/tests
)
target_include_directories
(
${
PROJECT_NAME
}
PRIVATE
${
INCLUDE_DIR
}
)
file
(
GLOB_RECURSE FILES
${
INCLUDE_DIR
}
/*.h
${
APP_SRC
}
/*.c
${
CONNECTOR_TEST_SRC
}
/*.c
)
add_executable
(
${
PROJECT_NAME
}
${
FILES
}
"main/test_main.c"
)
target_link_libraries
(
${
PROJECT_NAME
}
Catch2::Catch2
)
else
()
include
(
$ENV{IDF_PATH}/tools/cmake/project.cmake
)
project
(
door-controller
)
endif
()
src/embedded/Dockerfile
0 → 100644
View file @
cc0ef9e6
FROM
espressif/idf:latest
RUN
apt-get update
&&
apt-get
install
-y
\
build-essential
\
gcc
\
g++
\
gdb
\
cmake
\
&&
apt-get clean
\
&&
apt-get autoremove
-y
\
&&
rm
-rf
/var/lib/apt/lists/
*
# Install catch2
RUN
git clone https://github.com/catchorg/Catch2.git /catch2
\
&&
cd
/catch2
&&
cmake
-Bbuild
-H
.
-DBUILD_TESTING
=
OFF
\
&&
cmake
--build
build/
--target
install
\
&&
cd
/
\
&&
rm
-rf
/catch2
ENTRYPOINT
[ "/opt/esp/entrypoint.sh" ]
CMD
[ "/bin/bash" ]
src/embedded/main/.gitignore
View file @
cc0ef9e6
config.h
doorcode_root_cert.pem
\ No newline at end of file
*.pem
\ No newline at end of file
src/embedded/main/CMakeLists.txt
View file @
cc0ef9e6
idf_component_register
(
SRCS
"wifi.c"
"main.c"
"http.c"
"api.c"
INCLUDE_DIRS
"."
set
(
INCLUDE_DIR include
)
set
(
APP_SRC src/app
)
set
(
CONNECTOR_SRC src/connectors/esp32
)
file
(
GLOB_RECURSE FILES
${
APP_SRC
}
/*.c
${
CONNECTOR_SRC
}
/*.c
)
idf_component_register
(
SRCS
${
FILES
}
"main.c"
INCLUDE_DIRS
${
INCLUDE_DIR
}
EMBED_TXTFILES
"doorcode_root_cert.pem"
)
src/embedded/main/api.h
→
src/embedded/main/
include/app/
api.h
View file @
cc0ef9e6
File moved
src/embedded/main/config.h.example
→
src/embedded/main/
include/app/
config.h.example
View file @
cc0ef9e6
File moved
src/embedded/main/http.h
→
src/embedded/main/
include/connectors/
http.h
View file @
cc0ef9e6
File moved
src/embedded/main/wifi.h
→
src/embedded/main/
include/connectors/
wifi.h
View file @
cc0ef9e6
#ifndef DOOR__WIFI_H_
#define DOOR__WIFI_H_
#include <stdbool.h>
void
door_wifi_initialize
(
void
);
void
door_wifi_destroy
(
void
);
...
...
src/embedded/main/main.c
View file @
cc0ef9e6
...
...
@@ -11,9 +11,9 @@
#include <freertos/task.h>
#include <esp_log.h>
#include <nvs_flash.h>
#include "wifi.h"
#include "http.h"
#include "api.h"
#include "
connectors/
wifi.h"
#include "
connectors/
http.h"
#include "ap
p/ap
i.h"
static
const
char
*
TAG
=
"MAIN_MODULE"
;
...
...
@@ -25,6 +25,8 @@ static void check_code_task(void* pvParameters)
ESP_LOGI
(
TAG
,
"Connected to AP, begin connecting to DoorCode API"
);
bool
allowed
=
door_api_verify_code
(
"123866"
);
if
(
allowed
)
{
ESP_LOGI
(
TAG
,
"We are allowed in the door!"
);
...
...
@@ -33,6 +35,9 @@ static void check_code_task(void* pvParameters)
{
ESP_LOGI
(
TAG
,
"REJECTED"
);
}
ESP_LOGI
(
TAG
,
"Making second request"
);
door_api_verify_code
(
"123867"
);
ESP_LOGI
(
TAG
,
"Done with second request"
);
door_http_destroy
();
door_wifi_destroy
();
...
...
src/embedded/main/api.c
→
src/embedded/main/
src/app/
api.c
View file @
cc0ef9e6
#include <string.h>
#include "api.h"
#include "http.h"
#include "config.h"
#include "ap
p/ap
i.h"
#include "
connectors/
http.h"
#include "
app/
config.h"
#define ACCESS_PREFIX "/access/"
#define MAX_CODE_COUNT 500
...
...
src/embedded/main/http.c
→
src/embedded/main/
src/connectors/esp32/esp_
http.c
View file @
cc0ef9e6
#include <esp_http_client.h>
#include <esp_log.h>
#include <esp_tls.h>
#include "http.h"
#include "config.h"
#include "wifi.h"
#include <esp_partition.h>
#include "app/config.h"
#include "connectors/http.h"
#include "connectors/wifi.h"
/**
* @brief Input buffer
...
...
src/embedded/main/wifi.c
→
src/embedded/main/
src/connectors/esp32/esp_
wifi.c
View file @
cc0ef9e6
#include <string.h>
#include
"freertos/FreeRTOS.h"
#include
"freertos/task.h"
#include
"freertos/event_groups.h"
#include
"esp_system.h"
#include
"esp_wifi.h"
#include
"esp_event.h"
#include
"esp_log.h"
#include
"nvs_flash.h"
#include
<freertos/FreeRTOS.h>
#include
<freertos/task.h>
#include
<freertos/event_groups.h>
#include
<esp_system.h>
#include
<esp_wifi.h>
#include
<esp_event.h>
#include
<esp_log.h>
#include
<nvs_flash.h>
#include "config.h"
#include "wifi.h"
#include "
app/
config.h"
#include "
connectors/
wifi.h"
/* FreeRTOS event group to signal when we are connected*/
static
EventGroupHandle_t
s_wifi_event_group
;
...
...
src/embedded/main/test_main.c
0 → 100644
View file @
cc0ef9e6
src/embedded/version.txt
0 → 100644
View file @
cc0ef9e6
0.0.0.1
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment