当前位置:网站首页>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;
}边栏推荐
- SCM is now overwhelming, a wide variety, so that developers are overwhelmed
- Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~
- The third paper of information system project manager in soft examination
- C language enumeration type
- 端午节快乐!—— canvas写的粽子~~~~~
- There is no specific definition of embedded system
- Do you understand automatic packing and unpacking? What is the principle?
- Openeuler kernel technology sharing - Issue 1 - kdump basic principle, use and case introduction
- Schematic diagram and connection method of six pin self-locking switch
- Interruption system of 51 single chip microcomputer
猜你喜欢

There is no specific definition of embedded system

Open Euler Kernel Technology Sharing - Issue 1 - kdump Basic Principles, use and Case Introduction
![[graduation successful] [1] - tour [Student Management Information System]](/img/91/72cdea3eb3f61315595330d2c9016d.png)
[graduation successful] [1] - tour [Student Management Information System]
![[CSDN] C1 training problem analysis_ Part II_ Web Foundation](/img/91/72cdea3eb3f61315595330d2c9016d.png)
[CSDN] C1 training problem analysis_ Part II_ Web Foundation

内存数据库究竟是如何发挥内存优势的?

Comment la base de données mémoire joue - t - elle l'avantage de la mémoire?

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

Working mode of 80C51 Serial Port

Openeuler kernel technology sharing - Issue 1 - kdump basic principle, use and case introduction
![Successful graduation [2] - student health management system function development...](/img/91/72cdea3eb3f61315595330d2c9016d.png)
Successful graduation [2] - student health management system function development...
随机推荐
I think all friends should know that the basic law of learning is: from easy to difficult
Of course, the most widely used 8-bit single chip microcomputer is also the single chip microcomputer that beginners are most easy to learn
2021-10-28
Simple use of MySQL (addition, deletion, modification and query)
The third paper of information system project manager in soft examination
要選擇那種語言為單片機編寫程序呢
STM32 general timer 1s delay to realize LED flashing
开学实验里要用到mysql,忘记基本的select语句怎么玩啦?补救来啦~
Fundamentals of Electronic Technology (III)__ Fundamentals of circuit analysis__ Basic amplifier operating principle
When you need to use some functions of STM32, but 51 can't realize them, 32 naturally doesn't need to learn
SSB Introduction (PbCH and DMRs need to be supplemented)
51 MCU tmod and timer configuration
Embedded systems are inherently flawed. Compared with the Internet, there are so many holes that it is simply difficult to walk away from
Project cost management__ Topic of comprehensive calculation
NR PUCCH format0 sequence generation and detection mechanism
Fundamentals of Electronic Technology (III)_ Chapter 2 principle of amplification circuit__ Crystal triode and field effect triode
单片机职业发展:能做下去的都成牛人了,熬不动就辞职或者改行了
[successful graduation] [1] - visit [student management information system]
Hal library sets STM32 clock
Blue Bridge Cup for migrant workers majoring in electronic information engineering