#include <stdio.h>
#include "pico/stdlib.h"
#include "pico/cyw43_arch.h"
#include "lwip/pbuf.h"
#include "lwip/altcp_tcp.h"
#include "lwip/altcp_tls.h"
#include "hardware/structs/rosc.h"
#include "hardware/rtc.h"
#include "time.h"
#include "setupWifi.h"
#define BUF_SIZE 2048
void getDateNow(struct tm *t)
{
datetime_t rtc;
rtc_get_datetime(&rtc);
t->tm_sec = rtc.sec;
t->tm_min = rtc.min;
t->tm_hour = rtc.hour;
t->tm_mday = rtc.day;
t->tm_mon = rtc.month - 1;
t->tm_year = rtc.year - 1900;
t->tm_wday = rtc.dotw;
t->tm_yday = 0;
t->tm_isdst = -1;
}
void sendData(struct altcp_pcb *pcb)
{
err_t err;
char html[] = "<html><head><title>Temperature</title></head><body><p>{\"humidity\":81%, \"airtemperature\":23.5C}</p></body></html>\r\n";
char headers[1024] = {0};
char Status[] = "HTTP/1.1 200 OK\r\nContent-Type: text/html;charset=UTF-8\r\nServer:Picow\r\n";
struct tm t;
getDateNow(&t);
char Date[100];
strftime(Date, sizeof(Date), "Date: %a, %d %b %Y %k:%M:%S %Z\r\n", &t);
char ContLen[100] = {0};
snprintf(ContLen, sizeof ContLen, "Content-Length:%d \r\n", strlen(html));
snprintf(headers, sizeof headers, "%s%s%s\r\n", Status, Date, ContLen);
char data[2048] = {0};
snprintf(data, sizeof data, "%s%s", headers, html);
err = altcp_write(pcb, data, strlen(data), 0);
err = altcp_output(pcb);
}
err_t recv(void *arg, struct altcp_pcb *pcb, struct pbuf *p, err_t err)
{
char myBuff[BUF_SIZE];
if (p != NULL)
{
printf("recv total %d this buffer %d next %d err %d\n", p->tot_len, p->len, p->next, err);
pbuf_copy_partial(p, myBuff, p->tot_len, 0);
myBuff[p->tot_len] = 0;
printf("Buffer= %s\n", myBuff);
altcp_recved(pcb, p->tot_len);
pbuf_free(p);
sendData(pcb);
}
return ERR_OK;
}
static err_t sent(void *arg, struct altcp_pcb *pcb, u16_t len)
{
altcp_close(pcb);
}
static err_t accept(void *arg, struct altcp_pcb *pcb, err_t err)
{
altcp_recv(pcb, recv);
altcp_sent(pcb, sent);
printf("connect!\n");
return ERR_OK;
}
void setRTC()
{
datetime_t t = {
.year = 2023,
.month = 02,
.day = 03,
.dotw = 5,
.hour = 11,
.min = 10,
.sec = 00};
rtc_init();
rtc_set_datetime(&t);
}
int main()
{
stdio_init_all();
setRTC();
connect();
u8_t key[] = {0x30, 0x82, 0x04, 0xbd, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, 0x04, 0xa7, 0x30, 0x82, 0x04, 0xa3, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00, 0xbd, 0xb3, 0xb6, 0x94, 0x9f, 0x87, 0x85, 0xd6, 0xd4, 0xd0, 0xf9, 0x24, 0x4b, 0x8c, 0x7d, 0x9e, 0xf5, 0x83, 0xac, 0x90, 0x37, 0x5b, 0xdf, 0x4d, 0x9b, 0x05, 0x6b, 0x5f, 0xaa, 0x87, 0x31, 0x87, 0x0e, 0x97, 0x90, 0xa0, 0xff, 0x12, 0x81, 0xcc, 0xfe, 0x66, 0xa3, 0x8e, 0x34, 0x33, 0x63, 0x27, 0x10, 0xa4, 0xf1, 0x57, 0x27, 0x72, 0x54, 0x45, 0x41, 0x62, 0xee, 0x00, 0x36, 0xaa, 0x1f, 0xfa, 0xa3, 0xb0, 0x27, 0xeb, 0x3e, 0xf3, 0xcf, 0x04, 0x17, 0x68, 0x22, 0xf1, 0x1e, 0x1c, 0x9e, 0x27, 0x7d, 0x82, 0xb3, 0x3f, 0x3c, 0x12, 0x63, 0x94, 0x3b, 0xae, 0x87, 0x3c, 0x33, 0x6a, 0x08, 0x63, 0x84, 0xc2, 0xf8, 0x87, 0xbd, 0xfd, 0x25, 0x92, 0xb7, 0x8d, 0xdb, 0xac, 0xe9, 0xcb, 0x3f, 0x04, 0x3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 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x49, 0x4f, 0x20, 0x50, 0x72, 0x65, 0x73, 0x73, 0x31, 0x0e, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x05, 0x50, 0x69, 0x63, 0x6f, 0x57, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x33, 0x30, 0x32, 0x30, 0x36, 0x31, 0x35, 0x30, 0x39, 0x35, 0x34, 0x5a, 0x17, 0x0d, 0x32, 0x34, 0x30, 0x32, 0x30, 0x36, 0x31, 0x35, 0x30, 0x39, 0x35, 0x34, 0x5a, 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x49, 0x4f, 0x20, 0x50, 0x72, 0x65, 0x73, 0x73, 0x31, 0x0e, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x05, 0x50, 0x69, 0x63, 0x6f, 0x57, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01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cb, 0x49, 0xab, 0xc1, 0x50, 0x37, 0xca, 0x03, 0xb7, 0x44, 0x94, 0x16, 0xbf, 0xd6, 0xf5, 0xa6, 0xbc, 0x10, 0x86, 0xf2, 0x97, 0xea, 0x66, 0x15, 0xa3, 0x9f, 0x4d, 0xf0, 0xe6, 0xa5, 0xfb, 0x1f, 0x25, 0xd7, 0x71, 0xed, 0x85, 0x53, 0x5b, 0x86, 0x1c, 0x46, 0x29, 0xb5, 0xa8, 0xa8, 0x25, 0x27, 0x5a, 0x51, 0x27, 0x30, 0xa7, 0x94, 0x07, 0x21, 0xf7, 0x66, 0xe2, 0xab, 0x16, 0x0e, 0x59, 0xa2, 0x7a, 0x70, 0x30, 0xba, 0x6b, 0x9f, 0xf9, 0x4d, 0x22, 0x4e, 0xa3, 0x33, 0x7e, 0x49, 0x43, 0x62, 0x29, 0xf5, 0xc7, 0x61, 0x7e, 0x5f, 0xcd, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x53, 0x30, 0x51, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x93, 0xc8, 0x8f, 0xac, 0x37, 0x01, 0x7e, 0x4d, 0xd2, 0x87, 0x7a, 0xb5, 0x26, 0xba, 0xd1, 0xa6, 0x1a, 0xcd, 0xd1, 0xb2, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x93, 0xc8, 0x8f, 0xac, 0x37, 0x01, 0x7e, 0x4d, 0xd2, 0x87, 0x7a, 0xb5, 0x26, 0xba, 0xd1, 0xa6, 0x1a, 0xcd, 0xd1, 0xb2, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0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0xc8, 0x52, 0x6e, 0x58, 0x8e, 0x9c, 0x07, 0xa1, 0x52, 0xe2, 0x49, 0x8c, 0x04, 0x3f, 0x84, 0x32, 0x7b, 0xff, 0x5f, 0xf4, 0xf2, 0xdf, 0x3c, 0x73, 0xff, 0x9f, 0x63, 0x0e, 0xe5, 0x7f, 0xdf, 0xa8, 0x7e, 0x4d, 0xf3, 0x29, 0xd8, 0x2b, 0x41, 0x25, 0xbc, 0x73, 0x41, 0x3b, 0x1f, 0x39, 0x64, 0x48, 0x85, 0xe5, 0x66, 0x90, 0x8c, 0xd3, 0x8a, 0xce, 0xdc, 0xb5, 0x0d, 0x93, 0xb0, 0xd0, 0x8a, 0xef, 0x74, 0x8f, 0x28, 0x2f, 0x2c, 0x96, 0x4a, 0x4f, 0xc3, 0xf1, 0xde, 0x25, 0xff, 0xd4};
struct altcp_tls_config *tls_config = altcp_tls_create_config_server_privkey_cert(key, sizeof(key), NULL, 0, cert, sizeof(cert));
struct altcp_pcb *pcb = altcp_tls_new(tls_config, IPADDR_TYPE_ANY);
altcp_accept(pcb, accept);
altcp_bind(pcb, IP_ADDR_ANY, 443);
cyw43_arch_lwip_begin();
pcb = altcp_listen_with_backlog(pcb, 3);
cyw43_arch_lwip_end();
while (true)
{
sleep_ms(500);
}
}