├── MQTT-Client
├── M2Mqtt.dll
├── MQTT-Client
│ ├── Properties
│ │ ├── Settings.settings
│ │ ├── AssemblyInfo.cs
│ │ ├── Settings.Designer.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── Program.cs
│ ├── MQTT-Client.csproj
│ ├── Form1.cs
│ ├── Form1.resx
│ └── Form1.Designer.cs
└── MQTT-Client.sln
├── README.MD
├── .gitattributes
├── .gitignore
└── LICENSE
/MQTT-Client/M2Mqtt.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/er230059/MQTT-Client/HEAD/MQTT-Client/M2Mqtt.dll
--------------------------------------------------------------------------------
/MQTT-Client/MQTT-Client/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/MQTT-Client/MQTT-Client/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 |
6 | namespace MQTT_Client
7 | {
8 | static class Program
9 | {
10 | ///
11 | /// 應用程式的主要進入點。
12 | ///
13 | [STAThread]
14 | static void Main()
15 | {
16 | Application.EnableVisualStyles();
17 | Application.SetCompatibleTextRenderingDefault(false);
18 | Application.Run(new Form1());
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/README.MD:
--------------------------------------------------------------------------------
1 | #MQTT Client
2 | MQTT Client implemented by C# and Paho project
3 |
4 | #Usage
5 | Use [Mosquitto](http://mosquitto.org/) build a localhost MQTT broker server or use public MQTT broker server, such as:
6 | `test.mosquitto.org`, port `1883`
7 | `iot.eclipse.org`, port `1883`
8 |
9 | #Requirements
10 | Microsoft .NET Framework 4 to execution
11 | Visual Studio 2013 to build
12 |
13 | #Links
14 | [MQTT protocol](http://mqtt.org/)
15 | [Paho project](http://www.eclipse.org/paho/)
16 |
17 | #License
18 | [Eclipse Public License - v 1.0](https://projects.eclipse.org/content/eclipse-public-license-1.0)
19 |
--------------------------------------------------------------------------------
/MQTT-Client/MQTT-Client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MQTT-Client", "MQTT-Client\MQTT-Client.csproj", "{59EB20D4-4EC2-4FB2-8AB1-0AB1D1F2E63E}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {59EB20D4-4EC2-4FB2-8AB1-0AB1D1F2E63E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {59EB20D4-4EC2-4FB2-8AB1-0AB1D1F2E63E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {59EB20D4-4EC2-4FB2-8AB1-0AB1D1F2E63E}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {59EB20D4-4EC2-4FB2-8AB1-0AB1D1F2E63E}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/MQTT-Client/MQTT-Client/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 組件的一般資訊是由下列的屬性集控制。
6 | // 變更這些屬性的值即可修改組件的相關
7 | // 資訊。
8 | [assembly: AssemblyTitle("MQTT-Client")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("MQTT-Client")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 將 ComVisible 設定為 false 會使得這個組件中的類型
18 | // 對 COM 元件而言為不可見。如果您需要從 COM 存取這個組件中
19 | // 的類型,請在該類型上將 ComVisible 屬性設定為 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
23 | [assembly: Guid("1aa0de1a-5aa9-4b1f-a55c-c4e494d318ba")]
24 |
25 | // 組件的版本資訊是由下列四項值構成:
26 | //
27 | // 主要版本
28 | // 次要版本
29 | // 組建編號
30 | // 修訂編號
31 | //
32 | // 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將組建和修訂編號
33 | // 指定為預設值:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/MQTT-Client/MQTT-Client/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34209
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace MQTT_Client.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/MQTT-Client/MQTT-Client/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 這段程式碼是由工具產生的。
4 | // 執行階段版本:4.0.30319.34209
5 | //
6 | // 變更這個檔案可能會導致不正確的行為,而且如果已重新產生
7 | // 程式碼,這個檔案將會遺失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace MQTT_Client.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 用於查詢當地語系化字串等的強類型資源類別
17 | ///
18 | // 這個類別是自動產生的,是利用 StronglyTypedResourceBuilder
19 | // 類別透過 ResGen 或 Visual Studio 這類工具。
20 | // 若要加入或移除成員,請編輯您的 .ResX 檔,然後重新執行 ResGen
21 | // (利用 /str 選項),或重建您的 VS 專案。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 傳回這個類別使用的快取的 ResourceManager 執行個體。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MQTT_Client.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆寫目前執行緒的 CurrentUICulture 屬性,對象是所有
56 | /// 使用這個強類型資源類別的資源查閱。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.sln.docstates
8 |
9 | # Build results
10 |
11 | [Dd]ebug/
12 | [Rr]elease/
13 | x64/
14 | build/
15 | [Bb]in/
16 | [Oo]bj/
17 |
18 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
19 | !packages/*/build/
20 |
21 | # MSTest test Results
22 | [Tt]est[Rr]esult*/
23 | [Bb]uild[Ll]og.*
24 |
25 | *_i.c
26 | *_p.c
27 | *.ilk
28 | *.meta
29 | *.obj
30 | *.pch
31 | *.pdb
32 | *.pgc
33 | *.pgd
34 | *.rsp
35 | *.sbr
36 | *.tlb
37 | *.tli
38 | *.tlh
39 | *.tmp
40 | *.tmp_proj
41 | *.log
42 | *.vspscc
43 | *.vssscc
44 | .builds
45 | *.pidb
46 | *.log
47 | *.scc
48 |
49 | # Visual C++ cache files
50 | ipch/
51 | *.aps
52 | *.ncb
53 | *.opensdf
54 | *.sdf
55 | *.cachefile
56 |
57 | # Visual Studio profiler
58 | *.psess
59 | *.vsp
60 | *.vspx
61 |
62 | # Guidance Automation Toolkit
63 | *.gpState
64 |
65 | # ReSharper is a .NET coding add-in
66 | _ReSharper*/
67 | *.[Rr]e[Ss]harper
68 |
69 | # TeamCity is a build add-in
70 | _TeamCity*
71 |
72 | # DotCover is a Code Coverage Tool
73 | *.dotCover
74 |
75 | # NCrunch
76 | *.ncrunch*
77 | .*crunch*.local.xml
78 |
79 | # Installshield output folder
80 | [Ee]xpress/
81 |
82 | # DocProject is a documentation generator add-in
83 | DocProject/buildhelp/
84 | DocProject/Help/*.HxT
85 | DocProject/Help/*.HxC
86 | DocProject/Help/*.hhc
87 | DocProject/Help/*.hhk
88 | DocProject/Help/*.hhp
89 | DocProject/Help/Html2
90 | DocProject/Help/html
91 |
92 | # Click-Once directory
93 | publish/
94 |
95 | # Publish Web Output
96 | *.Publish.xml
97 |
98 | # NuGet Packages Directory
99 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line
100 | #packages/
101 |
102 | # Windows Azure Build Output
103 | csx
104 | *.build.csdef
105 |
106 | # Windows Store app package directory
107 | AppPackages/
108 |
109 | # Others
110 | sql/
111 | *.Cache
112 | ClientBin/
113 | [Ss]tyle[Cc]op.*
114 | ~$*
115 | *~
116 | *.dbmdl
117 | *.[Pp]ublish.xml
118 | *.pfx
119 | *.publishsettings
120 |
121 | # RIA/Silverlight projects
122 | Generated_Code/
123 |
124 | # Backup & report files from converting an old project file to a newer
125 | # Visual Studio version. Backup files are not needed, because we have git ;-)
126 | _UpgradeReport_Files/
127 | Backup*/
128 | UpgradeLog*.XML
129 | UpgradeLog*.htm
130 |
131 | # SQL Server files
132 | App_Data/*.mdf
133 | App_Data/*.ldf
134 |
135 |
136 | #LightSwitch generated files
137 | GeneratedArtifacts/
138 | _Pvt_Extensions/
139 | ModelManifest.xml
140 |
141 | # =========================
142 | # Windows detritus
143 | # =========================
144 |
145 | # Windows image file caches
146 | Thumbs.db
147 | ehthumbs.db
148 |
149 | # Folder config file
150 | Desktop.ini
151 |
152 | # Recycle Bin used on file shares
153 | $RECYCLE.BIN/
154 |
155 | # Mac desktop service store files
156 | .DS_Store
157 |
--------------------------------------------------------------------------------
/MQTT-Client/MQTT-Client/MQTT-Client.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {59EB20D4-4EC2-4FB2-8AB1-0AB1D1F2E63E}
8 | WinExe
9 | Properties
10 | MQTT_Client
11 | MQTT-Client
12 | v4.0
13 | 512
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 | ..\M2Mqtt.dll
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | Form
53 |
54 |
55 | Form1.cs
56 |
57 |
58 |
59 |
60 | Form1.cs
61 |
62 |
63 | ResXFileCodeGenerator
64 | Resources.Designer.cs
65 | Designer
66 |
67 |
68 | True
69 | Resources.resx
70 |
71 |
72 | SettingsSingleFileGenerator
73 | Settings.Designer.cs
74 |
75 |
76 | True
77 | Settings.settings
78 | True
79 |
80 |
81 |
82 |
89 |
--------------------------------------------------------------------------------
/MQTT-Client/MQTT-Client/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/MQTT-Client/MQTT-Client/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using System.Net;
11 | using uPLibrary.Networking.M2Mqtt;
12 | using uPLibrary.Networking.M2Mqtt.Messages;
13 |
14 | namespace MQTT_Client
15 | {
16 | public partial class Form1 : Form
17 | {
18 | private delegate void myUICallBack(string myStr, TextBox ctl);
19 | static MqttClient client;
20 | private void myUI(string myStr, TextBox ctl)
21 | {
22 | if (this.InvokeRequired)
23 | {
24 | myUICallBack myUpdate = new myUICallBack(myUI);
25 | this.Invoke(myUpdate, myStr, ctl);
26 | }
27 | else
28 | {
29 | ctl.AppendText(myStr + Environment.NewLine);
30 | }
31 | }
32 |
33 | private void client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e)
34 | {
35 | myUI(System.Text.Encoding.UTF8.GetString(e.Message), MessageTextBox);
36 | }
37 |
38 | public Form1()
39 | {
40 | InitializeComponent();
41 | }
42 |
43 | private void Form1_Load(object sender, EventArgs e)
44 | {
45 | this.AcceptButton = this.ConnectButton;
46 | QosComboBox.SelectedIndex = 0;
47 | }
48 |
49 | private void Form1_Closing(object sender, FormClosingEventArgs e)
50 | {
51 | if (client != null && client.IsConnected) client.Disconnect();
52 | }
53 |
54 | private void ConnectButton_Click(object sender, EventArgs e)
55 | {
56 | int port;
57 | if (HostTextBox.Text.Length == 0)
58 | {
59 | label4.Text = "Invild host";
60 | }
61 | else if (!Int32.TryParse(PortTextBox.Text, out port))
62 | {
63 | label4.Text = "Invild port";
64 | }
65 | else
66 | {
67 | try
68 | {
69 | client = new MqttClient(HostTextBox.Text, port, false, null);
70 | client.Connect(Guid.NewGuid().ToString());
71 | client.MqttMsgPublishReceived += new MqttClient.MqttMsgPublishEventHandler(client_MqttMsgPublishReceived);
72 | }
73 | catch
74 | {
75 | label4.Text = "Can't connect to server";
76 | }
77 | if (client != null && client.IsConnected)
78 | {
79 | this.AcceptButton = this.PublishButton;
80 | label4.Text = "";
81 | MessageTextBox.Clear();
82 | SubscribeButton.Enabled = true;
83 | PublishButton.Enabled = true;
84 | UnsubscribeButton.Enabled = true;
85 | DisconnectButton.Enabled = true;
86 | ConnectButton.Enabled = false;
87 | HostTextBox.Enabled = false;
88 | PortTextBox.Enabled = false;
89 | }
90 | }
91 | }
92 |
93 | private void DisconnectButton_Click(object sender, EventArgs e)
94 | {
95 | if (client != null && client.IsConnected) client.Disconnect();
96 | SubscribeButton.Enabled = false;
97 | PublishButton.Enabled = false;
98 | UnsubscribeButton.Enabled = false;
99 | DisconnectButton.Enabled = false;
100 | ConnectButton.Enabled = true;
101 | HostTextBox.Enabled = true;
102 | PortTextBox.Enabled = true;
103 | SubListBox.Items.Clear();
104 | }
105 |
106 | private void SubscribeButton_Click(object sender, EventArgs e)
107 | {
108 | if (SubTopicTextBox.Text.Length == 0)
109 | {
110 | label4.Text = "Subscribe topic can't be empty";
111 | }
112 | else
113 | {
114 | label4.Text = "";
115 | client.Subscribe(new string[] { SubTopicTextBox.Text }, new byte[] { (byte)QosComboBox.SelectedIndex });
116 | SubListBox.Items.Add(SubTopicTextBox.Text);
117 | }
118 | }
119 |
120 | private void PublishButton_Click(object sender, EventArgs e)
121 | {
122 | if (PubMessageTextBox.Text.Length == 0)
123 | {
124 | label4.Text = "No message to send";
125 | }
126 | else if (PubTopicTextBox.Text.Length == 0)
127 | {
128 | label4.Text = "Publish topic can't be empty";
129 | }
130 | else if (PubTopicTextBox.Text.IndexOf('#') != -1 || PubTopicTextBox.Text.IndexOf('+') != -1)
131 | {
132 | label4.Text = "Publish topic can't include wildcard(# , +)";
133 | }
134 | else
135 | {
136 | label4.Text = "";
137 | client.Publish(PubTopicTextBox.Text, Encoding.UTF8.GetBytes(PubMessageTextBox.Text), (byte)QosComboBox.SelectedIndex, RetainCheckBox.Checked);
138 | }
139 | }
140 |
141 | private void ClearButton_Click(object sender, EventArgs e)
142 | {
143 | MessageTextBox.Clear();
144 | }
145 |
146 | private void UnsubscribeButton_Click(object sender, EventArgs e)
147 | {
148 | if (SubListBox.SelectedItem == null)
149 | {
150 | label4.Text = "Select topic to unscribe";
151 | }
152 | else
153 | {
154 | label4.Text = "";
155 | client.Unsubscribe(new string[] { SubListBox.SelectedItem.ToString() });
156 | SubListBox.Items.Remove(SubListBox.SelectedItem);
157 | }
158 | }
159 | }
160 | }
161 |
--------------------------------------------------------------------------------
/MQTT-Client/MQTT-Client/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Eclipse Public License - v 1.0
2 |
3 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
4 | LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
5 | CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
6 |
7 | 1. DEFINITIONS
8 |
9 | "Contribution" means:
10 |
11 | a) in the case of the initial Contributor, the initial code and documentation
12 | distributed under this Agreement, and
13 | b) in the case of each subsequent Contributor:
14 | i) changes to the Program, and
15 | ii) additions to the Program;
16 |
17 | where such changes and/or additions to the Program originate from and are
18 | distributed by that particular Contributor. A Contribution 'originates'
19 | from a Contributor if it was added to the Program by such Contributor
20 | itself or anyone acting on such Contributor's behalf. Contributions do not
21 | include additions to the Program which: (i) are separate modules of
22 | software distributed in conjunction with the Program under their own
23 | license agreement, and (ii) are not derivative works of the Program.
24 |
25 | "Contributor" means any person or entity that distributes the Program.
26 |
27 | "Licensed Patents" mean patent claims licensable by a Contributor which are
28 | necessarily infringed by the use or sale of its Contribution alone or when
29 | combined with the Program.
30 |
31 | "Program" means the Contributions distributed in accordance with this
32 | Agreement.
33 |
34 | "Recipient" means anyone who receives the Program under this Agreement,
35 | including all Contributors.
36 |
37 | 2. GRANT OF RIGHTS
38 | a) Subject to the terms of this Agreement, each Contributor hereby grants
39 | Recipient a non-exclusive, worldwide, royalty-free copyright license to
40 | reproduce, prepare derivative works of, publicly display, publicly
41 | perform, distribute and sublicense the Contribution of such Contributor,
42 | if any, and such derivative works, in source code and object code form.
43 | b) Subject to the terms of this Agreement, each Contributor hereby grants
44 | Recipient a non-exclusive, worldwide, royalty-free patent license under
45 | Licensed Patents to make, use, sell, offer to sell, import and otherwise
46 | transfer the Contribution of such Contributor, if any, in source code and
47 | object code form. This patent license shall apply to the combination of
48 | the Contribution and the Program if, at the time the Contribution is
49 | added by the Contributor, such addition of the Contribution causes such
50 | combination to be covered by the Licensed Patents. The patent license
51 | shall not apply to any other combinations which include the Contribution.
52 | No hardware per se is licensed hereunder.
53 | c) Recipient understands that although each Contributor grants the licenses
54 | to its Contributions set forth herein, no assurances are provided by any
55 | Contributor that the Program does not infringe the patent or other
56 | intellectual property rights of any other entity. Each Contributor
57 | disclaims any liability to Recipient for claims brought by any other
58 | entity based on infringement of intellectual property rights or
59 | otherwise. As a condition to exercising the rights and licenses granted
60 | hereunder, each Recipient hereby assumes sole responsibility to secure
61 | any other intellectual property rights needed, if any. For example, if a
62 | third party patent license is required to allow Recipient to distribute
63 | the Program, it is Recipient's responsibility to acquire that license
64 | before distributing the Program.
65 | d) Each Contributor represents that to its knowledge it has sufficient
66 | copyright rights in its Contribution, if any, to grant the copyright
67 | license set forth in this Agreement.
68 |
69 | 3. REQUIREMENTS
70 |
71 | A Contributor may choose to distribute the Program in object code form under
72 | its own license agreement, provided that:
73 |
74 | a) it complies with the terms and conditions of this Agreement; and
75 | b) its license agreement:
76 | i) effectively disclaims on behalf of all Contributors all warranties
77 | and conditions, express and implied, including warranties or
78 | conditions of title and non-infringement, and implied warranties or
79 | conditions of merchantability and fitness for a particular purpose;
80 | ii) effectively excludes on behalf of all Contributors all liability for
81 | damages, including direct, indirect, special, incidental and
82 | consequential damages, such as lost profits;
83 | iii) states that any provisions which differ from this Agreement are
84 | offered by that Contributor alone and not by any other party; and
85 | iv) states that source code for the Program is available from such
86 | Contributor, and informs licensees how to obtain it in a reasonable
87 | manner on or through a medium customarily used for software exchange.
88 |
89 | When the Program is made available in source code form:
90 |
91 | a) it must be made available under this Agreement; and
92 | b) a copy of this Agreement must be included with each copy of the Program.
93 | Contributors may not remove or alter any copyright notices contained
94 | within the Program.
95 |
96 | Each Contributor must identify itself as the originator of its Contribution,
97 | if
98 | any, in a manner that reasonably allows subsequent Recipients to identify the
99 | originator of the Contribution.
100 |
101 | 4. COMMERCIAL DISTRIBUTION
102 |
103 | Commercial distributors of software may accept certain responsibilities with
104 | respect to end users, business partners and the like. While this license is
105 | intended to facilitate the commercial use of the Program, the Contributor who
106 | includes the Program in a commercial product offering should do so in a manner
107 | which does not create potential liability for other Contributors. Therefore,
108 | if a Contributor includes the Program in a commercial product offering, such
109 | Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
110 | every other Contributor ("Indemnified Contributor") against any losses,
111 | damages and costs (collectively "Losses") arising from claims, lawsuits and
112 | other legal actions brought by a third party against the Indemnified
113 | Contributor to the extent caused by the acts or omissions of such Commercial
114 | Contributor in connection with its distribution of the Program in a commercial
115 | product offering. The obligations in this section do not apply to any claims
116 | or Losses relating to any actual or alleged intellectual property
117 | infringement. In order to qualify, an Indemnified Contributor must:
118 | a) promptly notify the Commercial Contributor in writing of such claim, and
119 | b) allow the Commercial Contributor to control, and cooperate with the
120 | Commercial Contributor in, the defense and any related settlement
121 | negotiations. The Indemnified Contributor may participate in any such claim at
122 | its own expense.
123 |
124 | For example, a Contributor might include the Program in a commercial product
125 | offering, Product X. That Contributor is then a Commercial Contributor. If
126 | that Commercial Contributor then makes performance claims, or offers
127 | warranties related to Product X, those performance claims and warranties are
128 | such Commercial Contributor's responsibility alone. Under this section, the
129 | Commercial Contributor would have to defend claims against the other
130 | Contributors related to those performance claims and warranties, and if a
131 | court requires any other Contributor to pay any damages as a result, the
132 | Commercial Contributor must pay those damages.
133 |
134 | 5. NO WARRANTY
135 |
136 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
137 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
138 | IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
139 | NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
140 | Recipient is solely responsible for determining the appropriateness of using
141 | and distributing the Program and assumes all risks associated with its
142 | exercise of rights under this Agreement , including but not limited to the
143 | risks and costs of program errors, compliance with applicable laws, damage to
144 | or loss of data, programs or equipment, and unavailability or interruption of
145 | operations.
146 |
147 | 6. DISCLAIMER OF LIABILITY
148 |
149 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
150 | CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
151 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
152 | LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
153 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
154 | ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
155 | EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
156 | OF SUCH DAMAGES.
157 |
158 | 7. GENERAL
159 |
160 | If any provision of this Agreement is invalid or unenforceable under
161 | applicable law, it shall not affect the validity or enforceability of the
162 | remainder of the terms of this Agreement, and without further action by the
163 | parties hereto, such provision shall be reformed to the minimum extent
164 | necessary to make such provision valid and enforceable.
165 |
166 | If Recipient institutes patent litigation against any entity (including a
167 | cross-claim or counterclaim in a lawsuit) alleging that the Program itself
168 | (excluding combinations of the Program with other software or hardware)
169 | infringes such Recipient's patent(s), then such Recipient's rights granted
170 | under Section 2(b) shall terminate as of the date such litigation is filed.
171 |
172 | All Recipient's rights under this Agreement shall terminate if it fails to
173 | comply with any of the material terms or conditions of this Agreement and does
174 | not cure such failure in a reasonable period of time after becoming aware of
175 | such noncompliance. If all Recipient's rights under this Agreement terminate,
176 | Recipient agrees to cease use and distribution of the Program as soon as
177 | reasonably practicable. However, Recipient's obligations under this Agreement
178 | and any licenses granted by Recipient relating to the Program shall continue
179 | and survive.
180 |
181 | Everyone is permitted to copy and distribute copies of this Agreement, but in
182 | order to avoid inconsistency the Agreement is copyrighted and may only be
183 | modified in the following manner. The Agreement Steward reserves the right to
184 | publish new versions (including revisions) of this Agreement from time to
185 | time. No one other than the Agreement Steward has the right to modify this
186 | Agreement. The Eclipse Foundation is the initial Agreement Steward. The
187 | Eclipse Foundation may assign the responsibility to serve as the Agreement
188 | Steward to a suitable separate entity. Each new version of the Agreement will
189 | be given a distinguishing version number. The Program (including
190 | Contributions) may always be distributed subject to the version of the
191 | Agreement under which it was received. In addition, after a new version of the
192 | Agreement is published, Contributor may elect to distribute the Program
193 | (including its Contributions) under the new version. Except as expressly
194 | stated in Sections 2(a) and 2(b) above, Recipient receives no rights or
195 | licenses to the intellectual property of any Contributor under this Agreement,
196 | whether expressly, by implication, estoppel or otherwise. All rights in the
197 | Program not expressly granted under this Agreement are reserved.
198 |
199 | This Agreement is governed by the laws of the State of New York and the
200 | intellectual property laws of the United States of America. No party to this
201 | Agreement will bring a legal action under this Agreement more than one year
202 | after the cause of action arose. Each party waives its rights to a jury trial in
203 | any resulting litigation.
204 |
205 |
--------------------------------------------------------------------------------
/MQTT-Client/MQTT-Client/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace MQTT_Client
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// 設計工具所需的變數。
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// 清除任何使用中的資源。
12 | ///
13 | /// 如果應該處置 Managed 資源則為 true,否則為 false。
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form 設計工具產生的程式碼
24 |
25 | ///
26 | /// 此為設計工具支援所需的方法 - 請勿使用程式碼編輯器
27 | /// 修改這個方法的內容。
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.label2 = new System.Windows.Forms.Label();
33 | this.HostTextBox = new System.Windows.Forms.TextBox();
34 | this.SubTopicTextBox = new System.Windows.Forms.TextBox();
35 | this.PublishButton = new System.Windows.Forms.Button();
36 | this.ConnectButton = new System.Windows.Forms.Button();
37 | this.ClearButton = new System.Windows.Forms.Button();
38 | this.MessageTextBox = new System.Windows.Forms.TextBox();
39 | this.PubMessageTextBox = new System.Windows.Forms.TextBox();
40 | this.label3 = new System.Windows.Forms.Label();
41 | this.label4 = new System.Windows.Forms.Label();
42 | this.DisconnectButton = new System.Windows.Forms.Button();
43 | this.PortTextBox = new System.Windows.Forms.TextBox();
44 | this.label5 = new System.Windows.Forms.Label();
45 | this.SubscribeButton = new System.Windows.Forms.Button();
46 | this.label6 = new System.Windows.Forms.Label();
47 | this.PubTopicTextBox = new System.Windows.Forms.TextBox();
48 | this.label7 = new System.Windows.Forms.Label();
49 | this.QosComboBox = new System.Windows.Forms.ComboBox();
50 | this.SubListBox = new System.Windows.Forms.ListBox();
51 | this.label8 = new System.Windows.Forms.Label();
52 | this.UnsubscribeButton = new System.Windows.Forms.Button();
53 | this.label9 = new System.Windows.Forms.Label();
54 | this.RetainCheckBox = new System.Windows.Forms.CheckBox();
55 | this.SuspendLayout();
56 | //
57 | // label1
58 | //
59 | this.label1.AutoSize = true;
60 | this.label1.Font = new System.Drawing.Font("微軟正黑體", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
61 | this.label1.Location = new System.Drawing.Point(72, 12);
62 | this.label1.Name = "label1";
63 | this.label1.Size = new System.Drawing.Size(44, 19);
64 | this.label1.TabIndex = 0;
65 | this.label1.Text = "Host:";
66 | //
67 | // label2
68 | //
69 | this.label2.AutoSize = true;
70 | this.label2.Font = new System.Drawing.Font("微軟正黑體", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
71 | this.label2.Location = new System.Drawing.Point(14, 88);
72 | this.label2.Name = "label2";
73 | this.label2.Size = new System.Drawing.Size(102, 19);
74 | this.label2.TabIndex = 1;
75 | this.label2.Text = "Topic for sub:";
76 | //
77 | // HostTextBox
78 | //
79 | this.HostTextBox.Font = new System.Drawing.Font("微軟正黑體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
80 | this.HostTextBox.Location = new System.Drawing.Point(125, 11);
81 | this.HostTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
82 | this.HostTextBox.MaxLength = 128;
83 | this.HostTextBox.Name = "HostTextBox";
84 | this.HostTextBox.Size = new System.Drawing.Size(332, 23);
85 | this.HostTextBox.TabIndex = 2;
86 | //
87 | // SubTopicTextBox
88 | //
89 | this.SubTopicTextBox.Font = new System.Drawing.Font("微軟正黑體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
90 | this.SubTopicTextBox.Location = new System.Drawing.Point(125, 88);
91 | this.SubTopicTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
92 | this.SubTopicTextBox.MaxLength = 128;
93 | this.SubTopicTextBox.Name = "SubTopicTextBox";
94 | this.SubTopicTextBox.Size = new System.Drawing.Size(332, 23);
95 | this.SubTopicTextBox.TabIndex = 6;
96 | //
97 | // PublishButton
98 | //
99 | this.PublishButton.Enabled = false;
100 | this.PublishButton.Font = new System.Drawing.Font("微軟正黑體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
101 | this.PublishButton.Location = new System.Drawing.Point(19, 197);
102 | this.PublishButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
103 | this.PublishButton.Name = "PublishButton";
104 | this.PublishButton.Size = new System.Drawing.Size(555, 31);
105 | this.PublishButton.TabIndex = 9;
106 | this.PublishButton.Text = "Publish";
107 | this.PublishButton.UseVisualStyleBackColor = true;
108 | this.PublishButton.Click += new System.EventHandler(this.PublishButton_Click);
109 | //
110 | // ConnectButton
111 | //
112 | this.ConnectButton.Font = new System.Drawing.Font("微軟正黑體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
113 | this.ConnectButton.Location = new System.Drawing.Point(464, 8);
114 | this.ConnectButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
115 | this.ConnectButton.Name = "ConnectButton";
116 | this.ConnectButton.Size = new System.Drawing.Size(110, 31);
117 | this.ConnectButton.TabIndex = 4;
118 | this.ConnectButton.Text = "Connect";
119 | this.ConnectButton.UseVisualStyleBackColor = true;
120 | this.ConnectButton.Click += new System.EventHandler(this.ConnectButton_Click);
121 | //
122 | // ClearButton
123 | //
124 | this.ClearButton.Font = new System.Drawing.Font("微軟正黑體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
125 | this.ClearButton.Location = new System.Drawing.Point(13, 632);
126 | this.ClearButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
127 | this.ClearButton.Name = "ClearButton";
128 | this.ClearButton.Size = new System.Drawing.Size(559, 31);
129 | this.ClearButton.TabIndex = 10;
130 | this.ClearButton.Text = "Clear";
131 | this.ClearButton.UseVisualStyleBackColor = true;
132 | this.ClearButton.Click += new System.EventHandler(this.ClearButton_Click);
133 | //
134 | // MessageTextBox
135 | //
136 | this.MessageTextBox.Font = new System.Drawing.Font("微軟正黑體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
137 | this.MessageTextBox.Location = new System.Drawing.Point(13, 239);
138 | this.MessageTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
139 | this.MessageTextBox.Multiline = true;
140 | this.MessageTextBox.Name = "MessageTextBox";
141 | this.MessageTextBox.ReadOnly = true;
142 | this.MessageTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
143 | this.MessageTextBox.Size = new System.Drawing.Size(558, 381);
144 | this.MessageTextBox.TabIndex = 11;
145 | //
146 | // PubMessageTextBox
147 | //
148 | this.PubMessageTextBox.Font = new System.Drawing.Font("微軟正黑體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
149 | this.PubMessageTextBox.Location = new System.Drawing.Point(125, 163);
150 | this.PubMessageTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
151 | this.PubMessageTextBox.MaxLength = 128;
152 | this.PubMessageTextBox.Name = "PubMessageTextBox";
153 | this.PubMessageTextBox.Size = new System.Drawing.Size(448, 23);
154 | this.PubMessageTextBox.TabIndex = 8;
155 | //
156 | // label3
157 | //
158 | this.label3.AutoSize = true;
159 | this.label3.Font = new System.Drawing.Font("微軟正黑體", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
160 | this.label3.Location = new System.Drawing.Point(42, 163);
161 | this.label3.Name = "label3";
162 | this.label3.Size = new System.Drawing.Size(74, 19);
163 | this.label3.TabIndex = 9;
164 | this.label3.Text = "Message:";
165 | //
166 | // label4
167 | //
168 | this.label4.AutoSize = true;
169 | this.label4.Font = new System.Drawing.Font("微軟正黑體", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
170 | this.label4.ForeColor = System.Drawing.Color.Red;
171 | this.label4.Location = new System.Drawing.Point(14, 668);
172 | this.label4.Name = "label4";
173 | this.label4.Size = new System.Drawing.Size(0, 19);
174 | this.label4.TabIndex = 10;
175 | //
176 | // DisconnectButton
177 | //
178 | this.DisconnectButton.Enabled = false;
179 | this.DisconnectButton.Font = new System.Drawing.Font("微軟正黑體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
180 | this.DisconnectButton.Location = new System.Drawing.Point(464, 47);
181 | this.DisconnectButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
182 | this.DisconnectButton.Name = "DisconnectButton";
183 | this.DisconnectButton.Size = new System.Drawing.Size(110, 31);
184 | this.DisconnectButton.TabIndex = 12;
185 | this.DisconnectButton.Text = "Disconnect";
186 | this.DisconnectButton.UseVisualStyleBackColor = true;
187 | this.DisconnectButton.Click += new System.EventHandler(this.DisconnectButton_Click);
188 | //
189 | // PortTextBox
190 | //
191 | this.PortTextBox.Location = new System.Drawing.Point(125, 49);
192 | this.PortTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
193 | this.PortTextBox.MaxLength = 4;
194 | this.PortTextBox.Name = "PortTextBox";
195 | this.PortTextBox.Size = new System.Drawing.Size(52, 23);
196 | this.PortTextBox.TabIndex = 3;
197 | this.PortTextBox.Text = "1883";
198 | //
199 | // label5
200 | //
201 | this.label5.AutoSize = true;
202 | this.label5.Font = new System.Drawing.Font("微軟正黑體", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
203 | this.label5.Location = new System.Drawing.Point(75, 52);
204 | this.label5.Name = "label5";
205 | this.label5.Size = new System.Drawing.Size(41, 19);
206 | this.label5.TabIndex = 13;
207 | this.label5.Text = "Port:";
208 | //
209 | // SubscribeButton
210 | //
211 | this.SubscribeButton.Enabled = false;
212 | this.SubscribeButton.Font = new System.Drawing.Font("微軟正黑體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
213 | this.SubscribeButton.Location = new System.Drawing.Point(464, 88);
214 | this.SubscribeButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
215 | this.SubscribeButton.Name = "SubscribeButton";
216 | this.SubscribeButton.Size = new System.Drawing.Size(110, 31);
217 | this.SubscribeButton.TabIndex = 7;
218 | this.SubscribeButton.Text = "Subscribe";
219 | this.SubscribeButton.UseVisualStyleBackColor = true;
220 | this.SubscribeButton.Click += new System.EventHandler(this.SubscribeButton_Click);
221 | //
222 | // label6
223 | //
224 | this.label6.AutoSize = true;
225 | this.label6.Font = new System.Drawing.Font("微軟正黑體", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
226 | this.label6.Location = new System.Drawing.Point(12, 125);
227 | this.label6.Name = "label6";
228 | this.label6.Size = new System.Drawing.Size(104, 19);
229 | this.label6.TabIndex = 14;
230 | this.label6.Text = "Topic for pub:";
231 | //
232 | // PubTopicTextBox
233 | //
234 | this.PubTopicTextBox.Font = new System.Drawing.Font("微軟正黑體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
235 | this.PubTopicTextBox.Location = new System.Drawing.Point(125, 125);
236 | this.PubTopicTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
237 | this.PubTopicTextBox.MaxLength = 128;
238 | this.PubTopicTextBox.Name = "PubTopicTextBox";
239 | this.PubTopicTextBox.Size = new System.Drawing.Size(448, 23);
240 | this.PubTopicTextBox.TabIndex = 15;
241 | //
242 | // label7
243 | //
244 | this.label7.AutoSize = true;
245 | this.label7.Font = new System.Drawing.Font("微軟正黑體", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
246 | this.label7.Location = new System.Drawing.Point(196, 52);
247 | this.label7.Name = "label7";
248 | this.label7.Size = new System.Drawing.Size(42, 19);
249 | this.label7.TabIndex = 16;
250 | this.label7.Text = "QoS:";
251 | //
252 | // QosComboBox
253 | //
254 | this.QosComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
255 | this.QosComboBox.FormattingEnabled = true;
256 | this.QosComboBox.Items.AddRange(new object[] {
257 | "0 At most once",
258 | "1 At least once",
259 | "2 Exactly once"});
260 | this.QosComboBox.Location = new System.Drawing.Point(244, 48);
261 | this.QosComboBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
262 | this.QosComboBox.MaxDropDownItems = 3;
263 | this.QosComboBox.Name = "QosComboBox";
264 | this.QosComboBox.Size = new System.Drawing.Size(92, 24);
265 | this.QosComboBox.TabIndex = 17;
266 | //
267 | // SubListBox
268 | //
269 | this.SubListBox.Font = new System.Drawing.Font("微軟正黑體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
270 | this.SubListBox.FormattingEnabled = true;
271 | this.SubListBox.HorizontalScrollbar = true;
272 | this.SubListBox.ItemHeight = 16;
273 | this.SubListBox.Location = new System.Drawing.Point(586, 40);
274 | this.SubListBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
275 | this.SubListBox.Name = "SubListBox";
276 | this.SubListBox.ScrollAlwaysVisible = true;
277 | this.SubListBox.Size = new System.Drawing.Size(186, 580);
278 | this.SubListBox.TabIndex = 18;
279 | //
280 | // label8
281 | //
282 | this.label8.AutoSize = true;
283 | this.label8.Font = new System.Drawing.Font("微軟正黑體", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
284 | this.label8.Location = new System.Drawing.Point(582, 12);
285 | this.label8.Name = "label8";
286 | this.label8.Size = new System.Drawing.Size(144, 19);
287 | this.label8.TabIndex = 19;
288 | this.label8.Text = "Subscriptions topic:";
289 | //
290 | // UnsubscribeButton
291 | //
292 | this.UnsubscribeButton.Enabled = false;
293 | this.UnsubscribeButton.Font = new System.Drawing.Font("微軟正黑體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
294 | this.UnsubscribeButton.Location = new System.Drawing.Point(586, 632);
295 | this.UnsubscribeButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
296 | this.UnsubscribeButton.Name = "UnsubscribeButton";
297 | this.UnsubscribeButton.Size = new System.Drawing.Size(186, 31);
298 | this.UnsubscribeButton.TabIndex = 20;
299 | this.UnsubscribeButton.Text = "Unsubscribe";
300 | this.UnsubscribeButton.UseVisualStyleBackColor = true;
301 | this.UnsubscribeButton.Click += new System.EventHandler(this.UnsubscribeButton_Click);
302 | //
303 | // label9
304 | //
305 | this.label9.AutoSize = true;
306 | this.label9.Font = new System.Drawing.Font("微軟正黑體", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
307 | this.label9.Location = new System.Drawing.Point(353, 49);
308 | this.label9.Name = "label9";
309 | this.label9.Size = new System.Drawing.Size(56, 19);
310 | this.label9.TabIndex = 21;
311 | this.label9.Text = "Retain:";
312 | //
313 | // RetainCheckBox
314 | //
315 | this.RetainCheckBox.AutoSize = true;
316 | this.RetainCheckBox.Location = new System.Drawing.Point(415, 53);
317 | this.RetainCheckBox.Name = "RetainCheckBox";
318 | this.RetainCheckBox.Size = new System.Drawing.Size(15, 14);
319 | this.RetainCheckBox.TabIndex = 22;
320 | this.RetainCheckBox.UseVisualStyleBackColor = true;
321 | //
322 | // Form1
323 | //
324 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F);
325 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
326 | this.ClientSize = new System.Drawing.Size(784, 701);
327 | this.Controls.Add(this.RetainCheckBox);
328 | this.Controls.Add(this.label9);
329 | this.Controls.Add(this.UnsubscribeButton);
330 | this.Controls.Add(this.label8);
331 | this.Controls.Add(this.SubListBox);
332 | this.Controls.Add(this.QosComboBox);
333 | this.Controls.Add(this.label7);
334 | this.Controls.Add(this.PubTopicTextBox);
335 | this.Controls.Add(this.label6);
336 | this.Controls.Add(this.SubscribeButton);
337 | this.Controls.Add(this.label5);
338 | this.Controls.Add(this.PortTextBox);
339 | this.Controls.Add(this.DisconnectButton);
340 | this.Controls.Add(this.label4);
341 | this.Controls.Add(this.label3);
342 | this.Controls.Add(this.PubMessageTextBox);
343 | this.Controls.Add(this.MessageTextBox);
344 | this.Controls.Add(this.ClearButton);
345 | this.Controls.Add(this.ConnectButton);
346 | this.Controls.Add(this.PublishButton);
347 | this.Controls.Add(this.SubTopicTextBox);
348 | this.Controls.Add(this.HostTextBox);
349 | this.Controls.Add(this.label2);
350 | this.Controls.Add(this.label1);
351 | this.Font = new System.Drawing.Font("微軟正黑體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
352 | this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
353 | this.Name = "Form1";
354 | this.Text = " MQTT Client";
355 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_Closing);
356 | this.Load += new System.EventHandler(this.Form1_Load);
357 | this.ResumeLayout(false);
358 | this.PerformLayout();
359 |
360 | }
361 |
362 | #endregion
363 |
364 | private System.Windows.Forms.Label label1;
365 | private System.Windows.Forms.Label label2;
366 | private System.Windows.Forms.TextBox HostTextBox;
367 | private System.Windows.Forms.TextBox SubTopicTextBox;
368 | private System.Windows.Forms.Button PublishButton;
369 | private System.Windows.Forms.Button ConnectButton;
370 | private System.Windows.Forms.Button ClearButton;
371 | private System.Windows.Forms.TextBox MessageTextBox;
372 | private System.Windows.Forms.TextBox PubMessageTextBox;
373 | private System.Windows.Forms.Label label3;
374 | private System.Windows.Forms.Label label4;
375 | private System.Windows.Forms.Button DisconnectButton;
376 | private System.Windows.Forms.TextBox PortTextBox;
377 | private System.Windows.Forms.Label label5;
378 | private System.Windows.Forms.Button SubscribeButton;
379 | private System.Windows.Forms.Label label6;
380 | private System.Windows.Forms.TextBox PubTopicTextBox;
381 | private System.Windows.Forms.Label label7;
382 | private System.Windows.Forms.ComboBox QosComboBox;
383 | private System.Windows.Forms.ListBox SubListBox;
384 | private System.Windows.Forms.Label label8;
385 | private System.Windows.Forms.Button UnsubscribeButton;
386 | private System.Windows.Forms.Label label9;
387 | private System.Windows.Forms.CheckBox RetainCheckBox;
388 | }
389 | }
390 |
391 |
--------------------------------------------------------------------------------