📄 seriessample.cpp
字号:
// SeriesSample.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "SeriesSample.h"
#include "SeriesSampleDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//===== ADD Globile variable=======
//define for NETWORK LAYER PACKET constant
//Status of Send_object
#define ST_SENDOBJ_DISABLE 0
#define ST_SENDOBJ_ACTIVE 1
#define ST_SENDING_OBJ 2
#define ST_SENDOBJ_FINISHED 3
// 信息头
#define PAA 0xAA // 包起始第一位
#define P55 0x55 // 包起始第二位
// 包类型
#define PT_SEARCHNWREQ 0xA0 //搜索网络请求
#define PT_SEARCHNWACK 0xA1 //搜索网络应答
#define PT_SEARCHNDREQ 0xA2 //搜索设备请求
#define PT_SEARCHNDACK 0xA3 //搜索设备应答
#define PT_CONNREQ 0xA4 // 握手请求包
#define PT_CONNACK 0xA5 // 握手应答包
#define PT_SENDMSGREQ 0xB0 //消息发送
#define PT_SENDMSGACK 0xB1 //消息发送应答
#define PT_BROADCAST 0xB2 //消息广播
#define PT_BROADCASTACK 0xB3 //消息广播应答
#define PT_OBJTRANSREQ 0xC0 //对象传输请求
#define PT_OBJTRANSACK 0xC1 //对象传输应答
#define PT_ZBQULITYREQ 0xF0 //ZB信号质量查询请求
#define PT_ZBQULITYRACK 0xF1 //ZB信号质量查询应答
#define PT_ZBSENSITIVEREQ 0xF2 //ZB信号灵敏度查询请求
#define PT_ZBSENSITIVEACK 0xF3 //ZB信号灵敏度查询应答
#define MAX_PACKET_LEN 114 //最大包长度
#define MAX_PACKET_DATA_LEN 100 //最大包数长度
#define MAX_BUF_LEN 4096 ////最大缓冲区长度
CString g_MyID,g_OtherID,g_MyNickName,g_MyPwd,g_OtherNickName,
g_OtherGender,g_MyShow,g_OtherShow,g_RecvStr,g_MyFileName;
int g_MyIcon,g_OtherIcon,g_MyGender,g_PacketNo,g_FileLength;
BYTE g_second,g_statusOfObj,g_recvLen,g_BS_NoG,g_dataPointer;
BYTE g_BS_State[99];
BYTE g_sendBuf[MAX_PACKET_LEN];
BYTE g_recvBuf[MAX_BUF_LEN];
BYTE g_recvdata[MAX_PACKET_LEN];
WORD g_WritePointer,g_ReadPointer;
HANDLE g_hMyFileHandle;
BOOL g_bCom_Open,g_bRecvAck,g_bPacketRecv_Flag,g_bDone,g_bGhExit,g_bLargePacket;
//====== end Add Globile variable====
/////////////////////////////////////////////////////////////////////////////
// CSeriesSampleApp
BEGIN_MESSAGE_MAP(CSeriesSampleApp, CWinApp)
//{{AFX_MSG_MAP(CSeriesSampleApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSeriesSampleApp construction
CSeriesSampleApp::CSeriesSampleApp()
: CWinApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CSeriesSampleApp object
CSeriesSampleApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CSeriesSampleApp initialization
BOOL CSeriesSampleApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
CSeriesSampleDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -