加了点4g连接错误处理函数
This commit is contained in:
parent
4468240528
commit
3518b5946e
|
@ -2,7 +2,7 @@
|
|||
* @Author: mbw
|
||||
* @Date: 2024-10-09 08:42:14
|
||||
* @LastEditors: mbw && 1600520629@qq.com
|
||||
* @LastEditTime: 2024-12-04 15:56:22
|
||||
* @LastEditTime: 2025-01-02 15:29:19
|
||||
* @FilePath: \ble_bjq_ch303rct6_ml307\bsp\inc\at_device_ml307.h
|
||||
* @Description:
|
||||
* @
|
||||
|
@ -46,7 +46,7 @@
|
|||
#define TCP_GET_SOCKET_STATUS ("AT+NSOSTATUS=%d")
|
||||
#define TCP_CONNECT_CMD ("AT+MIPOPEN=%d,\"TCP\",\"%s\",%s") //AT+MIPOPEN=0,"TCP","120.27.12.119",2040
|
||||
#define TCP_CONNECT_STATE ("AT+MIPSTATE=%d")//AT+MIPSTATE=0 //
|
||||
#define TCP_SEND_DATA ("AT+MIPSEND=%d,%d,\"%s\"") //
|
||||
#define TCP_SEND_DATA ("AT+MIPSEND=%d,%d,\"%s\"")
|
||||
#define TCP_CLOSE_SOCKET ("AT+MIPCLOSE=%d") /* close socket_id */
|
||||
|
||||
#define AT_DEVICE_ML307_SOCKETS_NUM 5
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @Author : stark1898y 1658608470@qq.com
|
||||
* @Date : 2024-09-04 13:33:49
|
||||
* @LastEditors: mbw && 1600520629@qq.com
|
||||
* @LastEditTime: 2025-01-02 10:16:34
|
||||
* @LastEditTime: 2025-01-02 15:27:57
|
||||
* @FilePath: \ble_bjq_ch303rct6_ml307\bsp\src\at_device_ml307.c
|
||||
* @Description :
|
||||
*
|
||||
|
@ -176,7 +176,7 @@ static void urc_tcp_connect_state(struct at_client *client, const char *data, rt
|
|||
|
||||
if (sscanf(data, "+MIPOPEN:%d,%d", &id, &err_code) == 2)
|
||||
{
|
||||
if (id == socket_id)
|
||||
if ((id == socket_id)&&(err_code == 0))
|
||||
{
|
||||
ml307_conncet_tcp_flag = 1;
|
||||
rt_sem_release(ml307_connect_sem);
|
||||
|
@ -225,6 +225,7 @@ static const struct at_urc urc_table[] = {
|
|||
{"+MIPOPEN:", "\r\n", urc_tcp_connect_state},
|
||||
{"+MIPURC: \"disconn\"", "\r\n", urc_tcp_disconnect},
|
||||
{"+MIPURC: \"rtcp\"", "\r\n", urc_tcp_recv},
|
||||
{"+MATREADY", "\r\n", urc_device_reset},
|
||||
};
|
||||
static void show_resp_info(at_response_t resp)
|
||||
{
|
||||
|
@ -292,7 +293,7 @@ static int at_device_ml307_connect_tcp(struct at_device *device)
|
|||
{
|
||||
if (at_resp_get_line_by_kw(resp, "OK") != RT_NULL)
|
||||
{
|
||||
if (rt_sem_take(ml307_connect_sem, 5000) == RT_EOK)
|
||||
if (rt_sem_take(ml307_connect_sem, 60000) == RT_EOK)
|
||||
{
|
||||
LOG_D("ml307 connect to tcp server success");
|
||||
ret = RT_EOK;
|
||||
|
@ -313,7 +314,7 @@ static int at_device_ml307_connect_tcp(struct at_device *device)
|
|||
at_device_ml307_disconnect_tcp(device);
|
||||
}
|
||||
}
|
||||
rt_thread_mdelay(3000);
|
||||
rt_thread_mdelay(60000);
|
||||
}
|
||||
at_delete_resp(resp);
|
||||
return ret;
|
||||
|
@ -852,19 +853,24 @@ static void ml307_init_thread_entry(void *parameter)
|
|||
result = -RT_ERROR;
|
||||
goto __exit;
|
||||
}
|
||||
/*设置包模式*/
|
||||
if (at_obj_exec_cmd(device->client, resp, "AT+MIPCFG=\"encoding\",0,1,1") != RT_EOK)
|
||||
{
|
||||
result = -RT_ERROR;
|
||||
goto __exit;
|
||||
}
|
||||
/*设置包模式*/
|
||||
if (at_obj_exec_cmd(device->client, resp, "AT+MIPCFG=\"autofree\",0,0") != RT_EOK)
|
||||
{
|
||||
result = -RT_ERROR;
|
||||
goto __exit;
|
||||
}
|
||||
/*设置心跳包*/
|
||||
if (at_obj_exec_cmd(device->client, resp, "AT+MIPTKA=0,1,120,60,1") != RT_EOK)
|
||||
{
|
||||
result = -RT_ERROR;
|
||||
goto __exit;
|
||||
}
|
||||
/*设置包模式*/
|
||||
if (at_obj_exec_cmd(device->client, resp, "AT+MIPCFG=\"encoding\",0,1,1") != RT_EOK)
|
||||
{
|
||||
result = -RT_ERROR;
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
{
|
||||
#define ML307_NETDEV_HWADDR_LEN 8
|
||||
#define ML307_IMEI_LEN 15
|
||||
|
|
|
@ -17,15 +17,13 @@ struct flash_sever_info sever_info =
|
|||
{
|
||||
.server_url = "8.130.122.162",
|
||||
.server_port = "7153",
|
||||
// .server_port = "36078",
|
||||
// .server_url = "8.135.10.183",
|
||||
};
|
||||
|
||||
/*默认的系统配置*/
|
||||
rt_uint8_t sys_hw_ver = 0x10;
|
||||
rt_uint8_t sys_sw_ver = 0x11;
|
||||
rt_uint8_t sys_nb_retry = 0x03; // 重试次数3次
|
||||
rt_uint16_t sys_nb_upload_cycle = 0x000A; // 120分钟一次
|
||||
rt_uint16_t sys_nb_upload_cycle = 0x0001; // 120分钟一次
|
||||
rt_uint16_t sys_alarm_h_value = 0x0032; // 50
|
||||
rt_uint16_t sys_alarm_l_value = 0x09C4; // 2500
|
||||
rt_uint8_t sys_temp_alarm_threshold = 0x32;
|
||||
|
|
Loading…
Reference in New Issue