充电休眠 充电电量实时更新 代码优化
This commit is contained in:
parent
91bdc138d6
commit
c6697fc81e
Binary file not shown.
@ -97,6 +97,21 @@
|
||||
"unistd.h": "c",
|
||||
"time.h": "c",
|
||||
"types.h": "c",
|
||||
"rt_ota.h": "c"
|
||||
"rt_ota.h": "c",
|
||||
"sys_ctrl_pub.h": "c",
|
||||
"wlan_defs_pub.h": "c",
|
||||
"notifier_pub.h": "c",
|
||||
"flash_pub.h": "c",
|
||||
"str_pub.h": "c",
|
||||
"net.h": "c",
|
||||
"start_type_pub.h": "c",
|
||||
"kernel_mem.h": "c",
|
||||
"manual_ps_pub.h": "c",
|
||||
"sys_rtos.h": "c",
|
||||
"reg_mac_pl.h": "c",
|
||||
"force_ps_pub.h": "c",
|
||||
"generic.h": "c",
|
||||
"rtc_reg.h": "c",
|
||||
"rtc_reg_pub.h": "c"
|
||||
}
|
||||
}
|
@ -15,6 +15,8 @@
|
||||
#include "md5.h"
|
||||
#include "app_temperature.h"
|
||||
#include "app_voice_player.h"
|
||||
#include "BkDriverFlash.h"
|
||||
#include "manual_ps_pub.h"
|
||||
#ifdef PKG_USING_EASYFLASH
|
||||
#include "easyflash.h"
|
||||
|
||||
@ -38,6 +40,7 @@ static beken_timer_t timer_hall_detect;
|
||||
static beken_timer_t timer_poweroff;
|
||||
static beken_timer_t timer_bind;
|
||||
static beken_timer_t timer_idle;
|
||||
static beken_timer_t timer_battery_refresh ;
|
||||
|
||||
int start_bind_detect = 0;
|
||||
int hall_key_down_count = 0;
|
||||
@ -50,6 +53,7 @@ int hall_io_state = 0;
|
||||
static ADC_OBJ box_batt_adc;
|
||||
|
||||
static int box_battery_percent = -1;
|
||||
static int oled_is_on = 1; // 屏幕状态
|
||||
|
||||
uint16_t last_body_temp = 0;
|
||||
|
||||
@ -62,14 +66,21 @@ static RingQueue ring_queue;
|
||||
|
||||
extern mqtt_client client;
|
||||
|
||||
//WIFI账号密码
|
||||
//WIFI信息
|
||||
extern char last_ssid[33] ;
|
||||
extern char last_password[65];
|
||||
char last_bssid[65];
|
||||
char last_channel[65];
|
||||
char last_security[65];
|
||||
|
||||
network_InitTypeDef_adv_st adv_config;
|
||||
|
||||
//MQTT账号密码
|
||||
char mqtt_username[128];
|
||||
char mqtt_password[128];
|
||||
|
||||
extern char g_sta_mac[6];
|
||||
|
||||
/**
|
||||
* 当前绑定的设备
|
||||
*/
|
||||
@ -135,6 +146,7 @@ void temperature_adv_callback(recv_adv_t *r_ind)
|
||||
int ret = temperature_adv_get_name(r_ind,str_name);
|
||||
signed char rssi = (signed char)r_ind->rssi;
|
||||
|
||||
|
||||
if(ret){
|
||||
#if 0
|
||||
bk_printf("ble dev (%s): %02x:%02x:%02x:%02x:%02x:%02x,rssi:%d\r\n",str_name,r_ind->adv_addr[0], r_ind->adv_addr[1], r_ind->adv_addr[2],
|
||||
@ -145,12 +157,16 @@ void temperature_adv_callback(recv_adv_t *r_ind)
|
||||
//没有名称的 跳过!
|
||||
return;
|
||||
}
|
||||
//不等于 IT12 跳过!
|
||||
if(strstr(str_name,BLE_TEMPERATURE_DEVICE_IT12) == NULL){
|
||||
|
||||
//不等于 IT12 或 IT22 跳过!
|
||||
if(strstr(str_name,BLE_TEMPERATURE_DEVICE_IT12) == NULL && strstr(str_name,BLE_TEMPERATURE_DEVICE_IT22) == NULL){
|
||||
//bk_printf("%s\r\n",str_name);
|
||||
return;
|
||||
}
|
||||
|
||||
// if(str_name[0] != '\0') {
|
||||
// bk_printf("ble dev (%s): %02x:%02x:%02x:%02x:%02x:%02x,rssi:%d\r\n",str_name,r_ind->adv_addr[0], r_ind->adv_addr[1], r_ind->adv_addr[2],
|
||||
// r_ind->adv_addr[3], r_ind->adv_addr[4], r_ind->adv_addr[5],rssi);
|
||||
// }
|
||||
#if 1
|
||||
bk_printf("\r\n");
|
||||
bk_printf("ble dev (%s): %02x:%02x:%02x:%02x:%02x:%02x,rssi:%d\r\n",str_name,r_ind->adv_addr[0], r_ind->adv_addr[1], r_ind->adv_addr[2],
|
||||
@ -230,13 +246,20 @@ void temperature_adv_callback(recv_adv_t *r_ind)
|
||||
uint16_t obj = (data_ptr[3] & 0xff) | (((data_ptr[2] & 0xff) << 8));
|
||||
uint16_t env = (data_ptr[5] & 0xff) | (((data_ptr[4] & 0xff) << 8));
|
||||
uint16_t batt = data_ptr[6] & 0xff;
|
||||
uint16_t batt_val = (data_ptr[8] & 0xff) | (((data_ptr[7] & 0xff) << 8));
|
||||
|
||||
if(body <= 20 && obj ==0 && env ==0 && batt == 0){
|
||||
bk_printf("error data ...\r\n");
|
||||
return ;
|
||||
}
|
||||
|
||||
temperature_info.temperature_body = body;
|
||||
temperature_info.temperature_obj = obj;
|
||||
temperature_info.temperature_env = env;
|
||||
temperature_info.batt_val = batt;
|
||||
temperature_info.batt_percent = batt;
|
||||
temperature_info.batt_val = batt_val;
|
||||
|
||||
bk_printf("temp-> body : %d obj : %d env : %d batt : %d\r\n", body, obj, env, batt);
|
||||
bk_printf("temp-> body : %d obj : %d env : %d batt : %d batt_val : %d\r\n", body, obj, env, batt, batt_val);
|
||||
break;
|
||||
// 其他需要的类型可以继续添加
|
||||
default:
|
||||
@ -263,9 +286,9 @@ void temperature_adv_callback(recv_adv_t *r_ind)
|
||||
//如果当前温度和之前相同 不刷新温度
|
||||
uint16_t temp_body = temperature_info.temperature_body;
|
||||
|
||||
if(temp_body < 20){ //异常温度值
|
||||
bk_printf("temp_body == 0 \r\n");
|
||||
return;
|
||||
//判断温度是否在规定范围
|
||||
if(temp_body < BLE_TEMPERATURE_MIN || temp_body > BLE_TEMPERATURE_MAX){
|
||||
return;
|
||||
}
|
||||
|
||||
// if(last_body_temp == temp_body){
|
||||
@ -298,12 +321,6 @@ void temperature_adv_callback(recv_adv_t *r_ind)
|
||||
}
|
||||
int mean_value = sum / MAX_SIZE;
|
||||
bk_printf("mean_value:%d \r\n", mean_value);
|
||||
|
||||
|
||||
//判断温度是否在规定范围
|
||||
//if(mean_value < BLE_TEMPERATURE_LIMIT_MIN || mean_value > BLE_TEMPERATURE_LIMIT_MAX){
|
||||
// return;
|
||||
//}
|
||||
|
||||
//计算方差
|
||||
double sumOfSquares = 0;
|
||||
@ -329,11 +346,9 @@ void temperature_adv_callback(recv_adv_t *r_ind)
|
||||
}else{
|
||||
//connect_mqtt();
|
||||
bk_printf("mqtt not connected \r\n");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//MQTT上传温度
|
||||
@ -344,13 +359,18 @@ void mqtt_upload_temperature(uint16_t t_value){
|
||||
// uint16_t z = t_value/10%10 ;//小数位
|
||||
char msg[128];
|
||||
char *topic_properties =(char *)os_malloc(128);
|
||||
char device_id [64];
|
||||
rt_memset(device_id,0,sizeof(device_id));
|
||||
rt_sprintf(device_id,"%s_%02X%02X%02X%02X%02X%02X",
|
||||
PRODUCTID,g_sta_mac[0],g_sta_mac[1],g_sta_mac[2],g_sta_mac[3],g_sta_mac[4],g_sta_mac[5]);
|
||||
|
||||
os_memset(topic_properties,0,128);
|
||||
rt_sprintf(topic_properties, "/%s/%s/properties/report", PRODUCTID, DEVICEID);
|
||||
rt_sprintf(topic_properties, "/%s/%s/properties/report", PRODUCTID, device_id);
|
||||
|
||||
rt_sprintf(msg, "{\"properties\": {\"temperature\":%d}}", xy);
|
||||
paho_mqtt_publish(&client, QOS1, topic_properties, msg, strlen(msg));
|
||||
bk_printf("MQTT publish: %s\n", msg);
|
||||
bk_printf("device_id: %s\n", device_id);
|
||||
os_free(topic_properties);
|
||||
}
|
||||
|
||||
@ -365,7 +385,6 @@ UINT32 usb_power_is_pluged(void)
|
||||
void timer_check_device_run_callback(void *arg){
|
||||
|
||||
uint16_t reg_charge = CHARGE_REG0X2_CHARGE_X_STA_GET(0);
|
||||
//rt_kprintf("charge status: %d\r\n", reg_charge);
|
||||
//未接入充电 5376 接入充电 38144
|
||||
if(reg_charge == 5376){
|
||||
box_info.charge_state = 0;
|
||||
@ -376,20 +395,18 @@ void timer_check_device_run_callback(void *arg){
|
||||
rt_kprintf("usb_power_is_pluged reg:%d state:%d\r\n", reg_charge, box_info.charge_state);
|
||||
|
||||
//合盖状态接入充电 ---> 关机
|
||||
if (box_info.hall_state == 0)
|
||||
{
|
||||
if (box_info.charge_state)
|
||||
{
|
||||
// 接入充电 并且合盖 执行关机
|
||||
rtos_stop_timer(&timer_poweroff);
|
||||
//延迟关机
|
||||
//启动定时3秒关机
|
||||
rtos_start_timer(&timer_poweroff);
|
||||
}
|
||||
}
|
||||
// if (box_info.hall_state == 0)
|
||||
// {
|
||||
// if (box_info.charge_state){
|
||||
// // 接入充电 并且合盖 执行关机
|
||||
// rtos_stop_timer(&timer_poweroff);
|
||||
// //延迟关机
|
||||
// //启动定时3秒关机
|
||||
// rtos_start_timer(&timer_poweroff);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 显示 ... 表示等待
|
||||
*/
|
||||
@ -437,7 +454,6 @@ static void app_temperature_ui_wait_entry(void *parameter)
|
||||
|
||||
}
|
||||
|
||||
|
||||
void app_show_box_battery(){
|
||||
rt_kprintf("UI->app_show_box_battery\r\n");
|
||||
OLED_Clear();
|
||||
@ -458,6 +474,81 @@ void app_show_box_battery(){
|
||||
OLED_Refresh();
|
||||
}
|
||||
|
||||
/****channel 1 - 7***/
|
||||
static void box_adc_detect_callback(int new_mv, void *user_data)
|
||||
{
|
||||
static int cnt = 0;
|
||||
box_batt_adc.user_data = (void*)new_mv;
|
||||
if(cnt++ >= 20){
|
||||
cnt = 0;
|
||||
rt_kprintf("adc channel%d voltage:%d,%x\r\n",box_batt_adc.channel,new_mv,box_batt_adc.user_data);
|
||||
int bat_volt = new_mv*2;
|
||||
//int batt_min = 3300; //3300
|
||||
int batt_max = 4200;
|
||||
if(box_info.charge_state){
|
||||
bat_volt -= 48 ;
|
||||
}
|
||||
rt_kprintf("battery_calc --> bat_volt:%d\n",bat_volt);
|
||||
if(bat_volt >= batt_max)
|
||||
box_battery_percent = 100;
|
||||
else if(bat_volt >= 4100)
|
||||
box_battery_percent = 90 + (bat_volt - 4100) * 10 / 100; // 4100~4200
|
||||
else if(bat_volt >= 3900)
|
||||
box_battery_percent = 60 + (bat_volt - 3900) * 30 / 200; // 3900~4100
|
||||
else if(bat_volt >= 3700)
|
||||
box_battery_percent = 30 + (bat_volt - 3700) * 30 / 200; // 3700~3900
|
||||
else if(bat_volt >= 3500)
|
||||
box_battery_percent = 10 + (bat_volt - 3500) * 20 / 200; // 3500~3700
|
||||
else if(bat_volt >= 3300)
|
||||
box_battery_percent = (bat_volt - 3300) * 10 / 200; // 3300~3500
|
||||
else
|
||||
box_battery_percent = 1;
|
||||
|
||||
// if (bat_volt < batt_min) {
|
||||
// box_battery_percent=0;
|
||||
// } else if (bat_volt > batt_max) {
|
||||
// box_battery_percent= 100;
|
||||
// } else {
|
||||
// box_battery_percent= ((float)(bat_volt - batt_min) / (batt_max - batt_min)) * 100;
|
||||
// printf("battery_calc @@@ --> percent:%d\n",box_battery_percent);
|
||||
// }
|
||||
// if(box_battery_percent < 0){
|
||||
// box_battery_percent = 0;
|
||||
// }
|
||||
rt_kprintf("battery_calc --> percent:%d\n",box_battery_percent);
|
||||
adc_obj_stop(&box_batt_adc);
|
||||
}
|
||||
}
|
||||
|
||||
void box_init_power(){
|
||||
int channel;
|
||||
int retry = 0;
|
||||
channel = 7;
|
||||
saradc_work_create();
|
||||
adc_obj_init(&box_batt_adc, box_adc_detect_callback, channel, &box_batt_adc);
|
||||
adc_obj_start(&box_batt_adc);
|
||||
rt_thread_mdelay(500);
|
||||
|
||||
while(1){
|
||||
if(box_battery_percent > 0){
|
||||
break;
|
||||
}
|
||||
rt_thread_mdelay(20);
|
||||
if(++retry > 20) break;
|
||||
}
|
||||
}
|
||||
// 定时检测电量并刷新显示
|
||||
void timer_battery_refresh_callback(void *arg)
|
||||
{
|
||||
rt_kprintf("Update power...\r\n");
|
||||
// 重新采样电池电压
|
||||
adc_obj_start(&box_batt_adc);
|
||||
// 重新显示电量
|
||||
if(app_mode == UI_BOX_BATTERY || app_mode == UI_SHOW_MEMORY_INFO)
|
||||
{
|
||||
app_show_box_battery();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 显示最近一次检测的温度
|
||||
*/
|
||||
@ -470,7 +561,7 @@ void app_show_memory_detect_info(){
|
||||
rt_kprintf("no record\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
rtos_stop_timer(&timer_battery_refresh);
|
||||
OLED_Clear();
|
||||
OLED_ShowString(2,1,(u8 *)"M1",16,1);
|
||||
char str_temp[12]={0};
|
||||
@ -507,11 +598,11 @@ void app_show_temperature_device_info(){
|
||||
extern unsigned char f40x20_box_batt[];
|
||||
OLED_ShowPicture(0,23,40,20,(u8 *)&f40x20_box_batt,1);
|
||||
char str_batt[16]={0};
|
||||
rt_sprintf(str_batt,":%d%",temperature_info.batt_val);
|
||||
rt_sprintf(str_batt,":%d%",temperature_info.batt_percent);
|
||||
OLED_ShowString(35,25,(u8 *)str_batt,16,1);
|
||||
OLED_Refresh();
|
||||
rt_thread_mdelay(2000);
|
||||
if(temperature_info.batt_val < 20){
|
||||
if(temperature_info.batt_val < 365){ //电压值小于365显示“低电”
|
||||
app_enter_ui(UI_SHOW_LOW_BAT_INFO);
|
||||
}
|
||||
}
|
||||
@ -521,7 +612,7 @@ void app_show_temperature_device_info(){
|
||||
void app_show_wait_temperature(){
|
||||
rt_kprintf("UI->app_show_wait_temperature\r\n");
|
||||
if(tid_show_wait_temp){
|
||||
rt_thread_detach(tid_show_wait_temp);
|
||||
rt_thread_delete(tid_show_wait_temp);
|
||||
tid_show_wait_temp = NULL;
|
||||
}
|
||||
tid_show_wait_temp = rt_thread_create("wait_temp",app_temperature_ui_wait_entry,RT_NULL,1024 * 8,21,10);
|
||||
@ -603,21 +694,23 @@ static void app_temperature_ui_detect_entry(void *parameter)
|
||||
*/
|
||||
void app_show_detect_temperature(){
|
||||
rt_kprintf("UI->app_show_detect_temperature\r\n");
|
||||
OLED_Clear();
|
||||
//退出正在进行的动画线程
|
||||
if(tid_show_wait_temp){
|
||||
rt_thread_detach(tid_show_wait_temp);
|
||||
rt_thread_delete(tid_show_wait_temp);
|
||||
tid_show_wait_temp = NULL;
|
||||
}
|
||||
|
||||
//退出正在进行测温的动画线程
|
||||
if(tid_show_detect_temp){
|
||||
rt_thread_detach(tid_show_detect_temp);
|
||||
rt_thread_delete(tid_show_detect_temp);
|
||||
tid_show_detect_temp = NULL;
|
||||
}
|
||||
|
||||
tid_show_detect_temp = rt_thread_create("do_detect",app_temperature_ui_detect_entry,RT_NULL,1024 * 8,21,10);
|
||||
if (tid_show_detect_temp)
|
||||
rt_thread_startup(tid_show_detect_temp);
|
||||
rt_kprintf("startup success\r\n");
|
||||
}
|
||||
|
||||
void app_ui_show_bind(){
|
||||
@ -668,12 +761,22 @@ void app_ui_show_temperautre(){
|
||||
}
|
||||
OLED_Refresh();
|
||||
}
|
||||
|
||||
rt_mutex_t app_mode_mutex;
|
||||
void app_enter_ui(app_ui_mode mode){
|
||||
rt_kprintf("app_mode:%d\r\n",mode);
|
||||
rt_mutex_take(app_mode_mutex, RT_WAITING_FOREVER);
|
||||
if(app_mode == mode){
|
||||
return;
|
||||
rt_mutex_release(app_mode_mutex);
|
||||
return;
|
||||
}
|
||||
if(mode != UI_BOX_BATTERY && mode != UI_SHOW_MEMORY_INFO)
|
||||
{
|
||||
rt_kprintf("stop_timer\r\n");
|
||||
rtos_stop_timer(&timer_battery_refresh);
|
||||
}
|
||||
app_mode = mode;
|
||||
rt_mutex_release(app_mode_mutex);
|
||||
|
||||
//等待其它页面线程退出
|
||||
rt_thread_mdelay(50);
|
||||
if(tid_show_wait_temp){
|
||||
@ -682,7 +785,7 @@ void app_enter_ui(app_ui_mode mode){
|
||||
}
|
||||
//退出正在进行测温的动画线程
|
||||
if(tid_show_detect_temp){
|
||||
rt_thread_detach(tid_show_detect_temp);
|
||||
rt_thread_delete(tid_show_detect_temp);
|
||||
tid_show_detect_temp = NULL;
|
||||
}
|
||||
|
||||
@ -690,7 +793,14 @@ void app_enter_ui(app_ui_mode mode){
|
||||
{
|
||||
case UI_BOX_BATTERY:
|
||||
app_show_box_battery();
|
||||
//app_show_do_detect_temperature();
|
||||
//static int battery_timer_inited = 0;
|
||||
if(box_info.charge_state)
|
||||
{
|
||||
rtos_init_timer(&timer_battery_refresh, 10000, timer_battery_refresh_callback, NULL);
|
||||
rtos_start_timer(&timer_battery_refresh);
|
||||
// battery_timer_inited = 1;
|
||||
}
|
||||
|
||||
break;
|
||||
case UI_SHOW_DEVICE_INFO:
|
||||
app_show_temperature_device_info();
|
||||
@ -757,7 +867,7 @@ void temperature_read_record(app_detect_record_t *record){
|
||||
rt_kprintf("temperature_read_record error\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
void wifi_init();
|
||||
void box_show_ble_device_info(app_temperature_info_t *temperature_info){
|
||||
OLED_Clear();
|
||||
//OLED_ShowString(0+5,0+5,(u8 *)"BIND",32,1);
|
||||
@ -765,11 +875,57 @@ void box_show_ble_device_info(app_temperature_info_t *temperature_info){
|
||||
OLED_ShowString(22,0+5,(u8 *)"30%",24,1);
|
||||
rt_thread_mdelay(1500);
|
||||
}
|
||||
|
||||
|
||||
//充电合盖关闭外设
|
||||
void charge_sleep_on(int on) {
|
||||
if (oled_is_on != on) {
|
||||
oled_is_on = on;
|
||||
if (on){
|
||||
OLED_DisPlay_On();
|
||||
voice_player_mute(1);
|
||||
wifi_init();
|
||||
belon_ble_scan_start();
|
||||
rt_thread_mdelay(100);
|
||||
belon_ble_start_adv();
|
||||
}else{
|
||||
OLED_DisPlay_Off();//屏幕
|
||||
voice_player_mute(0); //声音
|
||||
bk_wlan_stop(BK_STATION); //WIFI
|
||||
belon_ble_scan_stop(); //蓝牙扫描
|
||||
belon_ble_deinit_adv(); //蓝牙广播
|
||||
}
|
||||
}
|
||||
}
|
||||
void deep_sleep(){
|
||||
rt_kprintf("box enter deep sleep!!!\r\n");
|
||||
voice_player_mute(0);
|
||||
PS_DEEP_CTRL_PARAM deep_sleep_param;
|
||||
rt_memset(&deep_sleep_param, 0, sizeof(deep_sleep_param));
|
||||
|
||||
deep_sleep_param.wake_up_way = 1;
|
||||
deep_sleep_param.gpio_index_map = 0;
|
||||
deep_sleep_param.gpio_edge_map = 0;
|
||||
deep_sleep_param.gpio_last_index_map = (1 << (BLE_TEMPERATURE_HALL_DETECT_PIN - 32)); // 38号GPIO
|
||||
deep_sleep_param.gpio_last_edge_map = 0;
|
||||
deep_sleep_param.gpio_stay_lo_map = 0;
|
||||
deep_sleep_param.gpio_stay_hi_map = 0;
|
||||
deep_sleep_param.sleep_time = 0;
|
||||
deep_sleep_param.lpo_32k_src = 0;
|
||||
deep_sleep_param.sleep_mode = 0; // 0=深度睡眠 1=低压睡眠
|
||||
deep_sleep_param.gpio_last_edge_sel_map = 0;
|
||||
bk_enter_deep_sleep_mode(&deep_sleep_param); //深度睡眠
|
||||
//bk_wlan_instant_lowvol_sleep(&deep_sleep_param); //低压睡眠--会死机
|
||||
}
|
||||
void box_poweroff_timeout_callback(void *arg){
|
||||
rtos_stop_timer(&timer_poweroff);
|
||||
//paho_mqtt_stop(&client);
|
||||
if (box_info.charge_state) {
|
||||
oled_is_on = 0;
|
||||
OLED_DisPlay_Off();
|
||||
voice_player_mute(0);
|
||||
//deep_sleep();
|
||||
//charge_sleep_on(0);
|
||||
//return;
|
||||
}
|
||||
bk_gpio_config_output(BLE_TEMPERATURE_BOX_POWER_CTR);
|
||||
bk_gpio_output(BLE_TEMPERATURE_BOX_POWER_CTR,0);
|
||||
rt_kprintf("box poweroff !!!\r\n");
|
||||
@ -830,7 +986,7 @@ void timer_app_idle_callback(void *arg){
|
||||
* 进入绑定模式后检测接收到的最强一个测温信号设备绑定
|
||||
*/
|
||||
void timer_hall_detect_callback(void *arg){
|
||||
int hall = bk_gpio_input(38);
|
||||
int hall = bk_gpio_input(BLE_TEMPERATURE_HALL_DETECT_PIN);
|
||||
//rt_kprintf("hall -> %d\r\n",hall);
|
||||
if(hall_io_state == hall){
|
||||
return;
|
||||
@ -864,12 +1020,16 @@ void timer_hall_detect_callback(void *arg){
|
||||
//启动定时3秒关机
|
||||
rtos_start_timer(&timer_poweroff);
|
||||
}else{
|
||||
//如果启动定时开机后 检测到开盖,则取消开机
|
||||
//如果启动定时关机后 检测到开盖,则取消关机
|
||||
if(rtos_is_timer_running(&timer_poweroff)){
|
||||
//rt_kprintf("stop poweroff timeout !!!\r\n");
|
||||
rtos_stop_timer(&timer_poweroff);
|
||||
}
|
||||
|
||||
if(!oled_is_on){ //充电时开盖复位设备
|
||||
bk_reboot();
|
||||
//rt_thread_mdelay(3000);
|
||||
//charge_sleep_on(1);
|
||||
}
|
||||
// 只有在5秒内且开关盖次数达到5才进入绑定
|
||||
if(start_bind_detect && hall_key_down_count == 5 && (now_tick - hall_first_down_tick <= HALL_BIND_WINDOW_MS)){
|
||||
rt_kprintf("enter bind !!!\r\n");
|
||||
@ -903,7 +1063,7 @@ void box_switch_irq_callback(unsigned char ucChannel)
|
||||
{
|
||||
rt_kprintf("Interrupt triggered!\n");
|
||||
// 这里可以添加更多的处理逻辑
|
||||
int hall = bk_gpio_input(38);
|
||||
int hall = bk_gpio_input(BLE_TEMPERATURE_HALL_DETECT_PIN);
|
||||
rt_kprintf("hall -> %d\r\n",hall);
|
||||
}
|
||||
|
||||
@ -913,7 +1073,7 @@ int box_switch_init(void)
|
||||
bk_gpio_config_output(39);
|
||||
bk_gpio_output(39,1);
|
||||
|
||||
bk_gpio_config_input(38);
|
||||
bk_gpio_config_input(BLE_TEMPERATURE_HALL_DETECT_PIN);
|
||||
|
||||
//启动中断失败
|
||||
//gpio_int_enable(38,GMODE_INPUT_PULLDOWN,box_switch_irq_callback);
|
||||
@ -942,53 +1102,11 @@ void temperature_dev_config_init(){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****channel 1 - 7***/
|
||||
static void box_adc_detect_callback(int new_mv, void *user_data)
|
||||
{
|
||||
static int cnt = 0;
|
||||
box_batt_adc.user_data = (void*)new_mv;
|
||||
if(cnt++ >= 20)
|
||||
{
|
||||
cnt = 0;
|
||||
rt_kprintf("adc channel%d voltage:%d,%x\r\n",box_batt_adc.channel,new_mv,box_batt_adc.user_data);
|
||||
int bat_volt = new_mv*2;
|
||||
int batt_min = 2500; //3300
|
||||
int batt_max = 4200;
|
||||
rt_kprintf("battery_calc --> bat_volt:%d\n",bat_volt);
|
||||
if (bat_volt < batt_min) {
|
||||
box_battery_percent=0;
|
||||
} else if (bat_volt > batt_max) {
|
||||
box_battery_percent= 100;
|
||||
} else {
|
||||
box_battery_percent= ((float)(bat_volt - batt_min) / (batt_max - batt_min)) * 100;
|
||||
printf("battery_calc @@@ --> percent:%d\n",box_battery_percent);
|
||||
}
|
||||
if(box_battery_percent < 0){
|
||||
box_battery_percent = 0;
|
||||
}
|
||||
rt_kprintf("battery_calc --> percent:%d\n",box_battery_percent);
|
||||
adc_obj_stop(&box_batt_adc);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void box_init_power(){
|
||||
int channel;
|
||||
channel = 7;
|
||||
saradc_work_create();
|
||||
adc_obj_init(&box_batt_adc, box_adc_detect_callback, channel, &box_batt_adc);
|
||||
adc_obj_start(&box_batt_adc);
|
||||
|
||||
}
|
||||
static void charger_module_enable(UINT32 enable)
|
||||
{
|
||||
sctrl_analog_set(SCTRL_ANALOG_CTRL4, (sctrl_analog_get(SCTRL_ANALOG_CTRL4) & ~(1 << 12)) | (!!enable << 12));
|
||||
}
|
||||
|
||||
void temperature_led_ble(bool onoff){
|
||||
//GPIO1
|
||||
if(onoff){
|
||||
@ -1031,10 +1149,16 @@ void connnect_wifi(char *oob_ssid,char *connect_key){//连接wifi
|
||||
//rt_thread_mdelay(5000);
|
||||
}
|
||||
|
||||
// 读取最新联网记录
|
||||
void wifi_read_ssid_pass(char *ssid, size_t ssid_len, char *password, size_t pass_len){
|
||||
// 读取最新联网信息
|
||||
void wifi_read_info(char *ssid, size_t ssid_len, char *password, size_t pass_len,
|
||||
char *bssid, size_t bssid_len, char *channel, size_t channel_len, char *security, size_t security_len){
|
||||
|
||||
char *t_ssid = ef_get_env(BLE_WIFI_FLASH_KEY_SSID);
|
||||
char *t_pass = ef_get_env(BLE_WIFI_FLASH_KEY_PASS);
|
||||
char *t_bssid = ef_get_env(BLE_WIFI_FLASH_KEY_BSSID);
|
||||
char *t_channel = ef_get_env(BLE_WIFI_FLASH_KEY_CHANNEL);
|
||||
char *t_security = ef_get_env(BLE_WIFI_FLASH_KEY_SECURITY);
|
||||
|
||||
if(t_ssid) {
|
||||
strncpy(last_ssid, t_ssid, ssid_len - 1);
|
||||
last_ssid[ssid_len - 1] = '\0';
|
||||
@ -1042,20 +1166,122 @@ void wifi_read_ssid_pass(char *ssid, size_t ssid_len, char *password, size_t pas
|
||||
if(t_pass) {
|
||||
strncpy(last_password, t_pass, pass_len - 1);
|
||||
last_password[pass_len - 1] = '\0';
|
||||
}
|
||||
if (t_bssid) {
|
||||
strncpy(bssid, t_bssid, bssid_len - 1);
|
||||
bssid[bssid_len - 1] = '\0';
|
||||
}
|
||||
if (t_channel) {
|
||||
strncpy(channel, t_channel, channel_len - 1);
|
||||
channel[channel_len - 1] = '\0';
|
||||
}
|
||||
if (t_security) {
|
||||
strncpy(security, t_security, security_len - 1);
|
||||
security[security_len - 1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
//将flash存储的mac地址字符串转换为二进制格式
|
||||
void mac_string_to_binary(const char *mac_str, uint8_t *mac_bin) {
|
||||
if (!mac_str || !mac_bin) return;
|
||||
|
||||
char temp[18];
|
||||
strncpy(temp, mac_str, sizeof(temp)-1);
|
||||
temp[sizeof(temp)-1] = '\0';
|
||||
|
||||
for (int i = 0; temp[i]; i++) {
|
||||
temp[i] = toupper(temp[i]);
|
||||
}
|
||||
|
||||
char *p = temp;
|
||||
char *end = temp + strlen(temp);
|
||||
while (p < end) {
|
||||
if (*p == ':' || *p == '-') {
|
||||
memmove(p, p+1, end - p);
|
||||
end--;
|
||||
} else {
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen(temp) != 12) {
|
||||
bk_printf("Invalid MAC length: %d\n", strlen(temp));
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
char byte_str[3] = { temp[i*2], temp[i*2+1], '\0' };
|
||||
char *endptr;
|
||||
mac_bin[i] = (uint8_t)strtol(byte_str, &endptr, 16);
|
||||
|
||||
if (*endptr != '\0') {
|
||||
bk_printf("MAC conversion error at position %d\n", i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//int fast_connect_try = 0;
|
||||
//快速连接
|
||||
void fast_connect_wifi(){
|
||||
// 检查是否有效
|
||||
// if (fci.ssid[0] != 0 && strlen((char*)fci.ssid) < 32) {
|
||||
uint8_t mac_bin[6] ={0};
|
||||
int sec_value = atoi(last_security);
|
||||
|
||||
memset(&adv_config, 0, sizeof(adv_config));
|
||||
strncpy(adv_config.ap_info.ssid, last_ssid, sizeof(adv_config.ap_info.ssid));
|
||||
adv_config.ap_info.ssid[sizeof(adv_config.ap_info.ssid)-1] = '\0';
|
||||
|
||||
mac_string_to_binary(last_bssid, mac_bin);
|
||||
memcpy(adv_config.ap_info.bssid, mac_bin, 6);
|
||||
|
||||
adv_config.ap_info.channel = (uint8_t)atoi(last_channel);
|
||||
|
||||
if (sec_value >= BK_SECURITY_TYPE_NONE && sec_value <= BK_SECURITY_TYPE_AUTO) {
|
||||
adv_config.ap_info.security = (wlan_sec_type_t)sec_value;
|
||||
} else {
|
||||
adv_config.ap_info.security = BK_SECURITY_TYPE_AUTO;
|
||||
}
|
||||
|
||||
strncpy(adv_config.key, last_password, sizeof(adv_config.key));
|
||||
adv_config.key[sizeof(adv_config.key)-1] = '\0';
|
||||
adv_config.key_len = strlen(last_password);
|
||||
adv_config.dhcp_mode = DHCP_CLIENT;
|
||||
|
||||
bk_printf(" SSID: %s\n", adv_config.ap_info.ssid);
|
||||
bk_printf(" BSSID: %02X:%02X:%02X:%02X:%02X:%02X\n",
|
||||
adv_config.ap_info.bssid[0], adv_config.ap_info.bssid[1],
|
||||
adv_config.ap_info.bssid[2], adv_config.ap_info.bssid[3],
|
||||
adv_config.ap_info.bssid[4], adv_config.ap_info.bssid[5]);
|
||||
bk_printf(" Channel: %d\n", adv_config.ap_info.channel);
|
||||
bk_printf(" Security: %d\n", adv_config.ap_info.security);
|
||||
|
||||
bk_wlan_start_sta_adv(&adv_config);
|
||||
// } else {
|
||||
// fast_connect_try = 0;
|
||||
// //fast_connect_failed = 1;
|
||||
// bk_printf("No fast connect info, fallback to normal connect\n");
|
||||
// // 调用普通连接流程
|
||||
// }
|
||||
}
|
||||
|
||||
//wifi初始化连接
|
||||
void wifi_init(){
|
||||
wifi_read_ssid_pass(last_ssid, sizeof(last_ssid), last_password, sizeof(last_password));
|
||||
if(last_ssid[0] != '\0' && last_password[0] != '\0') {
|
||||
wifi_read_info(last_ssid, sizeof(last_ssid), last_password, sizeof(last_password),
|
||||
last_bssid, sizeof(last_bssid), last_channel, sizeof(last_channel), last_security, sizeof(last_security));
|
||||
|
||||
//fast_connect_wifi();
|
||||
|
||||
if(last_ssid[0] != '\0' && last_password[0] != '\0') {
|
||||
bk_printf("Auto connect WiFi: SSID=%s, PASSWORD=%s\r\n", last_ssid, last_password);
|
||||
bk_printf("BSSID: %s\n", last_bssid);
|
||||
bk_printf("Channel: %s\n", last_channel);
|
||||
bk_printf("Security: %s\n", last_security);
|
||||
connnect_wifi(last_ssid, last_password);
|
||||
}else{
|
||||
bk_printf("NOT WiFi INFO\r\n");
|
||||
}
|
||||
}
|
||||
//volatile time_t g_ntp_time = 0;
|
||||
|
||||
|
||||
void poka_client_username(time_t now){
|
||||
rt_tick_t tick = rt_tick_get();
|
||||
@ -1071,7 +1297,6 @@ void poka_client_password(){
|
||||
|
||||
// 拼接 username 和 SECUREKEY_MQTT
|
||||
snprintf(input, sizeof(input), "%s|%s", mqtt_username, SECUREKEY_MQTT);
|
||||
bk_printf("input=%s\r\n", input);
|
||||
MD5_CTX ctx;
|
||||
MMD5Init(&ctx);
|
||||
MMD5Update(&ctx, (unsigned char *)input, strlen(input));
|
||||
@ -1097,20 +1322,29 @@ void temperature_init(void){
|
||||
// 查询绑定设备
|
||||
//uint8_t test_device_mac[6] = {0xe5, 0xe6, 0xb6, 0x09, 0x28, 0x37};
|
||||
//rt_memcmp(dev_info.bind_mac, test_device_mac, sizeof(test_device_mac));
|
||||
box_init_power();
|
||||
//初始化GPIO
|
||||
gpio_init();
|
||||
//初始化OLED显示屏
|
||||
OLED_Init();
|
||||
//初始化互斥锁
|
||||
app_mode_mutex = rt_mutex_create("app_mode_lock", RT_IPC_FLAG_FIFO);
|
||||
//初始化HALL按键检测
|
||||
box_switch_init();
|
||||
|
||||
timer_check_device_run_callback(NULL);
|
||||
|
||||
//霍尔检测 50ms一次 中断不好使 先这样处理
|
||||
rtos_init_timer(&timer_hall_detect, BLE_TEMPERATURE_HALL_DETECT_INTERVAL, timer_hall_detect_callback, NULL);
|
||||
rtos_start_timer(&timer_hall_detect);
|
||||
rtos_init_timer(&timer_poweroff, BLE_TEMPERATURE_POWEROFF_TIMEOUT, box_poweroff_timeout_callback, NULL);
|
||||
rtos_init_timer(&timer_bind, BLE_TEMPERATURE_BIND_MODE_TIMEOUT, box_bind_timeout_callback, NULL);
|
||||
rtos_init_timer(&timer_idle, BLE_TEMPERATURE_IDLE_MODE_TIMEOUT, timer_app_idle_callback, NULL);
|
||||
//初始化电量
|
||||
box_init_power();
|
||||
// user_app_start();
|
||||
rt_thread_mdelay(500);
|
||||
while(1){
|
||||
if(box_battery_percent >= 0){
|
||||
break;
|
||||
}
|
||||
rt_thread_mdelay(20);
|
||||
}
|
||||
|
||||
app_enter_ui(UI_BOX_BATTERY);
|
||||
|
||||
rt_thread_mdelay(2000);
|
||||
easyflash_init();
|
||||
ef_print_env();
|
||||
@ -1126,7 +1360,7 @@ void temperature_init(void){
|
||||
//注册WIFI回调
|
||||
bk_wlan_status_register_cb(wifi_status_cb);
|
||||
//自动联网
|
||||
wifi_init();
|
||||
//wifi_init();
|
||||
|
||||
//初始化BLE
|
||||
belon_ble_active();
|
||||
@ -1140,16 +1374,6 @@ void temperature_init(void){
|
||||
rtos_init_timer(&timer_detect, BLE_TEMPERATURE_DETECT_DEVICE_INTERVAL, timer_check_device_run_callback, NULL);
|
||||
rtos_start_timer(&timer_detect);
|
||||
|
||||
//初始化HALL按键检测
|
||||
box_switch_init();
|
||||
//霍尔检测 50ms一次 中断不好使 先这样处理
|
||||
rtos_init_timer(&timer_hall_detect, BLE_TEMPERATURE_HALL_DETECT_INTERVAL, timer_hall_detect_callback, NULL);
|
||||
rtos_start_timer(&timer_hall_detect);
|
||||
|
||||
rtos_init_timer(&timer_poweroff, BLE_TEMPERATURE_POWEROFF_TIMEOUT, box_poweroff_timeout_callback, NULL);
|
||||
rtos_init_timer(&timer_bind, BLE_TEMPERATURE_BIND_MODE_TIMEOUT, box_bind_timeout_callback, NULL);
|
||||
rtos_init_timer(&timer_idle, BLE_TEMPERATURE_IDLE_MODE_TIMEOUT, timer_app_idle_callback, NULL);
|
||||
|
||||
charger_module_enable(0);
|
||||
//sctrl_ctrl(CMD_SCTRL_USB_CHARGE_STOP, 0);
|
||||
voice_player_mute(1);
|
||||
|
@ -25,9 +25,9 @@
|
||||
*/
|
||||
#define BLE_TEMPERATURE_DEVICE_IT12 "iT12"
|
||||
/**
|
||||
* 耳温计iT19
|
||||
* 耳温计iT22
|
||||
*/
|
||||
#define BLE_TEMPERATURE_DEVICE_IT19 "iT19"
|
||||
#define BLE_TEMPERATURE_DEVICE_IT22 "iT22"
|
||||
/**
|
||||
* 产品ID iT18
|
||||
*/
|
||||
@ -35,7 +35,7 @@
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
#define DEVICEID "iT18_112233445566"
|
||||
#define DEVICEID "iT18_C8478C428848"
|
||||
/**
|
||||
* 检测硬件间隔时间
|
||||
*/
|
||||
@ -50,6 +50,19 @@
|
||||
*/
|
||||
#define BLE_TEMPERATURE_LIMIT_MAX 4290
|
||||
|
||||
/**
|
||||
* 合法温度最小值 低于该值不计入测温记录
|
||||
*/
|
||||
#define BLE_TEMPERATURE_MIN 2000
|
||||
/**
|
||||
* 合法温度最大值 高于该值不计入测温记录
|
||||
*/
|
||||
#define BLE_TEMPERATURE_MAX 5000
|
||||
|
||||
/**
|
||||
* 盒子复位GPIO
|
||||
*/
|
||||
#define BLE_TEMPERATURE_BOX_RESET_LCD 37
|
||||
/**
|
||||
* 霍尔按键检测GPIO
|
||||
*/
|
||||
@ -71,9 +84,9 @@
|
||||
*/
|
||||
#define BLE_TEMPERATURE_HALL_DETECT_INTERVAL 50 //ms
|
||||
/**
|
||||
* 超时10s 都没有收到温度广播数据 回到等待测温页面
|
||||
* 超时15s 都没有收到温度广播数据 回到等待测温页面
|
||||
*/
|
||||
#define BLE_TEMPERATURE_IDLE_MODE_TIMEOUT 10000 //ms
|
||||
#define BLE_TEMPERATURE_IDLE_MODE_TIMEOUT 15000 //ms
|
||||
|
||||
/**
|
||||
* 配置文件easyflah KEY
|
||||
@ -117,6 +130,7 @@ typedef struct
|
||||
uint16_t temperature_body;
|
||||
uint16_t temperature_obj;
|
||||
uint16_t temperature_env;
|
||||
uint16_t batt_percent;
|
||||
uint16_t batt_val;
|
||||
uint16_t device_state;
|
||||
}app_temperature_info_t;
|
||||
|
@ -33,6 +33,9 @@
|
||||
|
||||
#define BLE_WIFI_FLASH_KEY_SSID "wifi_ssid"
|
||||
#define BLE_WIFI_FLASH_KEY_PASS "wifi_pass"
|
||||
#define BLE_WIFI_FLASH_KEY_BSSID "wifi_bssid"
|
||||
#define BLE_WIFI_FLASH_KEY_CHANNEL "wifi_channel"
|
||||
#define BLE_WIFI_FLASH_KEY_SECURITY "wifi_security"
|
||||
#define BLE_IDLE_TIMEOUT_MS 10000 // 10秒无操作超时
|
||||
|
||||
//WIFI账号密码
|
||||
@ -43,6 +46,8 @@ char last_password[65] = {0};
|
||||
extern char mqtt_username[128];
|
||||
extern char mqtt_password[128];
|
||||
|
||||
char g_sta_mac[6] = {0};
|
||||
|
||||
static const uint8_t test_svc_uuid[16] = {0xFF,0xFF,0,0,0x34,0x56,0,0,0,0,0x28,0x37,0,0,0,0};
|
||||
app_dev_config_t dev_config = {0};
|
||||
extern int hostapd_scan_started; //扫描wifi全局变量
|
||||
@ -229,12 +234,27 @@ void ble_report_state(int state)//发送状态值
|
||||
bk_ble_send_ntf_value(strlen(msg), (uint8_t*)msg, 0, TEST_IDX_FF03_VAL_VALUE);
|
||||
}
|
||||
|
||||
void wifi_save_ssid_pass(const char *ssid, const char *password)//保存最后一次连接的wifi信息
|
||||
void wifi_save_ssid_pass(const char *ssid, const char *password, const uint8_t *bssid, uint8_t channel, uint8_t security)//保存最后一次连接的wifi信息
|
||||
{
|
||||
EfErrCode result;
|
||||
result = ef_set_env(BLE_WIFI_FLASH_KEY_SSID, ssid);
|
||||
result = ef_set_env(BLE_WIFI_FLASH_KEY_PASS, password);
|
||||
|
||||
char bssid_str[13] = {0};
|
||||
snprintf(bssid_str, sizeof(bssid_str), "%02X%02X%02X%02X%02X%02X",
|
||||
bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]);
|
||||
result = ef_set_env(BLE_WIFI_FLASH_KEY_BSSID, bssid_str);
|
||||
|
||||
char channel_str[8];
|
||||
snprintf(channel_str, sizeof(channel_str), "%u", channel);
|
||||
result = ef_set_env(BLE_WIFI_FLASH_KEY_CHANNEL, channel_str);
|
||||
|
||||
char security_str[8];
|
||||
snprintf(security_str, sizeof(security_str), "%u", security);
|
||||
result = ef_set_env(BLE_WIFI_FLASH_KEY_SECURITY, security_str);
|
||||
|
||||
result = ef_save_env();
|
||||
|
||||
if(result == EF_NO_ERR)
|
||||
bk_printf("wifi_save_ssid_pass success!\r\n");
|
||||
else
|
||||
@ -261,13 +281,24 @@ void connect_mqtt(){//创建线程
|
||||
if (tid_ntp) rt_thread_startup(tid_ntp);
|
||||
}
|
||||
|
||||
void wifi_status_cb(void *param)
|
||||
{
|
||||
LinkStatusTypeDef *status = (LinkStatusTypeDef *)param;
|
||||
bk_printf("wifi_status_cb: conn_state=%d\r\n", status->conn_state);
|
||||
if(status->conn_state == 12) {
|
||||
bk_printf("WiFi: SSID=%s, PASSWORD=%s\r\n", last_ssid, last_password);
|
||||
wifi_save_ssid_pass(last_ssid, last_password);
|
||||
void wifi_status_cb(void *param){
|
||||
LinkStatusTypeDef status;
|
||||
bk_wlan_get_link_status(&status);
|
||||
|
||||
bk_printf("wifi_status_cb: conn_state=%d\r\n", status.conn_state);
|
||||
if(status.conn_state == 11) {
|
||||
bk_printf("WiFi BSSID: %02X:%02X:%02X:%02X:%02X:%02X\n",
|
||||
status.bssid[0], status.bssid[1], status.bssid[2],
|
||||
status.bssid[3], status.bssid[4], status.bssid[5]);
|
||||
bk_printf("Channel: %d\n", status.channel);
|
||||
bk_printf("Security: %d\n", status.security);
|
||||
bk_printf("SSID=%s, PASSWORD=%s\r\n", last_ssid, last_password);
|
||||
|
||||
wifi_save_ssid_pass(last_ssid, last_password, status.bssid, status.channel, status.security);
|
||||
|
||||
bk_wifi_get_station_mac_address(g_sta_mac);
|
||||
bk_printf("Device MAC: %02X%02X%02X%02X%02X%02X\r\n",
|
||||
g_sta_mac[0], g_sta_mac[1], g_sta_mac[2], g_sta_mac[3], g_sta_mac[4], g_sta_mac[5]);
|
||||
ble_report_state(3);//连接成功
|
||||
connect_mqtt();
|
||||
}
|
||||
@ -331,6 +362,11 @@ void ble_notice_cb(ble_notice_t notice, void *param)
|
||||
if(strncmp((char *)data, "AT+WIFI:", 8) == 0){ //连接WiFi命令:AT+WIFI:SSID,PASSWORD
|
||||
ble_connnect_wifi(data);
|
||||
}
|
||||
|
||||
if(strstr((char *)data,"AT+STATE")!=NULL){ //返回当前状态
|
||||
char msg[32] = "AT+STATE=0";
|
||||
bk_ble_send_ntf_value(strlen(msg), (uint8_t*)msg, 0, TEST_IDX_FF03_VAL_VALUE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BLE_5_READ_EVENT:
|
||||
@ -841,6 +877,12 @@ static void ble_advertise_start(int argc, char **argv)
|
||||
bk_ble_start_advertising(actv_idx, 0, ble_cmd_cb);
|
||||
}
|
||||
|
||||
void belon_ble_deinit_adv() {
|
||||
bk_ble_stop_advertising(actv_idx_adv, ble_cmd_cb);
|
||||
}
|
||||
void belon_ble_start_adv() {
|
||||
bk_ble_start_advertising(actv_idx_adv, 0, ble_cmd_cb);
|
||||
}
|
||||
|
||||
void belon_ble_active() {
|
||||
ble_set_notice_cb(ble_notice_cb);
|
||||
@ -852,7 +894,7 @@ void belon_ble_init_scan() {
|
||||
struct scan_param scan_info;
|
||||
scan_info.channel_map = 7;
|
||||
scan_info.interval = 100;
|
||||
scan_info.window = 60; //window大小越接近interval 广播包漏掉的越少,但耗能更高
|
||||
scan_info.window = 40; //window大小越接近interval 广播包漏掉的越少,但耗能更高
|
||||
|
||||
actv_idx = app_ble_get_idle_actv_idx_handle(SCAN_ACTV);
|
||||
bk_printf("actv_idx_scan : (%d) \r\n",actv_idx);
|
||||
|
@ -2,6 +2,9 @@
|
||||
#define BELON_CONFIG_H_
|
||||
#define BLE_WIFI_FLASH_KEY_SSID "wifi_ssid"
|
||||
#define BLE_WIFI_FLASH_KEY_PASS "wifi_pass"
|
||||
#define BLE_WIFI_FLASH_KEY_BSSID "wifi_bssid"
|
||||
#define BLE_WIFI_FLASH_KEY_CHANNEL "wifi_channel"
|
||||
#define BLE_WIFI_FLASH_KEY_SECURITY "wifi_security"
|
||||
#include "stdint.h"
|
||||
|
||||
typedef struct{
|
||||
@ -21,7 +24,8 @@ void belon_ble_init_adv();
|
||||
|
||||
void belon_ble_scan_start();
|
||||
void belon_ble_scan_stop();
|
||||
|
||||
void belon_ble_deinit_adv();
|
||||
void belon_ble_start_adv();
|
||||
void wifi_status_cb(void *param);
|
||||
void connect_mqtt();
|
||||
|
||||
|
@ -67,7 +67,7 @@
|
||||
#define CFG_USE_WPA_29 1
|
||||
#define CFG_WPA_CTRL_IFACE 1
|
||||
#define CFG_RWNX_QOS_MSDU 1
|
||||
#define CFG_WLAN_FAST_CONNECT 0
|
||||
#define CFG_WLAN_FAST_CONNECT 1
|
||||
#define CFG_WPA2_ENTERPRISE 0
|
||||
#define CFG_WPA3_ENTERPRISE 0
|
||||
/* WPS(WSC) Support */
|
||||
|
@ -1,863 +0,0 @@
|
||||
#ifndef __RTOS_PUB__
|
||||
#define __RTOS_PUB__
|
||||
|
||||
|
||||
/** @brief Enter a critical session, all interrupts are disabled
|
||||
*
|
||||
* @param void
|
||||
*
|
||||
* @return
|
||||
* - void
|
||||
*/
|
||||
void rtos_enter_critical( void);
|
||||
|
||||
/** @brief Exit a critical session, all interrupts are enabled
|
||||
*
|
||||
* @param void
|
||||
*
|
||||
* @return
|
||||
* - void
|
||||
*/
|
||||
void rtos_exit_critical( void);
|
||||
|
||||
|
||||
/** @brief disable os scheduling
|
||||
*
|
||||
* @param void
|
||||
*
|
||||
* @return
|
||||
* - void
|
||||
*/
|
||||
void rtos_lock_scheduling( void );
|
||||
|
||||
|
||||
/** @brief enable os scheduling
|
||||
*
|
||||
* @param void
|
||||
*
|
||||
* @return
|
||||
* - void
|
||||
*/
|
||||
void rtos_unlock_scheduling( void );
|
||||
|
||||
|
||||
/** @brief Get system time value in milliseconds
|
||||
*
|
||||
* @param time_ptr : the pointer of time value in milliseconds
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus beken_time_get_time(beken_time_t* time_ptr);
|
||||
|
||||
|
||||
|
||||
|
||||
/** @defgroup BEKEN_RTOS_Thread _BK_ RTOS Thread Management Functions
|
||||
* @brief Provide thread creation, delete, suspend, resume, and other RTOS management API
|
||||
* @verbatim
|
||||
* _BK_ thread priority table
|
||||
*
|
||||
* +----------+-----------------+
|
||||
* | Priority | Thread |
|
||||
* |----------|-----------------|
|
||||
* | 0 | _BK_ | Highest priority
|
||||
* | 1 | Network |
|
||||
* | 2 | |
|
||||
* | 3 | Network worker |
|
||||
* | 4 | |
|
||||
* | 5 | Default Library |
|
||||
* | | Default worker |
|
||||
* | 6 | |
|
||||
* | 7 | Application |
|
||||
* | 8 | |
|
||||
* | 9 | Idle | Lowest priority
|
||||
* +----------+-----------------+
|
||||
* @endverbatim
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @brief Creates and starts a new thread
|
||||
*
|
||||
* @param thread : Pointer to variable that will receive the thread handle (can be null)
|
||||
* @param priority : A priority number. (0:Highest priority, 9:Lowest priority)
|
||||
* @param name : a text name for the thread (can be null)
|
||||
* @param function : the main thread function
|
||||
* @param stack_size : stack size for this thread
|
||||
* @param arg : argument which will be passed to thread function (can be null)
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_create_thread( beken_thread_t* thread, uint8_t priority, const char* name, beken_thread_function_t function, uint32_t stack_size, beken_thread_arg_t arg);
|
||||
|
||||
|
||||
|
||||
/** @brief Deletes a terminated thread
|
||||
*
|
||||
* @param thread : the handle of the thread to delete, NULL is the current thread
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_delete_thread( beken_thread_t* thread);
|
||||
|
||||
|
||||
|
||||
/** @brief Set thread priority
|
||||
*
|
||||
* @param thread : the handle of the thread
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_thread_set_priority(beken_thread_t *thread, int priority);
|
||||
|
||||
|
||||
/** @brief Suspend a thread
|
||||
*
|
||||
* @param thread : the handle of the thread to suspend, NULL is the current thread
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
void rtos_suspend_thread(beken_thread_t* thread);
|
||||
|
||||
|
||||
/** @brief Resume a thread
|
||||
*
|
||||
* @param thread : the handle of the thread to resume, NULL is the current thread
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
void rtos_resume_thread(beken_thread_t *thread);
|
||||
|
||||
|
||||
/** @brief Sleeps until another thread has terminated
|
||||
*
|
||||
* @Details Causes the current thread to sleep until the specified other thread
|
||||
* has terminated. If the processor is heavily loaded with higher priority
|
||||
* tasks, this thread may not wake until significantly after the thread termination.
|
||||
*
|
||||
* @param thread : the handle of the other thread which will terminate
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_thread_join( beken_thread_t* thread);
|
||||
|
||||
|
||||
/** @brief Forcibly wakes another thread
|
||||
*
|
||||
* @Details Causes the specified thread to wake from suspension. This will usually
|
||||
* cause an error or timeout in that thread, since the task it was waiting on
|
||||
* is not complete.
|
||||
*
|
||||
* @param thread : the handle of the other thread which will be woken
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_thread_force_awake( beken_thread_t* thread);
|
||||
|
||||
|
||||
/** @brief Checks if a thread is the current thread
|
||||
*
|
||||
* @Details Checks if a specified thread is the currently running thread
|
||||
*
|
||||
* @param thread : the handle of the other thread against which the current thread
|
||||
* will be compared
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
BOOL rtos_is_current_thread( beken_thread_t* thread);
|
||||
|
||||
|
||||
/** @brief Get current thread handler
|
||||
*
|
||||
* @return Current RTOS thread handler
|
||||
*/
|
||||
beken_thread_t* rtos_get_current_thread( void);
|
||||
|
||||
|
||||
/** @brief Suspend current thread for a specific time
|
||||
*
|
||||
* @param seconds : A time interval (Unit: seconds)
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
void rtos_thread_sleep(uint32_t seconds);
|
||||
|
||||
|
||||
/** @brief Suspend current thread for a specific time
|
||||
*
|
||||
* @param milliseconds : A time interval (Unit: millisecond)
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
void rtos_thread_msleep(uint32_t milliseconds);
|
||||
|
||||
|
||||
/** @brief Suspend current thread for a specific time
|
||||
*
|
||||
* @param num_ms : A time interval (Unit: millisecond)
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_delay_milliseconds( uint32_t num_ms);
|
||||
|
||||
|
||||
/** @brief Print Thread status into buffer
|
||||
*
|
||||
* @param buffer, point to buffer to store thread status
|
||||
* @param length, length of the buffer
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_print_thread_status( char* buffer, int length);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup BEKEN_RTOS_SEM _BK_ RTOS Semaphore Functions
|
||||
* @brief Provide management APIs for semaphore such as init,set,get and dinit.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Initialises a counting semaphore and set count to 0
|
||||
*
|
||||
* @param semaphore : a pointer to the semaphore handle to be initialised
|
||||
* @param maxCount : the max count number of this semaphore
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_init_semaphore( beken_semaphore_t* semaphore, int maxCount);
|
||||
|
||||
|
||||
/** @brief Initialises a counting semaphore and set count to init count
|
||||
*
|
||||
* @param semaphore : a pointer to the semaphore handle to be initialised
|
||||
* @param maxCount : the max count number of this semaphore
|
||||
* @param init_count : the init count number of this semaphore
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_init_semaphore_adv( beken_semaphore_t* semaphore, int maxCount, int init_count);
|
||||
|
||||
|
||||
/** @brief Set (post/put/increment) a semaphore
|
||||
*
|
||||
* @param semaphore : a pointer to the semaphore handle to be set
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_set_semaphore( beken_semaphore_t* semaphore);
|
||||
|
||||
|
||||
/** @brief Get (wait/decrement) a semaphore
|
||||
*
|
||||
* @Details Attempts to get (wait/decrement) a semaphore. If semaphore is at zero already,
|
||||
* then the calling thread will be suspended until another thread sets the
|
||||
* semaphore with @ref rtos_set_semaphore
|
||||
*
|
||||
* @param semaphore : a pointer to the semaphore handle
|
||||
* @param timeout_ms: the number of milliseconds to wait before returning
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_get_semaphore( beken_semaphore_t* semaphore, uint32_t timeout_ms);
|
||||
|
||||
|
||||
|
||||
/** @brief Get (wait/decrement) semaphore number
|
||||
*
|
||||
*
|
||||
* @param semaphore : a pointer to the semaphore handle
|
||||
*
|
||||
* @return the number of semaphore
|
||||
*/
|
||||
int rtos_get_sema_count( beken_semaphore_t* semaphore);
|
||||
|
||||
|
||||
/** @brief De-initialise a semaphore
|
||||
*
|
||||
* @Details Deletes a semaphore created with @ref rtos_init_semaphore
|
||||
*
|
||||
* @param semaphore : a pointer to the semaphore handle
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_deinit_semaphore( beken_semaphore_t* semaphore);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup BEKEN_RTOS_MUTEX _BK_ RTOS Mutex Functions
|
||||
* @brief Provide management APIs for Mutex such as init,lock,unlock and dinit.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Initialises a mutex
|
||||
*
|
||||
* @Details A mutex is different to a semaphore in that a thread that already holds
|
||||
* the lock on the mutex can request the lock again (nested) without causing
|
||||
* it to be suspended.
|
||||
*
|
||||
* @param mutex : a pointer to the mutex handle to be initialised
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_init_mutex( beken_mutex_t* mutex);
|
||||
|
||||
|
||||
/** @brief Obtains the lock on a mutex
|
||||
*
|
||||
* @Details Attempts to obtain the lock on a mutex. If the lock is already held
|
||||
* by another thead, the calling thread will be suspended until the mutex
|
||||
* lock is released by the other thread.
|
||||
*
|
||||
* @param mutex : a pointer to the mutex handle to be locked
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_lock_mutex( beken_mutex_t* mutex);
|
||||
|
||||
|
||||
|
||||
/** @brief Obtains the lock on a mutex
|
||||
*
|
||||
* @Details Attempts to obtain the lock on a mutex. If the lock is already held
|
||||
* by another thead, the calling thread will not be suspended until the mutex
|
||||
* lock is released by the other thread.
|
||||
*
|
||||
* @param mutex : a pointer to the mutex handle to be locked
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_trylock_mutex( beken_mutex_t* mutex);
|
||||
|
||||
|
||||
/** @brief Releases the lock on a mutex
|
||||
*
|
||||
* @Details Releases a currently held lock on a mutex. If another thread
|
||||
* is waiting on the mutex lock, then it will be resumed.
|
||||
*
|
||||
* @param mutex : a pointer to the mutex handle to be unlocked
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_unlock_mutex( beken_mutex_t* mutex);
|
||||
|
||||
|
||||
|
||||
|
||||
/** @brief De-initialise a mutex
|
||||
*
|
||||
* @Details Deletes a mutex created with @ref rtos_init_mutex
|
||||
*
|
||||
* @param mutex : a pointer to the mutex handle
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_deinit_mutex( beken_mutex_t* mutex);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup BEKEN_RTOS_MUTEX _BK_ RTOS Mutex Functions
|
||||
* @brief Provide management APIs for Mutex such as init,lock,unlock and dinit.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Initialises a recursive mutex
|
||||
*
|
||||
* @Details A mutex is different to a semaphore in that a thread that already holds
|
||||
* the lock on the mutex can request the lock again (nested) without causing
|
||||
* it to be suspended.
|
||||
*
|
||||
* @param mutex : a pointer to the mutex handle to be initialised
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_init_recursive_mutex(beken_mutex_t *mutex);
|
||||
|
||||
|
||||
|
||||
/** @brief Obtains the lock on a recursive mutex
|
||||
*
|
||||
* @Details Attempts to obtain the lock on a mutex. If the lock is already held
|
||||
* by another thead, the calling thread will be suspended until the mutex
|
||||
* lock is released by the other thread.
|
||||
*
|
||||
* @param mutex : a pointer to the mutex handle to be locked
|
||||
* - timeout: timeout for wait mutex
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_lock_recursive_mutex(beken_mutex_t *mutex, uint32_t timeout);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** @brief Releases the lock on a recursive mutex
|
||||
*
|
||||
* @Details Releases a currently held lock on a mutex. If another thread
|
||||
* is waiting on the mutex lock, then it will be resumed.
|
||||
*
|
||||
* @param mutex : a pointer to the mutex handle to be unlocked
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_unlock_recursive_mutex(beken_mutex_t *mutex);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup BEKEN_RTOS_QUEUE _BK_ RTOS FIFO Queue Functions
|
||||
* @brief Provide management APIs for FIFO such as init,push,pop and dinit.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Initialises a FIFO queue
|
||||
*
|
||||
* @param queue : a pointer to the queue handle to be initialised
|
||||
* @param name : a text string name for the queue (NULL is allowed)
|
||||
* @param message_size : size in bytes of objects that will be held in the queue
|
||||
* @param number_of_messages : depth of the queue - i.e. max number of objects in the queue
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_init_queue( beken_queue_t* queue, const char* name, uint32_t message_size, uint32_t number_of_messages);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** @brief Pushes an object onto a queue (to the back)
|
||||
*
|
||||
* @param queue : a pointer to the queue handle
|
||||
* @param message : the object to be added to the queue. Size is assumed to be
|
||||
* the size specified in @ref rtos_init_queue
|
||||
* @param timeout_ms: the number of milliseconds to wait before returning
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_push_to_queue( beken_queue_t* queue, void* message, uint32_t timeout_ms);
|
||||
|
||||
|
||||
|
||||
/** @brief Pushes an object to front of the queue
|
||||
*
|
||||
* @param queue : a pointer to the queue handle
|
||||
* @param message : the object to be added to the queue. Size is assumed to be
|
||||
* the size specified in @ref rtos_init_queue
|
||||
* @param timeout_ms: the number of milliseconds to wait before returning
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_push_to_queue_front(beken_queue_t* queue, void* message, uint32_t timeout_ms);
|
||||
|
||||
|
||||
/** @brief Pops an object off a queue
|
||||
*
|
||||
* @param queue : a pointer to the queue handle
|
||||
* @param message : pointer to a buffer that will receive the object being
|
||||
* popped off the queue. Size is assumed to be
|
||||
* the size specified in @ref rtos_init_queue , hence
|
||||
* you must ensure the buffer is long enough or memory
|
||||
* corruption will result
|
||||
* @param timeout_ms: the number of milliseconds to wait before returning
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_pop_from_queue( beken_queue_t* queue, void* message, uint32_t timeout_ms);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** @brief De-initialise a queue created with @ref rtos_init_queue
|
||||
*
|
||||
* @param queue : a pointer to the queue handle
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_deinit_queue( beken_queue_t* queue);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** @brief Check if a queue is empty
|
||||
*
|
||||
* @param queue : a pointer to the queue handle
|
||||
*
|
||||
* @return
|
||||
* - true : queue is empty.
|
||||
* - false : queue is not empty.
|
||||
*/
|
||||
BOOL rtos_is_queue_empty( beken_queue_t* queue);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** @brief Check if a queue is full
|
||||
*
|
||||
* @param queue : a pointer to the queue handle
|
||||
*
|
||||
* @return
|
||||
* - true : queue is empty.
|
||||
* - false : queue is not empty.
|
||||
*/
|
||||
BOOL rtos_is_queue_full( beken_queue_t* queue);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup BEKEN_RTOS_TIMER _BK_ RTOS Timer Functions
|
||||
* @brief Provide management APIs for timer such as init,start,stop,reload and dinit.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Gets time in miiliseconds since RTOS start
|
||||
*
|
||||
* @attention: Since this is only 32 bits, it will roll over every 49 days, 17 hours.
|
||||
*
|
||||
* @returns Time in milliseconds since RTOS started.
|
||||
*/
|
||||
uint32_t rtos_get_time(void);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Gets time in microsecond since RTOS start
|
||||
*
|
||||
* @attention: Since this is only 32 bits, it will roll over every 49 days, 17 hours.
|
||||
*
|
||||
* @returns Time in milliseconds since RTOS started.
|
||||
*/
|
||||
uint64_t rtos_get_time_us( void );
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Deinitialization a RTOS oneshot timer
|
||||
*
|
||||
* @attention Timer does not start running until @ref beken_start_timer is called
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to be initialised
|
||||
* @param time_ms : Timer period in milliseconds
|
||||
* @param function : the callback handler function that is called each time the
|
||||
* timer expires
|
||||
* @param larg : an argument that will be passed to the callback function
|
||||
* @param rarg : an argument that will be passed to the callback function
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_init_oneshot_timer( beken2_timer_t *timer,
|
||||
uint32_t time_ms,
|
||||
timer_2handler_t function,
|
||||
void* larg,
|
||||
void* rarg);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief De-initialise a RTOS oneshot timer
|
||||
*
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to be initialised
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_deinit_oneshot_timer( beken2_timer_t* timer);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief De-initialise a RTOS timer with block way
|
||||
*
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to be initialised
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_deinit_oneshot_timer_block( beken2_timer_t* timer);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief stop a RTOS oneshot timer
|
||||
*
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to be initialised
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_stop_oneshot_timer( beken2_timer_t* timer);
|
||||
|
||||
|
||||
/**
|
||||
* @brief whether oneshot_timer is running
|
||||
*
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to be initialised
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
BOOL rtos_is_oneshot_timer_running( beken2_timer_t* timer);
|
||||
|
||||
|
||||
/**
|
||||
* @brief start a RTOS oneshot timer
|
||||
*
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to be initialised
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_start_oneshot_timer( beken2_timer_t* timer);
|
||||
|
||||
|
||||
/**
|
||||
* @brief whether oneshot_timer is inited
|
||||
*
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to be initialised
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
BOOL rtos_is_oneshot_timer_init( beken2_timer_t* timer);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Reloads oneshot_timer is inited that has expired
|
||||
*
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to be initialised
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_oneshot_reload_timer( beken2_timer_t* timer);
|
||||
|
||||
|
||||
/**
|
||||
* @brief change timeout for a RTOS oneshot timer that has expired
|
||||
*
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to be initialised
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_change_period_1( beken2_timer_t* timer, uint32_t time_ms);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initialize a RTOS timer
|
||||
*
|
||||
* @attention Timer does not start running until @ref beken_start_timer is called
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to be initialised
|
||||
* @param time_ms : Timer period in milliseconds
|
||||
* @param function : the callback handler function that is called each time the
|
||||
* timer expires
|
||||
* @param arg : an argument that will be passed to the callback function
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_init_timer( beken_timer_t* timer, uint32_t time_ms, timer_handler_t function, void* arg);
|
||||
|
||||
|
||||
/** @brief Starts a RTOS timer running
|
||||
*
|
||||
* @attention Timer must have been previously initialised with @ref rtos_init_timer
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to start
|
||||
*
|
||||
* @return kNoErr : on success.
|
||||
* @return kGeneralErr : if an error occurred
|
||||
*/
|
||||
OSStatus rtos_start_timer( beken_timer_t* timer);
|
||||
|
||||
|
||||
/**
|
||||
* @brief change timeout for a RTOS oneshot timer that has expired
|
||||
*
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to be initialised
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_change_period( beken_timer_t* timer, uint32_t time_ms);
|
||||
|
||||
/** @brief Stops a running RTOS timer
|
||||
*
|
||||
* @attention Timer must have been previously started with @ref rtos_init_timer
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to stop
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_stop_timer( beken_timer_t* timer);
|
||||
|
||||
|
||||
/** @brief Reloads a RTOS timer that has expired
|
||||
*
|
||||
* @attention This is usually called in the timer callback handler, to
|
||||
* reschedule the timer for the next period.
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to reload
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_reload_timer( beken_timer_t* timer);
|
||||
|
||||
|
||||
/** @brief De-initialise a RTOS timer
|
||||
*
|
||||
* @attention Deletes a RTOS timer created with @ref rtos_init_timer
|
||||
*
|
||||
* @param timer : a pointer to the RTOS timer handle
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_deinit_timer( beken_timer_t* timer);
|
||||
|
||||
|
||||
/** @brief De-initialise a RTOS timer with black way
|
||||
*
|
||||
* @attention Deletes a RTOS timer created with @ref rtos_init_timer
|
||||
*
|
||||
* @param timer : a pointer to the RTOS timer handle
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
OSStatus rtos_deinit_timer_block(beken_timer_t *timer);
|
||||
|
||||
|
||||
/** @brief Check if an RTOS timer is running
|
||||
*
|
||||
* @param timer : a pointer to the RTOS timer handle
|
||||
*
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
BOOL rtos_is_timer_init( beken_timer_t* timer);
|
||||
|
||||
|
||||
/**
|
||||
* @brief whether oneshot_timer is running
|
||||
*
|
||||
*
|
||||
* @param timer : a pointer to the timer handle to be initialised
|
||||
* @return
|
||||
* - kNoErr : on success.
|
||||
* - kGeneralErr : if an error occurred with any step
|
||||
*/
|
||||
BOOL rtos_is_timer_running( beken_timer_t* timer);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __RTOS_PUB__
|
||||
// EOF
|
||||
|
@ -4,7 +4,9 @@
|
||||
#include "arch.h"
|
||||
#include "arm_arch.h"
|
||||
#include "reg_mac_pl.h"
|
||||
|
||||
#include "rtos_pub.h"
|
||||
|
||||
#include "target_util_pub.h"
|
||||
|
||||
#include "icu.h"
|
||||
@ -377,7 +379,7 @@ static void mcu_sleep(UINT32 wake_up_way,UINT64 sleep_us)
|
||||
#endif
|
||||
{
|
||||
// in mcu low voltage sleep, only gpio and rosc32k can wakeup
|
||||
mcu_time.cur_sleep_time = rtos_get_time_us();
|
||||
mcu_time.cur_sleep_time = rtc_reg_get_time_us();
|
||||
mcu_sleep_set_rosc_timer(sleep_us);
|
||||
}
|
||||
|
||||
@ -399,7 +401,7 @@ static void mcu_sleep(UINT32 wake_up_way,UINT64 sleep_us)
|
||||
lv_ps_wakeup_set_timepoint();
|
||||
#endif
|
||||
/* cpu stop here */
|
||||
mcu_time.last_wakeup_time = rtos_get_time_us();
|
||||
mcu_time.last_wakeup_time = rtc_reg_get_time_us();
|
||||
|
||||
#if WITH_BUCK_EN
|
||||
mcu_sleep_exit_with_buck();
|
||||
@ -408,7 +410,7 @@ static void mcu_sleep(UINT32 wake_up_way,UINT64 sleep_us)
|
||||
/* rosc timer int come, cpu wake up here*/
|
||||
mcu_sleep_clear_rosc_timer();
|
||||
} else if (g_mcu_sleep.cfg.sleep_mode == MCU_NORMAL_SLEEP) {
|
||||
mcu_time.cur_sleep_time = rtos_get_time_us();
|
||||
mcu_time.cur_sleep_time = rtc_reg_get_time_us();
|
||||
|
||||
/* set wakeup bit */
|
||||
reg = wake_up_way | g_mcu_sleep.cfg.wakeup_sig;
|
||||
@ -423,7 +425,7 @@ static void mcu_sleep(UINT32 wake_up_way,UINT64 sleep_us)
|
||||
|
||||
g_mcu_sleep.cfg.wakeup_sig = REG_READ(ICU_INT_STATUS);
|
||||
|
||||
mcu_time.last_wakeup_time = rtos_get_time_us();
|
||||
mcu_time.last_wakeup_time = rtc_reg_get_time_us();
|
||||
}
|
||||
|
||||
GLOBAL_INT_RESTORE();
|
||||
@ -733,7 +735,7 @@ UINT32 force_mcu_ps(UINT32 wake_up_way,UINT64 sleep_us, UINT32 sleep_mode)
|
||||
|
||||
force_mcu_ps_stop_ps_timer();
|
||||
force_mcu_ps_start_tick_timer();
|
||||
sleep_ms = (UINT32)((rtos_get_time_us() - mcu_time.cur_sleep_time) / 1000);
|
||||
sleep_ms = (UINT32)((rtc_reg_get_time_us() - mcu_time.cur_sleep_time) / 1000);
|
||||
#endif
|
||||
} else if (g_mcu_sleep.cfg.sleep_mode == MCU_LOW_VOLTAGE_SLEEP) {
|
||||
#if (CFG_SUPPORT_BLE == 1)
|
||||
@ -749,7 +751,7 @@ UINT32 force_mcu_ps(UINT32 wake_up_way,UINT64 sleep_us, UINT32 sleep_mode)
|
||||
if((g_mcu_sleep.cfg.off_ble == 1) && (ble_up == 1))
|
||||
ble_entry();
|
||||
#endif
|
||||
sleep_ms = (UINT32)((rtos_get_time_us() - mcu_time.cur_sleep_time) / 1000);
|
||||
sleep_ms = (UINT32)((rtc_reg_get_time_us() - mcu_time.cur_sleep_time) / 1000);
|
||||
}
|
||||
|
||||
sleep_tick = BK_MS_TO_TICKS(sleep_ms);
|
||||
|
@ -63,7 +63,7 @@ typedef enum {
|
||||
MANUAL_MODE_NORMAL = 0,
|
||||
MANUAL_MODE_IDLE = 1,
|
||||
} MANUAL_MODE;
|
||||
|
||||
#include "rtos_pub.h"
|
||||
#define PS_SUPPORT_MANUAL_SLEEP 0
|
||||
typedef void ( *ps_wakeup_cb ) ( void );
|
||||
extern void deep_sleep_wakeup_with_gpio ( UINT32 gpio_index_map, UINT32 gpio_edge_map );
|
||||
@ -71,5 +71,6 @@ extern void bk_enter_deep_sleep_mode ( PS_DEEP_CTRL_PARAM *deep_param );
|
||||
extern void bk_wlan_ps_wakeup_with_timer ( MANUAL_MODE mode, UINT32 sleep_time );
|
||||
extern void bk_wlan_ps_wakeup_with_peri ( UINT8 uart2_wk, UINT32 gpio_index_map, UINT32 gpio_edge_map );
|
||||
extern void bk_wlan_ps_wakeup_with_gpio ( MANUAL_MODE mode, UINT32 gpio_index_map, UINT32 gpio_edge_map );
|
||||
extern UINT32 bk_wlan_instant_lowvol_sleep(PS_DEEP_CTRL_PARAM *lowvol_param);
|
||||
#endif
|
||||
|
||||
|
@ -280,7 +280,7 @@ typedef struct _linkStatus_t
|
||||
uint8_t ssid[33]; /**< SSID of the current connected wlan */
|
||||
uint8_t bssid[6]; /**< BSSID of the current connected wlan */
|
||||
uint16_t aid; /**< BSSID of the current connected wlan */
|
||||
int channel; /**< Channel of the current connected wlan */
|
||||
uint8_t channel; /**< Channel of the current connected wlan */
|
||||
wlan_sec_type_t security;
|
||||
} LinkStatusTypeDef;
|
||||
|
||||
|
@ -548,7 +548,7 @@ void bk_enter_deep_sleep_mode ( PS_DEEP_CTRL_PARAM *deep_param )
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (1 == CFG_USE_FORCE_LOWVOL_PS)
|
||||
//#if (1 == CFG_USE_FORCE_LOWVOL_PS)
|
||||
UINT32 bk_wlan_instant_lowvol_sleep( PS_DEEP_CTRL_PARAM *lowvol_param )
|
||||
{
|
||||
return bk_force_instant_lowvol_sleep(lowvol_param);
|
||||
@ -611,5 +611,5 @@ void lowvol_Sleep_Command(char *pcWriteBuffer, int xWriteBufferLen, int argc, ch
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
|
@ -36,12 +36,12 @@
|
||||
#include "wpa_psk_cache.h"
|
||||
#include "drv_model_pub.h"
|
||||
#include "str_pub.h"
|
||||
|
||||
#if CFG_WPA_CTRL_IFACE
|
||||
#include "BkDriverFlash.h"
|
||||
//#if CFG_WPA_CTRL_IFACE
|
||||
#include "wlan_defs_pub.h"
|
||||
#include "wpa_ctrl.h"
|
||||
#include "flash_pub.h"
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
#if CFG_ROLE_LAUNCH
|
||||
#include "role_launch.h"
|
||||
@ -1003,7 +1003,7 @@ OSStatus bk_wlan_start_sta(network_InitTypeDef_st *inNetworkInitPara)
|
||||
#endif
|
||||
int chan = 0;
|
||||
#if CFG_WLAN_FAST_CONNECT || CFG_WLAN_FAST_CONNECT_WPA3 || CFG_BSSID_FAST_CONNECT
|
||||
sta_ip_get_start_time();
|
||||
//sta_ip_get_start_time();
|
||||
#endif
|
||||
#if CFG_STA_AUTO_RECONNECT
|
||||
/*
|
||||
|
@ -67,7 +67,7 @@
|
||||
#define CFG_USE_WPA_29 1
|
||||
#define CFG_WPA_CTRL_IFACE 1
|
||||
#define CFG_RWNX_QOS_MSDU 1
|
||||
#define CFG_WLAN_FAST_CONNECT 0
|
||||
#define CFG_WLAN_FAST_CONNECT 1
|
||||
#define CFG_WPA2_ENTERPRISE 0
|
||||
#define CFG_WPA3_ENTERPRISE 0
|
||||
/* WPS(WSC) Support */
|
||||
|
27
beken_rtt_sdk_release-SDK_3.0.76/docs/iT18 BLE 蓝牙配网.txt
Normal file
27
beken_rtt_sdk_release-SDK_3.0.76/docs/iT18 BLE 蓝牙配网.txt
Normal file
@ -0,0 +1,27 @@
|
||||
iT18 BLE 配网
|
||||
|
||||
1.搜索蓝牙7252n 并连接设备 ( 使用时建议申请ble 通讯的MTU 为254 否则会数据分包;)
|
||||
2.监听UUID为 0xFF03 的Characteristic 可以实时监听扫描结果或配网状态如 :
|
||||
AT+SSID=1603,iLock,TP-LINK15DA,HUAWEI-AB8D
|
||||
AT+STATE=1
|
||||
|
||||
|
||||
3.打开UUID为0xFFFF的Service
|
||||
|
||||
4.发送字符串AT+SCAN到UUID为 0xFF01 的Characteristic 开始搜索网络
|
||||
设备搜索附近WIFI完成则通过UUID为 0xFF03 的Characteristic 通知回传小程序,SSID之间通过逗号分隔
|
||||
如:AT+SSID=1603,iLock,TP-LINK15DA,HUAWEI-AB8D
|
||||
|
||||
|
||||
5.发送字符串AT+WIFI:SSID,PASSWORD到UUID为 0xFF01 的Characteristic
|
||||
|
||||
发送完成自动开始联网 并回传状态值
|
||||
|
||||
6.配网状态值
|
||||
AT+STATE=0 表示当前无操作
|
||||
AT+STATE=1 表示收到了下发扫描SSID指令并开始扫描网络 收到的结果会回传主控
|
||||
AT+STATE=2 表示收到下发的SSID 和密码,并开始尝试连接网络
|
||||
AT+STATE=3 表示已经连接WIFI并且获取IP
|
||||
|
||||
|
||||
|
22
beken_rtt_sdk_release-SDK_3.0.76/docs/iT18 收纳仓BLE 通讯协议.txt
Normal file
22
beken_rtt_sdk_release-SDK_3.0.76/docs/iT18 收纳仓BLE 通讯协议.txt
Normal file
@ -0,0 +1,22 @@
|
||||
iT18 收纳仓通讯协议
|
||||
|
||||
1.搜索蓝牙7252n 并连接设备 ( 使用时建议申请ble 通讯的MTU 为254 否则会数据分包;)
|
||||
|
||||
2.iT18的通讯Service UUID为 0xFFFF的
|
||||
3.监听UUID为 0xFF03 的Characteristic 可以实时监听回传数据
|
||||
4.指令通过UUID为 0xFF01 的Characteristic发送
|
||||
|
||||
5.指令CMD
|
||||
5.1 将当前设备与指定MAC地址的设备绑定 :AT+BIND
|
||||
|
||||
5.2 获取扫描附近的WIFI :AT+SCAN
|
||||
回复:AT+SSID=1603,iLock,TP-LINK15DA,HUAWEI-AB8D (信号强度依次减小)
|
||||
AT+STATE=1 (表示收到了下发扫描SSID指令并开始扫描网络 收到的结果会回传主控)
|
||||
|
||||
5.3 连接指定WIFI :AT+WIFI:SSID,PASSWORD (SSID为WIFI名称,PASSWORD为WIFI密码)
|
||||
回复:AT+STATE=2 (表示收到下发的SSID 和密码,并开始尝试连接网络)
|
||||
AT+STATE=3 (表示已经连接WIFI并且获取IP)
|
||||
|
||||
5.4 获取状态值 :AT+STATE
|
||||
回复:AT+STATE=0 (表示当前无操作)
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -13,7 +13,7 @@
|
||||
#include "mqtt_client.h"
|
||||
|
||||
/*********************************************************************************************************
|
||||
** 调试配置
|
||||
** <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
#define DBG_ENABLE
|
||||
#define DBG_SECTION_NAME "mqtt"
|
||||
@ -32,17 +32,17 @@
|
||||
#endif
|
||||
|
||||
/*********************************************************************************************************
|
||||
** mqtt客户端通信锁
|
||||
** mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
#define mqtt_client_lock(c) rt_mutex_take(c->mqtt_lock, RT_WAITING_FOREVER)
|
||||
#define mqtt_client_unlock(c) rt_mutex_release(c->mqtt_lock)
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: mqtt_resolve_uri
|
||||
** Descriptions: mqtt url地址解析
|
||||
** input parameters: c: mqtt客户端结构实例,里面已经赋值了url地址
|
||||
** output parameters: res: 解析IP地址和端口号存放
|
||||
** Returned value: 0:解析成功; 其它:解析失败
|
||||
** Descriptions: mqtt url<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>url<EFBFBD><EFBFBD>ַ
|
||||
** output parameters: res<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<EFBFBD><EFBFBD>ַ<EFBFBD>Ͷ˿ںŴ<EFBFBD><EFBFBD>
|
||||
** Returned value: 0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
||||
** URL example:
|
||||
** tcp://192.168.10.151:1883
|
||||
** tls://192.168.10.151:61614
|
||||
@ -188,10 +188,10 @@ _exit:
|
||||
#ifdef MQTT_USING_TLS
|
||||
/*********************************************************************************************************
|
||||
** Function name: mqtt_open_tls
|
||||
** Descriptions: 打开tls加密传输,分配加密传输的资源
|
||||
** input parameters: c: mqtt客户端结构实例
|
||||
** Descriptions: <EFBFBD><EFBFBD>tls<EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD>䣬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** output parameters: NONE
|
||||
** Returned value: RT_EOK:打开成功; 其它:错误码
|
||||
** Returned value: RT_EOK<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
static int mqtt_open_tls(mqtt_client *c)
|
||||
{
|
||||
@ -231,10 +231,10 @@ static int mqtt_open_tls(mqtt_client *c)
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: net_connect
|
||||
** Descriptions: 网络连接服务器
|
||||
** input parameters: c: mqtt客户端结构实例
|
||||
** Descriptions: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** output parameters: NONE
|
||||
** Returned value: 0:连接成功; 其它:连接失败
|
||||
** Returned value: 0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳɹ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
static int net_connect(mqtt_client *c)
|
||||
{
|
||||
@ -334,10 +334,10 @@ _exit:
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: net_disconnect
|
||||
** Descriptions: 网络关闭连接
|
||||
** input parameters: c: mqtt客户端结构实例
|
||||
** Descriptions: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** output parameters: NONE
|
||||
** Returned value: 0:关闭成功
|
||||
** Returned value: 0<EFBFBD><EFBFBD><EFBFBD>رճɹ<EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
static int net_disconnect(mqtt_client *c)
|
||||
{
|
||||
@ -361,10 +361,10 @@ static int net_disconnect(mqtt_client *c)
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: net_disconnect_exit
|
||||
** Descriptions: mqtt关闭,释放资源
|
||||
** input parameters: c: mqtt客户端结构实例
|
||||
** Descriptions: mqtt<EFBFBD>رգ<EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD>Դ
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** output parameters: NONE
|
||||
** Returned value: 0:关闭成功
|
||||
** Returned value: 0<EFBFBD><EFBFBD><EFBFBD>رճɹ<EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
static int net_disconnect_exit(mqtt_client *c)
|
||||
{
|
||||
@ -405,13 +405,13 @@ static int net_disconnect_exit(mqtt_client *c)
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: send_packet
|
||||
** Descriptions: 网络发送一个数据包
|
||||
** input parameters: c: mqtt客户端结构实例
|
||||
** buf: 发送数据缓冲区
|
||||
** length: 发送数据长度
|
||||
** Descriptions: <EFBFBD><EFBFBD><EFBFBD>緢<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** buf: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** length<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
||||
** output parameters: NONE
|
||||
** Returned value: PAHO_FAILURE: 发送失败,发生了一些异常,需要关闭连接
|
||||
** PAHO_SUCCESS: 发送成功
|
||||
** Returned value: PAHO_FAILURE: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һЩ<EFBFBD>쳣<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** PAHO_SUCCESS<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ͳɹ<EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
static int send_packet(mqtt_client *c, void *buf, int length)
|
||||
{
|
||||
@ -461,11 +461,11 @@ __send_exit:
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: recv_packet
|
||||
** Descriptions: 网络接收数据包
|
||||
** input parameters: c: mqtt客户端结构实例
|
||||
** Descriptions: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** output parameters: NONE
|
||||
** Returned value: -1: 连接已断开
|
||||
** bytes: 读到的数据长度
|
||||
** Returned value: -1: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѶϿ<EFBFBD>
|
||||
** bytes<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
static int recv_packet(mqtt_client *c, unsigned char *buf, int len, int timeout)
|
||||
{
|
||||
@ -518,11 +518,11 @@ static int recv_packet(mqtt_client *c, unsigned char *buf, int len, int timeout
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: decode_packet
|
||||
** Descriptions: 读取并解析mqtt帧中的长度字段
|
||||
** input parameters: c: mqtt客户端结构实例
|
||||
** timeout: 读取超时时间,以毫秒为单位
|
||||
** output parameters: value: 读取长度存放地址
|
||||
** Returned value: 读取次数
|
||||
** Descriptions: <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>mqtt֡<EFBFBD>еij<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** timeout<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>ʱʱ<EFBFBD>䣬<EFBFBD>Ժ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>λ
|
||||
** output parameters: value<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD>ŵ<EFBFBD>ַ
|
||||
** Returned value: <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
static int decode_packet(mqtt_client *c, int *value, int timeout)
|
||||
{
|
||||
@ -554,10 +554,10 @@ exit:
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: mqttpacket_readpacket
|
||||
** Descriptions: 读取一个mqtt数据包
|
||||
** input parameters: c: mqtt客户端结构实例
|
||||
** Descriptions: <EFBFBD><EFBFBD>ȡһ<EFBFBD><EFBFBD>mqtt<EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: 数据包类型
|
||||
** Returned value: <EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
static int mqttpacket_readpacket(mqtt_client *c)
|
||||
{
|
||||
@ -592,10 +592,10 @@ __read_exit:
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: get_next_packetId
|
||||
** Descriptions: 获取下一个有效的数据包ID
|
||||
** input parameters: c: mqtt客户端结构实例
|
||||
** Descriptions: <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>ID
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: 获取到的数据包ID
|
||||
** Returned value: <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>ID
|
||||
*********************************************************************************************************/
|
||||
static int get_next_packetId(mqtt_client *c)
|
||||
{
|
||||
@ -604,10 +604,10 @@ static int get_next_packetId(mqtt_client *c)
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: mqtt_connect
|
||||
** Descriptions: 连接MQTT服务器
|
||||
** input parameters: c: mqtt客户端结构实例
|
||||
** Descriptions: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>MQTT<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: 连接结果。-1:已经连接或连接失败;0:连接成功
|
||||
** Returned value: <EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>-1<EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳɹ<EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
static int mqtt_connect(mqtt_client *c)
|
||||
{
|
||||
@ -678,10 +678,10 @@ __connect_exit:
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: mqtt_disconnect
|
||||
** Descriptions: 断开连接MQTT服务器
|
||||
** input parameters: c: mqtt客户端结构实例
|
||||
** Descriptions: <EFBFBD>Ͽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>MQTT<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: 获取到的数据包ID
|
||||
** Returned value: <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>ID
|
||||
*********************************************************************************************************/
|
||||
static int mqtt_disconnect(mqtt_client *c)
|
||||
{
|
||||
@ -699,12 +699,12 @@ static int mqtt_disconnect(mqtt_client *c)
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: mqtt_subscribe
|
||||
** Descriptions: MQTT主题订阅
|
||||
** input parameters: c: mqtt客户端结构实例
|
||||
** topicFilter: 订阅的主题
|
||||
** qos: 订阅主题的链路质量
|
||||
** Descriptions: MQTT<EFBFBD><EFBFBD><EFBFBD>ⶩ<EFBFBD><EFBFBD>
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** topicFilter<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** qos<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: 订阅结果。0:订阅成功
|
||||
** Returned value: <EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>0:<EFBFBD><EFBFBD><EFBFBD>ijɹ<EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
static int mqtt_subscribe(mqtt_client *c, const char *topicFilter, enum QoS qos)
|
||||
{
|
||||
@ -773,10 +773,10 @@ _exit:
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: new_message_data
|
||||
** Descriptions: 赋值一个消息
|
||||
** input parameters: md: 待赋值的消息
|
||||
** aTopicName: 消息主题
|
||||
** aMessage: 消息内容
|
||||
** Descriptions: <EFBFBD><EFBFBD>ֵһ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
** input parameters: md: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
** aTopicName<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** aMessage<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: NULL
|
||||
*********************************************************************************************************/
|
||||
@ -788,12 +788,12 @@ static void new_message_data(message_data *md, MQTTString *aTopicName, mqtt_mess
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: is_topic_matched
|
||||
** Descriptions: 校验主题是否匹配
|
||||
** input parameters: topicFilter: 匹配目的主题
|
||||
** topic_name: 匹配源主题
|
||||
** Descriptions: У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ƥ<EFBFBD><EFBFBD>
|
||||
** input parameters: topicFilter: ƥ<EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** topic_name<EFBFBD><EFBFBD> ƥ<EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: 匹配结果。0:匹配失败;1:匹配成功
|
||||
** 通配符说明:
|
||||
** Returned value: ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>1<EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD>ɹ<EFBFBD>
|
||||
** ͨ<EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** #can only be at end
|
||||
** + and # can only be next to separator
|
||||
*********************************************************************************************************/
|
||||
@ -827,11 +827,11 @@ static char is_topic_matched(char *topicFilter, MQTTString *topic_name)
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: deliver_message
|
||||
** Descriptions: 处理MQTT消息
|
||||
** input parameters: topicFilter: 匹配目的主题
|
||||
** topic_name: 匹配源主题
|
||||
** Descriptions: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>MQTT<EFBFBD><EFBFBD>Ϣ
|
||||
** input parameters: topicFilter: ƥ<EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** topic_name<EFBFBD><EFBFBD> ƥ<EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: 处理结果
|
||||
** Returned value: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
static int deliver_message(mqtt_client *c, MQTTString *topic_name, mqtt_message *message)
|
||||
{
|
||||
@ -867,10 +867,10 @@ static int deliver_message(mqtt_client *c, MQTTString *topic_name, mqtt_message
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: mqtt_cycle
|
||||
** Descriptions: 处理MQTT消息
|
||||
** input parameters: c: mqtt客户端结构实例
|
||||
** Descriptions: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>MQTT<EFBFBD><EFBFBD>Ϣ
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: 处理结果
|
||||
** Returned value: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
static int mqtt_cycle(mqtt_client *c)
|
||||
{
|
||||
@ -1001,8 +1001,8 @@ __cycle_exit:
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: paho_mqtt_thread
|
||||
** Descriptions: mqtt处理核心线程
|
||||
** input parameters: param: 线程传入参数
|
||||
** Descriptions: mqtt<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
** input parameters: param: <EFBFBD>̴߳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: NULL
|
||||
*********************************************************************************************************/
|
||||
@ -1012,7 +1012,7 @@ static void paho_mqtt_thread(void *param)
|
||||
int i, rc, len;
|
||||
int rc_t = 0;
|
||||
|
||||
// 配置参数检查
|
||||
// <EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if(c->keepalive_interval == 0) {
|
||||
c->keepalive_interval = 60;
|
||||
}
|
||||
@ -1124,7 +1124,7 @@ __mqtt_start:
|
||||
goto __mqtt_disconnect;
|
||||
}
|
||||
|
||||
// 如果有接收到数据,则处理接收数据
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><EFBFBD>յ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (FD_ISSET(c->sock, &readset)) {
|
||||
rc_t = mqtt_cycle(c);
|
||||
if (rc_t < 0) goto __mqtt_disconnect;
|
||||
@ -1144,6 +1144,11 @@ __mqtt_restart:
|
||||
}
|
||||
|
||||
net_disconnect(c);
|
||||
|
||||
if (c->is_quit) {
|
||||
goto __mqtt_disconnect_exit;
|
||||
}
|
||||
|
||||
rt_thread_delay(c->reconnect_interval > 0 ?
|
||||
(c->reconnect_interval * RT_TICK_PER_SECOND) : (RT_TICK_PER_SECOND * 5));
|
||||
LOG_D("restart!");
|
||||
@ -1158,12 +1163,12 @@ __mqtt_disconnect_exit:
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: paho_mqtt_start
|
||||
** Descriptions: 初始化mqtt
|
||||
** input parameters: c: mqtt客户端结构实例
|
||||
** stack_size: mqtt核心线程栈大小
|
||||
** priority: mqtt核心线程优先级
|
||||
** Descriptions: <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>mqtt
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** stack_size<EFBFBD><EFBFBD> mqtt<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>ջ<EFBFBD><EFBFBD>С
|
||||
** priority<EFBFBD><EFBFBD> mqtt<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: 初始化结果。PAHO_SUCCESS:成功; 其它:失败
|
||||
** Returned value: <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>PAHO_SUCCESS<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
int paho_mqtt_start(mqtt_client *client, rt_uint32_t stack_size, rt_uint8_t priority)
|
||||
{
|
||||
@ -1203,10 +1208,10 @@ int paho_mqtt_start(mqtt_client *client, rt_uint32_t stack_size, rt_uint8_t pri
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: paho_mqtt_stop
|
||||
** Descriptions: 终止指定的mqtt应用
|
||||
** input parameters: c: mqtt客户端结构实例
|
||||
** Descriptions: <EFBFBD><EFBFBD>ָֹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>mqttӦ<EFBFBD><EFBFBD>
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: PAHO_SUCCESS:成功; 其它:失败
|
||||
** Returned value: PAHO_SUCCESS<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
int paho_mqtt_stop(mqtt_client *client)
|
||||
{
|
||||
@ -1216,13 +1221,13 @@ int paho_mqtt_stop(mqtt_client *client)
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: paho_mqtt_subscribe
|
||||
** Descriptions: mqtt消息订阅
|
||||
** input parameters: client: mqtt客户端结构实例
|
||||
** qos: 链路质量
|
||||
** topic: 订阅主题
|
||||
** callback: 匹配该主题的回调函数
|
||||
** Descriptions: mqtt<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** input parameters: client: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** qos<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** topic: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** callback: ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: PAHO_SUCCESS:成功; 其它:失败
|
||||
** Returned value: PAHO_SUCCESS<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
int paho_mqtt_subscribe(mqtt_client *client, enum QoS qos, const char *topic, subscribe_cb callback)
|
||||
{
|
||||
@ -1304,11 +1309,11 @@ __subscribe_exit:
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: paho_mqtt_unsubscribe
|
||||
** Descriptions: 取消mqtt消息订阅
|
||||
** input parameters: client: mqtt客户端结构实例
|
||||
** topic: 订阅主题
|
||||
** Descriptions: ȡ<EFBFBD><EFBFBD>mqtt<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** input parameters: client: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** topic: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: PAHO_SUCCESS:成功; 其它:失败
|
||||
** Returned value: PAHO_SUCCESS<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
int paho_mqtt_unsubscribe(mqtt_client *client, const char *topic)
|
||||
{
|
||||
@ -1384,14 +1389,14 @@ __unsubscribe_exit:
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: paho_mqtt_publish
|
||||
** Descriptions: 发布mqtt消息
|
||||
** input parameters: client: mqtt客户端结构实例
|
||||
** qos: 发布消息的链路质量
|
||||
** topic: 发布主题
|
||||
** payload: 发送的数据
|
||||
** length: 数据长度
|
||||
** Descriptions: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>mqtt<EFBFBD><EFBFBD>Ϣ
|
||||
** input parameters: client: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** qos<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** topic: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** payload<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** length<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: PAHO_SUCCESS:成功; 其它:失败
|
||||
** Returned value: PAHO_SUCCESS<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
int paho_mqtt_publish(mqtt_client *client, enum QoS qos, const char *topic, void *payload, size_t length)
|
||||
{
|
||||
@ -1450,10 +1455,10 @@ __publish_exit:
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: paho_mqtt_is_connected
|
||||
** Descriptions: 判断连接mqtt服务器是否成功
|
||||
** input parameters: client: mqtt客户端结构实例
|
||||
** Descriptions: <EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>mqtt<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ɹ<EFBFBD>
|
||||
** input parameters: client: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: 1: 连接成功;0:未连接
|
||||
** Returned value: 1: <EFBFBD><EFBFBD><EFBFBD>ӳɹ<EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
int paho_mqtt_is_connected(mqtt_client *client)
|
||||
{
|
||||
@ -1462,12 +1467,12 @@ int paho_mqtt_is_connected(mqtt_client *client)
|
||||
|
||||
/*********************************************************************************************************
|
||||
** Function name: paho_mqtt_control
|
||||
** Descriptions: mqtt客户端配置
|
||||
** input parameters: c: mqtt客户端结构实例
|
||||
** cmd: 配置命令
|
||||
** arg: 配置的值指针
|
||||
** Descriptions: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** input parameters: c: mqtt<EFBFBD>ͻ<EFBFBD><EFBFBD>˽ṹʵ<EFBFBD><EFBFBD>
|
||||
** cmd: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
** arg<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ֵָ<EFBFBD><EFBFBD>
|
||||
** output parameters: NULL
|
||||
** Returned value: 配置结果。PAHO_SUCCESS:成功;其它:失败
|
||||
** Returned value: <EFBFBD><EFBFBD><EFBFBD>ý<EFBFBD><EFBFBD><EFBFBD><EFBFBD>PAHO_SUCCESS<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
||||
*********************************************************************************************************/
|
||||
int paho_mqtt_control(mqtt_client *client, int cmd, void *arg)
|
||||
{
|
||||
|
@ -9,34 +9,24 @@
|
||||
#define DBG_LEVEL DBG_LOG
|
||||
#define DBG_COLOR
|
||||
#include <rtdbg.h>
|
||||
|
||||
#include "app_temperature.h"
|
||||
#include "mqtt_client.h"
|
||||
#include "belon_ble.h"
|
||||
/**
|
||||
* MQTT URI farmat:
|
||||
* domain mode
|
||||
* tcp://iot.eclipse.org:1883
|
||||
*
|
||||
* ipv4 mode
|
||||
* tcp://192.168.10.1:1883
|
||||
* ssl://192.168.10.1:1884
|
||||
*
|
||||
* ipv6 mode
|
||||
* tcp://[fe80::20c:29ff:fe9a:a07e]:1883
|
||||
* ssl://[fe80::20c:29ff:fe9a:a07e]:1884
|
||||
*/
|
||||
|
||||
#define MQTT_URI "tcp://svr.xa-poka.com:1883" //"tcp://iot.eclipse.org:1883"
|
||||
#define MQTT_SUBTOPIC "/iT18/iT18_112233445566/properties/report"
|
||||
#define MQTT_PUBTOPIC "/iT18/iT18_112233445566/properties/report"
|
||||
#define MQTT_SUBTOPIC "/iT18/iT18_C8478C428848/properties/report"
|
||||
#define MQTT_PUBTOPIC "/iT18/iT18_C8478C428848/properties/report"
|
||||
#define MQTT_WILLMSG "Goodbye!"
|
||||
// #define MQTT_USERNAME "admin"
|
||||
// #define MQTT_PASSWORD "admin"
|
||||
#define MQTT_CLIENTID "iT18_112233445566"
|
||||
// #define MQTT_CLIENTID "iT18_C8478C428848"
|
||||
/* define MQTT client context */
|
||||
|
||||
mqtt_client client;
|
||||
extern char g_sta_mac[6];
|
||||
static int is_started = 0;
|
||||
static uint32_t reciver_num=0;
|
||||
static beken_timer_t mqtt_connect_timer;
|
||||
static void mqtt_sub_callback(mqtt_client *c, message_data *msg_data)
|
||||
{
|
||||
reciver_num++;
|
||||
@ -69,6 +59,7 @@ static void mqtt_connect_callback(mqtt_client *c)
|
||||
static void mqtt_online_callback(mqtt_client *c)
|
||||
{
|
||||
LOG_D("inter mqtt_online_callback!");
|
||||
rtos_stop_timer(&mqtt_connect_timer);
|
||||
//paho_mqtt_subscribe(&client, QOS1, MQTT_SUBTOPIC, mqtt_sub_callback);
|
||||
}
|
||||
|
||||
@ -77,6 +68,22 @@ static void mqtt_offline_callback(mqtt_client *c)
|
||||
LOG_D("inter mqtt_offline_callback!");
|
||||
}
|
||||
|
||||
// void mqtt_connect_timeout_cb(void *arg)
|
||||
// {
|
||||
// LOG_E("MQTT connect timeout, stop client!");
|
||||
// mqtt_connect_timeout_flag = 1;
|
||||
// paho_mqtt_stop(&client);
|
||||
// if (client.buf) {
|
||||
// rt_free(client.buf);
|
||||
// client.buf = NULL;
|
||||
// }
|
||||
// if (client.readbuf) {
|
||||
// rt_free(client.readbuf);
|
||||
// client.readbuf = NULL;
|
||||
// }
|
||||
// is_started = 0;
|
||||
// }
|
||||
|
||||
int mqtt_start(char username[],char password[])
|
||||
{
|
||||
/* init condata param by using MQTTPacket_connectData_initializer */
|
||||
@ -94,7 +101,14 @@ int mqtt_start(char username[],char password[])
|
||||
|
||||
/* config connect param */
|
||||
memcpy(&client.condata, &condata, sizeof(condata));
|
||||
client.condata.clientID.cstring = MQTT_CLIENTID;
|
||||
|
||||
char device_id [64];
|
||||
rt_memset(device_id,0,sizeof(device_id));
|
||||
rt_sprintf(device_id,"%s_%02X%02X%02X%02X%02X%02X",
|
||||
PRODUCTID,g_sta_mac[0],g_sta_mac[1],g_sta_mac[2],g_sta_mac[3],g_sta_mac[4],g_sta_mac[5]);
|
||||
bk_printf("device_id: %s\n", device_id);
|
||||
|
||||
client.condata.clientID.cstring = device_id;
|
||||
client.condata.username.cstring = username;
|
||||
client.condata.password.cstring = password;
|
||||
client.condata.keepAliveInterval = 60;
|
||||
@ -148,6 +162,8 @@ int mqtt_start(char username[],char password[])
|
||||
|
||||
/* run mqtt client */
|
||||
paho_mqtt_start(&client, 8196, 20);
|
||||
// rtos_init_timer(&mqtt_connect_timer, 10000, mqtt_connect_timeout_cb, NULL);
|
||||
// rtos_start_timer(&mqtt_connect_timer);
|
||||
|
||||
is_started = 1;
|
||||
|
||||
|
6
env/tools/ConEmu/ConEmu.xml
vendored
6
env/tools/ConEmu/ConEmu.xml
vendored
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<key name="Software">
|
||||
<key name="ConEmu">
|
||||
<key name=".Vanilla" modified="2025-05-23 15:36:13" build="180206">
|
||||
<key name=".Vanilla" modified="2025-06-20 17:09:40" build="180206">
|
||||
<value name="StartType" type="hex" data="02"/>
|
||||
<value name="CmdLine" type="string" data=""/>
|
||||
<value name="StartTasksFile" type="string" data=""/>
|
||||
@ -259,8 +259,8 @@
|
||||
<value name="Cascaded" type="hex" data="01"/>
|
||||
<value name="IntegralSize" type="hex" data="00"/>
|
||||
<value name="WindowMode" type="dword" data="0000051f"/>
|
||||
<value name="ConWnd X" type="long" data="157"/>
|
||||
<value name="ConWnd Y" type="long" data="0"/>
|
||||
<value name="ConWnd X" type="long" data="661"/>
|
||||
<value name="ConWnd Y" type="long" data="250"/>
|
||||
<value name="LastMonitor" type="string" data="0,0,1920,1030"/>
|
||||
<value name="ConWnd Width" type="dword" data="00000075"/>
|
||||
<value name="ConWnd Height" type="dword" data="0000001a"/>
|
||||
|
106
env/tools/ConEmu/ConEmu/clink/profile/.history
vendored
106
env/tools/ConEmu/ConEmu/clink/profile/.history
vendored
@ -206,3 +206,109 @@ cd 。。
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons -c
|
||||
cd 。。
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons -c
|
||||
cd 。。
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
scons --beken=bk7252n -j32
|
||||
beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons -c
|
||||
cd 。。
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons -c
|
||||
cd 。。
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd 。。
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd 。。
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd 。。
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
scons --beken=bk7252n -j32
|
||||
beken_rtt_sdk_release-SDK_3.0.76
|
||||
cd 。。
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd 。。
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd 。。
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd 。。
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons -c
|
||||
scons --beken=bk7252n -j32
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd 。。
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
scons -c
|
||||
cd ..
|
||||
cd beken_rtt_sdk_release-SDK_3.0.76
|
||||
scons --beken=bk7252n -j32
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 12 -b 2000000 --uart-type CH340 --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-05-30 11:18:00.988 Current port : COM12 + BaudRate : 115200 connect success
|
||||
2025-05-30 11:18:00.988 do_reset_signal
|
||||
2025-05-30 11:18:00.988 Getting Bus...
|
||||
2025-05-30 11:18:02.016 Getting Bus...
|
@ -0,0 +1,502 @@
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-11 14:56:18.200 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-11 14:56:18.200 do_reset_signal
|
||||
2025-06-11 14:56:18.200 Getting Bus...
|
||||
2025-06-11 14:56:20.080 Getting Bus...
|
||||
2025-06-11 14:56:31.474 Gotten Bus...
|
||||
2025-06-11 14:56:31.521 Got ChipId: 0x7252a
|
||||
|
||||
2025-06-11 14:56:31.521 Current Chip is : BK7252N
|
||||
2025-06-11 14:56:31.552 rxf-uid : 43 31 30 34 35 38 33 2e 30 30 06 00 6a 00 a5 ff
|
||||
2025-06-11 14:56:31.552 Got FLashMID: 0x1560eb
|
||||
|
||||
2025-06-11 14:56:31.584 Current baudrate : 2000000 success
|
||||
2025-06-11 14:56:31.584 Unprotecting Flash
|
||||
2025-06-11 14:56:31.680 Unprotected Flash ->pass
|
||||
2025-06-11 14:56:31.681 [ 0 ] file_startAddr : 0x00000000
|
||||
2025-06-11 14:56:31.681 [ 0 ] file_path : C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin
|
||||
2025-06-11 14:56:31.681 [ 0 ] file_length : 0x132000 (1224 KB)
|
||||
2025-06-11 14:56:31.681 [ 0 ] file_crc : 0xe8476266
|
||||
2025-06-11 14:56:31.681 Begin EraseFlash
|
||||
2025-06-11 14:56:31.681 Start 4K Erase
|
||||
2025-06-11 14:56:31.681 End 4K Erase
|
||||
2025-06-11 14:56:31.681 Start 64K Erase
|
||||
2025-06-11 14:56:32.016 End 64K Erase
|
||||
2025-06-11 14:56:32.016 EraseFlash ->pass
|
||||
2025-06-11 14:56:32.019 [ 0 ] Begin write to flash...
|
||||
2025-06-11 14:56:45.874 WriteFlash ->pass
|
||||
2025-06-11 14:56:45.971 Enprotect pass
|
||||
2025-06-11 14:56:45.971 Boot_Reboot
|
||||
|
||||
2025-06-11 14:56:46.404 Total Test Time : 14.930 s
|
||||
2025-06-11 14:56:46.404 Writing Flash OK
|
||||
|
||||
2025-06-11 14:56:46.404
|
||||
==============================================================
|
||||
_ (done)
|
||||
| |
|
||||
__| | ___ _ __ ___
|
||||
/ _ |/ _ \| _ \ / _ \
|
||||
| (_| | (_) | | | | __/
|
||||
\__,_|\___/|_| |_|\___|
|
||||
{All Finished Successfully}
|
||||
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-11 16:03:56.760 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-11 16:03:56.760 do_reset_signal
|
||||
2025-06-11 16:03:56.760 Getting Bus...
|
||||
2025-06-11 16:03:58.079 Getting Bus...
|
||||
2025-06-11 16:03:59.282 Gotten Bus...
|
||||
2025-06-11 16:03:59.409 Got ChipId: 0x7252a
|
||||
|
||||
2025-06-11 16:03:59.409 Current Chip is : BK7252N
|
||||
2025-06-11 16:03:59.441 rxf-uid : 43 31 30 34 35 38 33 2e 30 30 05 00 6e 00 84 ff
|
||||
2025-06-11 16:03:59.441 Got FLashMID: 0x1560eb
|
||||
|
||||
2025-06-11 16:03:59.474 Current baudrate : 2000000 success
|
||||
2025-06-11 16:03:59.474 Unprotecting Flash
|
||||
2025-06-11 16:03:59.569 Unprotected Flash ->pass
|
||||
2025-06-11 16:03:59.570 [ 0 ] file_startAddr : 0x00000000
|
||||
2025-06-11 16:03:59.570 [ 0 ] file_path : C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin
|
||||
2025-06-11 16:03:59.570 [ 0 ] file_length : 0x132000 (1224 KB)
|
||||
2025-06-11 16:03:59.570 [ 0 ] file_crc : 0xe8476266
|
||||
2025-06-11 16:03:59.570 Begin EraseFlash
|
||||
2025-06-11 16:03:59.570 Start 4K Erase
|
||||
2025-06-11 16:03:59.570 End 4K Erase
|
||||
2025-06-11 16:03:59.570 Start 64K Erase
|
||||
2025-06-11 16:03:59.905 End 64K Erase
|
||||
2025-06-11 16:03:59.905 EraseFlash ->pass
|
||||
2025-06-11 16:03:59.908 [ 0 ] Begin write to flash...
|
||||
2025-06-11 16:04:13.763 WriteFlash ->pass
|
||||
2025-06-11 16:04:13.859 Enprotect pass
|
||||
2025-06-11 16:04:13.859 Boot_Reboot
|
||||
|
||||
2025-06-11 16:04:14.292 Total Test Time : 15.009 s
|
||||
2025-06-11 16:04:14.292 Writing Flash OK
|
||||
|
||||
2025-06-11 16:04:14.292
|
||||
==============================================================
|
||||
_ (done)
|
||||
| |
|
||||
__| | ___ _ __ ___
|
||||
/ _ |/ _ \| _ \ / _ \
|
||||
| (_| | (_) | | | | __/
|
||||
\__,_|\___/|_| |_|\___|
|
||||
{All Finished Successfully}
|
||||
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 16:52:51.216 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 16:52:51.216 do_reset_signal
|
||||
2025-06-16 16:52:51.216 Getting Bus...
|
||||
2025-06-16 16:52:52.946 Getting Bus...
|
||||
2025-06-16 16:52:59.306 Gotten Bus...
|
||||
2025-06-16 16:52:59.353 Got ChipId: 0x7252a
|
||||
|
||||
2025-06-16 16:52:59.353 Current Chip is : BK7252N
|
||||
2025-06-16 16:52:59.385 rxf-uid : 43 31 30 34 35 38 33 2e 30 30 06 00 63 00 b3 ff
|
||||
2025-06-16 16:52:59.385 Got FLashMID: 0x1560eb
|
||||
|
||||
2025-06-16 16:52:59.416 Current baudrate : 2000000 success
|
||||
2025-06-16 16:52:59.416 Unprotecting Flash
|
||||
2025-06-16 16:52:59.513 Unprotected Flash ->pass
|
||||
2025-06-16 16:52:59.513 [ 0 ] file_startAddr : 0x00000000
|
||||
2025-06-16 16:52:59.513 [ 0 ] file_path : C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin
|
||||
2025-06-16 16:52:59.513 [ 0 ] file_length : 0x132000 (1224 KB)
|
||||
2025-06-16 16:52:59.513 [ 0 ] file_crc : 0x321b9f75
|
||||
2025-06-16 16:52:59.513 Begin EraseFlash
|
||||
2025-06-16 16:52:59.513 Start 4K Erase
|
||||
2025-06-16 16:52:59.513 End 4K Erase
|
||||
2025-06-16 16:52:59.513 Start 64K Erase
|
||||
2025-06-16 16:53:00.344 End 64K Erase
|
||||
2025-06-16 16:53:00.344 EraseFlash ->pass
|
||||
2025-06-16 16:53:00.347 [ 0 ] Begin write to flash...
|
||||
2025-06-16 16:53:14.202 WriteFlash ->pass
|
||||
2025-06-16 16:53:14.298 Enprotect pass
|
||||
2025-06-16 16:53:14.298 Boot_Reboot
|
||||
|
||||
2025-06-16 16:53:14.732 Total Test Time : 15.426 s
|
||||
2025-06-16 16:53:14.732 Writing Flash OK
|
||||
|
||||
2025-06-16 16:53:14.732
|
||||
==============================================================
|
||||
_ (done)
|
||||
| |
|
||||
__| | ___ _ __ ___
|
||||
/ _ |/ _ \| _ \ / _ \
|
||||
| (_| | (_) | | | | __/
|
||||
\__,_|\___/|_| |_|\___|
|
||||
{All Finished Successfully}
|
||||
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 16:53:45.679 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 16:53:45.679 do_reset_signal
|
||||
2025-06-16 16:53:45.679 Getting Bus...
|
||||
2025-06-16 16:53:47.412 Getting Bus...
|
||||
2025-06-16 16:53:54.285 Gotten Bus...
|
||||
2025-06-16 16:53:54.332 Got ChipId: 0x7252a
|
||||
|
||||
2025-06-16 16:53:54.332 Current Chip is : BK7252N
|
||||
2025-06-16 16:53:54.364 rxf-uid : 43 31 30 34 35 38 33 2e 30 30 05 00 d8 00 72 ff
|
||||
2025-06-16 16:53:54.364 Got FLashMID: 0x1560eb
|
||||
|
||||
2025-06-16 16:53:54.396 Current baudrate : 2000000 success
|
||||
2025-06-16 16:53:54.396 Unprotecting Flash
|
||||
2025-06-16 16:53:54.596 Unprotected Flash ->pass
|
||||
2025-06-16 16:53:54.596 [ 0 ] file_startAddr : 0x00000000
|
||||
2025-06-16 16:53:54.596 [ 0 ] file_path : C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin
|
||||
2025-06-16 16:53:54.596 [ 0 ] file_length : 0x132000 (1224 KB)
|
||||
2025-06-16 16:53:54.596 [ 0 ] file_crc : 0x321b9f75
|
||||
2025-06-16 16:53:54.596 Begin EraseFlash
|
||||
2025-06-16 16:53:54.596 Start 4K Erase
|
||||
2025-06-16 16:53:54.596 End 4K Erase
|
||||
2025-06-16 16:53:54.596 Start 64K Erase
|
||||
2025-06-16 16:53:57.417 End 64K Erase
|
||||
2025-06-16 16:53:57.417 EraseFlash ->pass
|
||||
2025-06-16 16:53:57.420 [ 0 ] Begin write to flash...
|
||||
2025-06-16 16:53:58.184 CheckCRC ->fail ,Address = 0x0000f000
|
||||
2025-06-16 16:53:59.124 Getting Bus...
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 16:54:08.521 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 16:54:08.521 do_reset_signal
|
||||
2025-06-16 16:54:08.521 Getting Bus...
|
||||
2025-06-16 16:54:09.831 Getting Bus...
|
||||
2025-06-16 16:54:24.832 LinkCheck Timeout
|
||||
2025-06-16 16:54:24.832 do_reset_signal
|
||||
2025-06-16 16:54:24.832 BL2 Getting Bus...
|
||||
2025-06-16 16:54:39.833 GetBus fail!
|
||||
2025-06-16 16:54:39.844 Total Test Time : 0.010 s
|
||||
2025-06-16 16:54:39.875 Boot_Reboot
|
||||
|
||||
2025-06-16 16:54:40.321 Writing Flash Failed, code 0
|
||||
|
||||
2025-06-16 16:54:40.321
|
||||
==============================================================
|
||||
(warning)
|
||||
(_)
|
||||
__ ____ _ _ __ _ __ _ _ __ __ _
|
||||
\ \ /\ / / _` | '__| '_ \| | '_ \ / _` |
|
||||
\ V V / (_| | | | | | | | | | | (_| |
|
||||
\_/\_/ \__,_|_| |_| |_|_|_| |_|\__, |
|
||||
__/ |
|
||||
|___/
|
||||
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 16:54:45.151 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 16:54:45.151 do_reset_signal
|
||||
2025-06-16 16:54:45.151 Getting Bus...
|
||||
2025-06-16 16:54:46.461 Getting Bus...
|
||||
2025-06-16 16:55:01.461 LinkCheck Timeout
|
||||
2025-06-16 16:55:01.461 do_reset_signal
|
||||
2025-06-16 16:55:01.461 BL2 Getting Bus...
|
||||
2025-06-16 16:55:16.463 GetBus fail!
|
||||
2025-06-16 16:55:16.474 Total Test Time : 0.011 s
|
||||
2025-06-16 16:55:16.507 Boot_Reboot
|
||||
|
||||
2025-06-16 16:55:16.952 Writing Flash Failed, code 0
|
||||
|
||||
2025-06-16 16:55:16.952
|
||||
==============================================================
|
||||
(warning)
|
||||
(_)
|
||||
__ ____ _ _ __ _ __ _ _ __ __ _
|
||||
\ \ /\ / / _` | '__| '_ \| | '_ \ / _` |
|
||||
\ V V / (_| | | | | | | | | | | (_| |
|
||||
\_/\_/ \__,_|_| |_| |_|_|_| |_|\__, |
|
||||
__/ |
|
||||
|___/
|
||||
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 16:55:18.858 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 16:55:18.858 do_reset_signal
|
||||
2025-06-16 16:55:18.858 Getting Bus...
|
||||
2025-06-16 16:55:20.169 Getting Bus...
|
||||
2025-06-16 16:55:35.170 LinkCheck Timeout
|
||||
2025-06-16 16:55:35.170 do_reset_signal
|
||||
2025-06-16 16:55:35.170 BL2 Getting Bus...
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 16:55:52.288 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 16:55:52.288 do_reset_signal
|
||||
2025-06-16 16:55:52.288 Getting Bus...
|
||||
2025-06-16 16:55:53.089 Gotten Bus...
|
||||
2025-06-16 16:55:53.218 Got ChipId: 0x7252a
|
||||
|
||||
2025-06-16 16:55:53.218 Current Chip is : BK7252N
|
||||
2025-06-16 16:55:53.249 rxf-uid : 43 31 30 34 35 38 33 2e 30 30 05 00 75 00 6d ff
|
||||
2025-06-16 16:55:53.249 Got FLashMID: 0x1560eb
|
||||
|
||||
2025-06-16 16:55:53.281 Current baudrate : 2000000 success
|
||||
2025-06-16 16:55:53.281 Unprotecting Flash
|
||||
2025-06-16 16:55:53.377 Unprotected Flash ->pass
|
||||
2025-06-16 16:55:53.377 [ 0 ] file_startAddr : 0x00000000
|
||||
2025-06-16 16:55:53.378 [ 0 ] file_path : C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin
|
||||
2025-06-16 16:55:53.378 [ 0 ] file_length : 0x132000 (1224 KB)
|
||||
2025-06-16 16:55:53.378 [ 0 ] file_crc : 0x321b9f75
|
||||
2025-06-16 16:55:53.378 Begin EraseFlash
|
||||
2025-06-16 16:55:53.378 Start 4K Erase
|
||||
2025-06-16 16:55:53.378 End 4K Erase
|
||||
2025-06-16 16:55:53.378 Start 64K Erase
|
||||
2025-06-16 16:55:53.712 End 64K Erase
|
||||
2025-06-16 16:55:53.712 EraseFlash ->pass
|
||||
2025-06-16 16:55:53.715 [ 0 ] Begin write to flash...
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 16:56:11.021 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 16:56:11.021 do_reset_signal
|
||||
2025-06-16 16:56:11.021 Getting Bus...
|
||||
2025-06-16 16:56:12.332 Getting Bus...
|
||||
2025-06-16 16:56:27.333 LinkCheck Timeout
|
||||
2025-06-16 16:56:27.334 do_reset_signal
|
||||
2025-06-16 16:56:27.334 BL2 Getting Bus...
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 16:56:37.873 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 16:56:37.873 do_reset_signal
|
||||
2025-06-16 16:56:37.873 Getting Bus...
|
||||
2025-06-16 16:56:39.183 Getting Bus...
|
||||
2025-06-16 16:56:54.184 LinkCheck Timeout
|
||||
2025-06-16 16:56:54.185 do_reset_signal
|
||||
2025-06-16 16:56:54.185 BL2 Getting Bus...
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 16:57:10.095 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 16:57:10.095 do_reset_signal
|
||||
2025-06-16 16:57:10.095 Getting Bus...
|
||||
2025-06-16 16:57:11.406 Getting Bus...
|
||||
2025-06-16 16:57:13.858 Gotten Bus...
|
||||
2025-06-16 16:57:13.906 Got ChipId: 0x7252a
|
||||
|
||||
2025-06-16 16:57:13.906 Current Chip is : BK7252N
|
||||
2025-06-16 16:57:13.938 rxf-uid : 43 31 30 34 35 38 33 2e 30 30 05 00 bc 00 91 ff
|
||||
2025-06-16 16:57:13.938 Got FLashMID: 0x1560eb
|
||||
|
||||
2025-06-16 16:57:13.970 Current baudrate : 2000000 success
|
||||
2025-06-16 16:57:13.970 Unprotecting Flash
|
||||
2025-06-16 16:57:14.066 Unprotected Flash ->pass
|
||||
2025-06-16 16:57:14.066 [ 0 ] file_startAddr : 0x00000000
|
||||
2025-06-16 16:57:14.066 [ 0 ] file_path : C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin
|
||||
2025-06-16 16:57:14.066 [ 0 ] file_length : 0x132000 (1224 KB)
|
||||
2025-06-16 16:57:14.066 [ 0 ] file_crc : 0x321b9f75
|
||||
2025-06-16 16:57:14.066 Begin EraseFlash
|
||||
2025-06-16 16:57:14.066 Start 4K Erase
|
||||
2025-06-16 16:57:14.066 End 4K Erase
|
||||
2025-06-16 16:57:14.066 Start 64K Erase
|
||||
2025-06-16 16:57:14.402 End 64K Erase
|
||||
2025-06-16 16:57:14.402 EraseFlash ->pass
|
||||
2025-06-16 16:57:14.405 [ 0 ] Begin write to flash...
|
||||
2025-06-16 16:57:28.260 WriteFlash ->pass
|
||||
2025-06-16 16:57:28.355 Enprotect pass
|
||||
2025-06-16 16:57:28.355 Boot_Reboot
|
||||
|
||||
2025-06-16 16:57:28.789 Total Test Time : 14.930 s
|
||||
2025-06-16 16:57:28.789 Writing Flash OK
|
||||
|
||||
2025-06-16 16:57:28.789
|
||||
==============================================================
|
||||
_ (done)
|
||||
| |
|
||||
__| | ___ _ __ ___
|
||||
/ _ |/ _ \| _ \ / _ \
|
||||
| (_| | (_) | | | | __/
|
||||
\__,_|\___/|_| |_|\___|
|
||||
{All Finished Successfully}
|
||||
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 16:57:40.910 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 16:57:40.910 do_reset_signal
|
||||
2025-06-16 16:57:40.910 Getting Bus...
|
||||
2025-06-16 16:57:42.220 Getting Bus...
|
||||
2025-06-16 16:57:57.220 LinkCheck Timeout
|
||||
2025-06-16 16:57:57.220 do_reset_signal
|
||||
2025-06-16 16:57:57.220 BL2 Getting Bus...
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 16:58:05.441 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 16:58:05.441 do_reset_signal
|
||||
2025-06-16 16:58:05.441 Getting Bus...
|
||||
2025-06-16 16:58:06.752 Getting Bus...
|
||||
2025-06-16 16:58:21.754 LinkCheck Timeout
|
||||
2025-06-16 16:58:21.754 do_reset_signal
|
||||
2025-06-16 16:58:21.754 BL2 Getting Bus...
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 16:58:58.227 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 16:58:58.227 do_reset_signal
|
||||
2025-06-16 16:58:58.228 Getting Bus...
|
||||
2025-06-16 16:58:58.958 Gotten Bus...
|
||||
2025-06-16 16:58:59.005 Got ChipId: 0x7252a
|
||||
|
||||
2025-06-16 16:58:59.006 Current Chip is : BK7252N
|
||||
2025-06-16 16:58:59.037 rxf-uid : 43 31 30 34 35 38 33 2e 30 30 05 00 75 00 6d ff
|
||||
2025-06-16 16:58:59.037 Got FLashMID: 0x1560eb
|
||||
|
||||
2025-06-16 16:58:59.069 Current baudrate : 2000000 success
|
||||
2025-06-16 16:58:59.069 Unprotecting Flash
|
||||
2025-06-16 16:58:59.101 Unprotected Flash ->pass
|
||||
2025-06-16 16:58:59.101 [ 0 ] file_startAddr : 0x00000000
|
||||
2025-06-16 16:58:59.101 [ 0 ] file_path : C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin
|
||||
2025-06-16 16:58:59.102 [ 0 ] file_length : 0x132000 (1224 KB)
|
||||
2025-06-16 16:58:59.102 [ 0 ] file_crc : 0x321b9f75
|
||||
2025-06-16 16:58:59.102 Begin EraseFlash
|
||||
2025-06-16 16:58:59.102 Start 4K Erase
|
||||
2025-06-16 16:58:59.102 End 4K Erase
|
||||
2025-06-16 16:58:59.102 Start 64K Erase
|
||||
2025-06-16 16:58:59.437 End 64K Erase
|
||||
2025-06-16 16:58:59.437 EraseFlash ->pass
|
||||
2025-06-16 16:58:59.440 [ 0 ] Begin write to flash...
|
||||
2025-06-16 16:59:13.294 WriteFlash ->pass
|
||||
2025-06-16 16:59:13.390 Enprotect pass
|
||||
2025-06-16 16:59:13.390 Boot_Reboot
|
||||
|
||||
2025-06-16 16:59:13.823 Total Test Time : 14.866 s
|
||||
2025-06-16 16:59:13.823 Writing Flash OK
|
||||
|
||||
2025-06-16 16:59:13.823
|
||||
==============================================================
|
||||
_ (done)
|
||||
| |
|
||||
__| | ___ _ __ ___
|
||||
/ _ |/ _ \| _ \ / _ \
|
||||
| (_| | (_) | | | | __/
|
||||
\__,_|\___/|_| |_|\___|
|
||||
{All Finished Successfully}
|
||||
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 16:59:21.039 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 16:59:21.039 do_reset_signal
|
||||
2025-06-16 16:59:21.039 Getting Bus...
|
||||
2025-06-16 16:59:22.349 Getting Bus...
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 16:59:35.660 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 16:59:35.660 do_reset_signal
|
||||
2025-06-16 16:59:35.660 Getting Bus...
|
||||
2025-06-16 16:59:36.971 Getting Bus...
|
||||
2025-06-16 16:59:51.972 LinkCheck Timeout
|
||||
2025-06-16 16:59:51.972 do_reset_signal
|
||||
2025-06-16 16:59:51.973 BL2 Getting Bus...
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 17:00:03.214 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 17:00:03.214 do_reset_signal
|
||||
2025-06-16 17:00:03.214 Getting Bus...
|
||||
2025-06-16 17:00:04.525 Getting Bus...
|
||||
2025-06-16 17:00:19.526 LinkCheck Timeout
|
||||
2025-06-16 17:00:19.526 do_reset_signal
|
||||
2025-06-16 17:00:19.527 BL2 Getting Bus...
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 17:00:27.203 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 17:00:27.203 do_reset_signal
|
||||
2025-06-16 17:00:27.203 Getting Bus...
|
||||
2025-06-16 17:00:28.513 Getting Bus...
|
||||
2025-06-16 17:00:43.513 LinkCheck Timeout
|
||||
2025-06-16 17:00:43.514 do_reset_signal
|
||||
2025-06-16 17:00:43.514 BL2 Getting Bus...
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 17:00:52.725 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 17:00:52.725 do_reset_signal
|
||||
2025-06-16 17:00:52.725 Getting Bus...
|
||||
2025-06-16 17:00:54.036 Getting Bus...
|
||||
2025-06-16 17:01:09.037 LinkCheck Timeout
|
||||
2025-06-16 17:01:09.037 do_reset_signal
|
||||
2025-06-16 17:01:09.037 BL2 Getting Bus...
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 13 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 17:01:14.015 Current port : COM13 + BaudRate : 115200 connect success
|
||||
2025-06-16 17:01:14.015 do_reset_signal
|
||||
2025-06-16 17:01:14.015 Getting Bus...
|
||||
2025-06-16 17:01:15.326 Getting Bus...
|
||||
2025-06-16 17:01:30.327 LinkCheck Timeout
|
||||
2025-06-16 17:01:30.327 do_reset_signal
|
||||
2025-06-16 17:01:30.327 BL2 Getting Bus...
|
File diff suppressed because it is too large
Load Diff
@ -70,3 +70,77 @@
|
||||
__/ |
|
||||
|___/
|
||||
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 6 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-05-26 14:27:54.289 Current port : COM6 + BaudRate : 115200 connect failed
|
||||
2025-05-26 14:27:54.289 Connect device fail!
|
||||
2025-05-26 14:27:54.300 Total Test Time : 0.000 s
|
||||
2025-05-26 14:27:54.300 Writing Flash Failed, code 0
|
||||
|
||||
2025-05-26 14:27:54.300
|
||||
==============================================================
|
||||
(warning)
|
||||
(_)
|
||||
__ ____ _ _ __ _ __ _ _ __ __ _
|
||||
\ \ /\ / / _` | '__| '_ \| | '_ \ / _` |
|
||||
\ V V / (_| | | | | | | | | | | (_| |
|
||||
\_/\_/ \__,_|_| |_| |_|_|_| |_|\__, |
|
||||
__/ |
|
||||
|___/
|
||||
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 6 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 6 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 6 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 6 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 6 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 6 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 16:52:23.965 Current port : COM6 + BaudRate : 115200 connect failed
|
||||
2025-06-16 16:52:23.965 Connect device fail!
|
||||
2025-06-16 16:52:23.976 Total Test Time : 0.000 s
|
||||
2025-06-16 16:52:23.976 Writing Flash Failed, code 0
|
||||
|
||||
2025-06-16 16:52:23.976
|
||||
==============================================================
|
||||
(warning)
|
||||
(_)
|
||||
__ ____ _ _ __ _ __ _ _ __ __ _
|
||||
\ \ /\ / / _` | '__| '_ \| | '_ \ / _` |
|
||||
\ V V / (_| | | | | | | | | | | (_| |
|
||||
\_/\_/ \__,_|_| |_| |_|_|_| |_|\__, |
|
||||
__/ |
|
||||
|___/
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
|
||||
=====================================================================
|
||||
cmdline: |C:/Users/hjf/Desktop/temperature_iT18/tool/BEKEN_BKFIL_V2.1.11.15_20241119/BEKEN_BKFIL_V2.1.11.15_20241119/bk_loader.exe download -p 7 -b 2000000 --uart-type OTHER --mainBin-multi C:/Users/hjf/Desktop/temperature_iT18/beken_rtt_sdk_release-SDK_3.0.76/out/all_2M.1220.bin@0x0-0x132000 --reboot 0 --fast-link 1 |
|
||||
bk_loader version 2.1.11.15: build @Nov 14 2024 19:17:41
|
||||
2025-06-16 17:10:01.066 Current port : COM7 + BaudRate : 115200 connect success
|
||||
2025-06-16 17:10:01.066 do_reset_signal
|
||||
2025-06-16 17:10:01.066 Getting Bus...
|
||||
2025-06-16 17:10:03.874 Getting Bus...
|
||||
2025-06-16 17:10:18.947 LinkCheck Timeout
|
||||
2025-06-16 17:10:18.947 do_reset_signal
|
||||
2025-06-16 17:10:18.947 BL2 Getting Bus...
|
@ -2,7 +2,7 @@
|
||||
Theme=浅蓝色
|
||||
latest_version=
|
||||
Language=0
|
||||
UartPort=10
|
||||
UartPort=14
|
||||
UartPort_selected=true
|
||||
Baudrate=2000000
|
||||
Origin_EXE=
|
||||
@ -19,8 +19,8 @@ Device_ID_0=11
|
||||
Device_ID_1=22
|
||||
Device_ID_2=33
|
||||
Device_ID_3=44
|
||||
Device_ID_4=09
|
||||
Device_ID_5=7a
|
||||
Device_ID_4=0a
|
||||
Device_ID_5=29
|
||||
Device_ID_address=0x001e0024
|
||||
Device_ID_length=6
|
||||
Device_ID_auto_rolling=true
|
||||
|
Loading…
x
Reference in New Issue
Block a user