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

📄 apexcomm.odl

📁 提供串口通讯参数设置接口
💻 ODL
字号:
///////////////////////////////////////////////////////////////
// 文件: ApexComm.odl
// 功能: 使用对象定义语言,定义控件对外的接口
// 作者: 王念峰
// 日期: 1999.04.19 - 创建
//       1999.05.15 - 修改,整理
// E_mai:wnf@wisepeak.com
// Http://www.wisepeak.com
///////////////////////////////////////////////////////////////
// 版本: 1.0
///////////////////////////////////////////////////////////////

#include <olectl.h>
#include <idispids.h>

[ uuid(F0A2BEC5-F8B2-11D2-8A54-0080C8EB2FFE), version(1.0),
  helpfile("ApexComm.hlp"),
  helpstring("ApexComm ActiveX Control module"), control]
library APEXCOMMLib
{
	importlib(STDOLE_TLB);
	importlib(STDTYPE_TLB);

	//控件类型定义
	typedef [ uuid(D167D7B3-F0CE-11D2-8A4E-0080C8EB2FFE), version(1.0)]
	enum{
		RtsEnable=0,
		//RTS_CONTROL_ENABLE 缺省值,只点亮该信号线
		RtsDisable=1,
		//RTS_CONTROL_DISABLE 不点亮信号线
		RtsHandshake=2,
		//RTS_CONTROL_HANDSHAKE 握手信号 小于1/3不亮,但小于1/2亮
		RtsTransmissionAvailable=3 
		//RTS_CONTROL_TOGGLE 有数据亮,无数据不亮 
	}TRtsControl;//传输请求流控
	//(例如:计算机到调制解调器)(request-to-send)

	typedef [ uuid(D167D7B4-F0CE-11D2-8A4E-0080C8EB2FFE), version(1.0)]
	enum{
		None=0,
		//无奇偶校验,缺省值
		Odd=1, 
		//奇校验
		Even=2, 
		//偶校验
		Mark=3,
		//符号校验
		Space=4
		//空校验
	}TParity;//校验方式

	typedef [ uuid(D167D7B5-F0CE-11D2-8A4E-0080C8EB2FFE), version(1.0)]
	enum{
		 One,
		 //一位停止位,缺省值
		 One_Half,
		 //注:有些芯片限制不能与5个数据位连用
		 Two
         //注:有些芯片限制不能与6,7,8个数据位连用
	}TStopBits;//停止位

	typedef [ uuid(D167D7B6-F0CE-11D2-8A4E-0080C8EB2FFE), version(1.0)]
	enum{ 
		 Five,
		 //5个字节的数据位
		 Six,
		 //6
		 Seven,
		 //7
		 Eight
		 //8缺省值
	}TByteSize;//数据位

	typedef [ uuid(D167D7B7-F0CE-11D2-8A4E-0080C8EB2FFE), version(1.0)]
	enum{
		 DtrEnable=0,
		 // DTR_CONTROL_ENABLE 缺省值
		 DtrDisable=1,
		 //DTR_CONTROL_DISABLE 
		 DtrHandshake=2
		 //DTR_CONTROL_HANDSHAKE 
	}TDtrControl;//数据终端准备好流控,
	//(例如:计算机到调制解调器)data-terminal-ready

	//  控件的发布接口
	[ uuid(F0A2BEC6-F8B2-11D2-8A54-0080C8EB2FFE),
	  helpstring("Dispatch interface for ApexComm Control"), hidden]
	dispinterface _DApexComm
	{
		properties:
			// NOTE - ClassWizard will maintain property information here.
			//    Use extreme caution when editing this section.
			//{{AFX_ODL_PROP(CApexCommCtrl)
			[id(1)] BSTR PortID;
			[id(2)] long BaudRate;
			[id(3)] boolean EnableParity;
			[id(4)] boolean OutxCtsFlow;
			[id(5)] boolean OutxDsrFlow;
			[id(6)] TDtrControl DtrControl;
			[id(7)] boolean DsrSensitivity;
			[id(8)] boolean TxContinueOnXoff;
			[id(9)] boolean OutxXonXoffFlow;
			[id(10)] boolean InxXonXoffFlow;
			[id(11)] boolean ReplaceWhenParityError;
			[id(12)] boolean IgnoreNullChar;
			[id(13)] TRtsControl RtsControl;
			[id(14)] short XonLimit;
			[id(15)] short XoffLimit;
			[id(16)] TByteSize ByteSize;
			[id(17)] TParity Parity;
			[id(18)] TStopBits StopBits;
			[id(19)] short XonChar;
			[id(20)] short XoffChar;
			[id(21)] short ReplacedChar;
			[id(22)] long InputBufferSize;
			[id(23)] long OutputBufferSize;
			[id(24)] long ReadIntervalTimeout;
			[id(25)] long ReadTotalTimeoutMultiplier;
			[id(26)] long ReadTotalTimeoutConstant;
			[id(27)] long WriteTotalTimeoutMultiplier;
			[id(28)] long WriteTotalTimeoutConstant;
			//}}AFX_ODL_PROP

		methods:
			// NOTE - ClassWizard will maintain method information here.
			//    Use extreme caution when editing this section.
			//{{AFX_ODL_METHOD(CApexCommCtrl)
			[id(29)] void OpenPort();//启动串口通讯
			[id(30)] void ClosePort();//终止串口通讯
			[id(31)] boolean WritePort(BSTR pDataToWrite, long dwSizeofDataToWrite);//写串口
			//}}AFX_ODL_METHOD
	};

	//  控件的事件发布接口
	[ uuid(F0A2BEC7-F8B2-11D2-8A54-0080C8EB2FFE),
	  helpstring("Event interface for ApexComm Control") ]
	dispinterface _DApexCommEvents
	{
		properties:
			//  Event interface has no properties

		methods:
			// NOTE - ClassWizard will maintain event information here.
			//    Use extreme caution when editing this section.
			//{{AFX_ODL_EVENT(CApexCommCtrl)
			[id(1)] void OnReceiveData(BSTR pDataReceived, long dwSizeOfDataReceived);
			[id(2)] void OnCommHangup(boolean bReadOrWrite);
			[id(3)] void ReceiveDataError(long dwEventMask);
			[id(4)] void DataSendFinished();//数据传输完毕
			//}}AFX_ODL_EVENT
	};

	//控件的类信息
	[ uuid(F0A2BEC8-F8B2-11D2-8A54-0080C8EB2FFE),
	  helpstring("ApexComm Control"), control ]
	coclass ApexComm
	{
		[default] dispinterface _DApexComm;
		[default, source] dispinterface _DApexCommEvents;
	};
	//{{AFX_APPEND_ODL}}
	//}}AFX_APPEND_ODL}}
};

⌨️ 快捷键说明

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