/************************************************************************/
/*  Copyright (C), 2016-2020, [Wang], 保留所有权利;
/*  模 块 名：内存共享C/S通信协议;
/*  描    述：;
/*
/*  版    本：[V];	
/*  作    者：[Wang];
/*  日    期：[7/4/2018];
/*
/*
/*  注    意：;
/*
/*  修改记录：[Wang];
/*  修改日期：;
/*  修改版本：;
/*  修改内容：;
/************************************************************************/
#ifndef __CD750_PROTO__
#define __CD750_PROTO__

// 命令类型;
enum CommandType {
	SHOW_APP,
	HIDE_APP,
	CONNECT_DEVICE,
	DIS_CONNECT_DEVICE,
	START_STREAMING,
	STOP_STREAMING,
	STOP_CAPTUREIMAGE,
	CAPTURE_IMAGE_COUNT,
	CAPTURE_IMAGE_TIME,
	CAPTURE_IMAGE_SINGLE,
	STOP_CAPTUREAUDIO,
	SYN_CAPTURE_AUDIO,
	ASY_CAPTURE_AUDIO
};

// 命令头;
typedef struct COMMANDHAED{
	unsigned short cmdFlag;		// 命令标识符;//固定：0x7F;
	unsigned short cmdType;		// 命令类型;
	BOOL  cmdUser;				// 命令者：C端=false，S端=true;
	DWORD cmdCRC32;				// 对具体命令的crc32校验;//校验耗时,暂不做;

	COMMANDHAED()
	{
		cmdFlag = 0x7F;
		cmdType = 0;
		cmdUser = TRUE;
		cmdCRC32 = 0;
	}
	// 拷贝构造函数;
	COMMANDHAED(const COMMANDHAED& other)
	{
		if (this != &other)
		{
			cmdFlag = other.cmdFlag;
			cmdType = other.cmdType;
			cmdUser = other.cmdUser;
			cmdCRC32 = other.cmdCRC32;
		}
	}

	// 赋值重载函数;
	COMMANDHAED& operator = (const COMMANDHAED& other)
	{
		if (this != &other)
		{
			cmdFlag = other.cmdFlag;
			cmdType = other.cmdType;
			cmdUser = other.cmdUser;
			cmdCRC32 = other.cmdCRC32;
		}

		return *this;
	}
}CommandHead,*pCommandHead;

// 连接设备;
typedef struct CMD_CONECTDEVICE {
	CommandHead cmdHead;
	unsigned short nIndex;		// 设备索引;
}CMD_ConnectDevice, *pCMD_ConnectDevice;

// 截图;
typedef struct CMD_CAPUTERIMAGE{
	// 命令头;
	CommandHead cmdHead;
	// 图片格式;
	unsigned short dwImageType;
	// 持续方式;//false=以张数为单位; true以秒为单位;
	BOOL bContinuType;	
	// 持续时间;
	int nKeepTime;
	// 每秒抓取张数;
	int nCaputerCount;
	// 保存路径;
	TCHAR szSaveDir[MAX_PATH];
	// 文件名前缀;
	TCHAR szPrefix[64];
	// 是否自动命名;
	BOOL IsAutoName;
	// 是否单张截图;
	BOOL bSingle;
}CMD_CaputerImage,*pCMD_CaputerImage;

// 视屏保存;
typedef struct CMD_CAPUTERAUDIO {
	// 命令头;
	CommandHead cmdHead;
	// 录制时长//单位毫秒;
	DWORD dwDuration;
	// 保存路径;
	TCHAR szSaveDir[MAX_PATH];
}CMD_CaputerAudio,*pCMD_CaputerAudio;

// 开始/停止流命令;
typedef struct CMD_STREAMOPT{
	CommandHead cmdHead;
	BOOL bStartStreaming;
}CMD_StreamOpt, *pCMD_StreamOpt;

// 返回结果;
typedef struct CMD_RESULT{
	CommandHead cmdHead;
	BOOL bResult;
}CMD_Result,*pCMD_Result;

// 共享内存名称;
#define MEMERY_NAME _T("UB530#TCL#ShareMemery")
// 共享内存的大小;
#define MEMERY_SIZE 1024*8	//8k;

#endif // __CD750_PROTO__
