SIM7600数据回调拨号上网

2023-12-17 08:08

本文主要是介绍SIM7600数据回调拨号上网,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

DataCall用于设置/查询APN,CDMA网络下拨号用户和密码,连接网络,断开网络等功能,最多同时支持8个链接,建议序列号从7号开始使用。

1. API

1)int datacall_init(); 初始化网络

输入:无

输出:无

返回值:无

2)int start_dataCall(app_tech_e tech, int ip_family, int profile); //建立数据链接

输入

tech: 使用制式(枚举)

1.umts

2.cdma

3.1x

。。。

ip_family: ip类型

4:ip4

6:ip6

profile: 序列号

输出
返回值0:成功  -1:失败

3)int stop_dataCall(int profile); //断开链接

输入:profile序列号

4)int get_datacall_info_by_profile(int profile, datacall_info_type *callinfo)

功能获取数据链接参数
输入profile 序列号
输出callinfo 链接参数结构体
返回值0:成功  -1:失败

5)int datacall_deinit(); //释放网络资源

输入:无

输出:无

返回值:无

2. 数据回调函数

void simcom_datacall_test()
{const char *options_list[] = {"1. start data call","2. stop data call","3. get call Info","4. back",};int opt = 0;int i,j;char scan_string[100] = {0};if(datacall_init() != 0){return;}while(1){printf("\nPlease select an option to test from the items listed below.\n");print_option_menu(options_list, sizeof(options_list)/sizeof(options_list[0]));printf("Option > ");memset(scan_string, 0, sizeof(scan_string));if (fgets(scan_string, sizeof(scan_string), stdin) == NULL)continue;/* Convert the option to an integer, and switch on the option entered. */opt = atoi(scan_string);switch(opt){case 1: /* start data call*/{int profile;printf("\nPlease input profile index:\n");			             memset(scan_string, 0, sizeof(scan_string));if (fgets(scan_string, sizeof(scan_string), stdin) == NULL)break;profile = atoi(scan_string);if(profile > 16 || profile == 6)     //Profile = 1 for system. profile=6 for wifi{printf("please select other profile.\n");break;}start_dataCall(app_tech_auto, DSI_IP_VERSION_4, profile);}break;case 2: /*stop data call*/{int profile;printf("\nPlease input profile index:\n");			             memset(scan_string, 0, sizeof(scan_string));if (fgets(scan_string, sizeof(scan_string), stdin) == NULL)break;profile = atoi(scan_string);if(profile <= 1 || profile > 16 || profile == 6)     //Profile = 1 for system. profile=6 for wifi{printf("please select other profile.\n");break;}stop_dataCall(profile);}break;case 3:{/* get data call infomation*/int profile;int ret;datacall_info_type callinfo;printf("\nPlease input profile index:\n");			             memset(scan_string, 0, sizeof(scan_string));if (fgets(scan_string, sizeof(scan_string), stdin) == NULL)break;profile = atoi(scan_string);ret = get_datacall_info_by_profile(profile,&callinfo);if(ret == 0){printf("DC: profile=%d\n", callinfo.profile);					printf("DC: handle=%d\n", callinfo.handle);printf("DC: if_name=%s\n", callinfo.if_name);printf("DC: ip_str=%s\n", callinfo.ip_str);printf("DC: mask=%d\n", callinfo.mask);printf("DC: pri_dns_str=%s\n", callinfo.pri_dns_str);printf("DC: sec_dns_str=%s\n", callinfo.sec_dns_str);printf("DC: handle=%d\n", callinfo.status);}}break;case 4:break;default:break;}if(opt == 4){break;}}datacall_deinit();
}

 

这篇关于SIM7600数据回调拨号上网的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/503693

相关文章

C#监听txt文档获取新数据方式

《C#监听txt文档获取新数据方式》文章介绍通过监听txt文件获取最新数据,并实现开机自启动、禁用窗口关闭按钮、阻止Ctrl+C中断及防止程序退出等功能,代码整合于主函数中,供参考学习... 目录前言一、监听txt文档增加数据二、其他功能1. 设置开机自启动2. 禁止控制台窗口关闭按钮3. 阻止Ctrl +

java如何实现高并发场景下三级缓存的数据一致性

《java如何实现高并发场景下三级缓存的数据一致性》这篇文章主要为大家详细介绍了java如何实现高并发场景下三级缓存的数据一致性,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 下面代码是一个使用Java和Redisson实现的三级缓存服务,主要功能包括:1.缓存结构:本地缓存:使

在MySQL中实现冷热数据分离的方法及使用场景底层原理解析

《在MySQL中实现冷热数据分离的方法及使用场景底层原理解析》MySQL冷热数据分离通过分表/分区策略、数据归档和索引优化,将频繁访问的热数据与冷数据分开存储,提升查询效率并降低存储成本,适用于高并发... 目录实现冷热数据分离1. 分表策略2. 使用分区表3. 数据归档与迁移在mysql中实现冷热数据分

C#解析JSON数据全攻略指南

《C#解析JSON数据全攻略指南》这篇文章主要为大家详细介绍了使用C#解析JSON数据全攻略指南,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录一、为什么jsON是C#开发必修课?二、四步搞定网络JSON数据1. 获取数据 - HttpClient最佳实践2. 动态解析 - 快速

MyBatis-Plus通用中等、大量数据分批查询和处理方法

《MyBatis-Plus通用中等、大量数据分批查询和处理方法》文章介绍MyBatis-Plus分页查询处理,通过函数式接口与Lambda表达式实现通用逻辑,方法抽象但功能强大,建议扩展分批处理及流式... 目录函数式接口获取分页数据接口数据处理接口通用逻辑工具类使用方法简单查询自定义查询方法总结函数式接口

SQL中如何添加数据(常见方法及示例)

《SQL中如何添加数据(常见方法及示例)》SQL全称为StructuredQueryLanguage,是一种用于管理关系数据库的标准编程语言,下面给大家介绍SQL中如何添加数据,感兴趣的朋友一起看看吧... 目录在mysql中,有多种方法可以添加数据。以下是一些常见的方法及其示例。1. 使用INSERT I

Python使用vllm处理多模态数据的预处理技巧

《Python使用vllm处理多模态数据的预处理技巧》本文深入探讨了在Python环境下使用vLLM处理多模态数据的预处理技巧,我们将从基础概念出发,详细讲解文本、图像、音频等多模态数据的预处理方法,... 目录1. 背景介绍1.1 目的和范围1.2 预期读者1.3 文档结构概述1.4 术语表1.4.1 核

MySQL 删除数据详解(最新整理)

《MySQL删除数据详解(最新整理)》:本文主要介绍MySQL删除数据的相关知识,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录一、前言二、mysql 中的三种删除方式1.DELETE语句✅ 基本语法: 示例:2.TRUNCATE语句✅ 基本语

MyBatisPlus如何优化千万级数据的CRUD

《MyBatisPlus如何优化千万级数据的CRUD》最近负责的一个项目,数据库表量级破千万,每次执行CRUD都像走钢丝,稍有不慎就引起数据库报警,本文就结合这个项目的实战经验,聊聊MyBatisPl... 目录背景一、MyBATis Plus 简介二、千万级数据的挑战三、优化 CRUD 的关键策略1. 查

python实现对数据公钥加密与私钥解密

《python实现对数据公钥加密与私钥解密》这篇文章主要为大家详细介绍了如何使用python实现对数据公钥加密与私钥解密,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录公钥私钥的生成使用公钥加密使用私钥解密公钥私钥的生成这一部分,使用python生成公钥与私钥,然后保存在两个文