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

📄 comtraview.h

📁 sms短信模拟程序
💻 H
字号:
// comtraView.h : interface of the CComtraView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_COMTRAVIEW_H__80FA3C3A_55CE_4A9B_B9DE_88AD98D0BA02__INCLUDED_)
#define AFX_COMTRAVIEW_H__80FA3C3A_55CE_4A9B_B9DE_88AD98D0BA02__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "global.h"
#include "SockServer.h"
// 用户信息编码方式
#define GSM_7BIT		0
#define GSM_8BIT		4
#define GSM_UCS2		8

// 应答状态
#define GSM_WAIT		0		// 等待,不确定
#define GSM_OK			1		// OK
#define GSM_ERR			-1		// ERROR

typedef struct {
	char SCA[16];			// 短消息服务中心号码(SMSC地址)
	char TPA[16];			// 目标号码或回复号码(TP-DA或TP-RA)
	char TP_PID;			// 用户信息协议标识(TP-PID)
	char TP_DCS;			// 用户信息编码方式(TP-DCS)
	char TP_SCTS[16];		// 服务时间戳字符串(TP_SCTS), 接收时用到
	char TP_UD[160];		// 原始用户信息(编码前或解码后的TP-UD)
	short index;			// 短消息序号,在读取时用到
} SM_PARAM;

class CComtraView : public CEditView
{
protected: // create from serialization only
	CComtraView();
	DECLARE_DYNCREATE(CComtraView)

// Attributes
public:
	CComtraDoc* GetDocument();
	SYSINFO sysinfo;
	SockServer *m_SockServer;
	SockServer m_ConnSock;

	unsigned char m_CommData[20];
	int m_iLen;
// Operations
public:

	void Message(LPCTSTR lpszMessage);
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CComtraView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void OnInitialUpdate();
	

	protected:
	virtual void CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType = adjustBorder);
	//}}AFX_VIRTUAL

// Implementation
public:
	void ParseCallID(char *string);
	int SendCallInfo(char *CallID);
	static CComtraView * GetView();
	void initsysinfo();
	virtual ~CComtraView();

	DWORD OnSocketReceive(int nError);
	DWORD OnSocketAccept(int nError);
	DWORD OnSocketClose(int nError);

	int gsmSendMessage(SM_PARAM* pSrc);
	int gsmEncodePdu(const SM_PARAM* pSrc, char* pDst);
	int gsmEncode7bit(const char* pSrc, unsigned char* pDst, int nSrcLength);
	int gsmEncode8bit(const char* pSrc, unsigned char* pDst, int nSrcLength);
	int gsmEncodeUcs2(const char* pSrc, unsigned char* pDst, int nSrcLength);

	int gsmInvertNumbers(const char* pSrc, char* pDst, int nSrcLength);
	int gsmString2Bytes(const char* pSrc, unsigned char* pDst, int nSrcLength);
	int gsmBytes2String(const unsigned char* pSrc, char* pDst, int nSrcLength);

#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CComtraView)
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in comtraView.cpp
inline CComtraDoc* CComtraView::GetDocument()
   { return (CComtraDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_COMTRAVIEW_H__80FA3C3A_55CE_4A9B_B9DE_88AD98D0BA02__INCLUDED_)

⌨️ 快捷键说明

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