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

相关文章

Python使用Pandas对比两列数据取最大值的五种方法

《Python使用Pandas对比两列数据取最大值的五种方法》本文主要介绍使用Pandas对比两列数据取最大值的五种方法,包括使用max方法、apply方法结合lambda函数、函数、clip方法、w... 目录引言一、使用max方法二、使用apply方法结合lambda函数三、使用np.maximum函数

Redis的数据过期策略和数据淘汰策略

《Redis的数据过期策略和数据淘汰策略》本文主要介绍了Redis的数据过期策略和数据淘汰策略,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一... 目录一、数据过期策略1、惰性删除2、定期删除二、数据淘汰策略1、数据淘汰策略概念2、8种数据淘汰策略

轻松上手MYSQL之JSON函数实现高效数据查询与操作

《轻松上手MYSQL之JSON函数实现高效数据查询与操作》:本文主要介绍轻松上手MYSQL之JSON函数实现高效数据查询与操作的相关资料,MySQL提供了多个JSON函数,用于处理和查询JSON数... 目录一、jsON_EXTRACT 提取指定数据二、JSON_UNQUOTE 取消双引号三、JSON_KE

Python给Excel写入数据的四种方法小结

《Python给Excel写入数据的四种方法小结》本文主要介绍了Python给Excel写入数据的四种方法小结,包含openpyxl库、xlsxwriter库、pandas库和win32com库,具有... 目录1. 使用 openpyxl 库2. 使用 xlsxwriter 库3. 使用 pandas 库

SpringBoot定制JSON响应数据的实现

《SpringBoot定制JSON响应数据的实现》本文主要介绍了SpringBoot定制JSON响应数据的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们... 目录前言一、如何使用@jsonView这个注解?二、应用场景三、实战案例注解方式编程方式总结 前言

使用Python在Excel中创建和取消数据分组

《使用Python在Excel中创建和取消数据分组》Excel中的分组是一种通过添加层级结构将相邻行或列组织在一起的功能,当分组完成后,用户可以通过折叠或展开数据组来简化数据视图,这篇博客将介绍如何使... 目录引言使用工具python在Excel中创建行和列分组Python在Excel中创建嵌套分组Pyt

在Rust中要用Struct和Enum组织数据的原因解析

《在Rust中要用Struct和Enum组织数据的原因解析》在Rust中,Struct和Enum是组织数据的核心工具,Struct用于将相关字段封装为单一实体,便于管理和扩展,Enum用于明确定义所有... 目录为什么在Rust中要用Struct和Enum组织数据?一、使用struct组织数据:将相关字段绑

在Mysql环境下对数据进行增删改查的操作方法

《在Mysql环境下对数据进行增删改查的操作方法》本文介绍了在MySQL环境下对数据进行增删改查的基本操作,包括插入数据、修改数据、删除数据、数据查询(基本查询、连接查询、聚合函数查询、子查询)等,并... 目录一、插入数据:二、修改数据:三、删除数据:1、delete from 表名;2、truncate

Java实现Elasticsearch查询当前索引全部数据的完整代码

《Java实现Elasticsearch查询当前索引全部数据的完整代码》:本文主要介绍如何在Java中实现查询Elasticsearch索引中指定条件下的全部数据,通过设置滚动查询参数(scrol... 目录需求背景通常情况Java 实现查询 Elasticsearch 全部数据写在最后需求背景通常情况下

Java中注解与元数据示例详解

《Java中注解与元数据示例详解》Java注解和元数据是编程中重要的概念,用于描述程序元素的属性和用途,:本文主要介绍Java中注解与元数据的相关资料,文中通过代码介绍的非常详细,需要的朋友可以参... 目录一、引言二、元数据的概念2.1 定义2.2 作用三、Java 注解的基础3.1 注解的定义3.2 内