⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smshandle.h

📁 在GPRS或者CDMA modem上实现发送/接收短信的C代码;支持Siemens
💻 H
字号:
#ifndef _SMS_HANDLE_H_
#define _SMS_HANDLE_H_

#include "typedef.h"
/*
#ifdef __cplusplus
extern "C" {
#endif
*/
#define MAX_MODULE_NAME 30
#define MAX_TTY_NAME    50

//sms type
#define SMS_TEXT  0x01
#define SMS_PDU   0x02

//message encode type
#define SMS_ENCODE_7BIT   0x01  //English message
#define SMS_ENCODE_8BIT   0x02  //binary message
#define SMS_ENCODE_UCS16  0x03 //Chinese message or English message

typedef struct _PDU_
{
    /* Address of SMSC */
    uchar sc_addr_len;    //sms center address length
    uchar sc_addr_type;   //sms center number type
    char  sc_addr[30];    //86+phone number
    
    uchar tp_head;        //File header type - 11
    uchar tp_msg_refer;   //TP-Message-Reference - 00
    /* TP-Destination-Address */
    uchar tp_da_len;      //destination address length
    uchar tp_da_type;     //destination address type
    char  tp_daddr[30];   //should be ingored
	
    uchar tp_pid;     //TP-Protocol-Identifier
    uchar tp_dcs;     //TP-Data-Coding-Scheme
    uchar tp_vp;      //TP valid period
}PDU;

typedef struct _SMS_CONFIG_
{
    /* tty configure */
    int  baudrate;   //serial baud rate
    int  databits;   //serial data bits
    int  stopbits;   //serial stop bits
    int  parity;     //serial parity type
    int  crtscts;    //flow control
    /* message configure */
    uchar smstype;  //0-pdu 1-text
    uchar smscode;  //0x00 7-bit  //0x08 ucs16 //0x15 8-bit
    /* PDU configure */
    PDU pdu;
}SMS_CONFIG;


//wmmp-sms functions configure
typedef struct _SMS_FUNC_
{
	char desc[MAX_MODULE_NAME];
	uchar acModuleType;
//	int  (*psms_init)(char smstype, char smscode);
	int  (*psms_init)(int fd, uchar ucSmsType, uchar ucSmsCode);
	int  (*psms_send)(int fd, const uchar *pSms_content, int len, const char *pDest, uchar ucSmsType, uchar ucSmsCode);
	int  (*psms_recv)(int fd, uchar *pSms_content, int *len, char *pFrom, uchar ucSmsType, uchar ucSmsCode);
	int  (*psms_ifnew)(int fd, uchar ucSmsType, uchar ucSmsCode);
	int  (*psms_parse)(const uchar *pRawSms, int rawlen, uchar *pMsg, int *msgLen, char *pFrom);
	int  (*psms_delall)(int fd);
}SMS_FUNC;

typedef struct _SMS_NODE_
{
	/* tty device name */
	char ttyname[MAX_TTY_NAME];
	int  ttyfd;
	/* sms configure */
	SMS_CONFIG SmsConf; 
	/* module information */
	SMS_FUNC SmsFunc;
	/* point to next sms node */
//	int allocated; //0-un-allocated 1-allocated
	struct _SMS_NODE_* next_node;
}SMS_NODE;

typedef SMS_NODE* SmsHandle;  //design like this is dangerous!!!

extern int allocsmshandle(SmsHandle* hSmsHandle);
extern int addsmshandle(SmsHandle* hSmsHandle);
extern int delsmshandle(SmsHandle* hSmsHandle);
extern int searchsmshandle(SmsHandle* hSmsHandle);
extern int findnode(const char* ttyname);

/*
#ifdef __cplusplus
}
#endif
*/
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -