当前位置:网站首页>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
- [22 graduation season] I'm a graduate yo~
- Open Euler Kernel Technology Sharing - Issue 1 - kdump Basic Principles, use and Case Introduction
- The cyclic shift of PUCCH in NR channel is generated by MATLAB
- Synchronization control between tasks
- MYSQL数据库底层基础专栏
- 万字手撕七大排序(代码+动图演示)
- Pymssql controls SQL for Chinese queries
- PRACH --- originator
猜你喜欢
[22 graduation season] I'm a graduate yo~
Interruption system of 51 single chip microcomputer
How does the nr-prach receiver detect the relationship between prembleid and Ta
UCI and data multiplexing are transmitted on Pusch - placement of data and UCI positions (Part III)
Education is a pass and ticket. With it, you can step into a higher-level environment
yocto 技术分享第四期:自定义增加软件包支持
单片机学到什么程度能找到工作,这个标准不好量化
Runtime. getRuntime(). GC () and runtime getRuntime(). The difference between runfinalization()
Eight working modes of stm32gpio and chip naming rules
手机都算是单片机的一种,只不过它用的硬件不是51的芯片
随机推荐
Assignment to '*' form incompatible pointer type 'linkstack' {aka '*'} problem solving
ADS simulation design of class AB RF power amplifier
[male nanny style] teach you to open the first wechat applet
I think all friends should know that the basic law of learning is: from easy to difficult
Learn the contents of 5g toolbox supporting NR through the NR resources provided by MATLAB
Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~
In third tier cities and counties, it is difficult to get 10K after graduation
[successful graduation] [1] - visit [student management information system]
Eight working modes of stm32gpio and chip naming rules
学历是一张通行证,门票,你有了它,可以踏入更高层次的环境里
Timer and counter of 51 single chip microcomputer
(2)接口中新增的方法
Mobile phones are a kind of MCU, but the hardware it uses is not 51 chip
[keil5 debugging] warning:enumerated type mixed with other type
在三线城市、在县城,很难毕业就拿到10K
It is difficult to quantify the extent to which a single-chip computer can find a job
yocto 技术分享第四期:自定义增加软件包支持
Design of charging pile mqtt transplantation based on 4G EC20 module
Application of external interrupts
嵌入式本来就很坑,相对于互联网来说那个坑多得简直是难走