Files
iot-bedroom-environment-con…/components/ui/vars.c
2026-03-31 21:52:29 +08:00

95 lines
1.7 KiB
C

#include <string.h>
#include "vars.h"
static char time[100] = {0};
const char *get_var_time()
{
return time;
}
void set_var_time(const char *value)
{
strncpy(time, value, sizeof(time) / sizeof(char));
time[sizeof(time) / sizeof(char) - 1] = 0;
}
static char humity[100] = {0};
const char *get_var_humity()
{
return humity;
}
void set_var_humity(const char *value)
{
strncpy(humity, value, sizeof(humity) / sizeof(char));
humity[sizeof(humity) / sizeof(char) - 1] = 0;
}
static char light_value[100] = {0};
const char *get_var_light_value()
{
return light_value;
}
void set_var_light_value(const char *value)
{
strncpy(light_value, value, sizeof(light_value) / sizeof(char));
light_value[sizeof(light_value) / sizeof(char) - 1] = 0;
}
static char co2_value[100] = {0};
const char *get_var_co2_value()
{
return co2_value;
}
void set_var_co2_value(const char *value)
{
strncpy(co2_value, value, sizeof(co2_value) / sizeof(char));
co2_value[sizeof(co2_value) / sizeof(char) - 1] = 0;
}
static char voc_value[100] = { 0 };
const char *get_var_voc_value() {
return voc_value;
}
void set_var_voc_value(const char *value) {
strncpy(voc_value, value, sizeof(voc_value) / sizeof(char));
voc_value[sizeof(voc_value) / sizeof(char) - 1] = 0;
}
static char mode[100] = {0};
const char *get_var_mode()
{
return mode;
}
void set_var_mode(const char *value)
{
strncpy(mode, value, sizeof(mode) / sizeof(char));
mode[sizeof(mode) / sizeof(char) - 1] = 0;
}
static char tempture[100] = {0};
const char *get_var_tempture()
{
return tempture;
}
void set_var_tempture(const char *value)
{
strncpy(tempture, value, sizeof(tempture) / sizeof(char));
tempture[sizeof(tempture) / sizeof(char) - 1] = 0;
}