├── DanfossGW
├── DanfossGW.sln
├── DanfossGW.v11.suo
└── DanfossGW
│ ├── App.config
│ ├── DanfossGW.csproj
│ ├── Form1.Designer.cs
│ ├── Form1.cs
│ ├── Form1.resx
│ ├── Program.cs
│ └── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── README.md
├── SimpleBLECentral_cc2541
├── CC2540
│ ├── SimpleBLECentral.ewd
│ ├── SimpleBLECentral.ewp
│ ├── SimpleBLECentral.eww
│ └── buildConfig.cfg
├── CC2541
│ ├── Backup (2) of SimpleBLECentral.ewp
│ ├── Backup of SimpleBLECentral.ewp
│ ├── BuildLog.log
│ ├── CC2541EM
│ │ ├── Exe
│ │ │ ├── SimpleBLECentral.bin
│ │ │ ├── SimpleBLECentral.d51
│ │ │ └── SimpleBLECentral.hex
│ │ └── List
│ │ │ └── SimpleBLECentral.map
│ ├── SimpleBLECentral.dep
│ ├── SimpleBLECentral.ewd
│ ├── SimpleBLECentral.ewp
│ ├── SimpleBLECentral.ewt
│ ├── SimpleBLECentral.eww
│ ├── buildConfig.cfg
│ └── settings
│ │ ├── SimpleBLECentral.CC2541EM.cspy.bat
│ │ ├── SimpleBLECentral.CC2541EM.cspy.ps1
│ │ ├── SimpleBLECentral.CC2541EM.driver.xcl
│ │ ├── SimpleBLECentral.CC2541EM.general.xcl
│ │ ├── SimpleBLECentral.dbgdt
│ │ ├── SimpleBLECentral.dnx
│ │ └── SimpleBLECentral.wsdt
└── Source
│ ├── OSAL_simpleBLECentral.c
│ ├── simpleBLECentral.c
│ ├── simpleBLECentral.h
│ ├── simpleBLECentral_Main.c
│ ├── uartManager.c
│ └── uartManager.h
└── uuids.xls
/DanfossGW/DanfossGW.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Express 2012 for Windows Desktop
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DanfossGW", "DanfossGW\DanfossGW.csproj", "{55FDB6CD-6238-4345-86D5-385BF7638123}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {55FDB6CD-6238-4345-86D5-385BF7638123}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {55FDB6CD-6238-4345-86D5-385BF7638123}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {55FDB6CD-6238-4345-86D5-385BF7638123}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {55FDB6CD-6238-4345-86D5-385BF7638123}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/DanfossGW/DanfossGW.v11.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsltip/Danfoss-BLE/df5ac0e7b42e639374b2b9cbedc07f1df3f0da99/DanfossGW/DanfossGW.v11.suo
--------------------------------------------------------------------------------
/DanfossGW/DanfossGW/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | 6
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/DanfossGW/DanfossGW/DanfossGW.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {55FDB6CD-6238-4345-86D5-385BF7638123}
8 | WinExe
9 | Properties
10 | DanfossGW
11 | DanfossGW
12 | v4.5
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 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | Form
49 |
50 |
51 | Form1.cs
52 |
53 |
54 |
55 |
56 | Form1.cs
57 |
58 |
59 | ResXFileCodeGenerator
60 | Resources.Designer.cs
61 | Designer
62 |
63 |
64 | True
65 | Resources.resx
66 |
67 |
68 | SettingsSingleFileGenerator
69 | Settings.Designer.cs
70 |
71 |
72 | True
73 | Settings.settings
74 | True
75 |
76 |
77 |
78 |
79 |
80 |
81 |
88 |
--------------------------------------------------------------------------------
/DanfossGW/DanfossGW/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace DanfossGW
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Требуется переменная конструктора.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Освободить все используемые ресурсы.
12 | ///
13 | /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
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
24 |
25 | ///
26 | /// Обязательный метод для поддержки конструктора - не изменяйте
27 | /// содержимое данного метода при помощи редактора кода.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.components = new System.ComponentModel.Container();
32 | this.comboBox1 = new System.Windows.Forms.ComboBox();
33 | this.textBox3 = new System.Windows.Forms.TextBox();
34 | this.button1 = new System.Windows.Forms.Button();
35 | this.label1 = new System.Windows.Forms.Label();
36 | this.serialPort1 = new System.IO.Ports.SerialPort(this.components);
37 | this.button2 = new System.Windows.Forms.Button();
38 | this.button3 = new System.Windows.Forms.Button();
39 | this.button4 = new System.Windows.Forms.Button();
40 | this.button5 = new System.Windows.Forms.Button();
41 | this.button6 = new System.Windows.Forms.Button();
42 | this.button7 = new System.Windows.Forms.Button();
43 | this.button9 = new System.Windows.Forms.Button();
44 | this.checkBox1 = new System.Windows.Forms.CheckBox();
45 | this.button10 = new System.Windows.Forms.Button();
46 | this.label2 = new System.Windows.Forms.Label();
47 | this.label3 = new System.Windows.Forms.Label();
48 | this.label4 = new System.Windows.Forms.Label();
49 | this.textBox1 = new System.Windows.Forms.TextBox();
50 | this.textBox2 = new System.Windows.Forms.TextBox();
51 | this.label5 = new System.Windows.Forms.Label();
52 | this.button11 = new System.Windows.Forms.Button();
53 | this.timer1 = new System.Windows.Forms.Timer(this.components);
54 | this.button12 = new System.Windows.Forms.Button();
55 | this.button8 = new System.Windows.Forms.Button();
56 | this.textBox4 = new System.Windows.Forms.TextBox();
57 | this.label6 = new System.Windows.Forms.Label();
58 | this.button13 = new System.Windows.Forms.Button();
59 | this.SuspendLayout();
60 | //
61 | // comboBox1
62 | //
63 | this.comboBox1.FormattingEnabled = true;
64 | this.comboBox1.Location = new System.Drawing.Point(66, 12);
65 | this.comboBox1.Name = "comboBox1";
66 | this.comboBox1.Size = new System.Drawing.Size(62, 21);
67 | this.comboBox1.TabIndex = 10;
68 | //
69 | // textBox3
70 | //
71 | this.textBox3.Enabled = false;
72 | this.textBox3.Location = new System.Drawing.Point(12, 100);
73 | this.textBox3.Multiline = true;
74 | this.textBox3.Name = "textBox3";
75 | this.textBox3.Size = new System.Drawing.Size(305, 298);
76 | this.textBox3.TabIndex = 9;
77 | //
78 | // button1
79 | //
80 | this.button1.Location = new System.Drawing.Point(147, 10);
81 | this.button1.Name = "button1";
82 | this.button1.Size = new System.Drawing.Size(60, 23);
83 | this.button1.TabIndex = 8;
84 | this.button1.Text = "Open";
85 | this.button1.UseVisualStyleBackColor = true;
86 | this.button1.Click += new System.EventHandler(this.button1_Click);
87 | //
88 | // label1
89 | //
90 | this.label1.AutoSize = true;
91 | this.label1.Location = new System.Drawing.Point(9, 15);
92 | this.label1.Name = "label1";
93 | this.label1.Size = new System.Drawing.Size(29, 13);
94 | this.label1.TabIndex = 11;
95 | this.label1.Text = "Port:";
96 | //
97 | // serialPort1
98 | //
99 | this.serialPort1.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(this.serialPort1_DataReceived);
100 | //
101 | // button2
102 | //
103 | this.button2.Location = new System.Drawing.Point(351, 149);
104 | this.button2.Name = "button2";
105 | this.button2.Size = new System.Drawing.Size(119, 23);
106 | this.button2.TabIndex = 12;
107 | this.button2.Text = "Discover";
108 | this.button2.UseVisualStyleBackColor = true;
109 | this.button2.Click += new System.EventHandler(this.button2_Click);
110 | //
111 | // button3
112 | //
113 | this.button3.Location = new System.Drawing.Point(351, 178);
114 | this.button3.Name = "button3";
115 | this.button3.Size = new System.Drawing.Size(119, 23);
116 | this.button3.TabIndex = 13;
117 | this.button3.Text = "Connect/Disconnect";
118 | this.button3.UseVisualStyleBackColor = true;
119 | this.button3.Click += new System.EventHandler(this.button3_Click);
120 | //
121 | // button4
122 | //
123 | this.button4.Location = new System.Drawing.Point(351, 207);
124 | this.button4.Name = "button4";
125 | this.button4.Size = new System.Drawing.Size(119, 23);
126 | this.button4.TabIndex = 14;
127 | this.button4.Text = "SendPIN";
128 | this.button4.UseVisualStyleBackColor = true;
129 | this.button4.Click += new System.EventHandler(this.button4_Click);
130 | //
131 | // button5
132 | //
133 | this.button5.Location = new System.Drawing.Point(351, 236);
134 | this.button5.Name = "button5";
135 | this.button5.Size = new System.Drawing.Size(119, 23);
136 | this.button5.TabIndex = 15;
137 | this.button5.Text = "Battrey Read";
138 | this.button5.UseVisualStyleBackColor = true;
139 | this.button5.Click += new System.EventHandler(this.button5_Click);
140 | //
141 | // button6
142 | //
143 | this.button6.Location = new System.Drawing.Point(351, 265);
144 | this.button6.Name = "button6";
145 | this.button6.Size = new System.Drawing.Size(119, 23);
146 | this.button6.TabIndex = 16;
147 | this.button6.Text = "Temperature Read";
148 | this.button6.UseVisualStyleBackColor = true;
149 | this.button6.Click += new System.EventHandler(this.button6_Click);
150 | //
151 | // button7
152 | //
153 | this.button7.Location = new System.Drawing.Point(351, 323);
154 | this.button7.Name = "button7";
155 | this.button7.Size = new System.Drawing.Size(119, 23);
156 | this.button7.TabIndex = 17;
157 | this.button7.Text = "Temperature Write";
158 | this.button7.UseVisualStyleBackColor = true;
159 | this.button7.Click += new System.EventHandler(this.button7_Click);
160 | //
161 | // button9
162 | //
163 | this.button9.Location = new System.Drawing.Point(370, 374);
164 | this.button9.Name = "button9";
165 | this.button9.Size = new System.Drawing.Size(75, 23);
166 | this.button9.TabIndex = 19;
167 | this.button9.Text = "reset BLE";
168 | this.button9.UseVisualStyleBackColor = true;
169 | this.button9.Click += new System.EventHandler(this.button9_Click);
170 | //
171 | // checkBox1
172 | //
173 | this.checkBox1.AutoSize = true;
174 | this.checkBox1.Checked = true;
175 | this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
176 | this.checkBox1.Location = new System.Drawing.Point(13, 403);
177 | this.checkBox1.Name = "checkBox1";
178 | this.checkBox1.Size = new System.Drawing.Size(94, 17);
179 | this.checkBox1.TabIndex = 21;
180 | this.checkBox1.Text = "Log exchange";
181 | this.checkBox1.UseVisualStyleBackColor = true;
182 | //
183 | // button10
184 | //
185 | this.button10.Location = new System.Drawing.Point(351, 119);
186 | this.button10.Name = "button10";
187 | this.button10.Size = new System.Drawing.Size(119, 23);
188 | this.button10.TabIndex = 22;
189 | this.button10.Text = "Test";
190 | this.button10.UseVisualStyleBackColor = true;
191 | this.button10.Click += new System.EventHandler(this.button10_Click_1);
192 | //
193 | // label2
194 | //
195 | this.label2.AutoSize = true;
196 | this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
197 | this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
198 | this.label2.Location = new System.Drawing.Point(9, 78);
199 | this.label2.Name = "label2";
200 | this.label2.Size = new System.Drawing.Size(64, 20);
201 | this.label2.TabIndex = 23;
202 | this.label2.Text = "Bat = *";
203 | //
204 | // label3
205 | //
206 | this.label3.AutoSize = true;
207 | this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
208 | this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
209 | this.label3.Location = new System.Drawing.Point(136, 78);
210 | this.label3.Name = "label3";
211 | this.label3.Size = new System.Drawing.Size(104, 20);
212 | this.label3.TabIndex = 24;
213 | this.label3.Text = "SP temp = *";
214 | //
215 | // label4
216 | //
217 | this.label4.AutoSize = true;
218 | this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
219 | this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
220 | this.label4.Location = new System.Drawing.Point(293, 78);
221 | this.label4.Name = "label4";
222 | this.label4.Size = new System.Drawing.Size(109, 20);
223 | this.label4.TabIndex = 25;
224 | this.label4.Text = "Cur.temp = *";
225 | //
226 | // textBox1
227 | //
228 | this.textBox1.Location = new System.Drawing.Point(377, 297);
229 | this.textBox1.Name = "textBox1";
230 | this.textBox1.Size = new System.Drawing.Size(53, 20);
231 | this.textBox1.TabIndex = 26;
232 | this.textBox1.Text = "25";
233 | this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
234 | //
235 | // textBox2
236 | //
237 | this.textBox2.Location = new System.Drawing.Point(96, 36);
238 | this.textBox2.Name = "textBox2";
239 | this.textBox2.Size = new System.Drawing.Size(85, 20);
240 | this.textBox2.TabIndex = 27;
241 | this.textBox2.Text = "00042FC105E5";
242 | //
243 | // label5
244 | //
245 | this.label5.AutoSize = true;
246 | this.label5.ForeColor = System.Drawing.Color.Red;
247 | this.label5.Location = new System.Drawing.Point(9, 39);
248 | this.label5.Name = "label5";
249 | this.label5.Size = new System.Drawing.Size(81, 13);
250 | this.label5.TabIndex = 28;
251 | this.label5.Text = "Danfoss addres";
252 | //
253 | // button11
254 | //
255 | this.button11.Location = new System.Drawing.Point(240, 6);
256 | this.button11.Name = "button11";
257 | this.button11.Size = new System.Drawing.Size(77, 38);
258 | this.button11.TabIndex = 29;
259 | this.button11.Text = "AUTO Read";
260 | this.button11.UseVisualStyleBackColor = true;
261 | this.button11.Click += new System.EventHandler(this.button11_Click);
262 | //
263 | // timer1
264 | //
265 | this.timer1.Enabled = true;
266 | this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
267 | //
268 | // button12
269 | //
270 | this.button12.Location = new System.Drawing.Point(240, 400);
271 | this.button12.Name = "button12";
272 | this.button12.Size = new System.Drawing.Size(75, 20);
273 | this.button12.TabIndex = 30;
274 | this.button12.Text = "Clear";
275 | this.button12.UseVisualStyleBackColor = true;
276 | this.button12.Click += new System.EventHandler(this.button12_Click);
277 | //
278 | // button8
279 | //
280 | this.button8.Location = new System.Drawing.Point(351, 6);
281 | this.button8.Name = "button8";
282 | this.button8.Size = new System.Drawing.Size(77, 38);
283 | this.button8.TabIndex = 31;
284 | this.button8.Text = "AUTO Write";
285 | this.button8.UseVisualStyleBackColor = true;
286 | this.button8.Click += new System.EventHandler(this.button8_Click_2);
287 | //
288 | // textBox4
289 | //
290 | this.textBox4.Location = new System.Drawing.Point(96, 56);
291 | this.textBox4.Name = "textBox4";
292 | this.textBox4.Size = new System.Drawing.Size(197, 20);
293 | this.textBox4.TabIndex = 32;
294 | this.textBox4.Text = "e77bfa6a664c6a7f798e107b280d01d6";
295 | this.textBox4.TextChanged += new System.EventHandler(this.textBox4_TextChanged);
296 | //
297 | // label6
298 | //
299 | this.label6.AutoSize = true;
300 | this.label6.ForeColor = System.Drawing.Color.Red;
301 | this.label6.Location = new System.Drawing.Point(9, 58);
302 | this.label6.Name = "label6";
303 | this.label6.Size = new System.Drawing.Size(77, 13);
304 | this.label6.TabIndex = 33;
305 | this.label6.Text = "Encryption key";
306 | //
307 | // button13
308 | //
309 | this.button13.Location = new System.Drawing.Point(435, 52);
310 | this.button13.Name = "button13";
311 | this.button13.Size = new System.Drawing.Size(35, 23);
312 | this.button13.TabIndex = 34;
313 | this.button13.Text = "button13";
314 | this.button13.UseVisualStyleBackColor = true;
315 | this.button13.Click += new System.EventHandler(this.button13_Click);
316 | //
317 | // Form1
318 | //
319 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
320 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
321 | this.ClientSize = new System.Drawing.Size(495, 423);
322 | this.Controls.Add(this.button13);
323 | this.Controls.Add(this.label6);
324 | this.Controls.Add(this.textBox4);
325 | this.Controls.Add(this.button8);
326 | this.Controls.Add(this.button12);
327 | this.Controls.Add(this.button11);
328 | this.Controls.Add(this.label5);
329 | this.Controls.Add(this.textBox2);
330 | this.Controls.Add(this.textBox1);
331 | this.Controls.Add(this.label4);
332 | this.Controls.Add(this.label3);
333 | this.Controls.Add(this.label2);
334 | this.Controls.Add(this.button10);
335 | this.Controls.Add(this.checkBox1);
336 | this.Controls.Add(this.button9);
337 | this.Controls.Add(this.button7);
338 | this.Controls.Add(this.button6);
339 | this.Controls.Add(this.button5);
340 | this.Controls.Add(this.button4);
341 | this.Controls.Add(this.button3);
342 | this.Controls.Add(this.button2);
343 | this.Controls.Add(this.label1);
344 | this.Controls.Add(this.comboBox1);
345 | this.Controls.Add(this.textBox3);
346 | this.Controls.Add(this.button1);
347 | this.Name = "Form1";
348 | this.Text = "Danfoss Eco 2 Gateway";
349 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
350 | this.Load += new System.EventHandler(this.Form1_Load);
351 | this.ResumeLayout(false);
352 | this.PerformLayout();
353 |
354 | }
355 |
356 | #endregion
357 |
358 | private System.Windows.Forms.ComboBox comboBox1;
359 | private System.Windows.Forms.TextBox textBox3;
360 | private System.Windows.Forms.Button button1;
361 | private System.Windows.Forms.Label label1;
362 | private System.IO.Ports.SerialPort serialPort1;
363 | private System.Windows.Forms.Button button2;
364 | private System.Windows.Forms.Button button3;
365 | private System.Windows.Forms.Button button4;
366 | private System.Windows.Forms.Button button5;
367 | private System.Windows.Forms.Button button6;
368 | private System.Windows.Forms.Button button7;
369 | private System.Windows.Forms.Button button9;
370 | private System.Windows.Forms.CheckBox checkBox1;
371 | private System.Windows.Forms.Button button10;
372 | private System.Windows.Forms.Label label2;
373 | private System.Windows.Forms.Label label3;
374 | private System.Windows.Forms.Label label4;
375 | private System.Windows.Forms.TextBox textBox1;
376 | private System.Windows.Forms.TextBox textBox2;
377 | private System.Windows.Forms.Label label5;
378 | private System.Windows.Forms.Button button11;
379 | private System.Windows.Forms.Timer timer1;
380 | private System.Windows.Forms.Button button12;
381 | private System.Windows.Forms.Button button8;
382 | private System.Windows.Forms.TextBox textBox4;
383 | private System.Windows.Forms.Label label6;
384 | private System.Windows.Forms.Button button13;
385 | }
386 | }
387 |
388 |
--------------------------------------------------------------------------------
/DanfossGW/DanfossGW/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 |
11 | namespace DanfossGW
12 | {
13 | public partial class Form1 : Form
14 | {
15 | byte[] rxbuf = new byte[255];
16 | byte[] txbuf = new byte[255];
17 | String[] rxlines = new String[5];
18 | String curline;
19 | Boolean DoWrite;
20 | int rxlen;
21 | int stage;
22 |
23 | private static float sp_temp;
24 | private static float room_temp;
25 | private const int DELTA = -1640531527;
26 | private const byte BIG_ENDIAN = 1;
27 | private const byte LITTLE_ENDIAN = 0;
28 | private const int INT_BYTESIZE = 4;
29 | private static readonly char[] hexArray = "0123456789ABCDEF".ToCharArray();
30 | //private static readonly sbyte[] secret = new sbyte[] { -25, 123, -6, 106, 102, 76, 106, 127, 121, -114, 16, 123, 40, 13, 1, -42 };
31 | private static sbyte[] secret = new sbyte[16];// { -25, 123, -6, 106, 102, 76, 106, 127, 121, -114, 16, 123, 40, 13, 1, -42 };
32 |
33 | public Form1()
34 | {
35 | InitializeComponent();
36 | }
37 | private static bool parseManualTemperature(sbyte[] value)
38 | {
39 | if (value.Length < 2)
40 | {
41 | return false;
42 | }
43 | sp_temp = ((float)value[0]) / 2.0f;
44 | room_temp = ((float)value[1]) / 2.0f;
45 | return true;
46 | }
47 |
48 | private void button1_Click(object sender, EventArgs e)
49 | {
50 | try
51 | {
52 | if (serialPort1.IsOpen)
53 | {
54 | serialPort1.Close();
55 | button1.Text = "Open";
56 | }
57 | else
58 | {
59 | serialPort1.PortName = comboBox1.Text;
60 | serialPort1.Open();
61 | textBox3.Clear();
62 | button1.Text = "Close";
63 | }
64 | }
65 | catch (SystemException error)
66 | {
67 | MessageBox.Show(error.Message);
68 | }
69 | }
70 |
71 | private void Form1_Load(object sender, EventArgs e)
72 | {
73 | foreach (string s in System.IO.Ports.SerialPort.GetPortNames())
74 | {
75 | comboBox1.Items.Add(s);
76 | }
77 | comboBox1.Text = Properties.Settings.Default.port;
78 | secret = StringToByteArray(textBox4.Text);
79 | }
80 |
81 | private void Form1_FormClosing(object sender, FormClosingEventArgs e)
82 | {
83 | Properties.Settings.Default.port = comboBox1.Text;
84 | Properties.Settings.Default.Save();
85 | }
86 |
87 | private void button2_Click(object sender, EventArgs e)
88 | {
89 | txbuf[0] = 1;
90 | serialPort1.Write(txbuf, 0, 1);
91 | }
92 | private void ProcessRx(object sender, EventArgs e)
93 | {
94 | int i;
95 | String rxtext = "";
96 | for (i = 0; i < rxlen; i++)
97 | {
98 | if ((char)rxbuf[i] == '\n')
99 | {
100 | rxtext = rxtext + '\r';
101 | rxlines[4] = rxlines[3];
102 | rxlines[3] = rxlines[2];
103 | rxlines[2] = rxlines[1];
104 | rxlines[1] = rxlines[0];
105 | rxlines[0] = curline;
106 | if (rxlines[1] == "Read val"){
107 | if ((txbuf[0] == 5) && (curline.Length == 16))
108 | {
109 | parseManualTemperature(decrypt(StringToByteArray(curline), secret));
110 | label3.Text = "SP temp = " + sp_temp.ToString()+ " C";
111 | label4.Text = "Cur.temp = " + room_temp.ToString() + " C";
112 | };
113 | if ((txbuf[0] == 4) && (curline.Length == 2))
114 | {
115 | label2.Text = "Bat = " + StringToByteArray(curline)[0].ToString() + "%";
116 |
117 | };
118 | };
119 | curline = "";
120 |
121 | }
122 | else curline = curline + (char)rxbuf[i];
123 | rxtext = rxtext + (char)rxbuf[i];
124 | };
125 | if(checkBox1.Checked) textBox3.AppendText(rxtext);
126 | rxlen = 0;
127 |
128 | }
129 | private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
130 | {
131 | int rxlennew = serialPort1.BytesToRead;
132 | serialPort1.Read(rxbuf, rxlen, rxlennew);
133 | rxlen += rxlennew;
134 | this.Invoke(new EventHandler(ProcessRx));
135 | }
136 | private void button10_Click_1(object sender, EventArgs e)
137 | {
138 | txbuf[0] = 0; serialPort1.Write(txbuf, 0, 1);
139 | }
140 |
141 | private void button3_Click(object sender, EventArgs e)//connect
142 | {
143 | sbyte[] evalue = new sbyte[6];
144 | evalue = StringToByteArray(textBox2.Text);
145 | txbuf[0] = 2;
146 | txbuf[1] = (byte)evalue[5];
147 | txbuf[2] = (byte)evalue[4];
148 | txbuf[3] = (byte)evalue[3];
149 | txbuf[4] = (byte)evalue[2];
150 | txbuf[5] = (byte)evalue[1];
151 | txbuf[6] = (byte)evalue[0];
152 | for (int i = 0; i < 7; i++) { serialPort1.Write(txbuf, i, 1); Task.Delay(50); };
153 |
154 | }
155 |
156 | private void button4_Click(object sender, EventArgs e)
157 | {
158 | txbuf[0] = 3; serialPort1.Write(txbuf, 0, 1);
159 | }
160 |
161 | private void button5_Click(object sender, EventArgs e)
162 | {
163 | txbuf[0] = 4; serialPort1.Write(txbuf, 0, 1);
164 | label2.Text = "Bat = *";
165 | }
166 |
167 | private void button6_Click(object sender, EventArgs e)
168 | {
169 | txbuf[0] = 5; serialPort1.Write(txbuf, 0, 1);
170 | label3.Text = "SP = *";
171 | label4.Text = "Cur = *";
172 | }
173 |
174 | private void button7_Click(object sender, EventArgs e)//write setpoint
175 | {
176 | sbyte[] tval = new sbyte[2];
177 | sbyte[] evalue = new sbyte[8];
178 | tval[0] = convertTemperature(float.Parse(textBox1.Text));
179 | evalue = encrypt(tval);
180 |
181 | txbuf[0] = 6;//e9 33 95 3b 0c 4e 1a c7 - 25C
182 | txbuf[1] = (byte)evalue[0];
183 | txbuf[2] = (byte)evalue[1];
184 | txbuf[3] = (byte)evalue[2];
185 | txbuf[4] = (byte)evalue[3];
186 | txbuf[5] = (byte)evalue[4];
187 | txbuf[6] = (byte)evalue[5];
188 | txbuf[7] = (byte)evalue[6];
189 | txbuf[8] = (byte)evalue[7];
190 |
191 | for (int i = 0; i < 9; i++) { serialPort1.Write(txbuf, i, 1); Task.Delay(50); };
192 | }
193 |
194 | private void button8_Click(object sender, EventArgs e)
195 | {
196 | txbuf[0] = 6; serialPort1.Write(txbuf, 0, 1);
197 | }
198 |
199 | private void button9_Click(object sender, EventArgs e)
200 | {
201 | txbuf[0] = 255; serialPort1.Write(txbuf, 0, 1);
202 | }
203 |
204 | private void button10_Click(object sender, EventArgs e)
205 | {
206 | txbuf[0] = 49; serialPort1.Write(txbuf, 0, 1);
207 | }
208 |
209 | private void button8_Click_1(object sender, EventArgs e)
210 | {
211 | sbyte[] tval = new sbyte[2];
212 | sbyte[] evalue = new sbyte[8];
213 | tval[0] = convertTemperature(float.Parse(textBox1.Text));
214 | evalue = encrypt(tval);
215 | foreach (sbyte i in evalue)
216 | {
217 | textBox3.AppendText(i.ToString() + ',');
218 | }
219 | //textBox3.AppendText();
220 | /*int[] ii = new int[2];
221 | sbyte[] bb = {-25, 123, -6, 106, 102, 76, 106, 127, 121, -114, 16, 123, 40, 13, 1, -42};
222 | sbyte[] bb1 = {-11, -63, -91, -50, -70, 65, -34, 26};
223 | foreach (int i in bytesToInts(bb, LITTLE_ENDIAN))
224 | {
225 | textBox3.AppendText(i.ToString() + ',');
226 | }
227 | foreach (int i in bytesToInts(bb1, BIG_ENDIAN))
228 | {
229 | textBox3.AppendText(i.ToString() + ',');
230 | }
231 |
232 | ii[0] = 942866432;
233 | ii[1] = 0;
234 | foreach (sbyte i in intsToBytes(ii, BIG_ENDIAN))
235 | {
236 | textBox3.AppendText(i.ToString()+',');
237 | }*/
238 |
239 |
240 | }
241 | private static sbyte convertTemperature(float v)
242 | {
243 | return (sbyte)((int)Math.Min(Math.Max(2.0f * v, 0.0f), 255.0f));
244 | }
245 | private static sbyte[] encrypt(sbyte[] value)
246 | {
247 | int byteArraySize = value.Length + (value.Length % 4 == 0 ? 0 : 4 - (value.Length % 4));
248 | if (byteArraySize < 8)
249 | {
250 | byteArraySize = 8;
251 | }
252 | sbyte[] padded = new sbyte[byteArraySize];
253 | Array.Copy(value, 0, padded, 0, value.Length);
254 | return xencrypt(padded, secret);
255 | }
256 | private static sbyte[] xencrypt(sbyte[] data, sbyte[] key)
257 | {
258 | return intsToBytes(xxencrypt(bytesToInts(data, BIG_ENDIAN), bytesToInts(key, LITTLE_ENDIAN)), BIG_ENDIAN);
259 | }
260 |
261 | public static sbyte[] StringToByteArray(string hex)
262 | {
263 | return Enumerable.Range(0, hex.Length)
264 | .Where(x => x % 2 == 0)
265 | .Select(x => (sbyte)Convert.ToByte(hex.Substring(x, 2), 16))
266 | .ToArray();
267 | }
268 | private static sbyte[] intsToBytes(int[] ints, byte order)
269 | {
270 | sbyte[] array = new sbyte[ints.Length * INT_BYTESIZE];
271 | int k = 0;
272 | foreach (int i in ints)
273 | {
274 | byte[] bytes = BitConverter.GetBytes(i);
275 | if (order == LITTLE_ENDIAN) for (int j = 0; j < 4; j++) { array[k] = (sbyte)bytes[j]; k++; }
276 | if (order == BIG_ENDIAN) for (int j = 0; j < 4; j++) { array[k] = (sbyte)bytes[3 - j]; k++; }
277 | }
278 | return array;
279 | }
280 |
281 | private static int[] bytesToInts(sbyte[] bytes, byte order)
282 | {
283 |
284 | if (bytes.Length % INT_BYTESIZE != 0)
285 | {
286 | throw new System.ArgumentException("Length of byte-array must be divisible by 4!");
287 | }
288 | int count = bytes.Length / INT_BYTESIZE;
289 | int[] ints = new int[count];
290 | byte[] array = new byte[INT_BYTESIZE];
291 | int k=0,j;
292 |
293 | for (int i = 0; i < count; i++)
294 | {
295 | if (order == LITTLE_ENDIAN) for (j = 0; j < 4; j++) { array[j] = (byte)bytes[k]; k++; };
296 | if (order == BIG_ENDIAN) for (j = 0; j < 4; j++) { array[3 - j] = (byte)bytes[k]; k++; };
297 | ints[i] = BitConverter.ToInt32(array, 0);
298 | }
299 | return ints;
300 | }
301 |
302 | private static sbyte[] decrypt(sbyte[] data, sbyte[] key)
303 | {
304 | return intsToBytes(xxdecrypt(bytesToInts(data, BIG_ENDIAN), bytesToInts(key, LITTLE_ENDIAN)), BIG_ENDIAN);
305 |
306 | }
307 | private static int MX(int sum, int y, int z, int p, int e, int[] k)
308 | {
309 | return ((((int)((uint)z >> 5)) ^ (y << 2)) + (((int)((uint)y >> 3)) ^ (z << 4))) ^ ((sum ^ y) + (k[(p & 3) ^ e] ^ z));
310 | }
311 |
312 | public static int[] xxdecrypt(int[] vi, int[] k)
313 | {
314 | int[] v = (int[])vi.Clone();
315 | int n = v.Length - 1;
316 | if (n >= 1)
317 | {
318 | int q = (52 / (n + 1)) + 6;
319 | int y = v[0];
320 | for (int sum = q * DELTA; sum != 0; sum -= DELTA)
321 | {
322 | int e = ((int)((uint)sum >> 2)) & 3;
323 | int p = n;
324 | while (p > 0)
325 | {
326 | y = v[p] - MX(sum, y, v[p - 1], p, e, k);
327 | v[p] = y;
328 | p--;
329 | }
330 | y = v[0] - MX(sum, y, v[n], p, e, k);
331 | v[0] = y;
332 | }
333 | }
334 | return v;
335 | }
336 | public static int[] xxencrypt(int[] vi, int[] k)
337 | {
338 | int[] v = (int[])vi.Clone();
339 | int n = v.Length - 1;
340 | if (n >= 1)
341 | {
342 | int q = (52 / (n + 1)) + 6;
343 | int z = v[n];
344 | int sum = 0;
345 | int q2 = q;
346 | while (true)
347 | {
348 | q = q2 - 1;
349 | if (q2 <= 0)
350 | {
351 | break;
352 | }
353 | sum += DELTA;
354 | int e = ((int)((uint)sum >> 2)) & 3;
355 | int p = 0;
356 | while (p < n)
357 | {
358 | z = v[p] + MX(sum, v[p + 1], z, p, e, k);
359 | v[p] = z;
360 | p++;
361 | }
362 | z = v[n] + MX(sum, v[0], z, p, e, k);
363 | v[n] = z;
364 | q2 = q;
365 | }
366 | }
367 | return v;
368 | }
369 |
370 | private void button11_Click(object sender, EventArgs e)
371 | {
372 | stage = 1;
373 | }
374 | private void button8_Click_2(object sender, EventArgs e)
375 | {
376 | stage = 1;
377 | DoWrite = true;
378 | }
379 |
380 | private void timer1_Tick(object sender, EventArgs e)
381 | {
382 | if(stage>0)
383 | switch(stage){
384 | case 1: button3.PerformClick(); stage++; break;
385 | case 2: if (rxlines[0] == "Connected!") { button4.PerformClick(); stage++; }; break;
386 | case 3: if (rxlines[0] == "Write OK") { button5.PerformClick(); stage++; }; break;
387 | case 4: if (rxlines[1] == "Read val") { button6.PerformClick(); stage++; }; break;
388 | case 5: if (rxlines[1] == "Read val") if (DoWrite) { button7.PerformClick(); stage++; } else stage = 7; break;
389 | case 6: if (rxlines[0] == "Write OK") stage = 7; break;
390 | case 7: button3.PerformClick(); stage = 0; DoWrite = false; break;
391 | }
392 | }
393 |
394 | private void textBox4_TextChanged(object sender, EventArgs e)
395 | {
396 | if (textBox4.Text.Length == 32) secret = StringToByteArray(textBox4.Text);
397 | }
398 |
399 | private void button13_Click(object sender, EventArgs e)
400 | {//2F-6B-47-55-38-C2-7A-17
401 | sbyte[] temp = new sbyte[] { 47,107,71,85,56,-62,122,23 };
402 | sbyte[] evalue = new sbyte[16];
403 | evalue = decrypt(temp, secret);
404 | for (int i = 0; i < 8; i++) { textBox3.AppendText(evalue[i].ToString() + " "); };
405 | /*sbyte[] tval = new sbyte[2];
406 | sbyte[] evalue = new sbyte[8];
407 | tval[0] = convertTemperature(float.Parse(textBox1.Text));
408 | evalue = encrypt(tval);
409 |
410 | txbuf[0] = 6;//e9 33 95 3b 0c 4e 1a c7 - 25C
411 | txbuf[1] = (byte)evalue[0];
412 | txbuf[2] = (byte)evalue[1];
413 | txbuf[3] = (byte)evalue[2];
414 | txbuf[4] = (byte)evalue[3];
415 | txbuf[5] = (byte)evalue[4];
416 | txbuf[6] = (byte)evalue[5];
417 | txbuf[7] = (byte)evalue[6];
418 | txbuf[8] = (byte)evalue[7];
419 |
420 | for (int i = 0; i < 9; i++) { textBox3.AppendText(txbuf[i].ToString() + " "); };*/
421 |
422 | //txbuf[0] = 7; serialPort1.Write(txbuf, 0, 1);
423 | //tval[0] = convertTemperature(float.Parse(textBox1.Text));
424 | //textBox3.AppendText(convertTemperature(float.Parse(textBox1.Text)).ToString());
425 | /*sbyte[] tval = new sbyte[2];
426 | sbyte[] evalue = new sbyte[8];
427 | tval[0] = convertTemperature(float.Parse(textBox1.Text));
428 | int byteArraySize = tval.Length + (tval.Length % 4 == 0 ? 0 : 4 - (tval.Length % 4));
429 | textBox3.AppendText(tval.Length.ToString());
430 | textBox3.AppendText(byteArraySize.ToString());
431 |
432 | evalue = encrypt(tval);*/
433 |
434 | /*int[] ui = new int[2];
435 | ui[0] = 235442;
436 | ui[1] = 345345;
437 | sbyte[] ub = new sbyte[8];
438 | ub = intsToBytes(ui, BIG_ENDIAN);
439 | for (int i = 0; i < 8; i++) textBox3.AppendText(ub[i].ToString()+" ");*/
440 | /*sbyte[] ub = new sbyte[8];
441 | ub[0] = 1;
442 | ub[1] = 2;
443 | ub[2] = 3;
444 | ub[3] = 4;
445 | ub[4] = 5;
446 | ub[5] = 6;
447 | ub[6] = 7;
448 | ub[7] = 8;
449 | int[] ui = new int[2];
450 | ui = bytesToInts(ub, BIG_ENDIAN);
451 | for (int i = 0; i < 2; i++) textBox3.AppendText(ui[i].ToString()+" ");*/
452 |
453 | /*int[] ui = new int[2];
454 | ui[0] = 235442;
455 | ui[1] = 345345;
456 | int[] rui = new int[10];
457 | rui = xxencrypt(ui, bytesToInts(secret, LITTLE_ENDIAN));
458 | for (int i = 0; i < 2; i++) textBox3.AppendText(rui[i].ToString() + " ");*/
459 | //textBox3.AppendText(ui[i].ToString() + " ");
460 |
461 | }
462 |
463 | private void button12_Click(object sender, EventArgs e)
464 | {
465 | textBox3.Clear();
466 | }
467 |
468 |
469 |
470 |
471 | }
472 | }
473 |
--------------------------------------------------------------------------------
/DanfossGW/DanfossGW/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 |
121 | 17, 17
122 |
123 |
124 | 126, 17
125 |
126 |
127 | 49
128 |
129 |
--------------------------------------------------------------------------------
/DanfossGW/DanfossGW/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace DanfossGW
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// Главная точка входа для приложения.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/DanfossGW/DanfossGW/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Управление общими сведениями о сборке осуществляется с помощью
6 | // набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
7 | // связанные со сборкой.
8 | [assembly: AssemblyTitle("DanfossGW")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("DanfossGW")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Параметр ComVisible со значением FALSE делает типы в сборке невидимыми
18 | // для COM-компонентов. Если требуется обратиться к типу в этой сборке через
19 | // COM, задайте атрибуту ComVisible значение TRUE для этого типа.
20 | [assembly: ComVisible(false)]
21 |
22 | // Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
23 | [assembly: Guid("0bbd1eb8-6fbe-4988-8bb5-b2d4957dde6f")]
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 |
--------------------------------------------------------------------------------
/DanfossGW/DanfossGW/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Этот код создан программным средством.
4 | // Версия среды выполнения: 4.0.30319.42000
5 | //
6 | // Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если
7 | // код создан повторно.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DanfossGW.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("DanfossGW.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 |
--------------------------------------------------------------------------------
/DanfossGW/DanfossGW/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 |
--------------------------------------------------------------------------------
/DanfossGW/DanfossGW/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Этот код создан программой.
4 | // Исполняемая версия:4.0.30319.42000
5 | //
6 | // Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
7 | // повторной генерации кода.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DanfossGW.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("6")]
29 | public string port {
30 | get {
31 | return ((string)(this["port"]));
32 | }
33 | set {
34 | this["port"] = value;
35 | }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/DanfossGW/DanfossGW/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 6
7 |
8 |
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Danfoss-BLE
2 | Sources for control Danfoss ECO via cc2541 as gateway
3 |
4 | Contains MS Visual Studio 2012 PC project and IAR Embedded Workbench 10.10 TI cc2541 project.
5 |
6 | cc2541 should be connected to PC via USB TTL converter.
7 |
8 | Main things I've found out:
9 | 1) Before reading and writing data, PIN code must be send to danfoss.
10 | I'm sending four zero bytes to charasteristic uuid_pin. You can try with nRF Connect.
11 |
12 | 2) All data is encrypted, so after reading , you should decrypt it.
13 | And encrypt before writing. You can find encrypting and decrypting
14 | functions in attached MS Visual Studio project.
15 |
16 | 3) Encryption key, which I struggled with much). You are able to read it,
17 | only if you connect after pressing danfoss hard button.
18 | It is used by encryption/decryption functions.
19 |
20 | I've marked characteristics which I used (see Excel sheet).
21 |
22 | https://www.youtube.com/watch?v=RZPkLU8rEGs
23 |
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2540/SimpleBLECentral.ewd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 2
5 |
6 | CC2540EM
7 |
8 | 8051
9 |
10 | 1
11 |
12 | C-SPY
13 | 2
14 |
15 | 8
16 | 1
17 | 1
18 |
22 |
26 |
30 |
34 |
38 |
42 |
46 |
50 |
54 |
58 |
62 |
66 |
70 |
74 |
78 |
82 |
86 |
90 |
94 |
98 |
102 |
106 |
110 |
114 |
118 |
122 |
126 |
130 |
134 |
138 |
142 |
146 |
150 |
154 |
158 |
159 |
160 |
161 | _3RD_ID
162 | 1
163 |
164 | 0
165 | 1
166 | 1
167 |
171 |
175 |
179 |
183 |
184 |
185 |
186 | CHIPCON_ID
187 | 2
188 |
189 | 4
190 | 1
191 | 1
192 |
196 |
200 |
204 |
208 |
212 |
216 |
220 |
224 |
229 |
233 |
237 |
242 |
246 |
250 |
254 |
258 |
262 |
266 |
270 |
274 |
278 |
282 |
286 |
287 |
288 |
289 | FS2_ID
290 | 1
291 |
292 | 0
293 | 1
294 | 1
295 |
299 |
304 |
308 |
312 |
316 |
320 |
324 |
328 |
332 |
333 |
334 |
335 | INFINEON_ID
336 | 1
337 |
338 | 2
339 | 1
340 | 1
341 |
345 |
349 |
353 |
357 |
361 |
365 |
369 |
373 |
377 |
381 |
385 |
390 |
394 |
398 |
399 |
400 |
401 | NS_ID
402 | 1
403 |
404 | 0
405 | 1
406 | 1
407 |
411 |
415 |
419 |
420 |
421 |
422 | ROM_ID
423 | 1
424 |
425 | 2
426 | 1
427 | 1
428 |
432 |
436 |
440 |
444 |
449 |
454 |
459 |
464 |
469 |
474 |
478 |
482 |
486 |
490 |
491 |
492 |
493 | AD2_ID
494 | 2
495 |
496 | 6
497 | 1
498 | 1
499 |
503 |
507 |
512 |
517 |
521 |
525 |
529 |
533 |
537 |
541 |
542 |
543 |
544 | CYGNAL_ID
545 | 2
546 |
547 | 2
548 | 1
549 | 1
550 |
554 |
558 |
562 |
566 |
571 |
576 |
580 |
584 |
588 |
592 |
596 |
600 |
604 |
608 |
612 |
616 |
617 |
618 |
619 | SIM_ID
620 | 1
621 |
622 | 2
623 | 1
624 | 1
625 |
629 |
633 |
637 |
641 |
642 |
643 |
644 |
645 | $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin
646 | 1
647 |
648 |
649 | $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin
650 | 0
651 |
652 |
653 | $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin
654 | 1
655 |
656 |
657 |
658 |
659 |
660 |
661 |
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2540/SimpleBLECentral.ewp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 2
5 |
6 | CC2540EM
7 |
8 | 8051
9 |
10 | 1
11 |
12 | General
13 | 1
14 |
15 | 5
16 | 1
17 | 1
18 |
22 |
26 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
64 |
68 |
72 |
77 |
82 |
86 |
90 |
95 |
99 |
103 |
107 |
111 |
115 |
119 |
123 |
127 |
131 |
135 |
139 |
143 |
147 |
151 |
155 |
160 |
164 |
169 |
173 |
177 |
181 |
185 |
189 |
193 |
197 |
201 |
205 |
209 |
213 |
217 |
222 |
226 |
230 |
234 |
238 |
243 |
248 |
253 |
254 |
255 |
256 | ICC8051
257 | 5
258 |
259 | 10
260 | 1
261 | 1
262 |
266 |
277 |
281 |
285 |
289 |
293 |
297 |
301 |
305 |
309 |
313 |
317 |
321 |
325 |
329 |
333 |
337 |
341 |
345 |
349 |
353 |
358 |
362 |
366 |
370 |
374 |
378 |
382 |
386 |
390 |
394 |
398 |
402 |
406 |
410 |
414 |
418 |
422 |
426 |
431 |
435 |
439 |
443 |
448 |
466 |
470 |
475 |
479 |
483 |
487 |
491 |
496 |
500 |
505 |
509 |
513 |
517 |
521 |
525 |
529 |
533 |
537 |
538 |
539 |
540 | A8051
541 | 2
542 |
543 | 6
544 | 1
545 | 1
546 |
550 |
554 |
558 |
562 |
566 |
571 |
575 |
579 |
583 |
587 |
591 |
595 |
599 |
603 |
607 |
611 |
615 |
619 |
623 |
627 |
631 |
635 |
639 |
643 |
647 |
651 |
655 |
659 |
663 |
667 |
671 |
675 |
679 |
683 |
687 |
691 |
692 |
693 |
694 | CUSTOM
695 | 3
696 |
697 |
698 |
699 |
700 |
701 |
702 | BICOMP
703 | 0
704 |
705 |
706 |
707 | BUILDACTION
708 | 1
709 |
710 |
711 |
712 |
713 |
714 |
715 | XLINK
716 | 3
717 |
718 | 18
719 | 1
720 | 1
721 |
725 |
729 |
734 |
739 |
743 |
747 |
751 |
755 |
759 |
763 |
767 |
771 |
775 |
779 |
783 |
787 |
791 |
795 |
799 |
803 |
807 |
811 |
815 |
819 |
823 |
827 |
831 |
835 |
839 |
843 |
848 |
852 |
856 |
861 |
865 |
869 |
873 |
877 |
881 |
886 |
891 |
895 |
899 |
903 |
907 |
911 |
915 |
919 |
923 |
927 |
931 |
936 |
941 |
945 |
949 |
953 |
957 |
961 |
965 |
969 |
973 |
977 |
981 |
985 |
989 |
993 |
997 |
1001 |
1005 |
1009 |
1013 |
1017 |
1021 |
1025 |
1029 |
1033 |
1038 |
1039 |
1040 |
1041 | XAR
1042 | 1
1043 |
1044 | 0
1045 | 1
1046 | 1
1047 |
1051 |
1055 |
1059 |
1063 |
1064 |
1065 |
1066 | BILINK
1067 | 0
1068 |
1069 |
1070 |
1071 |
1072 | APP
1073 |
1074 | $PROJ_DIR$\..\Source\OSAL_simpleBLECentral.c
1075 |
1076 |
1077 | $PROJ_DIR$\..\Source\simpleBLECentral.c
1078 |
1079 |
1080 | $PROJ_DIR$\..\Source\simpleBLECentral.h
1081 |
1082 |
1083 | $PROJ_DIR$\..\Source\simpleBLECentral_Main.c
1084 |
1085 |
1086 |
1087 | HAL
1088 |
1089 | Common
1090 |
1091 | $PROJ_DIR$\..\..\..\..\Components\hal\common\hal_drivers.c
1092 |
1093 |
1094 |
1095 | Include
1096 |
1097 | $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_adc.h
1098 |
1099 |
1100 | $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_assert.h
1101 |
1102 |
1103 | $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_board.h
1104 |
1105 |
1106 | $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_defs.h
1107 |
1108 |
1109 | $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_drivers.h
1110 |
1111 |
1112 | $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_flash.h
1113 |
1114 |
1115 | $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_key.h
1116 |
1117 |
1118 | $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_lcd.h
1119 |
1120 |
1121 | $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_led.h
1122 |
1123 |
1124 | $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_rpc.h
1125 |
1126 |
1127 | $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_sleep.h
1128 |
1129 |
1130 | $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_timer.h
1131 |
1132 |
1133 | $PROJ_DIR$\..\..\..\..\Components\hal\include\hal_uart.h
1134 |
1135 |
1136 |
1137 | Target
1138 |
1139 | CC2540EB
1140 |
1141 | Config
1142 |
1143 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_board_cfg.h
1144 |
1145 |
1146 |
1147 | Drivers
1148 |
1149 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_adc.c
1150 |
1151 |
1152 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_aes.c
1153 |
1154 |
1155 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_dma.c
1156 |
1157 |
1158 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_flash.c
1159 |
1160 |
1161 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_key.c
1162 |
1163 |
1164 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_lcd.c
1165 |
1166 |
1167 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_led.c
1168 |
1169 |
1170 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_sleep.c
1171 |
1172 |
1173 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_startup.c
1174 |
1175 |
1176 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_timer.c
1177 |
1178 |
1179 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_uart.c
1180 |
1181 |
1182 |
1183 | Includes
1184 |
1185 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_aes.h
1186 |
1187 |
1188 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_ccm.h
1189 |
1190 |
1191 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_dma.h
1192 |
1193 |
1194 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_mcu.h
1195 |
1196 |
1197 | $PROJ_DIR$\..\..\..\..\Components\hal\target\CC2540EB\hal_types.h
1198 |
1199 |
1200 |
1201 |
1202 |
1203 |
1204 | LIB
1205 |
1206 | $PROJ_DIR$\..\..\Libraries\CC2540DB\bin\CC2540_BLE_cent.lib
1207 |
1208 |
1209 | $PROJ_DIR$\..\..\Libraries\Common\bin\CC254x_BLE_HCI_TL_None.lib
1210 |
1211 |
1212 |
1213 | NPI
1214 |
1215 | $PROJ_DIR$\..\..\common\npi\npi_np\npi.c
1216 |
1217 |
1218 | $PROJ_DIR$\..\..\common\npi\npi_np\npi.h
1219 |
1220 |
1221 | $PROJ_DIR$\..\..\common\npi\npi_np\npi_spi.c
1222 |
1223 | CC2540EM
1224 |
1225 |
1226 |
1227 | $PROJ_DIR$\..\..\common\npi\npi_np\npi_uart.c
1228 |
1229 | CC2540EM
1230 |
1231 |
1232 |
1233 |
1234 | OSAL
1235 |
1236 | $PROJ_DIR$\..\..\..\..\Components\ble\include\bcomdef.h
1237 |
1238 |
1239 | $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL.c
1240 |
1241 |
1242 | $PROJ_DIR$\..\..\..\..\Components\osal\common\osal_bufmgr.c
1243 |
1244 |
1245 | $PROJ_DIR$\..\..\..\..\Components\osal\common\osal_cbtimer.c
1246 |
1247 |
1248 | $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_ClockBLE.c
1249 |
1250 |
1251 | $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Memory.c
1252 |
1253 |
1254 | $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_PwrMgr.c
1255 |
1256 |
1257 | $PROJ_DIR$\..\..\..\..\Components\osal\mcu\cc2540\osal_snv.c
1258 |
1259 |
1260 | $PROJ_DIR$\..\..\..\..\Components\osal\common\OSAL_Timers.c
1261 |
1262 |
1263 |
1264 | PROFILES
1265 |
1266 | $PROJ_DIR$\..\..\Profiles\Roles\central.c
1267 |
1268 |
1269 | $PROJ_DIR$\..\..\Profiles\Roles\central.h
1270 |
1271 |
1272 | $PROJ_DIR$\..\..\Profiles\Roles\gap.c
1273 |
1274 |
1275 | $PROJ_DIR$\..\..\Profiles\Roles\gapbondmgr.c
1276 |
1277 |
1278 | $PROJ_DIR$\..\..\Profiles\Roles\gapbondmgr.h
1279 |
1280 |
1281 | $PROJ_DIR$\..\..\Include\gapgattserver.h
1282 |
1283 |
1284 | $PROJ_DIR$\..\..\..\..\Components\ble\host\gatt_uuid.c
1285 |
1286 |
1287 | $PROJ_DIR$\..\..\Include\gattservapp.h
1288 |
1289 |
1290 |
1291 | TOOLS
1292 |
1293 | $PROJ_DIR$\..\..\config\buildComponents.cfg
1294 |
1295 |
1296 | $PROJ_DIR$\buildConfig.cfg
1297 |
1298 |
1299 | $PROJ_DIR$\..\..\common\cc2540\OnBoard.c
1300 |
1301 |
1302 | $PROJ_DIR$\..\..\common\cc2540\OnBoard.h
1303 |
1304 |
1305 |
1306 |
1307 |
1308 |
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2540/SimpleBLECentral.eww:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | $WS_DIR$\SimpleBLECentral.ewp
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2540/buildConfig.cfg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsltip/Danfoss-BLE/df5ac0e7b42e639374b2b9cbedc07f1df3f0da99/SimpleBLECentral_cc2541/CC2540/buildConfig.cfg
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2541/BuildLog.log:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2541/CC2541EM/Exe/SimpleBLECentral.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsltip/Danfoss-BLE/df5ac0e7b42e639374b2b9cbedc07f1df3f0da99/SimpleBLECentral_cc2541/CC2541/CC2541EM/Exe/SimpleBLECentral.bin
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2541/CC2541EM/Exe/SimpleBLECentral.d51:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsltip/Danfoss-BLE/df5ac0e7b42e639374b2b9cbedc07f1df3f0da99/SimpleBLECentral_cc2541/CC2541/CC2541EM/Exe/SimpleBLECentral.d51
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2541/SimpleBLECentral.ewd:
--------------------------------------------------------------------------------
1 |
2 |
3 | 3
4 |
5 | CC2541EM
6 |
7 | 8051
8 |
9 | 1
10 |
11 | C-SPY
12 | 2
13 |
14 | 8
15 | 1
16 | 1
17 |
21 |
25 |
29 |
33 |
37 |
41 |
45 |
49 |
53 |
57 |
61 |
65 |
69 |
73 |
77 |
81 |
85 |
89 |
93 |
97 |
101 |
105 |
109 |
113 |
117 |
121 |
125 |
129 |
133 |
137 |
141 |
145 |
149 |
153 |
157 |
158 |
159 |
160 | _3RD_ID
161 | 1
162 |
163 | 0
164 | 1
165 | 1
166 |
170 |
174 |
178 |
182 |
183 |
184 |
185 | CHIPCON_ID
186 | 2
187 |
188 | 4
189 | 1
190 | 1
191 |
195 |
199 |
203 |
207 |
211 |
215 |
219 |
223 |
228 |
232 |
236 |
241 |
245 |
249 |
253 |
257 |
261 |
265 |
269 |
273 |
277 |
281 |
285 |
286 |
287 |
288 | FS2_ID
289 | 1
290 |
291 | 0
292 | 1
293 | 1
294 |
298 |
303 |
307 |
311 |
315 |
319 |
323 |
327 |
331 |
332 |
333 |
334 | INFINEON_ID
335 | 1
336 |
337 | 2
338 | 1
339 | 1
340 |
344 |
348 |
352 |
356 |
360 |
364 |
368 |
372 |
376 |
380 |
384 |
389 |
393 |
397 |
398 |
399 |
400 | JLINK_ID
401 | 1
402 |
403 | 0
404 | 1
405 | 1
406 |
410 |
414 |
418 |
423 |
427 |
431 |
435 |
439 |
443 |
447 |
448 |
449 |
450 | NS_ID
451 | 1
452 |
453 | 0
454 | 1
455 | 1
456 |
460 |
464 |
468 |
469 |
470 |
471 | ROM_ID
472 | 1
473 |
474 | 2
475 | 1
476 | 1
477 |
481 |
485 |
489 |
493 |
498 |
503 |
508 |
513 |
518 |
523 |
527 |
531 |
535 |
539 |
540 |
541 |
542 | AD2_ID
543 | 2
544 |
545 | 6
546 | 1
547 | 1
548 |
552 |
556 |
561 |
566 |
570 |
574 |
578 |
582 |
586 |
590 |
591 |
592 |
593 | CYGNAL_ID
594 | 2
595 |
596 | 2
597 | 1
598 | 1
599 |
603 |
607 |
611 |
615 |
620 |
625 |
629 |
633 |
637 |
641 |
645 |
649 |
653 |
657 |
661 |
665 |
666 |
667 |
668 | SIM_ID
669 | 1
670 |
671 | 2
672 | 1
673 | 1
674 |
678 |
682 |
686 |
690 |
691 |
692 |
693 |
694 | $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin
695 | 1
696 |
697 |
698 | $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin
699 | 0
700 |
701 |
702 | $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin
703 | 0
704 |
705 |
706 |
707 |
708 |
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2541/SimpleBLECentral.eww:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | $WS_DIR$\SimpleBLECentral.ewp
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2541/buildConfig.cfg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsltip/Danfoss-BLE/df5ac0e7b42e639374b2b9cbedc07f1df3f0da99/SimpleBLECentral_cc2541/CC2541/buildConfig.cfg
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2541/settings/SimpleBLECentral.CC2541EM.cspy.bat:
--------------------------------------------------------------------------------
1 | @REM This batch file has been generated by the IAR Embedded Workbench
2 | @REM C-SPY Debugger, as an aid to preparing a command line for running
3 | @REM the cspybat command line utility using the appropriate settings.
4 | @REM
5 | @REM Note that this file is generated every time a new debug session
6 | @REM is initialized, so you may want to move or rename the file before
7 | @REM making changes.
8 | @REM
9 | @REM You can launch cspybat by typing the name of this batch file followed
10 | @REM by the name of the debug file (usually an ELF/DWARF or UBROF file).
11 | @REM
12 | @REM Read about available command line parameters in the C-SPY Debugging
13 | @REM Guide. Hints about additional command line parameters that may be
14 | @REM useful in specific cases:
15 | @REM --download_only Downloads a code image without starting a debug
16 | @REM session afterwards.
17 | @REM --silent Omits the sign-on message.
18 | @REM --timeout Limits the maximum allowed execution time.
19 | @REM
20 |
21 |
22 | @echo off
23 |
24 | if not "%~1" == "" goto debugFile
25 |
26 | @echo on
27 |
28 | "C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.0\common\bin\cspybat" -f "C:\Texas Instruments\BLE-CC254x-1.4.0\Projects\ble\SimpleBLECentral\CC2541\settings\SimpleBLECentral.CC2541EM.general.xcl" --backend -f "C:\Texas Instruments\BLE-CC254x-1.4.0\Projects\ble\SimpleBLECentral\CC2541\settings\SimpleBLECentral.CC2541EM.driver.xcl"
29 |
30 | @echo off
31 | goto end
32 |
33 | :debugFile
34 |
35 | @echo on
36 |
37 | "C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.0\common\bin\cspybat" -f "C:\Texas Instruments\BLE-CC254x-1.4.0\Projects\ble\SimpleBLECentral\CC2541\settings\SimpleBLECentral.CC2541EM.general.xcl" "--debug_file=%~1" --backend -f "C:\Texas Instruments\BLE-CC254x-1.4.0\Projects\ble\SimpleBLECentral\CC2541\settings\SimpleBLECentral.CC2541EM.driver.xcl"
38 |
39 | @echo off
40 | :end
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2541/settings/SimpleBLECentral.CC2541EM.cspy.ps1:
--------------------------------------------------------------------------------
1 | param([String]$debugfile = "");
2 |
3 | # This powershell file has been generated by the IAR Embedded Workbench
4 | # C - SPY Debugger, as an aid to preparing a command line for running
5 | # the cspybat command line utility using the appropriate settings.
6 | #
7 | # Note that this file is generated every time a new debug session
8 | # is initialized, so you may want to move or rename the file before
9 | # making changes.
10 | #
11 | # You can launch cspybat by typing Powershell.exe -File followed by the name of this batch file, followed
12 | # by the name of the debug file (usually an ELF / DWARF or UBROF file).
13 | #
14 | # Read about available command line parameters in the C - SPY Debugging
15 | # Guide. Hints about additional command line parameters that may be
16 | # useful in specific cases :
17 | # --download_only Downloads a code image without starting a debug
18 | # session afterwards.
19 | # --silent Omits the sign - on message.
20 | # --timeout Limits the maximum allowed execution time.
21 | #
22 |
23 |
24 | if ($debugfile -eq "")
25 | {
26 | & "C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.0\common\bin\cspybat" -f "C:\Texas Instruments\BLE-CC254x-1.4.0\Projects\ble\SimpleBLECentral\CC2541\settings\SimpleBLECentral.CC2541EM.general.xcl" --backend -f "C:\Texas Instruments\BLE-CC254x-1.4.0\Projects\ble\SimpleBLECentral\CC2541\settings\SimpleBLECentral.CC2541EM.driver.xcl"
27 | }
28 | else
29 | {
30 | & "C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.0\common\bin\cspybat" -f "C:\Texas Instruments\BLE-CC254x-1.4.0\Projects\ble\SimpleBLECentral\CC2541\settings\SimpleBLECentral.CC2541EM.general.xcl" --debug_file=$debugfile --backend -f "C:\Texas Instruments\BLE-CC254x-1.4.0\Projects\ble\SimpleBLECentral\CC2541\settings\SimpleBLECentral.CC2541EM.driver.xcl"
31 | }
32 |
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2541/settings/SimpleBLECentral.CC2541EM.driver.xcl:
--------------------------------------------------------------------------------
1 | "--proc_core"
2 |
3 | "plain"
4 |
5 | "--proc_code_model"
6 |
7 | "banked"
8 |
9 | "--proc_nr_virtual_regs"
10 |
11 | "16"
12 |
13 | "--proc_pdata_bank_reg_addr"
14 |
15 | "0x93"
16 |
17 | "--proc_dptr_nr_of"
18 |
19 | "1"
20 |
21 | "--proc_codebank_reg"
22 |
23 | "0x9F"
24 |
25 | "--proc_codebank_start"
26 |
27 | "0x8000"
28 |
29 | "--proc_codebank_end"
30 |
31 | "0xFFFF"
32 |
33 | "--proc_codebank_mask"
34 |
35 | "0xFF"
36 |
37 | "--proc_data_model"
38 |
39 | "large"
40 |
41 | "-p"
42 |
43 | "C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.0\8051\config\devices\Texas Instruments\ioCC2541F256.ddf"
44 |
45 | "--proc_exclude_exit_breakpoint"
46 |
47 | "--proc_driver"
48 |
49 | "chipcon"
50 |
51 | "--erase_flash"
52 |
53 | "--verify_download"
54 |
55 | "use_crc16"
56 |
57 | "--stack_overflow"
58 |
59 | "--number_of_banks"
60 |
61 | "4"
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2541/settings/SimpleBLECentral.CC2541EM.general.xcl:
--------------------------------------------------------------------------------
1 | "C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.0\8051\bin\8051proc.dll"
2 |
3 | "C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.0\8051\bin\8051emu_cc.dll"
4 |
5 | "C:\Texas Instruments\BLE-CC254x-1.4.0\Projects\ble\SimpleBLECentral\CC2541\CC2541EM\Exe\SimpleBLECentral.d51"
6 |
7 | --plugin "C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.0\8051\bin\8051bat.dll"
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2541/settings/SimpleBLECentral.dbgdt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2541/settings/SimpleBLECentral.dnx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0
5 | 1
6 | 90
7 | 1
8 | 1
9 | 1
10 | main
11 | 0
12 | 50
13 |
14 |
15 | 0
16 |
17 |
18 | 1
19 | 1
20 |
21 |
22 | 0
23 | 0
24 |
25 |
26 |
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/CC2541/settings/SimpleBLECentral.wsdt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SimpleBLECentral/CC2541EM
6 |
7 |
8 |
9 |
10 | 34048
11 | 34049
12 | 34050
13 | 34051
14 | 34052
15 | 34053
16 | 34054
17 | 34055
18 | 34056
19 | 34057
20 | 34058
21 | 34059
22 | 34060
23 | 34061
24 |
25 |
26 |
27 |
28 | - 57600
29 | - 57601
30 | - 57603
31 | - 33024
32 | - 0
33 | - 57607
34 | - 0
35 | - 57635
36 | - 57634
37 | - 57637
38 | - 0
39 | - 57643
40 | - 57644
41 | - 0
42 | - 33090
43 | - 33057
44 | - 57636
45 | - 57640
46 | - 57641
47 | - 33026
48 | - 33065
49 | - 33063
50 | - 33064
51 | - 33053
52 | - 33054
53 | - 0
54 | - 33035
55 | - 33036
56 | - 34399
57 | - 0
58 | - 33038
59 | - 33039
60 | - 0
61 |
62 |
63 |
64 | 21
65 | 1537
66 | 2
67 |
68 | 0
69 | -1
70 |
71 |
72 |
73 | 333
74 | 2
75 | 27
76 | 0
77 |
78 |
79 | SimpleBLECentral
80 | SimpleBLECentral/APP
81 |
82 |
83 |
84 | 4
85 | 0
86 |
87 |
88 | 1
89 | 1
90 | 0
91 | 0
92 | 1
93 | 1
94 | 1
95 | 30000000130004840000020000002CE1000001000000ED800000010000000C81000005000000EA80000002000000068400000100000017810000070000007784000001000000148100000200000000810000010000000E84000012000000EC80000001000000E98000000100000005840000060000001084000005000000EE80000001000000EB80000001000000E8800000010000000784000001000000
96 |
97 |
98 | 19000C8400003384000078840000118400007784000007840000FFFFFFFF808C00000D8400000F8400000884000054840000328100001C81000009840000538400007C8400007D8400007E8400008384000084840000008200001C8200000182000067860000
99 | 300004840000450000002CE100003C000000158100001C000000048100001300000007E1000033000000318400004C0000005F8600002C00000004E10000310000000F8100001A000000208100002300000023E100003500000001E100002E0000000D8000000E0000000C81000017000000198200000C0000000684000047000000168200000A0000004A81000040000000178100001E00000003840000440000002BE100003B000000148100001B0000000081000010000000308400004B0000000E840000490000002F8200000D00000025E100003700000003E10000300000000E810000190000001F8100002200000022E100003400000000E100002D0000000B81000016000000188200000B00000041E100003E0000000584000046000000498100003F000000168100001D000000058100001400000002840000430000002AE100003A000000328400004D000000108400004A00000005E1000032000000518400004F00000002E100002F0000000D810000180000000A84000048000000
100 |
101 |
102 | 0
103 | 0A0000000A0000006E0000006E000000
104 | 00000000330300004006000046030000
105 | 4096
106 | 0
107 | 0
108 | 32767
109 | 0
110 |
111 |
112 | 1
113 |
114 |
115 | 4294967295
116 | 00000000480000007601000073020000
117 | 0000000032000000760100005D020000
118 | 4096
119 | 0
120 | 0
121 | 32767
122 | 0
123 |
124 |
125 | 1
126 |
127 |
128 | 34049
129 | 000000001600000022010000C6000000
130 | 040000009B0200001E01000019030000
131 | 32768
132 | 0
133 | 0
134 | 32767
135 | 0
136 |
137 |
138 | 0
139 |
140 |
141 |
142 | 34050
143 | 000000001600000022010000C6000000
144 | 04000000790200003C06000019030000
145 | 4096
146 | 0
147 | 0
148 | 32767
149 | 0
150 |
151 |
152 | 1
153 |
154 |
155 | 24
156 | 1160
157 | 309
158 | 77
159 | 2
160 | C:\Texas Instruments\BLE-CC254x-1.4.0\Projects\ble\SimpleBLECentral\CC2541\BuildLog.log
161 | 0
162 | -1
163 |
164 |
165 | 34054
166 | 000000001600000022010000C6000000
167 | 04000000790200003C06000019030000
168 | 4096
169 | 0
170 | 0
171 | 32767
172 | 0
173 |
174 |
175 | 1
176 |
177 |
178 | 34055
179 | 000000001600000022010000C6000000
180 | 04000000790200003C06000019030000
181 | 4096
182 | 0
183 | 0
184 | 32767
185 | 0
186 |
187 |
188 | 1
189 |
190 |
191 | 554
192 | 79
193 | 950
194 | 2
195 |
196 | 0
197 | -1
198 |
199 |
200 | 34056
201 | 000000001600000022010000C6000000
202 | 04000000790200003C06000019030000
203 | 4096
204 | 0
205 | 0
206 | 32767
207 | 0
208 |
209 |
210 | 0
211 |
212 |
213 |
214 | 34057
215 | 000000001600000022010000C6000000
216 | 04000000790200003C06000019030000
217 | 4096
218 | 0
219 | 0
220 | 32767
221 | 0
222 |
223 |
224 | 0
225 |
226 |
227 |
228 | 34058
229 | 000000001600000022010000C6000000
230 | 04000000790200003C06000019030000
231 | 4096
232 | 0
233 | 0
234 | 32767
235 | 0
236 |
237 |
238 | 0
239 |
240 |
241 |
242 | 34060
243 | 000000001600000022010000C6000000
244 | 04000000790200003C06000019030000
245 | 4096
246 | 0
247 | 0
248 | 32767
249 | 0
250 |
251 |
252 | 0
253 |
254 |
255 |
256 | 34051
257 | 000000001600000080020000A6000000
258 | 00000000000000008002000090000000
259 | 32768
260 | 0
261 | 0
262 | 32767
263 | 0
264 |
265 |
266 | 0
267 |
268 |
269 |
270 | 34052
271 | 000000001600000022010000C6000000
272 | 000000000000000022010000B0000000
273 | 32768
274 | 0
275 | 0
276 | 32767
277 | 0
278 |
279 |
280 | 0
281 |
282 |
283 |
284 | 34053
285 | 000000001600000022010000C6000000
286 | 000000000000000022010000B0000000
287 | 32768
288 | 0
289 | 0
290 | 32767
291 | 0
292 |
293 |
294 | 0
295 |
296 |
297 |
298 | 34059
299 | 00000000160000000601000076010000
300 | 040000004A0000007201000043020000
301 | 4096
302 | 0
303 | 0
304 | 32767
305 | 0
306 |
307 |
308 | 0
309 |
310 |
311 | 2147483647
312 | 1
313 |
314 |
315 | 34061
316 | 00000000160000000601000076010000
317 | 0000000046000000760100005D020000
318 | 4096
319 | 0
320 | 0
321 | 32767
322 | 0
323 |
324 |
325 | 1
326 |
327 |
328 | 0000000008000000000000000010000001000000FFFFFFFFFFFFFFFF76010000320000007A0100005D0200000100000002000010040000000100000091FFFFFF31050000FFFFFFFF020000000B8500000D850000FFFF02000B004354616262656450616E650010000001000000000000004800000076010000730200000000000032000000760100005D020000000000004010005602000000FFFEFF0E53006F0075007200630065002000420072006F007700730065007200000000000B85000001000000FFFFFFFFFFFFFFFFFFFEFF0957006F0072006B0073007000610063006500010000000D85000001000000FFFFFFFFFFFFFFFF01000000000000000000000000000000000000000000000001000000FFFFFFFF0B85000001000000FFFFFFFF0B850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000058500000000000000000000000000000000000001000000058500000100000005850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000038500000000000000000000000000000000000001000000038500000100000003850000000000000080000001000000FFFFFFFFFFFFFFFF000000005D020000400600006102000001000000010000100400000001000000B0FDFFFF67000000FFFFFFFF0700000002850000068500000785000008850000098500000A8500000C850000018000800000010000000000000077020000400600004903000000000000610200004006000033030000000000004080005607000000FFFEFF054200750069006C006400010000000285000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000685000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300010000000785000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000000985000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000000A85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000000C85000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF0285000001000000FFFFFFFF02850000000000000000000000000000
329 |
330 |
331 | Main
332 | 00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E10000000000002D000000FFFEFF000000000000000000000000000100000001000000018001E10000000000002E000000FFFEFF000000000000000000000000000100000001000000018003E100000000000030000000FFFEFF0000000000000000000000000001000000010000000180008100000000000010000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E100000000000033000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E100000000040035000000FFFEFF000000000000000000000000000100000001000000018022E100000000040034000000FFFEFF000000000000000000000000000100000001000000018025E100000000040037000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE10000000004003B000000FFFEFF00000000000000000000000000010000000100000001802CE10000000004003C000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000000FFFFFFFFFFFEFF0000000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF0096000000000000004A00FFFEFF036C0063006400FFFEFF036B0065007900FFFEFF04660069006C007400FFFEFF1C440045004600410055004C0054005F004400450056005F0044004900530043005F00420059005F005300560043005F005500550049004400FFFEFF17530049004D0050004C004500500052004F00460049004C0045005F0053004500520056005F005500550049004400FFFEFF1B730069006D0070006C00650042004C004500430065006E007400720061006C005F00480061006E0064006C0065004B00650079007300FFFEFF13530054004100520054005F0044004900530043004F0056004500520059005F00450056005400FFFEFF1E730069006D0070006C00650042004C004500430065006E007400720061006C005300740061007200740044006900730063006F007600650072007900FFFEFF1B730069006D0070006C00650042004C004500470041005400540044006900730063006F0076006500720079004500760065006E007400FFFEFF0B6D00790044006100740061004D00730067005F007400FFFEFF0F730069006D0070006C00650042004C0045005400610073006B0049006400FFFEFF0E500072006F0063006500730073004F00530041004C004D0073006700FFFEFF0469006E0069007400FFFEFF0670006500720069006F006400FFFEFF066500760065006E0074007300FFFEFF0870006500720069006F00640069006300FFFEFF0E430042005F004D00530047005F004D0059005F004400410054004100FFFEFF0D5F00500072006F0063006500730073004500760065006E007400FFFEFF047500610072007400FFFEFF0863006F006D0070006C00650074006500FFFEFF03720065007300FFFEFF10730069006D0070006C00650042004C0045005300630061006E00520065007300FFFEFF16730069006D0070006C00650042004C00450041006400640044006500760069006300650049006E0066006F00FFFEFF0561006400640072003000FFFEFF0763006F006E006E00650063007400FFFEFF0870006500650072004100640064007200FFFEFF076700530074006100740075007300FFFEFF10730069006D0070006C00650042004C00450044006F0057007200690074006500FFFEFF047500750069006400FFFEFF03720065007100FFFEFF047200650061006400FFFEFF104100540054005F00420054005F0055005500490044005F00530049005A004500FFFEFF047300740061007400FFFEFF0C75006100720074007000720069006E007400680065007800FFFEFF0370002E007500FFFEFF0672006500610064002E002E00FFFEFF06750069003200530074007200FFFEFF0F47004100540054005F004D00530047005F004500560045004E0054002000FFFEFF144100540054005F0052004500410044005F00420059005F0054005900500045005F00520053005000FFFEFF0D4100540054005F004500520052004F0052005F00520053005000FFFEFF0E4100540054005F004500520052004F0052005F005200530050002000FFFEFF0664006900730063006F007600FFFEFF1B440045004600410055004C0054005F005300560043005F0044004900530043004F0056004500520059005F00440045004C0041005900FFFEFF14440045004600410055004C0054005F0042004F004E00440049004E0047005F004D004F0044004500FFFEFF1447004100500042004F004E0044005F00500041004900520049004E0047005F004D004F0044004500FFFEFF10440045004600410055004C0054005F00500041005300530043004F0044004500FFFEFF0872006500610064002000720073007000FFFEFF154100540054005F0052004500410044005F00420059005F0054005900500045005F005200530050002000FFFEFF0863006800610072003200680065007800FFFEFF043000780045003500FFFEFF0861006400640072007400790070006500FFFEFF06750061007200740063006800FFFEFF066F00700063006F0064006500FFFEFF0C52004500530050004F004E00530045005F00410043004B00FFFEFF135000410059004C004F00410044005F004C0045004E005F0055004E004B004E004F0057004E00FFFEFF1552004500530050004F004E00530045005F004400450056004900430045005F0046004F0055004E004400FFFEFF1C730069006D0070006C00650042004C004500500072006F0063006500640075007200650049006E00500072006F0067007200650073007300FFFEFF1075006100720074004D0061006E0061006700650072005F0049006E0069007400FFFEFF0C480061006C00550041005200540043006200610063006B00FFFEFF05720078006C0065006E00FFFEFF03650076007400FFFEFF0F430042005F0050004500520049004F004400490043005F00450056005400FFFEFF057200780063006E007400FFFEFF08640061006E0066006100640064007200FFFEFF0963006F006E006E0065006300740065006400FFFEFF0577007200690074006500FFFEFF1342004C0045005F0044004900530043005F00530054004100540045005F00490044004C004500FFFEFF1342004C0045005F00530054004100540045005F0043004F004E004E0045004300540045004400FFFEFF0E730069006D0070006C00650042004C00450053007400610074006500FFFEFF0B62006C0065005F00730074006100740065005F006300FFFEFF042100210021002100FFFEFF0875006100720074006400610074006100FFFEFF0573007400610067006500FFFEFF0D44006900730063006F006E006E0065006300740065006400210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180218100000000000024000000FFFEFF000000000000000000000000000100000001000000018024E100000000000036000000FFFEFF000000000000000000000000000100000001000000018028E100000000000038000000FFFEFF000000000000000000000000000100000001000000018029E100000000000039000000FFFEFF0000000000000000000000000001000000010000000180028100000000000012000000FFFEFF0000000000000000000000000001000000010000000180298100000000000028000000FFFEFF0000000000000000000000000001000000010000000180278100000000000026000000FFFEFF0000000000000000000000000001000000010000000180288100000000000027000000FFFEFF00000000000000000000000000010000000100000001801D8100000000040020000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040021000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B8100000000000016000000FFFEFF00000000000000000000000000010000000100000001800C8100000000000017000000FFFEFF00000000000000000000000000010000000100000001805F860000000004002C000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E8100000000040019000000FFFEFF00000000000000000000000000010000000100000001800F810000000004001A000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00E8020000
333 |
334 |
335 | 34048
336 | 0A0000000A0000006E0000006E000000
337 | 0100000018000000FF02000032000000
338 | 8192
339 | 1
340 | 0
341 | 744
342 | 0
343 |
344 |
345 | 1
346 |
347 |
348 |
349 |
350 | 010000000300000001000000000000000000000001000000010000000200000000000000010000000100000000000000280000002800000001000000060000000000000001000000FFFEFF252400570053005F0044004900520024005C002E002E005C0053006F0075007200630065005C00730069006D0070006C00650042004C004500430065006E007400720061006C002E00630001000000FFFF010014004966436F6E74656E7453746F72616765496D706CFFFEFF00FFFEFFFF2A013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E003900320036003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E00330032003400300034003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E00330032003400300034003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF10730069006D0070006C00650042004C004500430065006E007400720061006C0000000000FFFFFFFFFFFFFFFFFFFEFF252400570053005F0044004900520024005C002E002E005C0053006F0075007200630065005C00730069006D0070006C00650042004C004500430065006E007400720061006C002E006800010000000180FFFEFF00FFFEFFFF26013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E0037003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0032003100390032003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0032003100390032003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF10730069006D0070006C00650042004C004500430065006E007400720061006C0000000000FFFFFFFFFFFFFFFFFFFEFF202400570053005F0044004900520024005C002E002E005C0053006F0075007200630065005C0075006100720074004D0061006E0061006700650072002E006300010000000180FFFEFF00FFFEFFFF27013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E00320031003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0031003300370037003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0031003300380032003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0B75006100720074004D0061006E00610067006500720000000000FFFFFFFFFFFFFFFFFFFEFF202400570053005F0044004900520024005C002E002E005C0053006F0075007200630065005C0075006100720074004D0061006E0061006700650072002E006800010000000180FFFEFF00FFFEFFFF25013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E00310032003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E003700340032003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E003700340032003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0B75006100720074004D0061006E00610067006500720000000000FFFFFFFFFFFFFFFFFFFEFF2A2400570053005F0044004900520024005C002E002E005C0053006F0075007200630065005C004F00530041004C005F00730069006D0070006C00650042004C004500430065006E007400720061006C002E006300010000000180FFFEFF00FFFEFFFF28013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E003100330031003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0035003100330032003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0035003100330032003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF154F00530041004C005F00730069006D0070006C00650042004C004500430065006E007400720061006C0000000000FFFFFFFFFFFFFFFFFFFEFF432400570053005F0044004900520024005C002E002E005C002E002E005C002E002E005C002E002E005C0043006F006D0070006F006E0065006E00740073005C00680061006C005C007400610072006700650074005C00430043003200350034003000450042005C00680061006C005F0062006F006100720064005F006300660067002E006800010000000180FFFEFF00FFFEFFFF22013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E0030003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E00370039003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E00370039003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0D680061006C005F0062006F006100720064005F0063006600670000000000FFFFFFFFFFFFFFFF0000000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD5000100000001000000020000007A010000480000004006000073020000
351 |
352 |
353 |
354 |
355 |
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/Source/OSAL_simpleBLECentral.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsltip/Danfoss-BLE/df5ac0e7b42e639374b2b9cbedc07f1df3f0da99/SimpleBLECentral_cc2541/Source/OSAL_simpleBLECentral.c
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/Source/simpleBLECentral.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsltip/Danfoss-BLE/df5ac0e7b42e639374b2b9cbedc07f1df3f0da99/SimpleBLECentral_cc2541/Source/simpleBLECentral.h
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/Source/simpleBLECentral_Main.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsltip/Danfoss-BLE/df5ac0e7b42e639374b2b9cbedc07f1df3f0da99/SimpleBLECentral_cc2541/Source/simpleBLECentral_Main.c
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/Source/uartManager.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | Filename: uartManager.c
3 | Description: handles command send over the serial interface
4 | **************************************************************************************************/
5 |
6 | /*********************************************************************
7 | * INCLUDES
8 | */
9 |
10 | #include "OSAL.h"
11 | #include "OSAL_PwrMgr.h"
12 |
13 | #include "simpleBLECentral.h"
14 |
15 | #include "hal_led.h"
16 | #include "hal_uart.h"
17 | #include "hal_flash.h"
18 | #include "uartManager.h"
19 |
20 | /*********************************************************************
21 | * MACROS
22 | */
23 |
24 | /*********************************************************************
25 | * CONSTANTS
26 | */
27 | #define BAUD_RATE HAL_UART_BR_9600
28 | //#define BAUD_RATE HAL_UART_BR_115200
29 | #define POLL_INTERVAL 50
30 | #define READ_TRIES_MAX 10
31 |
32 |
33 | // responses
34 | #define RESPONSE_DEVICE_FOUND 0x02 //used for sending results of device discovery
35 |
36 | // events
37 | #define UART_START_DEVICE_EVT 0x01
38 | #define UART_PERIODIC_EVT 0x02
39 |
40 | /*********************************************************************
41 | * TYPEDEFS
42 | */
43 |
44 | /*********************************************************************
45 | * GLOBAL VARIABLES
46 | */
47 | uint8 uartManagerTaskID;
48 | uint8 rxlen;
49 | uint8 stage=0;
50 | /*********************************************************************
51 | * LOCAL FUNCTIONS
52 | */
53 | static void uartManager_ProcessOSALMsg( osal_event_hdr_t *pMsg );
54 | static void HalUARTCback (uint8 port, uint8 event);
55 | static void uartSendMsg(uint8 num );
56 | //static void execute_command();
57 |
58 | /*********************************************************************
59 | * LOCAL VARIABLES
60 | */
61 | static halUARTCfg_t config =
62 | {
63 | .configured = TRUE,
64 | .baudRate = BAUD_RATE,
65 | .flowControl = FALSE,
66 | .idleTimeout = 100,
67 | .rx = { .maxBufSize = 255 },
68 | .tx = { .maxBufSize = 255 },
69 | .intEnable = TRUE,
70 | .callBackFunc = HalUARTCback
71 | };
72 |
73 | //pahses
74 |
75 | static uint8 opcode = 0;
76 |
77 |
78 | /*********************************************************************
79 | * PUBLIC FUNCTIONS
80 | */
81 |
82 | /*********************************************************************
83 | * @fn uartManager_Init
84 | *
85 | * @brief TODO
86 | *
87 | * @param task_id - the ID assigned by OSAL. This ID should be
88 | * used to send messages and set timers.
89 | *
90 | * @return none
91 | */
92 | void uartManager_Init( uint8 task_id )
93 | {
94 | uartManagerTaskID = task_id;
95 | osal_set_event(uartManagerTaskID, UART_START_DEVICE_EVT );
96 | }
97 |
98 |
99 | static void uartSendMsg(uint8 num ){
100 | myDataMsg_t* msg = (myDataMsg_t*) osal_msg_allocate(sizeof(myDataMsg_t));
101 | msg->event = CB_MSG_MY_DATA;
102 | msg->length = 2;
103 | osal_msg_send(simpleBLETaskId, (uint8*) msg);
104 | uartchr = num;
105 | };
106 | /*********************************************************************
107 | * @fn uartManager_ProcessEvent
108 | *
109 | * @brief This function is called to process all events for the task. Events
110 | * include timers, messages and any other user defined events.
111 | *
112 | * @param task_id - The OSAL assigned task ID.
113 | * @param events - events to process. This is a bit map and can
114 | * contain more than one event.
115 | *
116 | * @return events not processed
117 | */
118 | uint16 uartManager_ProcessEvent( uint8 task_id, uint16 events )
119 | {
120 | VOID task_id; // OSAL required parameter that isn't used in this function
121 | //HalLedSet( HAL_LED_1, HAL_LED_MODE_ON );
122 | uint8 buflen;
123 | uint8 rxbuf[20];
124 | uint8 j,maxlen;
125 | if ( events & SYS_EVENT_MSG )
126 | {
127 | uint8 *pMsg;
128 | if ( (pMsg = osal_msg_receive(uartManagerTaskID )) != NULL )
129 | {
130 | uartManager_ProcessOSALMsg( (osal_event_hdr_t *)pMsg );
131 | VOID osal_msg_deallocate( pMsg ); //Release the OSAL message
132 | }
133 | return (events ^ SYS_EVENT_MSG); //return unprocessed events
134 | }
135 |
136 | if ( events & UART_START_DEVICE_EVT )
137 | {
138 | //HalLedSet( HAL_LED_1, HAL_LED_MODE_ON );
139 | HalUARTOpen(HAL_UART_PORT_1, &config);
140 | osal_start_reload_timer(uartManagerTaskID, UART_PERIODIC_EVT, POLL_INTERVAL);
141 | return ( events ^ UART_START_DEVICE_EVT );
142 | }
143 |
144 | if ( events & UART_PERIODIC_EVT)
145 | {
146 | buflen = Hal_UART_RxBufLen(HAL_UART_PORT_1);
147 | //rxcnt = rxcnt + buflen;
148 | if( buflen > 0)
149 | {
150 | //HalUARTRead(HAL_UART_PORT_1, &opcode, 1);
151 | HalUARTRead(HAL_UART_PORT_1, rxbuf, buflen );
152 | for(j=0;jevent )
191 | {
192 | case CB_MSG_DEVICE_FOUND:
193 | {
194 | deviceFoundMsg_t* msg = (deviceFoundMsg_t*) pMsg;
195 | msg->event = RESPONSE_DEVICE_FOUND;
196 | HalUARTWrite(HAL_UART_PORT_1, (uint8*) msg, msg->length + sizeof(uint8) + sizeof(uint8) );
197 | break;
198 | }
199 | }*/
200 | }
201 |
202 | /***************************
203 | * @fn execute_command()
204 | * @breif executes the command send over serial
205 | */
206 |
207 |
208 | /**
209 | * @brief UART event callback
210 | */
211 | static void HalUARTCback(uint8 port, uint8 event)
212 | {
213 | switch(event)
214 | {
215 | case HAL_UART_RX_FULL:
216 | case HAL_UART_RX_ABOUT_FULL:
217 | case HAL_UART_RX_TIMEOUT:
218 | case HAL_UART_TX_FULL:
219 | case HAL_UART_TX_EMPTY:
220 | break;
221 | }
222 | }
223 |
224 | /**
225 | #define FLASH_PAGE_SIZE 2048
226 | //This could be added in future versions
227 | static void command_flash()
228 | {
229 | while(Hal_UART_RxBufLen(HAL_UART_PORT_1) == 0); //wait for first data
230 | HalLedSet(HAL_LED_1, HAL_LED_MODE_ON);
231 | HalFlashErase(0);
232 | uint8 current_page = 0;
233 | uint32 current_byte = 0;
234 | uint8 buf[4];
235 |
236 | //start writing to flash
237 | while(TRUE)
238 | {
239 | while(Hal_UART_RxBufLen(HAL_UART_PORT_1) < 4) ; //wait for at least 4 bytes
240 | HalLedSet(HAL_LED_1, HAL_LED_MODE_TOGGLE);
241 | if(current_byte == FLASH_PAGE_SIZE)
242 | {
243 | current_page++;
244 | HalFlashErase(current_page);
245 | current_byte=0;
246 | }
247 | HalUARTRead(HAL_UART_PORT_1, buf, 4);
248 | HalFlashWrite(current_byte / 4, buf, 1);
249 | current_byte += 4;
250 | }
251 | }
252 | **/
253 |
254 | /*********************************************************************
255 | *********************************************************************/
256 |
--------------------------------------------------------------------------------
/SimpleBLECentral_cc2541/Source/uartManager.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | Filename: uartManager.h
3 | **************************************************************************************************/
4 |
5 | #ifndef UARTMANAGER_H
6 | #define UARTMANAGER_H
7 |
8 | #ifdef __cplusplus
9 | extern "C"
10 | {
11 | #endif
12 |
13 | /*********************************************************************
14 | * Types
15 | */
16 | /*********************************************************************
17 | * CONSTANTS
18 | */
19 | /*********************************************************************
20 | * VARIABLES
21 | */
22 | extern uint8 uartManagerTaskID;
23 | extern uint8 simpleBLETaskId;
24 | extern uint8 uartchr;
25 | extern uint8 uartaddr[6];
26 | extern uint8 uartdata[8];
27 | //extern uint8 rxcnt;
28 |
29 | /*********************************************************************
30 | * FUNCTIONS
31 | */
32 |
33 | extern void uartManager_Init( uint8 task_id );
34 | extern uint16 uartManager_ProcessEvent( uint8 task_id, uint16 events );
35 |
36 | /*********************************************************************
37 | *********************************************************************/
38 |
39 | #ifdef __cplusplus
40 | }
41 | #endif
42 |
43 | #endif /* SIMPLEBLEBROADCASTER_H */
44 |
--------------------------------------------------------------------------------
/uuids.xls:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsltip/Danfoss-BLE/df5ac0e7b42e639374b2b9cbedc07f1df3f0da99/uuids.xls
--------------------------------------------------------------------------------