有冲突
This commit is contained in:
commit
35de03a186
@ -362,7 +362,11 @@ static void handle_system_event(key_event_t event)
|
||||
poweroff_voice();
|
||||
ws2812_led_clear_all();
|
||||
ispoweron = 0;
|
||||
<<<<<<< HEAD
|
||||
rtos_delay_milliseconds(400);
|
||||
=======
|
||||
rtos_delay_milliseconds(1000);
|
||||
>>>>>>> 055e7e84bd6a0e47612d1047b42c9c6184b187e9
|
||||
bk_gpio_enable_output(51);
|
||||
bk_gpio_set_output_low(51);
|
||||
|
||||
@ -675,8 +679,7 @@ static void handle_system_event(key_event_t event)
|
||||
thing_init();
|
||||
init_bat_timer();
|
||||
// spi_led_init();
|
||||
// bk_printf("bk_misc_get_reset_reason = 0x%02X \n",bk_misc_get_reset_reason());
|
||||
bk_printf("VER:1.0.3 2025.05.27\r\n");
|
||||
bk_printf("VER:%s\r\n","1.0.6");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -252,8 +252,7 @@ static void bk_genie_message_handle(void)
|
||||
break;
|
||||
case DBEVT_WIFI_STATION_CONNECT:
|
||||
{
|
||||
//helloyifa
|
||||
be_set_smart_config_running();
|
||||
|
||||
ble_notify_boarding_state(BOARDING_STATE_SETWIFI);
|
||||
LOGE("DBEVT_WIFI_STATION_CONNECT\n");
|
||||
bk_genie_boarding_info_t *bk_genie_boarding_info = (bk_genie_boarding_info_t *) msg.param;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "wifi_boarding_utils.h"
|
||||
|
||||
//helloyifa
|
||||
#include "bk_genie_smart_config.h"
|
||||
#include "../iot/iot_sleep_helper.h"
|
||||
#include "../iot/iot_lamp.h"
|
||||
#include "spi_led.h"
|
||||
@ -184,8 +185,12 @@ static uint16_t *const s_boarding_attr_handle_list[sizeof(s_gatts_attr_db_servic
|
||||
//helloyifa
|
||||
&s_char_cmd_char_handle,
|
||||
};
|
||||
|
||||
static boarding_state m_state = BOARDING_STATE_IDLE;
|
||||
int ble_notify_boarding_state(boarding_state state){
|
||||
if(m_state == state){
|
||||
return 0;
|
||||
}
|
||||
m_state = state;
|
||||
uint8_t str_respone [32] = {0};
|
||||
memset(str_respone,0,sizeof(str_respone));
|
||||
switch (state)
|
||||
@ -444,6 +449,8 @@ static int32_t wifi_boarding_gatts_cb(bk_gatts_cb_event_t event, bk_gatt_if_t ga
|
||||
//<2F>ص<EFBFBD>
|
||||
if (s_ble_boarding_info && s_ble_boarding_info->set_wifi_cb)
|
||||
{
|
||||
//helloyifa
|
||||
be_set_smart_config_running();
|
||||
s_ble_boarding_info->set_wifi_cb(s_ble_boarding_info->ssid_value,s_ble_boarding_info->ssid_length,s_ble_boarding_info->password_value,s_ble_boarding_info->password_length);
|
||||
}
|
||||
}
|
||||
@ -523,6 +530,10 @@ static int32_t wifi_boarding_gatts_cb(bk_gatts_cb_event_t event, bk_gatt_if_t ga
|
||||
if (s_ble_boarding_info && s_ble_boarding_info->set_wifi_cb)
|
||||
{
|
||||
//(char* ssid, int ssid_len ,char* password,int password_len);
|
||||
//helloyifa
|
||||
be_set_smart_config_running();
|
||||
wboard_loge("^^^be_set_smart_config_running!!");
|
||||
|
||||
s_ble_boarding_info->set_wifi_cb(m_ssid,strlen(m_ssid),m_pwd,strlen(m_pwd));
|
||||
}
|
||||
|
||||
@ -646,6 +657,11 @@ static int32_t wifi_boarding_gatts_cb(bk_gatts_cb_event_t event, bk_gatt_if_t ga
|
||||
wifi_boarding_notify(str_respone, strlen((char *)&str_respone));
|
||||
}
|
||||
|
||||
else if(NULL != (ptr = strstr((char *)recv, "AT+RESET"))){
|
||||
extern int demo_erase_network_auto_reconnect_info();
|
||||
demo_erase_network_auto_reconnect_info();
|
||||
}
|
||||
|
||||
/**
|
||||
* 蓝牙控制助眠仪超时时间
|
||||
* 发送:AT+SLEEP_TIMEOUT=1 (0-30 分钟)
|
||||
@ -706,14 +722,10 @@ static int32_t wifi_boarding_gatts_cb(bk_gatts_cb_event_t event, bk_gatt_if_t ga
|
||||
wboard_loge("AT+VERSION!!");
|
||||
uint8_t str_respone[32] = {0};
|
||||
memset(str_respone, 0, sizeof(str_respone));
|
||||
char level[12] = {0};
|
||||
memset(level, 0, sizeof(level));
|
||||
sscanf((char *)recv, "AT+VERSION=%s", level);
|
||||
if (strcmp(level, "?") == 0)
|
||||
{
|
||||
sprintf((char *)str_respone, "AT+VERSION=%s", IOT_LAMP_DEVICE_VERSION);
|
||||
wifi_boarding_notify(str_respone, strlen((char *)&str_respone));
|
||||
}
|
||||
|
||||
sprintf((char *)str_respone, "AT+VERSION=%s", IOT_LAMP_DEVICE_VERSION);
|
||||
wifi_boarding_notify(str_respone, strlen((char *)&str_respone));
|
||||
|
||||
}
|
||||
|
||||
else if (NULL != (ptr = strstr((char *)recv, "AT+SOU_DEVICE")))
|
||||
|
@ -21,7 +21,7 @@ extern "C" {
|
||||
#define IOT_LAMP_DEVICE_GET_BATTERY "GetBattery"
|
||||
#define IOT_LAMP_DEVICE_OTA "ota"
|
||||
|
||||
#define IOT_LAMP_DEVICE_VERSION "1.0.6"
|
||||
#define IOT_LAMP_DEVICE_VERSION "1.0.7"
|
||||
|
||||
void lamp_init();
|
||||
void lamp_http_ota_start(char *url);
|
||||
|
@ -36,6 +36,8 @@
|
||||
#include "boarding_service.h"
|
||||
#include "components/bluetooth/bk_dm_bluetooth.h"
|
||||
|
||||
#include "wifi_boarding_utils.h"
|
||||
|
||||
#define TAG "bk_sconf"
|
||||
#define RCV_BUF_SIZE 256
|
||||
#define SEND_HEADER_SIZE 1024
|
||||
@ -587,43 +589,18 @@ int demo_network_auto_reconnect(bool val) // val true means from disconnect to r
|
||||
#if (CONFIG_EASY_FLASH && CONFIG_EASY_FLASH_V4)
|
||||
bk_get_env_enhance("d_network_id", (void *)&info, sizeof(BK_FAST_CONNECT_D));
|
||||
#endif
|
||||
/*0x01110001:sta, 0x01110010:softap, 0x01110100:pan*/
|
||||
if ((info.flag & 0x71l) == 0x71l)
|
||||
|
||||
BK_LOGE(TAG, "aaaaaaaaaaaaaaaa\n");
|
||||
if (val == false)
|
||||
{
|
||||
BK_LOGE(TAG, "aaaaaaaaaaaaaaaa\n");
|
||||
if (val == false)
|
||||
{
|
||||
network_reconnect_stop_timeout_check();
|
||||
network_reconnect_start_timeout_check(50); // 50s
|
||||
app_event_send_msg(APP_EVT_RECONNECT_NETWORK, 0);
|
||||
network_disc_evt_posted = 0;
|
||||
}
|
||||
BK_LOGE(TAG, "bbbbbbbbbbb\n");
|
||||
demo_sta_app_init((char *)info.sta_ssid, (char *)info.sta_pwd);
|
||||
return 0x71l;
|
||||
network_reconnect_stop_timeout_check();
|
||||
network_reconnect_start_timeout_check(50); // 50s
|
||||
app_event_send_msg(APP_EVT_RECONNECT_NETWORK, 0);
|
||||
network_disc_evt_posted = 0;
|
||||
}
|
||||
if ((info.flag & 0x72l) == 0x72l)
|
||||
{
|
||||
demo_softap_app_init((char *)info.ap_ssid, (char *)info.ap_pwd, NULL);
|
||||
return 0x72l;
|
||||
}
|
||||
BK_LOGE(TAG, "ccccccccccccc\n");
|
||||
#if CONFIG_NET_PAN
|
||||
if ((info.flag & 0x74l) == 0x74l)
|
||||
{
|
||||
if (val == false)
|
||||
{
|
||||
network_reconnect_stop_timeout_check();
|
||||
network_reconnect_start_timeout_check(50); // 50s
|
||||
app_event_send_msg(APP_EVT_RECONNECT_NETWORK, 0);
|
||||
network_disc_evt_posted = 0;
|
||||
}
|
||||
pan_service_init();
|
||||
bt_start_pan_reconnect();
|
||||
return 0x74l;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
BK_LOGE(TAG, "bbbbbbbbbbb\n");
|
||||
demo_sta_app_init((char *)info.sta_ssid, (char *)info.sta_pwd);
|
||||
return 0x71l;
|
||||
}
|
||||
|
||||
int demo_save_network_auto_restart_info(netif_if_t type, void *val)
|
||||
@ -632,16 +609,9 @@ int demo_save_network_auto_restart_info(netif_if_t type, void *val)
|
||||
BK_FAST_CONNECT_D info_tmp = {0};
|
||||
__maybe_unused wifi_ap_config_t *ap_config = NULL;
|
||||
__maybe_unused wifi_sta_config_t *sta_config = NULL;
|
||||
#if (CONFIG_EASY_FLASH && CONFIG_EASY_FLASH_V4)
|
||||
bk_get_env_enhance("d_network_id", (void *)&info_tmp, sizeof(BK_FAST_CONNECT_D));
|
||||
#endif
|
||||
if ((info_tmp.flag & 0xf0l) != 0x70l)
|
||||
{
|
||||
BK_LOGI(TAG, "erase network provisioning info, %x\r\n", info_tmp.flag);
|
||||
info_tmp.flag = 0x70l;
|
||||
}
|
||||
if (type == NETIF_IF_STA)
|
||||
{
|
||||
|
||||
//if (type == NETIF_IF_STA)
|
||||
//{
|
||||
info_tmp.flag |= 0x71l;
|
||||
sta_config = (wifi_sta_config_t *)val;
|
||||
os_memset((char *)info_tmp.sta_ssid, 0x0, 33);
|
||||
@ -649,27 +619,11 @@ int demo_save_network_auto_restart_info(netif_if_t type, void *val)
|
||||
os_strcpy((char *)info_tmp.sta_ssid, (char *)sta_config->ssid);
|
||||
os_strcpy((char *)info_tmp.sta_pwd, (char *)sta_config->password);
|
||||
BK_LOGE(TAG, "demo_save_network :%s %s\n",(char *)info_tmp.sta_ssid,(char *)info_tmp.sta_pwd);
|
||||
}
|
||||
else if (type == NETIF_IF_AP)
|
||||
{
|
||||
info_tmp.flag |= 0x72l;
|
||||
ap_config = (wifi_ap_config_t *)val;
|
||||
os_memset((char *)info_tmp.ap_ssid, 0x0, 33);
|
||||
os_memset((char *)info_tmp.ap_pwd, 0x0, 65);
|
||||
os_strcpy((char *)info_tmp.ap_ssid, (char *)ap_config->ssid);
|
||||
os_strcpy((char *)info_tmp.ap_pwd, (char *)ap_config->password);
|
||||
#if CONFIG_NET_PAN
|
||||
}
|
||||
else if (type == NETIF_IF_PAN)
|
||||
{
|
||||
info_tmp.flag |= 0x74l;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
#if (CONFIG_EASY_FLASH && CONFIG_EASY_FLASH_V4)
|
||||
bk_set_env_enhance("d_network_id", (const void *)&info_tmp, sizeof(BK_FAST_CONNECT_D));
|
||||
#endif
|
||||
//}
|
||||
|
||||
#if (CONFIG_EASY_FLASH && CONFIG_EASY_FLASH_V4)
|
||||
bk_set_env_enhance("d_network_id", (const void *)&info_tmp, sizeof(BK_FAST_CONNECT_D));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -751,11 +705,13 @@ static int bk_genie_sconf_netif_event_cb(void *arg, event_module_t event_module,
|
||||
network_disc_evt_posted = 0;
|
||||
got_ip = (netif_event_got_ip4_t *)event_data;
|
||||
BK_LOGE(TAG, "%s got ip %s.\n", got_ip->netif_if == NETIF_IF_STA ? "STA" : "BK PAN", got_ip->ip);
|
||||
|
||||
BK_LOGE(TAG, "***** smart_config_running:%d\n",smart_config_running);
|
||||
if (smart_config_running)
|
||||
{
|
||||
app_event_send_msg(APP_EVT_NETWORK_PROVISIONING_SUCCESS, 0);
|
||||
bk_wifi_sta_get_config(&sta_config);
|
||||
BK_LOGE(TAG, "22222222222222222\n");
|
||||
|
||||
demo_save_network_auto_restart_info(got_ip->netif_if, &sta_config);
|
||||
|
||||
msg.event = DBEVT_WIFI_STATION_CONNECTED;
|
||||
@ -836,7 +792,17 @@ static int bk_genie_sconf_wifi_event_cb(void *arg, event_module_t event_module,
|
||||
|
||||
case EVENT_WIFI_STA_DISCONNECTED:
|
||||
sta_disconnected = (wifi_event_sta_disconnected_t *)event_data;
|
||||
BK_LOGI(TAG, "STA disconnected, reason(%d)\n", sta_disconnected->disconnect_reason);
|
||||
BK_LOGE(TAG, "STA disconnected, reason(%d)\n", sta_disconnected->disconnect_reason);
|
||||
|
||||
//AP 不存在
|
||||
if(sta_disconnected->disconnect_reason == 257){
|
||||
ble_notify_boarding_state(BOARDING_STATE_AP_NOFOUND);
|
||||
}
|
||||
//密码错误
|
||||
if(sta_disconnected->disconnect_reason == 258 || sta_disconnected->disconnect_reason == WIFI_REASON_PREV_AUTH_NOT_VALID){
|
||||
ble_notify_boarding_state(BOARDING_STATE_PASSWORD_ERROR);
|
||||
}
|
||||
|
||||
/*drop local generated disconnect event by user*/
|
||||
if ((sta_disconnected->disconnect_reason == WIFI_REASON_DEAUTH_LEAVING &&
|
||||
sta_disconnected->local_generated == 1) ||
|
||||
|
@ -107,7 +107,7 @@ rtc_session *__get_beken_rtc(void)
|
||||
return beken_rtc;
|
||||
}
|
||||
|
||||
extern bool smart_config_running;
|
||||
//extern bool smart_config_running;
|
||||
extern uint32_t volume;
|
||||
extern uint32_t g_volume_gain[SPK_VOLUME_LEVEL];
|
||||
extern app_aud_para_t app_aud_cust_para;
|
||||
@ -550,7 +550,7 @@ void rtc_websocket_msg_handle(char *json_text, unsigned int size)
|
||||
g_connected_flag = true;
|
||||
network_reconnect_stop_timeout_check();
|
||||
app_event_send_msg(APP_EVT_AGENT_JOINED, 0);
|
||||
smart_config_running = false;
|
||||
//smart_config_running = false;
|
||||
__get_beken_rtc()->disconnecting_state = 0;
|
||||
|
||||
// 发送设备IOT能力描述到服务器
|
||||
@ -1005,6 +1005,7 @@ void beken_auto_run(void)
|
||||
// bk_genie_wakeup_agent();
|
||||
audio_en = true;
|
||||
video_en = false;
|
||||
/*
|
||||
int check_version = ota_check_version();
|
||||
if(check_version == BK_OK){
|
||||
LOGE("beken_auto_run check_version %d\n",check_version);
|
||||
@ -1012,7 +1013,7 @@ void beken_auto_run(void)
|
||||
LOGE("ota_has_activation_code %d\n",ota_has_activation_code());
|
||||
LOGE("ota_has_websocket_config %d\n",ota_has_websocket_config());
|
||||
}
|
||||
|
||||
*/
|
||||
//bk_https_ota_download("https://xiaozhi.xa-poka.com/xiaozhi/otaMag/download/59cc091e-eaf3-417d-a524-d5e3d95883f4");
|
||||
beken_rtc_start();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user