feat(api): Settings-Typ standalone und wifi.standalone in system/info
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "fake_api_ctx.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "light/nl_boot_state.h"
|
||||
@@ -12,6 +13,10 @@ nl_ctrl_err_t fake_apply_result;
|
||||
int fake_apply_calls, fake_save_calls, fake_save_result;
|
||||
int fake_wifi_calls, fake_wifi_result;
|
||||
char fake_wifi_ssid[NL_SSID_LEN], fake_wifi_pass[NL_PASS_LEN];
|
||||
int fake_standalone_calls, fake_standalone_result;
|
||||
bool fake_standalone_enabled, fake_standalone_pulse;
|
||||
char fake_standalone_ssid[NL_SSID_LEN], fake_standalone_pass[NL_PASS_LEN];
|
||||
uint8_t fake_standalone_channel;
|
||||
int fake_factory_calls, fake_ping_calls, fake_fw_result;
|
||||
char fake_fw_url[256];
|
||||
bool fake_open;
|
||||
@@ -49,6 +54,18 @@ static int wifi_configure(const char *ssid, const char *pass)
|
||||
return fake_wifi_result;
|
||||
}
|
||||
|
||||
static int fake_standalone_configure(bool enabled, const char *ssid, const char *pass,
|
||||
uint8_t channel, bool pulse)
|
||||
{
|
||||
fake_standalone_calls++;
|
||||
fake_standalone_enabled = enabled;
|
||||
fake_standalone_pulse = pulse;
|
||||
fake_standalone_channel = channel;
|
||||
snprintf(fake_standalone_ssid, sizeof fake_standalone_ssid, "%s", ssid ? ssid : "");
|
||||
snprintf(fake_standalone_pass, sizeof fake_standalone_pass, "%s", pass ? pass : "");
|
||||
return fake_standalone_result;
|
||||
}
|
||||
|
||||
static bool open_access(void) { return fake_open; }
|
||||
static void get_info(nl_sys_info_t *out) { *out = fake_info; }
|
||||
static void factory_reset(void) { fake_factory_calls++; }
|
||||
@@ -83,6 +100,10 @@ void fake_api_reset(const char *board_id)
|
||||
fake_apply_calls = fake_save_calls = fake_save_result = 0;
|
||||
fake_wifi_calls = fake_wifi_result = 0;
|
||||
fake_wifi_ssid[0] = fake_wifi_pass[0] = '\0';
|
||||
fake_standalone_calls = fake_standalone_result = 0;
|
||||
fake_standalone_enabled = fake_standalone_pulse = false;
|
||||
fake_standalone_ssid[0] = fake_standalone_pass[0] = '\0';
|
||||
fake_standalone_channel = 0;
|
||||
fake_factory_calls = fake_ping_calls = 0;
|
||||
fake_fw_result = -1;
|
||||
fake_fw_url[0] = '\0';
|
||||
@@ -96,6 +117,8 @@ void fake_api_reset(const char *board_id)
|
||||
fake_ctx.get_settings = get_settings;
|
||||
fake_ctx.save_settings = save_settings;
|
||||
fake_ctx.wifi_configure = wifi_configure;
|
||||
fake_ctx.standalone_configure = fake_standalone_configure;
|
||||
fake_ctx.hostname = "ninlight-681f";
|
||||
fake_ctx.open_access = open_access;
|
||||
fake_ctx.get_info = get_info;
|
||||
fake_ctx.factory_reset = factory_reset;
|
||||
|
||||
Reference in New Issue
Block a user