kopia lustrzana https://github.com/SP8EBC/ParaTNC
post test
rodzic
b4fa8d7afe
commit
ae1fd396bf
24
src/main.c
24
src/main.c
|
@ -235,6 +235,23 @@ static void message_callback(struct AX25Msg *msg) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char * post_content = "{\
|
||||||
|
\"main_config_data_basic_callsign\": \"SP8EBC\",\
|
||||||
|
\"main_config_data_basic_ssid\": 8,\
|
||||||
|
\"master_time\": 12345,\
|
||||||
|
\"main_cpu_load\": 50,\
|
||||||
|
\"rx10m\": 30,\
|
||||||
|
\"tx10m\": 20,\
|
||||||
|
\"digi10m\": 50,\
|
||||||
|
\"digidrop10m\": 10,\
|
||||||
|
\"kiss10m\": 5,\
|
||||||
|
\"rte_main_rx_total\": 11,\
|
||||||
|
\"rte_main_tx_total\": 12,\
|
||||||
|
\"rte_main_average_battery_voltage\": 123,\
|
||||||
|
\"rte_main_wakeup_count\": 0,\
|
||||||
|
\"rte_main_going_sleep_count\": 2,\
|
||||||
|
\"rte_main_last_sleep_master_time\": 9}\0\0";
|
||||||
|
|
||||||
static void dupa(uint16_t http_code, char * content, uint16_t content_lenght) {
|
static void dupa(uint16_t http_code, char * content, uint16_t content_lenght) {
|
||||||
|
|
||||||
if (http_code == 200) {
|
if (http_code == 200) {
|
||||||
|
@ -1183,7 +1200,12 @@ int main(int argc, char* argv[]){
|
||||||
if (main_config_data_mode->gsm == 1) {
|
if (main_config_data_mode->gsm == 1) {
|
||||||
|
|
||||||
if (gsm_sim800_gprs_ready == 1) {
|
if (gsm_sim800_gprs_ready == 1) {
|
||||||
retval = http_client_async_get("http://pogoda.cc:8080/meteo_backend/status", strlen("http://pogoda.cc:8080/meteo_backend/status"), 0xFFF0, 0x1, dupa);
|
/***
|
||||||
|
*
|
||||||
|
* TEST TEST TEST TODO
|
||||||
|
*/
|
||||||
|
//retval = http_client_async_get("http://pogoda.cc:8080/meteo_backend/status", strlen("http://pogoda.cc:8080/meteo_backend/status"), 0xFFF0, 0x1, dupa);
|
||||||
|
retval = http_client_async_post("http://pogoda.cc:8080/meteo_backend/status", strlen("http://pogoda.cc:8080/meteo_backend/status"), post_content, strlen(post_content), 1, dupa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,15 @@
|
||||||
#include <stm32l4xx_ll_usart.h>
|
#include <stm32l4xx_ll_usart.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RX_BUFFER_1_LN 512
|
#define RX_BUFFER_1_LN 384
|
||||||
#define TX_BUFFER_1_LN 512
|
#define TX_BUFFER_1_LN 384
|
||||||
|
|
||||||
#define RX_BUFFER_2_LN 96
|
#define RX_BUFFER_2_LN 96
|
||||||
#define TX_BUFFER_2_LN 96
|
#define TX_BUFFER_2_LN 96
|
||||||
|
|
||||||
|
#define RX_BUFFER_3_LN 768
|
||||||
|
#define TX_BUFFER_3_LN 768
|
||||||
|
|
||||||
#define SEPARATE_RX_BUFF
|
#define SEPARATE_RX_BUFF
|
||||||
#define SEPARATE_TX_BUFF
|
#define SEPARATE_TX_BUFF
|
||||||
|
|
||||||
|
@ -183,8 +186,8 @@ extern uint8_t srl_usart2_rx_buffer[RX_BUFFER_2_LN];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PARAMETEO
|
#ifdef PARAMETEO
|
||||||
extern uint8_t srl_usart3_tx_buffer[TX_BUFFER_1_LN];
|
extern uint8_t srl_usart3_tx_buffer[TX_BUFFER_3_LN];
|
||||||
extern uint8_t srl_usart3_rx_buffer[TX_BUFFER_1_LN];
|
extern uint8_t srl_usart3_rx_buffer[RX_BUFFER_3_LN];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@ uint8_t srl_usart2_tx_buffer[TX_BUFFER_2_LN] = {'\0'};
|
||||||
uint8_t srl_usart2_rx_buffer[RX_BUFFER_2_LN] = {'\0'};
|
uint8_t srl_usart2_rx_buffer[RX_BUFFER_2_LN] = {'\0'};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t srl_usart3_tx_buffer[TX_BUFFER_1_LN] = {'\0'};
|
uint8_t srl_usart3_tx_buffer[TX_BUFFER_3_LN] = {'\0'};
|
||||||
uint8_t srl_usart3_rx_buffer[TX_BUFFER_1_LN] = {'\0'};
|
uint8_t srl_usart3_rx_buffer[RX_BUFFER_3_LN] = {'\0'};
|
||||||
|
|
||||||
|
|
||||||
void srl_init(
|
void srl_init(
|
||||||
|
|
|
@ -140,13 +140,13 @@ static uint16_t http_client_get_port_from_url(char * input, uint16_t input_ln, c
|
||||||
|
|
||||||
// copy port number into target buffer
|
// copy port number into target buffer
|
||||||
//memcpy(port, temp, 5);
|
//memcpy(port, temp, 5);
|
||||||
for (; i >= 0 ; i--) {
|
for (; i > 0 ; i--) {
|
||||||
|
|
||||||
if (temp[i] == 0) {
|
if (temp[i - 1] == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
port[j++] = temp[i];
|
port[j++] = temp[i - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -106,7 +106,7 @@ uint16_t http_client_headers_terminate(char* output, uint16_t output_ln, uint16_
|
||||||
uint16_t http_client_headers_content_ln(char* output, uint16_t output_ln, uint16_t offset, uint16_t content_ln) {
|
uint16_t http_client_headers_content_ln(char* output, uint16_t output_ln, uint16_t offset, uint16_t content_ln) {
|
||||||
uint16_t out = 0;
|
uint16_t out = 0;
|
||||||
|
|
||||||
snprintf(output + offset, output_ln - offset, "User-Agent: %d\r\n", content_ln);
|
snprintf(output + offset, output_ln - offset, "Content-lenght: %d\r\n", content_ln);
|
||||||
|
|
||||||
out = strlen (output);
|
out = strlen (output);
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue