当前位置:网站首页>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;
}边栏推荐
- STM32 serial communication principle
- Getting started with JMX, MBean, mxbean, mbeanserver
- UCI and data multiplexing are transmitted on Pusch - placement of data and UCI positions (Part III)
- The third paper of information system project manager in soft examination
- Serial communication based on 51 single chip microcomputer
- STM32 interrupt switch
- Runtime.getRuntime().gc() 和 Runtime.getRuntime().runFinalization() 的区别
- Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~
- GPIO port details, Hal library operation keys
- Interruption system of 51 single chip microcomputer
猜你喜欢

Serial communication based on 51 single chip microcomputer

I didn't think so much when I was in the field of single chip microcomputer. I just wanted to earn money to support myself first

新系列单片机还延续了STM32产品家族的低电压和节能两大优势

CEF下载,编译工程
C language enumeration type

Getting started with JMX, MBean, mxbean, mbeanserver

嵌入式本来就很坑,相对于互联网来说那个坑多得简直是难走

2021-10-27

2021-10-28

Oracle database SQL statement execution plan, statement tracking and optimization instance
随机推荐
(2) New methods in the interface
Uniapp realizes global sharing of wechat applet and custom sharing button style
The third paper of information system project manager in soft examination
Fundamentals of Electronic Technology (III)__ Logic gate symbols in Chapter 5
Nr--- Pusch I: sorting out the agreement process
SSB Introduction (PbCH and DMRs need to be supplemented)
SCM career development: those who can continue to do it have become great people. If they can't endure it, they will resign or change their careers
Gif image analysis drawing RGB to YUV table lookup method to reduce CPU occupancy
openEuler kernel 技术分享 - 第1期 - kdump 基本原理、使用及案例介绍
[CSDN] C1 training problem analysis_ Part II_ Web Foundation
I think all friends should know that the basic law of learning is: from easy to difficult
In third tier cities and counties, it is difficult to get 10K after graduation
Application of external interrupts
CEF download, compile project
How does the memory database give full play to the advantages of memory?
2020-08-23
01仿B站项目业务架构
Embedded systems are inherently flawed. Compared with the Internet, there are so many holes that it is simply difficult to walk away from
当你需要使用STM32某些功能,而51实现不了时, 那32自然不需要学
內存數據庫究竟是如何發揮內存優勢的?