📄 form1.h
字号:
#pragma once
/*
* "Copyright (c) 2006 Robert B. Reese ("AUTHOR")"
* All rights reserved.
* (R. Reese, reese@ece.msstate.edu, Mississippi State University)
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE "AUTHOR" BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE "AUTHOR"
* HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE "AUTHOR" SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE "AUTHOR" HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
* Please maintain this header in its entirety when copying/modifying
* these files.
*
* Files in this software distribution may have different usage
* permissions, see the header in each file. Some files have NO permission
* headers since parts of the original sources in these files
* came from vendor sources with no usage restrictions.
*
*/
/*
V0.1 Initial Release 10/July/2006 RBR
*/
/*
Author: R. Reese, Mississippi State, June 2006
To use this, the number in the EVB SIM typein field must
match the number used for the #define EVB_ID in the
Win32 Console application that is executing the stack.
Steps:
a. Start the WIN32 Console stack application
b. Start a virtual board application
c. Type EVB_ID number in to the EVB SIM typein window
d. Click on 'Connect' button.
e. If the status window says 'Connection Succeeded', then
the Virtual board process connected to the shared memory
of the Win32 console memory successfully.
f. Now you can click on the btn1, btn2 checkboxes to
simulate button presses to the WIN32 Console application
running the stack code.
*/
namespace virtual_board
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public __gc class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
MyInit();
}
protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}
private: System::Windows::Forms::TextBox * evbText;
private: System::Windows::Forms::Label * label2;
private: System::Windows::Forms::Button * connectBtn;
private: System::Windows::Forms::StatusBar * statusBar;
private: HANDLE smemH;
private: System::Windows::Forms::CheckBox * sw1ChkBox;
private: System::Windows::Forms::CheckBox * sw2ChkBox;
//pointer to the mutex used to coordinate access to shared memory
//even though this is write only for now and don't need a mutex
//we might want to change this later, so go ahead and make one
private: HANDLE hMutex;
private: System::Windows::Forms::Button * disconnBtn;
private: System::Windows::Forms::Label * label1;
private: System::Windows::Forms::Button * rdbg_Btn;
private: System::Windows::Forms::Button * wdbg_Btn;
private: System::Windows::Forms::TextBox * dbgText;
private: System::Windows::Forms::CheckBox * led1;
private: System::Windows::Forms::CheckBox * led2;
private: System::Timers::Timer * timer1;
private: System::Windows::Forms::CheckBox * rxEnable;
#define BTN1_MASK 0x01
#define BTN2_MASK 0x02
#define LED1_MASK 0x80
#define LED2_MASK 0x40
#define BLOCK_RX_MASK 0x10
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container * components;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->evbText = new System::Windows::Forms::TextBox();
this->label2 = new System::Windows::Forms::Label();
this->connectBtn = new System::Windows::Forms::Button();
this->statusBar = new System::Windows::Forms::StatusBar();
this->sw1ChkBox = new System::Windows::Forms::CheckBox();
this->sw2ChkBox = new System::Windows::Forms::CheckBox();
this->disconnBtn = new System::Windows::Forms::Button();
this->label1 = new System::Windows::Forms::Label();
this->dbgText = new System::Windows::Forms::TextBox();
this->rdbg_Btn = new System::Windows::Forms::Button();
this->wdbg_Btn = new System::Windows::Forms::Button();
this->led1 = new System::Windows::Forms::CheckBox();
this->led2 = new System::Windows::Forms::CheckBox();
this->timer1 = new System::Timers::Timer();
this->rxEnable = new System::Windows::Forms::CheckBox();
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->timer1))->BeginInit();
this->SuspendLayout();
//
// evbText
//
this->evbText->Location = System::Drawing::Point(64, 8);
this->evbText->Name = S"evbText";
this->evbText->Size = System::Drawing::Size(32, 20);
this->evbText->TabIndex = 4;
this->evbText->Text = S"0";
//
// label2
//
this->label2->Location = System::Drawing::Point(8, 8);
this->label2->Name = S"label2";
this->label2->Size = System::Drawing::Size(48, 23);
this->label2->TabIndex = 5;
this->label2->Text = S"EVB ID";
//
// connectBtn
//
this->connectBtn->Location = System::Drawing::Point(136, 40);
this->connectBtn->Name = S"connectBtn";
this->connectBtn->Size = System::Drawing::Size(200, 23);
this->connectBtn->TabIndex = 6;
this->connectBtn->Text = S"ConnectDummy";
this->connectBtn->Click += new System::EventHandler(this, connectBtn_Click);
//
// statusBar
//
this->statusBar->Location = System::Drawing::Point(0, 104);
this->statusBar->Name = S"statusBar";
this->statusBar->Size = System::Drawing::Size(488, 22);
this->statusBar->TabIndex = 7;
//
// sw1ChkBox
//
this->sw1ChkBox->Location = System::Drawing::Point(16, 40);
this->sw1ChkBox->Name = S"sw1ChkBox";
this->sw1ChkBox->TabIndex = 8;
this->sw1ChkBox->Text = S"SW1 (released)";
this->sw1ChkBox->CheckedChanged += new System::EventHandler(this, sw1ChkBox_CheckedChanged);
//
// sw2ChkBox
//
this->sw2ChkBox->Location = System::Drawing::Point(16, 64);
this->sw2ChkBox->Name = S"sw2ChkBox";
this->sw2ChkBox->TabIndex = 9;
this->sw2ChkBox->Text = S"SW2 (released)";
this->sw2ChkBox->CheckedChanged += new System::EventHandler(this, sw2ChkBox_CheckedChanged);
//
// disconnBtn
//
this->disconnBtn->Location = System::Drawing::Point(136, 72);
this->disconnBtn->Name = S"disconnBtn";
this->disconnBtn->Size = System::Drawing::Size(200, 23);
this->disconnBtn->TabIndex = 10;
this->disconnBtn->Text = S"DisConnDummy";
this->disconnBtn->Click += new System::EventHandler(this, disconnBtn_Click);
//
// label1
//
this->label1->Location = System::Drawing::Point(112, 8);
this->label1->Name = S"label1";
this->label1->Size = System::Drawing::Size(48, 23);
this->label1->TabIndex = 11;
this->label1->Text = S"DbgLev";
//
// dbgText
//
this->dbgText->Location = System::Drawing::Point(168, 8);
this->dbgText->Name = S"dbgText";
this->dbgText->Size = System::Drawing::Size(32, 20);
this->dbgText->TabIndex = 12;
this->dbgText->Text = S"0";
//
// rdbg_Btn
//
this->rdbg_Btn->Location = System::Drawing::Point(216, 8);
this->rdbg_Btn->Name = S"rdbg_Btn";
this->rdbg_Btn->TabIndex = 13;
this->rdbg_Btn->Text = S"ReadDbg";
this->rdbg_Btn->Click += new System::EventHandler(this, rdbg_Btn_Click);
//
// wdbg_Btn
//
this->wdbg_Btn->Location = System::Drawing::Point(304, 8);
this->wdbg_Btn->Name = S"wdbg_Btn";
this->wdbg_Btn->TabIndex = 14;
this->wdbg_Btn->Text = S"WriteDbg";
this->wdbg_Btn->Click += new System::EventHandler(this, wdbg_Btn_Click);
//
// led1
//
this->led1->Location = System::Drawing::Point(376, 40);
this->led1->Name = S"led1";
this->led1->Size = System::Drawing::Size(56, 24);
this->led1->TabIndex = 15;
this->led1->Text = S"LED1";
//
// led2
//
this->led2->Location = System::Drawing::Point(376, 72);
this->led2->Name = S"led2";
this->led2->Size = System::Drawing::Size(72, 24);
this->led2->TabIndex = 16;
this->led2->Text = S"LED2";
//
// timer1
//
this->timer1->Enabled = true;
this->timer1->Interval = 200;
this->timer1->SynchronizingObject = this;
this->timer1->Elapsed += new System::Timers::ElapsedEventHandler(this, timer1_Elapsed);
//
// rxEnable
//
this->rxEnable->Location = System::Drawing::Point(392, 8);
this->rxEnable->Name = S"rxEnable";
this->rxEnable->TabIndex = 17;
this->rxEnable->Text = S"Rx (enabled)";
this->rxEnable->CheckedChanged += new System::EventHandler(this, rxEnable_CheckedChanged);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -