http test, not working
This commit is contained in:
@ -37,7 +37,7 @@ BUILD_DIR = build
|
||||
######################################
|
||||
# C sources
|
||||
C_SOURCES = \
|
||||
User/Src/mqttComm.c User/Src/tcpTest.c User/Src/ports.c User/Src/eeprom.c User/Src/frontend.c User/Src/logger.c User/Src/loopCtrl.c User/Src/main2.c User/Src/mbusComm.c User/Src/ringbuffer.c User/Src/show.c User/Src/utils.c User/Src/wizHelper.c hottislib/PontCoopScheduler.c \
|
||||
User/Src/httpTest.c User/Src/mqttComm.c User/Src/tcpTest.c User/Src/ports.c User/Src/eeprom.c User/Src/frontend.c User/Src/logger.c User/Src/loopCtrl.c User/Src/main2.c User/Src/mbusComm.c User/Src/ringbuffer.c User/Src/show.c User/Src/utils.c User/Src/wizHelper.c hottislib/PontCoopScheduler.c \
|
||||
libmbus/mbus/mbus-protocol.c \
|
||||
Core/Src/main.c \
|
||||
Core/Src/gpio.c \
|
||||
@ -125,7 +125,7 @@ C_INCLUDES = \
|
||||
-IUser/Inc \
|
||||
-IioLibrary_Driver/Ethernet \
|
||||
-IioLibrary_Driver/Internet/DHCP \
|
||||
-IioLibrary_Driver/Internet/MQTT \
|
||||
-IioLibrary_Driver/Internet/httpServer \
|
||||
-Ipubsubc/src \
|
||||
-ICore/Inc \
|
||||
-IDrivers/STM32F1xx_HAL_Driver/Inc \
|
||||
|
9
cube/User/Inc/httpTest.h
Normal file
9
cube/User/Inc/httpTest.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef _HTTPTEST_H_
|
||||
#define _HTTPTEST_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void httpTestInit();
|
||||
|
||||
|
||||
#endif /* _HTTPTEST_H_ */
|
@ -20,7 +20,7 @@ static const uint8_t EEPROM_WREN = 0x06;
|
||||
// static const uint8_t EEPROM_WRSR = 0x01;
|
||||
|
||||
|
||||
static const uint32_t EEPROM_MAGIC = 0xaffe0005;
|
||||
static const uint32_t EEPROM_MAGIC = 0xaffe0006;
|
||||
|
||||
|
||||
typedef union {
|
||||
|
64
cube/User/Src/httpTest.c
Normal file
64
cube/User/Src/httpTest.c
Normal file
@ -0,0 +1,64 @@
|
||||
#include <httpTest.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <socket.h>
|
||||
#include <httpServer.h>
|
||||
|
||||
#include <logger.h>
|
||||
#include <PontCoopScheduler.h>
|
||||
#include <wizHelper.h>
|
||||
|
||||
|
||||
extern const uint8_t HTTP_SOCK_1;
|
||||
extern const uint8_t HTTP_SOCK_2;
|
||||
extern const uint8_t HTTP_SOCK_3;
|
||||
#define MAX_HTTPSOCK 3
|
||||
uint8_t HTTPTEST_SOCKS[] = { 3, 4, 5 };
|
||||
|
||||
#define DATA_BUF_SIZE 1024
|
||||
uint8_t RX_BUF[DATA_BUF_SIZE], TX_BUF[DATA_BUF_SIZE];
|
||||
|
||||
static uint8_t webpath[] = "hello";
|
||||
static uint8_t message[] = "Hello World!\n\r";
|
||||
|
||||
|
||||
void httpTestHandler(void *handle) {
|
||||
static uint8_t state = 0;
|
||||
if (isNetworkAvailable()) {
|
||||
switch (state) {
|
||||
case 0:
|
||||
coloredMsg(LOG_YELLOW, "hth, initializing server");
|
||||
|
||||
httpServer_init(TX_BUF, RX_BUF, MAX_HTTPSOCK, HTTPTEST_SOCKS);
|
||||
reg_httpServer_webContent(webpath, message);
|
||||
state = 1;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
coloredMsg(LOG_YELLOW, "hth, running");
|
||||
state = 2;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
for (uint8_t i = 0; i < MAX_HTTPSOCK; i++) {
|
||||
httpServer_run(i);
|
||||
}
|
||||
break;
|
||||
|
||||
case 255:
|
||||
coloredMsg(LOG_YELLOW, "hth, error state, will stop here");
|
||||
schDel(httpTestHandler, NULL);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
coloredMsg(LOG_YELLOW, "hth, network not yet ready");
|
||||
}
|
||||
}
|
||||
|
||||
void httpTestInit() {
|
||||
schAdd(httpTestHandler, NULL, 0, 100);
|
||||
}
|
@ -18,7 +18,7 @@
|
||||
#include <eeprom.h>
|
||||
#include <wizHelper.h>
|
||||
#include <mqttComm.h>
|
||||
|
||||
// #include <httpTest.h>
|
||||
|
||||
void my_setup_1() {
|
||||
schInit();
|
||||
@ -193,7 +193,7 @@ void my_setup_2() {
|
||||
wizInit();
|
||||
|
||||
mqttCommInit();
|
||||
|
||||
// httpTestInit();
|
||||
|
||||
frontendInit();
|
||||
frontendSetThreshold(240);
|
||||
|
@ -6,4 +6,7 @@
|
||||
|
||||
const uint8_t DHCP_SOCK = 0;
|
||||
const uint8_t MQTT_SOCK = 1;
|
||||
const uint8_t TCPTEST_SOCK = 2;
|
||||
const uint8_t TCPTEST_SOCK = 2;
|
||||
const uint8_t HTTP_SOCK_1 = 3;
|
||||
const uint8_t HTTP_SOCK_2 = 4;
|
||||
const uint8_t HTTP_SOCK_3 = 5;
|
Reference in New Issue
Block a user