- 20
- 0
- 约 20页
- 2017-07-09 发布于河南
- 举报
(新)实验六 BciTool
实验六 BciTool1. 创建工程(注:图片说明中的工程名为MyBciDrawWave,文档中工程名为BciTool,请同学们自行统一。)2.编辑界面1)2)ID名串口设置ID_MENU_UART_SET打开串口ID_MENU_UART_OPEN关闭串口ID_MENU_UART_CLOSE文件保存ID_MENU_FILE_SAVE文件回放ID_MENU_FILE_REVIEW3.添加库1)复制下列文件到工程文件夹中#include MyFileSaveThread.h#include MyWorkThread.h#include PlayFile.h#include SerialPort.h#include BciData.h#include BciPack.h#include OScopeCtrl.h#pragma comment(lib, BciDll)#pragma comment(lib, ComSet)#pragma comment(lib, CFilePlay)#pragma comment(lib, DrawWave)#pragma comment(lib, FileSave)#pragma comment(lib, DrawWave)声明对象:4.编写初始化函数OnInitialUpdatevoid CBciToolView::OnInitialUpdate(){CFormView::OnInitialUpdate();GetParentFrame()-RecalcLayout();ResizeParentToFit();CRect rect;GetDlgItem(IDC_STATIC_WAVE)-GetWindowRect(rect) ;ScreenToClient(rect);m_OScopeCtrl.Create(WS_VISIBLE | WS_CHILD, rect, this) ; // customize the controlm_OScopeCtrl.SetRange(0, 100, 0) ;m_OScopeCtrl.SetYUnits() ;m_OScopeCtrl.SetXUnits(SPO2 WAVE) ;//m_OScopeCtrl.SetTitle() ;m_OScopeCtrl.SetBackgroundColor(RGB(0, 0, 0)) ;m_OScopeCtrl.SetGridColor(RGB(192, 192, 255)) ;m_OScopeCtrl.SetPlotColor(RGB(255, 255, 255)) ;}5.实现串口设置功能,编写1)为菜单选项添加消息映射函数(以ID_MENU_UART_SET为例)给其他4个菜单选项添加消息映射函数。2)关联消息映射需要手动添加的消息映射函数:ON_MESSAGE(WM_COMM_RXCHAR,OnMessageCom)//用来保存文件ON_MESSAGE(WM_FILE_PLAY_REFRESH,OnPlayFile)//用来播放文件3)在头文件里声明函数需要手动添加的函数:afx_msg void OnMessageCom(WPARAM wp,LPARAM lp);afx_msg void OnPlayFile(WPARAM wp,LPARAM lp);4)在初始化函数中添加代码m_SerialPort.m_strBuad = 4800;m_SerialPort.m_strCheck = ODD;//m_PlayFile.m_pOwner = this;InitBcipackResp();5)编辑实现函数(注:最后两个函数需要手动添加)void CBciToolView::OnMenuUartSet() {// TODO: Add your command handler code herem_SerialPort.ConfigPort();}void CBciToolView::OnMenuUartOpen() {// TODO: Add your command handler code herem_SerialPort.OpenPort(this);}void CBciToolView::OnMenuUartClose() {// TODO: Add your command handler code herem_SerialPort.ClosePort();}void CBciToolView::OnMenuFileSave() {// TODO: Add your command handler code herem_FileSaveThread.ShowDlg();}void CBciToolView::
原创力文档

文档评论(0)