天嵌二次封装库使用手册  V1.0
tq_gsm.h
浏览该文件的文档.
1 #ifndef _TQ_GSM_H__
2 #define _TQ_GSM_H__
3 
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <unistd.h>
22 #include <string.h>
23 #include "tq_network.h"
24 #include "tq_uart.h"
25 #include "tq_common.h"
29 typedef void (*Callback)(int intput_type, char *pin, char *puk);
30 enum Model
31 {
32  N720,
33  SLM750
34 };
35 enum PDP_type
36 {
37  IP,
38  PPP,
39  IPv6,
40  IPV4V6
41 };
42 enum APN
43 {
44  CMNET, //移动2G/3G/4G
45  CMMTM, //移动物联卡2G/3G
46  CMIOT, //移动物联卡4G
47  _3GNET, //联通2G/3G/4G
48  CTNET, //电信2G/3G
49  CTLTE //电信4G
50 };
51 enum AUTH
52 {
53  NONE,
54  PAP,
55  CHAP,
56  PAP_OR_CHAP
57 };
58 enum DIALING_TYPE
59 {
60  PPPD,
61  RMNET,
62  RNDIS,
63  ECM
64 };
65 #ifdef __cplusplus
66 extern "C"
67 {
68 #endif
69 #define with_r 0
70 
84  int send_at(int fd, const char *cmd, char *buff, int buff_size);
91  int cmd_AT(int fd);
102  int cmd_signal(int fd, char *buff, int buff_size);
106  void set_Callback(Callback);
122  int init(int fd, enum Model model, char *reply, int reply_size);
137  int dial(int fd, char *dialing_type, enum PDP_type pdp_type, char *apn, enum AUTH auth, char *name, char *pwd);
149  int dial_pppd(char *modem, enum PDP_type pdp_type, char *apn, char *auth, char *name, char *pwd);
157  int disconnect_dial(int fd, char *dialing_type);
161  void disconnect_pppd();
162 
163 #ifdef __cplusplus
164 }
165 #endif
166 #endif
int cmd_AT(int fd)
发送指令“AT”,检查模块是否在线。
void disconnect_pppd()
对于PPPD方式,使用本函数断开拨号。
int dial_pppd(char *modem, enum PDP_type pdp_type, char *apn, char *auth, char *name, char *pwd)
使用PPPD方式通过脚本进行拨号
int init(int fd, enum Model model, char *reply, int reply_size)
对GSM模块进行初始化
char * name
字体的描述(字体名)
Definition: font.h:36
void(* Callback)(int intput_type, char *pin, char *puk)
回调函数类型,其中intput_type为0时仅需输入PIN码进行解锁,若连续3次输入错误PIN码,这时intput_type为1,...
Definition: tq_gsm.h:29
void set_Callback(Callback)
设置用于输入PUK与PIN码的回调函数。
int dial(int fd, char *dialing_type, enum PDP_type pdp_type, char *apn, enum AUTH auth, char *name, char *pwd)
使用RMNET、RMDIS、ECM方式通过AT指令进行拨号。
int cmd_signal(int fd, char *buff, int buff_size)
发送指令“AT+CSQ”,获取信号强度
int disconnect_dial(int fd, char *dialing_type)
对于RMNET、RMDIS、ECM方式通过AT指令断开拨号。
int send_at(int fd, const char *cmd, char *buff, int buff_size)
用于发送AT指令