| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- /*
- * File : at_sample_air720.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Change Logs:
- * Date Author Notes
- * 2019-12-07 liang.shao first version
- */
- #include <at_device_air720.h>
- #include "sys_config.h"
- #include <easyflash.h>
- #define LOG_TAG "at.reg"
- #include <at_log.h>
- #define AIR720_SAMPLE_DEIVCE_NAME "air720"
- #define AT_DEVICE_CTRL_REBOOT 0x0DL
- extern rt_uint8_t export_logdata_flag;
- extern int w5500Start(void);
- static struct at_device_air720 sim0 =
- {
- AIR720_SAMPLE_DEIVCE_NAME,
- AIR720_SAMPLE_CLIENT_NAME,
- AIR720_SAMPLE_POWER_PIN,
- AIR720_SAMPLE_STATUS_PIN,
- AIR720_SAMPLE_RECV_BUFF_LEN,
- };
- //static int air720_device_register(void)
- int air720_device_register(void)
- {
- struct at_device_air720 *air720 = &sim0;
-
- extern Sector qxz;
- if(ef_get_env_blob("upload_mode_swtich_flag", &qxz.Param.upload_mode_swtich_flag, sizeof(qxz.Param.upload_mode_swtich_flag) , NULL) )
- //如果设置为有线网络连接+device_sn不是初始值18054384,则不初始化
- {
- if((qxz.Param.upload_mode_swtich_flag) && (rt_strcmp(qxz.Param.device_sn, "18054384" ) != 0))
- {
- LOG_W("qxz.Param.device_sn != 18054384");
- //w5500Start();
- goto end;
- }
- else if(qxz.Param.upload_mode_swtich_flag)
- {
- LOG_W("Use W5500 , jump Air720");
- //w5500Start();
- goto end;
- }
- }
-
- if(ef_get_env_blob("export_logdata_flag", &export_logdata_flag, sizeof(export_logdata_flag) , NULL))
- {
- if(export_logdata_flag == 1)
- {
- LOG_W("detect logdata export flag. jump over 4G init !");
- goto end;
-
- }//如果当前需要导出数据 则不初始化联网
- }
- //2023.6.9 新增延时3秒 为参数校验争取时间
- rt_thread_mdelay(3000);
- return at_device_register(&(air720->device),
- air720->device_name,
- air720->client_name,
- AT_DEVICE_CLASS_AIR720,
- (void *) air720);
-
- end:
- return RT_EOK;
- }
- INIT_APP_EXPORT(air720_device_register);
- //INIT_COMPONENT_EXPORT(air720_device_register);
- //MSH_CMD_EXPORT(air720_device_register, air720_device_register);
- //MSH_CMD_EXPORT_ALIAS(air720_reboot, reboot_720, reboot_720 to manual);
- //int air720_reboot(void)
- //{
- // struct at_device_air720 *air720 = &sim0;
- // air720->device.is_init = RT_FALSE;//可以启动初始化线程
- // return at_device_control(&(air720->device), AT_DEVICE_CTRL_REBOOT, RT_NULL);
- //}
|