加了优先级发送部分
This commit is contained in:
parent
e9614b7115
commit
221fbe4950
|
@ -2,7 +2,7 @@
|
||||||
* @Author: mbw
|
* @Author: mbw
|
||||||
* @Date: 2024-10-23 17:14:16
|
* @Date: 2024-10-23 17:14:16
|
||||||
* @LastEditors: mbw && 1600520629@qq.com
|
* @LastEditors: mbw && 1600520629@qq.com
|
||||||
* @LastEditTime: 2025-01-25 14:10:49
|
* @LastEditTime: 2025-02-15 14:12:31
|
||||||
* @FilePath: \JT-DT-YD4N02A_RTT_MRS-NT26K\applications\main.c
|
* @FilePath: \JT-DT-YD4N02A_RTT_MRS-NT26K\applications\main.c
|
||||||
* @Descrt_thread_
|
* @Descrt_thread_
|
||||||
*
|
*
|
||||||
|
@ -427,17 +427,10 @@ int main(void)
|
||||||
Nt26k_Send_Event(kNt26kPowerDownEvent);
|
Nt26k_Send_Event(kNt26kPowerDownEvent);
|
||||||
#endif
|
#endif
|
||||||
rt_uint8_t cnt = 0;
|
rt_uint8_t cnt = 0;
|
||||||
while ((device_power_down_flag == 0) && (cnt < 10)) // 等待接收到掉电事件响应
|
while ((nt26k_power_down_flag == 0) && (cnt < 20)) // 等待接收到物联网模组关机完成
|
||||||
{
|
{
|
||||||
rt_thread_mdelay(500);
|
rt_thread_mdelay(1000);
|
||||||
LOG_D("cnt1 = %d", cnt);
|
LOG_D("cnt = %d", cnt);
|
||||||
cnt++;
|
|
||||||
}
|
|
||||||
cnt = 0;
|
|
||||||
while ((nt26k_power_down_flag == 0) && (cnt < 10)) // 等待接收到物联网模组关机完成
|
|
||||||
{
|
|
||||||
rt_thread_mdelay(500);
|
|
||||||
LOG_D("cnt2 = %d", cnt);
|
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,11 @@
|
||||||
#define SYS_RELAY_SWITCH (0X04U)
|
#define SYS_RELAY_SWITCH (0X04U)
|
||||||
#define SYS_ALARM_VALVE_MAX (0X30U)
|
#define SYS_ALARM_VALVE_MAX (0X30U)
|
||||||
|
|
||||||
#define SYS_IOT_URL ("8.130.127.158")
|
// #define SYS_IOT_URL ("8.130.127.158")
|
||||||
#define SYS_IOT_PORT ("7101")
|
// #define SYS_IOT_PORT ("7101")
|
||||||
|
|
||||||
|
#define SYS_IOT_URL ("121.41.227.175")
|
||||||
|
#define SYS_IOT_PORT ("2345")
|
||||||
|
|
||||||
// 定义宏来打印编译时间和日期
|
// 定义宏来打印编译时间和日期
|
||||||
#define COMPILE_TIME \
|
#define COMPILE_TIME \
|
||||||
|
|
|
@ -210,7 +210,6 @@ extern rt_uint8_t nt26k_conncet_tcp_flag;
|
||||||
extern rt_uint8_t nt26k_connect_sever_flag;
|
extern rt_uint8_t nt26k_connect_sever_flag;
|
||||||
extern rt_uint8_t nt26k_disconnect_pdp_flag;
|
extern rt_uint8_t nt26k_disconnect_pdp_flag;
|
||||||
extern rt_uint8_t power_on_send_flag;
|
extern rt_uint8_t power_on_send_flag;
|
||||||
extern rt_uint8_t device_power_down_flag;
|
|
||||||
extern rt_uint8_t nt26k_power_down_flag;
|
extern rt_uint8_t nt26k_power_down_flag;
|
||||||
|
|
||||||
int BSP_Nt26k_Thread_Init(void);
|
int BSP_Nt26k_Thread_Init(void);
|
||||||
|
|
|
@ -299,7 +299,7 @@ void show_resp_info(at_response_t resp)
|
||||||
|
|
||||||
int at_device_nt26k_disconnect_tcp(struct at_device *device)
|
int at_device_nt26k_disconnect_tcp(struct at_device *device)
|
||||||
{
|
{
|
||||||
#define NT26K_CLOSE_REP_TIME (10 * AT_DEFAULT_TIMEOUT)
|
#define NT26K_CLOSE_REP_TIME (5 * AT_DEFAULT_TIMEOUT)
|
||||||
|
|
||||||
at_response_t resp = at_create_resp(AT_CLIENT_RECV_BUFF_LEN, 0, NT26K_CLOSE_REP_TIME);
|
at_response_t resp = at_create_resp(AT_CLIENT_RECV_BUFF_LEN, 0, NT26K_CLOSE_REP_TIME);
|
||||||
if (resp == RT_NULL)
|
if (resp == RT_NULL)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @Author: mbw
|
* @Author: mbw
|
||||||
* @Date: 2024-10-09 08:42:14
|
* @Date: 2024-10-09 08:42:14
|
||||||
* @LastEditors: mbw && 1600520629@qq.com
|
* @LastEditors: mbw && 1600520629@qq.com
|
||||||
* @LastEditTime: 2025-02-14 12:04:59
|
* @LastEditTime: 2025-02-15 14:15:57
|
||||||
* @FilePath: \JT-DT-YD4N02A_RTT_MRS-NT26K\bsp\src\bsp_nt26k.c
|
* @FilePath: \JT-DT-YD4N02A_RTT_MRS-NT26K\bsp\src\bsp_nt26k.c
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
|
@ -67,7 +67,6 @@ static rt_timer_t nt26k_timer; // 上报心跳
|
||||||
static rt_timer_t nt26k_upload_timer; // 更新本地时间定时器
|
static rt_timer_t nt26k_upload_timer; // 更新本地时间定时器
|
||||||
static rt_timer_t nt26k_error_timer; // 上电失败情况下启动定时器
|
static rt_timer_t nt26k_error_timer; // 上电失败情况下启动定时器
|
||||||
|
|
||||||
rt_uint8_t device_power_down_flag;
|
|
||||||
rt_uint8_t nt26k_power_down_flag;
|
rt_uint8_t nt26k_power_down_flag;
|
||||||
rt_uint8_t nt26k_connect_sever_flag;
|
rt_uint8_t nt26k_connect_sever_flag;
|
||||||
rt_uint8_t nt26k_send_error_flag;
|
rt_uint8_t nt26k_send_error_flag;
|
||||||
|
@ -76,6 +75,9 @@ rt_uint8_t nt26k_disconnect_pdp_flag; // PDP断开连接标志
|
||||||
rt_uint8_t nt26k_disconnect_retry_flag = 0; // 用于判断是否已经启动了重连,如果启动,不需要每次都进入
|
rt_uint8_t nt26k_disconnect_retry_flag = 0; // 用于判断是否已经启动了重连,如果启动,不需要每次都进入
|
||||||
Nt26kEventIndex nt26k_event_index;
|
Nt26kEventIndex nt26k_event_index;
|
||||||
|
|
||||||
|
Nt26kEvent nt26_current_evnet = kNt26kPowerOnEvent; // 默认上电事件
|
||||||
|
Nt26kEvent nt26_latest_evnet = kNt26kPowerOnEvent; // 最新传入的事件
|
||||||
|
|
||||||
rt_uint8_t power_on_send_flag = 0;
|
rt_uint8_t power_on_send_flag = 0;
|
||||||
|
|
||||||
int BSP_Nt26k_Init(struct Nt26k_Ops *ops, rt_uint8_t version);
|
int BSP_Nt26k_Init(struct Nt26k_Ops *ops, rt_uint8_t version);
|
||||||
|
@ -167,12 +169,14 @@ rt_uint32_t Nt26k_Get_Event_Flag(Nt26kEvent event_type)
|
||||||
|
|
||||||
void Nt26k_Send_Event(Nt26kEvent event_type)
|
void Nt26k_Send_Event(Nt26kEvent event_type)
|
||||||
{
|
{
|
||||||
LOG_D("Send_Nt26k_Event = %d", event_type);
|
|
||||||
nt26k_event_index.last_event = nt26k_event_index.current_event;
|
nt26k_event_index.last_event = nt26k_event_index.current_event;
|
||||||
nt26k_event_index.current_event = event_type;
|
nt26k_event_index.current_event = event_type;
|
||||||
|
nt26_latest_evnet = event_type;
|
||||||
|
LOG_D("Send_Nt26k_Event = %d", event_type);
|
||||||
if (nt26k_event_initialized == RT_TRUE)
|
if (nt26k_event_initialized == RT_TRUE)
|
||||||
{
|
{
|
||||||
if (nt26k_event_index.current_event != kNt26kPowerOnEvent)
|
if ((nt26k_event_index.current_event != kNt26kPowerOnEvent) && (nt26k_event_index.current_event != kNt26kPowerDownEvent))
|
||||||
{
|
{
|
||||||
if (power_on_send_flag)
|
if (power_on_send_flag)
|
||||||
{
|
{
|
||||||
|
@ -748,13 +752,13 @@ int Nt26k_Send_Device_Failure(struct at_device *device, void *param)
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*这个【4、优先级最低当同时触发后,相同服务直接合并】暂时还没想好怎么做,
|
|
||||||
思路感觉就是得重新开一个线程,然后再开一个任务队列,将所有的事件,发送到任务队列
|
|
||||||
在线程中,对任务队列进行查看并处理,看目前都有哪些事件,是处于那个优先级得,如果是最低优先级,就只发送一帧数据就行了,
|
|
||||||
如果是不同优先级,按照优先级顺序发送事件,但感觉这样会使得程序更复杂,本来发送就很快,感觉没必要这样搞*/
|
|
||||||
const Nt26kEventInfo nt26k_event_info[] = {
|
const Nt26kEventInfo nt26k_event_info[] = {
|
||||||
{kNt26kPowerOnEvent, NT26K_PRIORITY_HIGHEST, "上电心跳事件", Nt26k_Send_Power_On},
|
// {kNt26kPowerOnEvent, NT26K_PRIORITY_HIGHEST, "上电心跳事件", Nt26k_Send_Power_On},
|
||||||
{kNt26kPowerDownEvent, NT26K_PRIORITY_HIGH, "掉电事件", Nt26k_Send_Power_Off},
|
// {kNt26kPowerDownEvent, NT26K_PRIORITY_HIGH, "掉电事件", Nt26k_Send_Power_Off},
|
||||||
|
{kNt26kPowerOnEvent, NT26K_PRIORITY_HIGH, "上电心跳事件", Nt26k_Send_Power_On},
|
||||||
|
{kNt26kPowerDownEvent, NT26K_PRIORITY_HIGHEST, "掉电事件", Nt26k_Send_Power_Off},
|
||||||
{kNt26kSelfCheckEvent, NT26K_PRIORITY_MEDIUM, "自检事件", Nt26k_Send_Self_Check},
|
{kNt26kSelfCheckEvent, NT26K_PRIORITY_MEDIUM, "自检事件", Nt26k_Send_Self_Check},
|
||||||
{kNt26kHeartbeatEvent, NT26K_PRIORITY_LOWEST, "定时心跳事件", Nt26k_Send_Heartbeat},
|
{kNt26kHeartbeatEvent, NT26K_PRIORITY_LOWEST, "定时心跳事件", Nt26k_Send_Heartbeat},
|
||||||
{kNt26kTempAnomalyEvent, NT26K_PRIORITY_LOWEST, "温度异常事件", Nt26k_Send_Temp_Anomaly},
|
{kNt26kTempAnomalyEvent, NT26K_PRIORITY_LOWEST, "温度异常事件", Nt26k_Send_Temp_Anomaly},
|
||||||
|
@ -769,6 +773,18 @@ const Nt26kEventInfo nt26k_event_info[] = {
|
||||||
{kNt26kFanStatusEvent, NT26K_PRIORITY_LOWEST, "风机状态改变事件", Nt26k_Send_Fan_Status},
|
{kNt26kFanStatusEvent, NT26K_PRIORITY_LOWEST, "风机状态改变事件", Nt26k_Send_Fan_Status},
|
||||||
{kNt26kDeviceFailureEvent, NT26K_PRIORITY_LOWEST, "设备失效事件", Nt26k_Send_Device_Failure}};
|
{kNt26kDeviceFailureEvent, NT26K_PRIORITY_LOWEST, "设备失效事件", Nt26k_Send_Device_Failure}};
|
||||||
|
|
||||||
|
Nt26kPriority GetEventPriority(Nt26kEvent event_type)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < sizeof(nt26k_event_info) / sizeof(nt26k_event_info[0]); i++)
|
||||||
|
{
|
||||||
|
if (nt26k_event_info[i].event_flag == event_type)
|
||||||
|
{
|
||||||
|
return nt26k_event_info[i].priority;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NT26K_PRIORITY_LOWEST;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理NT26K设备的事件
|
* 处理NT26K设备的事件
|
||||||
* @param nt26k_recv_event 接收到的NT26K事件标志
|
* @param nt26k_recv_event 接收到的NT26K事件标志
|
||||||
|
@ -776,10 +792,10 @@ const Nt26kEventInfo nt26k_event_info[] = {
|
||||||
*/
|
*/
|
||||||
int Nt26k_Process_Events(Nt26kEvent nt26k_recv_event, struct at_device *device, void *param)
|
int Nt26k_Process_Events(Nt26kEvent nt26k_recv_event, struct at_device *device, void *param)
|
||||||
{
|
{
|
||||||
|
|
||||||
rt_uint8_t cnt = 0;
|
rt_uint8_t cnt = 0;
|
||||||
rt_err_t ret = RT_EOK;
|
rt_err_t ret = RT_EOK;
|
||||||
rt_uint8_t max_retry_count = (rt_uint8_t)Flash_Get_SysCfg(kIotRetryId);
|
rt_uint8_t max_retry_count = (rt_uint8_t)Flash_Get_SysCfg(kIotRetryId);
|
||||||
LOG_D("max_retry_count:%d\n", max_retry_count);
|
|
||||||
struct Nt26k_Ops *nt26k_ops = (struct Nt26k_Ops *)param;
|
struct Nt26k_Ops *nt26k_ops = (struct Nt26k_Ops *)param;
|
||||||
const Nt26kEventInfo *event = RT_NULL;
|
const Nt26kEventInfo *event = RT_NULL;
|
||||||
|
|
||||||
|
@ -789,14 +805,14 @@ int Nt26k_Process_Events(Nt26kEvent nt26k_recv_event, struct at_device *device,
|
||||||
if (nt26k_recv_event == nt26k_event_info[i].event_flag)
|
if (nt26k_recv_event == nt26k_event_info[i].event_flag)
|
||||||
{
|
{
|
||||||
event = &nt26k_event_info[i];
|
event = &nt26k_event_info[i];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event) // 处理该事件
|
if (event) // 处理该事件
|
||||||
{
|
{
|
||||||
LOG_D("%s上报\n", event->event_name); // 打印事件的名称
|
LOG_D("%s上报\n", event->event_name); // 打印事件的名称
|
||||||
|
nt26_current_evnet = event->event_flag;
|
||||||
for (size_t i = 0; i < max_retry_count; i++)
|
for (size_t i = 0; i < max_retry_count; i++)
|
||||||
{
|
{
|
||||||
if (nt26k_conncet_tcp_flag)
|
if (nt26k_conncet_tcp_flag)
|
||||||
|
@ -816,7 +832,7 @@ int Nt26k_Process_Events(Nt26kEvent nt26k_recv_event, struct at_device *device,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (rt_sem_take(nt26k_recv_msg_sem, 15000) == RT_EOK)
|
if (rt_sem_take(nt26k_recv_msg_sem, 5000) == RT_EOK)
|
||||||
{
|
{
|
||||||
LOG_D("收到回复\n");
|
LOG_D("收到回复\n");
|
||||||
nt26k_connect_sever_flag = 1;
|
nt26k_connect_sever_flag = 1;
|
||||||
|
@ -826,7 +842,6 @@ int Nt26k_Process_Events(Nt26kEvent nt26k_recv_event, struct at_device *device,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 收不到说明在平台未注册或者信号不行,此时nt26k_connect_sever_flag 为0,但nt26k_conncet_tcp_flag = 1;此时不发起重连,等待事件触发就行
|
// 收不到说明在平台未注册或者信号不行,此时nt26k_connect_sever_flag 为0,但nt26k_conncet_tcp_flag = 1;此时不发起重连,等待事件触发就行
|
||||||
|
|
||||||
ret = RT_ERROR;
|
ret = RT_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -836,15 +851,22 @@ int Nt26k_Process_Events(Nt26kEvent nt26k_recv_event, struct at_device *device,
|
||||||
{
|
{
|
||||||
ret = RT_ERROR;
|
ret = RT_ERROR;
|
||||||
}
|
}
|
||||||
rt_thread_mdelay(IMEI_Delay() + 5000);//放到后面的原因是,保证了第一次发送数据的及时性
|
rt_thread_mdelay(3000);
|
||||||
|
if (event->priority < GetEventPriority(nt26_latest_evnet)) // 查看当前事件和新传入的事件的优先级哪个高,如果有高的直接退出处理高优先级的
|
||||||
|
{
|
||||||
|
LOG_W("有更高优先级的事件进入,退出当前处理\n");
|
||||||
|
ret = RT_EOK;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
rt_thread_mdelay(IMEI_Delay());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rt_strcmp(event->event_name, "掉电事件") == RT_EOK)
|
if (rt_strcmp(event->event_name, "掉电事件") == RT_EOK)
|
||||||
{
|
{
|
||||||
rt_uint8_t cnt = 0;
|
LOG_D("掉电处理TCP");
|
||||||
while ((device_power_down_flag == 0) && (cnt < 10))
|
if (device->class->device_ops->control(device, AT_DEVICE_CTRL_NET_DISCONN, RT_NULL) == RT_EOK)
|
||||||
{
|
{
|
||||||
rt_thread_mdelay(500);
|
LOG_D("关闭TCP");
|
||||||
}
|
}
|
||||||
if (device->class->device_ops->control(device, AT_DEVICE_RF_CLOSE, RT_NULL) == RT_EOK)
|
if (device->class->device_ops->control(device, AT_DEVICE_RF_CLOSE, RT_NULL) == RT_EOK)
|
||||||
{
|
{
|
||||||
|
@ -910,10 +932,6 @@ void Handle_Server_Reply(struct Nt26k_Ops *ops)
|
||||||
{
|
{
|
||||||
LOG_D("nt26k send data success\n");
|
LOG_D("nt26k send data success\n");
|
||||||
}
|
}
|
||||||
else if (ops->recv->recv_data.event_type == EVENT_TYPE_POWER_OFF) // 是掉电事件回应
|
|
||||||
{
|
|
||||||
device_power_down_flag = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Handle_Self_Check(struct Nt26k_Ops *ops)
|
void Handle_Self_Check(struct Nt26k_Ops *ops)
|
||||||
|
@ -1296,6 +1314,7 @@ static void Nt26k_Send_Thread_Entry(void *param)
|
||||||
|
|
||||||
if (result == RT_EOK)
|
if (result == RT_EOK)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (nt26k_recv_event & Nt26k_Get_Event_Flag(kNt26kPowerOnEvent))
|
if (nt26k_recv_event & Nt26k_Get_Event_Flag(kNt26kPowerOnEvent))
|
||||||
{
|
{
|
||||||
result = Nt26k_Process_Events(kNt26kPowerOnEvent, device, ops); // 当上电心跳包发送不成功时,其他事件不启动
|
result = Nt26k_Process_Events(kNt26kPowerOnEvent, device, ops); // 当上电心跳包发送不成功时,其他事件不启动
|
||||||
|
@ -1312,6 +1331,15 @@ static void Nt26k_Send_Thread_Entry(void *param)
|
||||||
rt_timer_start(nt26k_upload_timer); // 周期修改时间更新
|
rt_timer_start(nt26k_upload_timer); // 周期修改时间更新
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (nt26k_recv_event & Nt26k_Get_Event_Flag(kNt26kPowerDownEvent))
|
||||||
|
{
|
||||||
|
nt26k_event_initialized = RT_FALSE; // 当接收到掉电事件时,发送完成后删除事件,不再接收其他事件
|
||||||
|
result = Nt26k_Process_Events(kNt26kPowerDownEvent, device, ops);
|
||||||
|
if (result != RT_EOK)
|
||||||
|
{
|
||||||
|
LOG_E("nt26k send data failed result = [%d]\n", result);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (power_on_send_flag)
|
if (power_on_send_flag)
|
||||||
{
|
{
|
||||||
if (nt26k_recv_event & Nt26k_Get_Event_Flag(kNt26kHeartbeatEvent))
|
if (nt26k_recv_event & Nt26k_Get_Event_Flag(kNt26kHeartbeatEvent))
|
||||||
|
@ -1414,15 +1442,6 @@ static void Nt26k_Send_Thread_Entry(void *param)
|
||||||
LOG_E("nt26k send data failed result = [%d]\n", result);
|
LOG_E("nt26k send data failed result = [%d]\n", result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (nt26k_recv_event & Nt26k_Get_Event_Flag(kNt26kPowerDownEvent))
|
|
||||||
{
|
|
||||||
nt26k_event_initialized = RT_FALSE; // 当接收到掉电事件时,发送完成后删除事件,不再接收其他事件
|
|
||||||
result = Nt26k_Process_Events(kNt26kPowerDownEvent, device, ops);
|
|
||||||
if (result != RT_EOK)
|
|
||||||
{
|
|
||||||
LOG_E("nt26k send data failed result = [%d]\n", result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (nt26k_recv_event & Nt26k_Get_Event_Flag(kNt26kDeviceFailureEvent))
|
else if (nt26k_recv_event & Nt26k_Get_Event_Flag(kNt26kDeviceFailureEvent))
|
||||||
{
|
{
|
||||||
result = Nt26k_Process_Events(kNt26kDeviceFailureEvent, device, ops);
|
result = Nt26k_Process_Events(kNt26kDeviceFailureEvent, device, ops);
|
||||||
|
@ -1459,9 +1478,9 @@ static void Nt26k_Life_Thread_Entry(void *parameter)
|
||||||
struct at_device_nt26k *nt26k = &_dev;
|
struct at_device_nt26k *nt26k = &_dev;
|
||||||
struct at_device *device = at_device_get_by_name(AT_DEVICE_NAMETYPE_NETDEV, nt26k->device_name);
|
struct at_device *device = at_device_get_by_name(AT_DEVICE_NAMETYPE_NETDEV, nt26k->device_name);
|
||||||
RT_ASSERT(device);
|
RT_ASSERT(device);
|
||||||
rt_err_t result = RT_ETIMEOUT;
|
rt_err_t result = RT_ETIMEOUT;
|
||||||
rt_uint32_t delay_n = 0;
|
rt_uint32_t delay_n = 0;
|
||||||
at_response_t resp = RT_NULL;
|
at_response_t resp = RT_NULL;
|
||||||
rt_uint32_t retry_delay = 8000;
|
rt_uint32_t retry_delay = 8000;
|
||||||
LOG_D("nt26k_life_thread entry\n");
|
LOG_D("nt26k_life_thread entry\n");
|
||||||
|
|
||||||
|
@ -1482,13 +1501,13 @@ static void Nt26k_Life_Thread_Entry(void *parameter)
|
||||||
result = -RT_ETIMEOUT;
|
result = -RT_ETIMEOUT;
|
||||||
goto __exit;
|
goto __exit;
|
||||||
}
|
}
|
||||||
if(device->class->device_ops->control(device, AT_DEVICE_CTRL_NET_DISCONN, RT_NULL) == RT_EOK)
|
if (device->class->device_ops->control(device, AT_DEVICE_CTRL_NET_DISCONN, RT_NULL) == RT_EOK)
|
||||||
{
|
{
|
||||||
rt_thread_mdelay(RT_TICK_PER_SECOND);//这里如果有TCP连接,先关掉TCP,没有返回错误无所谓
|
rt_thread_mdelay(RT_TICK_PER_SECOND); // 这里如果有TCP连接,先关掉TCP,没有返回错误无所谓
|
||||||
}
|
}
|
||||||
if(device->class->device_ops->control(device, AT_DEVICE_RF_CLOSE, RT_NULL) == RT_EOK)
|
if (device->class->device_ops->control(device, AT_DEVICE_RF_CLOSE, RT_NULL) == RT_EOK)
|
||||||
{
|
{
|
||||||
rt_thread_mdelay(RT_TICK_PER_SECOND);//这里如果有TCP连接,先关掉TCP,没有返回错误无所谓
|
rt_thread_mdelay(RT_TICK_PER_SECOND); // 这里如果有TCP连接,先关掉模组功能,没有返回错误无所谓
|
||||||
}
|
}
|
||||||
rt_thread_mdelay(RT_TICK_PER_SECOND);
|
rt_thread_mdelay(RT_TICK_PER_SECOND);
|
||||||
if (device->class->device_ops->control(device, AT_DEVICE_CTRL_WAKEUP, RT_NULL) == RT_EOK)
|
if (device->class->device_ops->control(device, AT_DEVICE_CTRL_WAKEUP, RT_NULL) == RT_EOK)
|
||||||
|
@ -1574,7 +1593,7 @@ static void Nt26k_Life_Thread_Entry(void *parameter)
|
||||||
result = -RT_ERROR;
|
result = -RT_ERROR;
|
||||||
goto __exit;
|
goto __exit;
|
||||||
}
|
}
|
||||||
/* check the GPRS network is registered */
|
/* check the GPRS network is registered */
|
||||||
for (cnt = 0; cnt < 10; cnt++)
|
for (cnt = 0; cnt < 10; cnt++)
|
||||||
{
|
{
|
||||||
if (at_obj_exec_cmd(device->client, resp, "AT+CEREG?") == RT_EOK) // 60s内注册CS业务
|
if (at_obj_exec_cmd(device->client, resp, "AT+CEREG?") == RT_EOK) // 60s内注册CS业务
|
||||||
|
|
Loading…
Reference in New Issue