您好,欢迎来电子发烧友网! ,新用户?[免费注册]

您的位置:电子发烧友网>源码下载>通讯/手机编程>

wince+gprs收发短信源码

大小:70 人气: 2010-03-20 需要积分:0
小野七七的空间

用户级别:注册会员

贡献文章:

贡献资料:

wince+gprs收发短信源码

部分代码如下:// GPRS.h: interface for the CGPRS class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_GPRS_H__8EB70C01_884B_4974_88B3_048F9C8F9735__INCLUDED_)
#define AFX_GPRS_H__8EB70C01_884B_4974_88B3_048F9C8F9735__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "CeSerial.h"

class CGPRS 
{
public:
 CGPRS();
 virtual ~CGPRS();

 BOOL GPRS_Init(LPCTSTR Port, int BaudRate, DWORD UserParam);

 // GPRS 回调函数
 typedef void (CALLBACK *ONGPRSRECV)(DWORD UserParam, DWORD Status, CString strData);
 ONGPRSRECV OnGPRSRecv;

 BOOL GPRS_DialUp(CString strTelNum); 
 BOOL GPRS_DialDown(void);

 BOOL GPRS_TakeTheCall(void);
 BOOL GPRS_HangUpTheCall(void);

 BOOL GPRS_DeleteShortMsg(DWORD num);

 BOOL GPRS_ReadShortMessage(DWORD num, CString *strTelCode, CString *Msg);

 BOOL GPRS_SendShortMessage(CString strTelNum, CString Msg);
 BOOL GPRS_SetShortMSGCenterTel(CString strTelNum);
 
 BOOL GPRS_CheckMsgNum(CString *strNum, CString *strTotal);

private:

 CCeSerial *pCeSerial;
 DWORD m_UserParam;       /* 使用本模块用户 */

 HANDLE m_ATCmdRespEvent;     /* AT 命令回复事件 */
 
 CString m_strRespBuf;      /* 回复缓冲区字符串 */

 DWORD m_RespCnt;

 BOOL bSendATCmd;       /* 是否发送了命令 */

 void ResetGlobalVarial(void);

 BOOL GPRS_SendATCmd(CString strCmd);  /* 发送 AT 命令 */
 BOOL GPRS_WriteMsg(CString Msg);   /* 发送短信内容 */
 BOOL GPRS_WaitResponseOK(void);    /* 等待 AT 命令的响应 */

 CString GPRS_GetTheCallNum(CString str); /* 获取打进来的电话的号码 */

 //int FindMsgPos(void);      /* 查找短信的位置 */
 int FindMsgPos(int *posnum, int *numlen, int *posmsg, int *msglen);
 static void CALLBACK OnCommRecv(DWORD UserParam, BYTE *buf, DWORD buflen);
};

// GPRS 状态码
#define GPRS_STATUS_RECEIVE_CALL   0x01  /* 接到来电 */
#define GPRS_STATUS_OTHER_SIDE_HANDUP  0x02  /* 对方挂机 */

#endif // !defined(AFX_GPRS_H__8EB70C01_884B_4974_88B3_048F9C8F9735__INCLUDED_)

非常好我支持^.^

(7) 77.8%

不好我反对

(2) 22.2%

      发表评论

      用户评论
      评价:好评中评差评

      发表评论,获取积分! 请遵守相关规定!