当前位置:网站首页>4G module IMEI of charging pile design
4G module IMEI of charging pile design
2022-07-03 09:59:00 【Wukong is so timid】
void dx_get_lte_imei(void)
{
// char cmd[64] = {0};
//char result[512] = {0};
int ret = -1;
char *pcTmp = NULL;
char *pcOut = g_imei;
unsigned char *cmd = at_tx_buffer;
unsigned char *result = at_rx_buffer;
unsigned char result_len = 0;
printf("g_imei:%s\n", g_imei);
if (dx_check_imei(g_imei))
{
// snprintf(imei, imei_len, "%s", g_imei);
printf("imei haved get ,is %s\r\n",g_imei);
return;
}
memset(at_tx_buffer,0,UART2_TX_BUFFER_LEN);
memset((char*)at_rx_buffer,0,UART2_RX_BUFFER_LEN);
snprintf((char*)at_tx_buffer,UART2_TX_BUFFER_LEN, "%s",AT_GSN);
ret = AT_cmd(cmd, strlen((const char*)cmd), result,&result_len);
/*
AT+GSN
865860040521701
OK
*/
printf("ret=%d \r\n", ret);
printf("strstr(result, OK=0x%08x \r\n", (unsigned int)strstr((const char*)result, "OK"));
printf("strstr(result, GSN=0x%08x \r\n", (unsigned int)strstr((const char*)result, "GSN"));
/* Filter out wrong data */
#if 0
// if ((ret ==0) && strstr((const char*)result, "OK") && !strstr((const char*)result, "GSN"))
if ((ret ==0) && strstr((const char*)result, "OK") )
{
// memset(result, 0, sizeof(result));
// ret = AT_cmd(cmd, strlen(cmd), result, sizeof(result));
printf("GSN read ok data %s----\n", result);
printf("AT+GSN:\n%s\n", result);
// goto out ;
}
#endif
if (ret ==0)
{
if(strstr((const char*)result, "OK") ==NULL )
{
// memset(result, 0, sizeof(result));
// ret = AT_cmd(cmd, strlen(cmd), result, sizeof(result));
printf("GSN read error data1 %s----\n", result);
printf("AT+GSN:\n%s\n", result);
goto out ;
}
#if 0
else if(!strstr((const char*)result, "GSN"))
{
// memset(result, 0, sizeof(result));
// ret = AT_cmd(cmd, strlen(cmd), result, sizeof(result));
printf("GSN read error data2 %s----\n", result);
printf("AT+GSN:\n%s\n", result);
goto out ;
}
#endif
}
else
{
printf("AT+GSN fail\n");
goto out ;
}
/*
if (ret || !strlen(result) || strstr(result, "OK"))
{
snprintf(g_imei, sizeof(g_imei), "000000000000000");
return;
}
*/
printf("\n result =%s\n", result);
pcTmp = strchr((const char*)result, '\n');
if (pcTmp)
{
pcTmp++;
while(*pcTmp != '\r' && *pcTmp != '\n' && *pcTmp != '\0' && (*pcTmp >= '0' && *pcTmp <= '9'))
{
//printf("*pcTmp=%c\r\n",*pcTmp);
*pcOut++ = *pcTmp++;
}
}
if (strlen(g_imei) < 15)
{
snprintf(g_imei, sizeof(g_imei), "000000000000000");
goto out ;
}
else
{
//memset(g_imei, 0, sizeof(g_imei));
// snprintf(g_imei, sizeof(g_imei), "%s", imei);
printf("g_imei=%s\r\n",g_imei);
}
out:
// memset(at_tx_buffer,0,UART2_TX_BUFFER_LEN);
// memset(at_rx_buffer,0,UART2_RX_BUFFER_LEN);
return;
}边栏推荐
- Pymssql controls SQL for Chinese queries
- STM32 serial communication principle
- UCI and data multiplexing are transmitted on Pusch (Part V) -- polar coding
- (2) New methods in the interface
- [CSDN] C1 training problem analysis_ Part II_ Web Foundation
- Working mode of 80C51 Serial Port
- Project cost management__ Cost management technology__ Article 7 completion performance index (tcpi)
- Which language should I choose to program for single chip microcomputer
- JMX、MBean、MXBean、MBeanServer 入门
- Sending and interrupt receiving of STM32 serial port
猜你喜欢

STM32 interrupt switch

NR PUCCH format0 sequence generation and detection mechanism

UCI and data multiplexing are transmitted on Pusch (Part V) -- polar coding

Gpiof6, 7, 8 configuration

Oracle数据库 SQL语句执行计划、语句跟踪与优化实例

JMX、MBean、MXBean、MBeanServer 入门

应用最广泛的8位单片机当然也是初学者们最容易上手学习的单片机

It is difficult to quantify the extent to which a single-chip computer can find a job

Which language should I choose to program for single chip microcomputer
![Successful graduation [3]- blog system update...](/img/91/72cdea3eb3f61315595330d2c9016d.png)
Successful graduation [3]- blog system update...
随机推荐
单片机现在可谓是铺天盖地,种类繁多,让开发者们应接不暇
Fundamentals of Electronic Technology (III)__ Chapter 1 resistance of parallel circuit
[22 graduation season] I'm a graduate yo~
JMX、MBean、MXBean、MBeanServer 入门
Drive and control program of Dianchuan charging board for charging pile design
Working mode of 80C51 Serial Port
MySQL的简单使用(增删改查)
JS foundation - prototype prototype chain and macro task / micro task / event mechanism
一个可执行的二进制文件包含的不仅仅是机器指令
Mobile phones are a kind of MCU, but the hardware it uses is not 51 chip
2021-10-28
01仿B站项目业务架构
Characteristics of PUCCH formats
yocto 技术分享第四期:自定义增加软件包支持
Comment la base de données mémoire joue - t - elle l'avantage de la mémoire?
Stm32 NVIC interrupt priority management
Openeuler kernel technology sharing - Issue 1 - kdump basic principle, use and case introduction
STM32 running lantern experiment - library function version
Project cost management__ Cost management technology__ Article 8 performance review
[untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer