Browse Source

显示屏模块工程文件

yc_t 6 years ago
commit
eac9d4b746
46 changed files with 7814 additions and 0 deletions
  1. 353 0
      .gitignore
  2. 65 0
      DUCP_Demo.sln
  3. 6 0
      DUCP_Demo/App.config
  4. 91 0
      DUCP_Demo/DUCP_Demo.csproj
  5. 325 0
      DUCP_Demo/Form1.Designer.cs
  6. 517 0
      DUCP_Demo/Form1.cs
  7. 120 0
      DUCP_Demo/Form1.resx
  8. 22 0
      DUCP_Demo/Program.cs
  9. 36 0
      DUCP_Demo/Properties/AssemblyInfo.cs
  10. 71 0
      DUCP_Demo/Properties/Resources.Designer.cs
  11. 117 0
      DUCP_Demo/Properties/Resources.resx
  12. 30 0
      DUCP_Demo/Properties/Settings.Designer.cs
  13. 7 0
      DUCP_Demo/Properties/Settings.settings
  14. BIN
      DUCP协议栈/DLL/DUCP.dll
  15. 202 0
      DUCP协议栈/DLL/DUCP.h
  16. 476 0
      DUCP协议栈/DLL/DUCP_Host.h
  17. 94 0
      DUCP协议栈/DLL/MBmsg.h
  18. BIN
      DUCP协议栈/Tool/DUCP.dll
  19. 202 0
      DUCP协议栈/Tool/DUCP.h
  20. 476 0
      DUCP协议栈/Tool/DUCP_Host.h
  21. 94 0
      DUCP协议栈/Tool/MBmsg.h
  22. BIN
      DUCP协议栈/Tool/dll.rar
  23. BIN
      DUCP协议栈/Tool/mfc100d.dll
  24. BIN
      DUCP协议栈/Tool/mfc120d.dll
  25. BIN
      DUCP协议栈/Tool/msvcp120d.dll
  26. BIN
      DUCP协议栈/Tool/msvcr100d.dll
  27. BIN
      DUCP协议栈/Tool/msvcr120d.dll
  28. 12 0
      DUCP协议栈/readme.txt
  29. 172 0
      DUCP协议栈/src/DUCP.h
  30. 1939 0
      DUCP协议栈/src/DUCP_Host.c
  31. 444 0
      DUCP协议栈/src/DUCP_Host.h
  32. 254 0
      DUCP协议栈/src/MBMsg.c
  33. 82 0
      DUCP协议栈/src/MBmsg.h
  34. 390 0
      DUCP协议栈/vc/MBPHY.c
  35. 23 0
      DUCP协议栈/vc/MBPHY.h
  36. 447 0
      broadcastDLL/BroadcastModule.cs
  37. 36 0
      broadcastDLL/Properties/AssemblyInfo.cs
  38. 50 0
      broadcastDLL/broadcastDLL.csproj
  39. 6 0
      broadcastModule/App.config
  40. 447 0
      broadcastModule/BroadcastModule.cs
  41. 69 0
      broadcastModule/Program.cs
  42. 36 0
      broadcastModule/Properties/AssemblyInfo.cs
  43. 55 0
      broadcastModule/broadcastModule.csproj
  44. 33 0
      linkTest.txt
  45. 15 0
      linkTest2.txt
  46. BIN
      显示屏使用说明书DC297_v1.04_中性版本.pdf

+ 353 - 0
.gitignore

@@ -0,0 +1,353 @@
+
+# Created by https://www.gitignore.io/api/csharp
+
+### Csharp ###
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+
+# End of https://www.gitignore.io/api/csharp
+#Ignore thumbnails created by Windows
+Thumbs.db
+#Ignore files built by Visual Studio
+*.exe
+*.bak
+*.cache
+[Bb]in
+[Dd]ebug*/
+*.lib
+obj/
+[Rr]elease*/
+[Tt]est[Rr]esult*
+#Nuget packages folder
+packages/

+ 65 - 0
DUCP_Demo.sln

@@ -0,0 +1,65 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.27130.2026
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DUCP_Demo", "DUCP_Demo\DUCP_Demo.csproj", "{F34A2524-76F5-4525-BA25-FCA0725D6615}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "broadcastModule", "broadcastModule\broadcastModule.csproj", "{F78E4CF1-009D-4438-A3BF-B7EAD3463E87}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "broadcastDLL", "broadcastDLL\broadcastDLL.csproj", "{7E9331F6-711F-4F82-92FA-500178D89465}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|Any CPU = Release|Any CPU
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{F34A2524-76F5-4525-BA25-FCA0725D6615}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F34A2524-76F5-4525-BA25-FCA0725D6615}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F34A2524-76F5-4525-BA25-FCA0725D6615}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{F34A2524-76F5-4525-BA25-FCA0725D6615}.Debug|x64.Build.0 = Debug|Any CPU
+		{F34A2524-76F5-4525-BA25-FCA0725D6615}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{F34A2524-76F5-4525-BA25-FCA0725D6615}.Debug|x86.Build.0 = Debug|Any CPU
+		{F34A2524-76F5-4525-BA25-FCA0725D6615}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F34A2524-76F5-4525-BA25-FCA0725D6615}.Release|Any CPU.Build.0 = Release|Any CPU
+		{F34A2524-76F5-4525-BA25-FCA0725D6615}.Release|x64.ActiveCfg = Release|Any CPU
+		{F34A2524-76F5-4525-BA25-FCA0725D6615}.Release|x64.Build.0 = Release|Any CPU
+		{F34A2524-76F5-4525-BA25-FCA0725D6615}.Release|x86.ActiveCfg = Release|Any CPU
+		{F34A2524-76F5-4525-BA25-FCA0725D6615}.Release|x86.Build.0 = Release|Any CPU
+		{F78E4CF1-009D-4438-A3BF-B7EAD3463E87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F78E4CF1-009D-4438-A3BF-B7EAD3463E87}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F78E4CF1-009D-4438-A3BF-B7EAD3463E87}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{F78E4CF1-009D-4438-A3BF-B7EAD3463E87}.Debug|x64.Build.0 = Debug|Any CPU
+		{F78E4CF1-009D-4438-A3BF-B7EAD3463E87}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{F78E4CF1-009D-4438-A3BF-B7EAD3463E87}.Debug|x86.Build.0 = Debug|Any CPU
+		{F78E4CF1-009D-4438-A3BF-B7EAD3463E87}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F78E4CF1-009D-4438-A3BF-B7EAD3463E87}.Release|Any CPU.Build.0 = Release|Any CPU
+		{F78E4CF1-009D-4438-A3BF-B7EAD3463E87}.Release|x64.ActiveCfg = Release|Any CPU
+		{F78E4CF1-009D-4438-A3BF-B7EAD3463E87}.Release|x64.Build.0 = Release|Any CPU
+		{F78E4CF1-009D-4438-A3BF-B7EAD3463E87}.Release|x86.ActiveCfg = Release|Any CPU
+		{F78E4CF1-009D-4438-A3BF-B7EAD3463E87}.Release|x86.Build.0 = Release|Any CPU
+		{7E9331F6-711F-4F82-92FA-500178D89465}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{7E9331F6-711F-4F82-92FA-500178D89465}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{7E9331F6-711F-4F82-92FA-500178D89465}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{7E9331F6-711F-4F82-92FA-500178D89465}.Debug|x64.Build.0 = Debug|Any CPU
+		{7E9331F6-711F-4F82-92FA-500178D89465}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{7E9331F6-711F-4F82-92FA-500178D89465}.Debug|x86.Build.0 = Debug|Any CPU
+		{7E9331F6-711F-4F82-92FA-500178D89465}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{7E9331F6-711F-4F82-92FA-500178D89465}.Release|Any CPU.Build.0 = Release|Any CPU
+		{7E9331F6-711F-4F82-92FA-500178D89465}.Release|x64.ActiveCfg = Release|Any CPU
+		{7E9331F6-711F-4F82-92FA-500178D89465}.Release|x64.Build.0 = Release|Any CPU
+		{7E9331F6-711F-4F82-92FA-500178D89465}.Release|x86.ActiveCfg = Release|Any CPU
+		{7E9331F6-711F-4F82-92FA-500178D89465}.Release|x86.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {E2105348-0FDA-4C81-9B96-89ED51FC933B}
+	EndGlobalSection
+EndGlobal

+ 6 - 0
DUCP_Demo/App.config

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
+    </startup>
+</configuration>

+ 91 - 0
DUCP_Demo/DUCP_Demo.csproj

@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{F34A2524-76F5-4525-BA25-FCA0725D6615}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>DUCP_Demo</RootNamespace>
+    <AssemblyName>DUCP_Demo</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="DevComponents.DotNetBar2, Version=12.5.0.2, Culture=neutral, PublicKeyToken=c39c3242a43eee2b, processorArchitecture=MSIL" />
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Deployment" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Form1.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Form1.Designer.cs">
+      <DependentUpon>Form1.cs</DependentUpon>
+    </Compile>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <EmbeddedResource Include="Form1.resx">
+      <DependentUpon>Form1.cs</DependentUpon>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 325 - 0
DUCP_Demo/Form1.Designer.cs

@@ -0,0 +1,325 @@
+namespace DUCP_Demo
+{
+    partial class Form1
+    {
+        /// <summary>
+        /// 必需的设计器变量。
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// 清理所有正在使用的资源。
+        /// </summary>
+        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows 窗体设计器生成的代码
+
+        /// <summary>
+        /// 设计器支持所需的方法 - 不要
+        /// 使用代码编辑器修改此方法的内容。
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.DISTEXT = new System.Windows.Forms.Button();
+            this.TextBox = new System.Windows.Forms.TextBox();
+            this.PLAYVOICE = new System.Windows.Forms.Button();
+            this.label1 = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.TextBox_WID = new System.Windows.Forms.TextBox();
+            this.BUTTON_DEMO1 = new System.Windows.Forms.Button();
+            this.BUTTON_DEMO2 = new System.Windows.Forms.Button();
+            this.button1 = new System.Windows.Forms.Button();
+            this.button2 = new System.Windows.Forms.Button();
+            this.label3 = new System.Windows.Forms.Label();
+            this.slider1 = new DevComponents.DotNetBar.Controls.Slider();
+            this.button3 = new System.Windows.Forms.Button();
+            this.button4 = new System.Windows.Forms.Button();
+            this.button5 = new System.Windows.Forms.Button();
+            this.textBox_ip = new System.Windows.Forms.TextBox();
+            this.label4 = new System.Windows.Forms.Label();
+            this.label5 = new System.Windows.Forms.Label();
+            this.textBox_port = new System.Windows.Forms.TextBox();
+            this.button6 = new System.Windows.Forms.Button();
+            this.button7 = new System.Windows.Forms.Button();
+            this.button8 = new System.Windows.Forms.Button();
+            this.SuspendLayout();
+            // 
+            // DISTEXT
+            // 
+            this.DISTEXT.Location = new System.Drawing.Point(12, 128);
+            this.DISTEXT.Name = "DISTEXT";
+            this.DISTEXT.Size = new System.Drawing.Size(61, 31);
+            this.DISTEXT.TabIndex = 0;
+            this.DISTEXT.Text = "显示文字";
+            this.DISTEXT.UseVisualStyleBackColor = true;
+            this.DISTEXT.Click += new System.EventHandler(this.DISTEXT_Click);
+            // 
+            // TextBox
+            // 
+            this.TextBox.Location = new System.Drawing.Point(43, 78);
+            this.TextBox.Name = "TextBox";
+            this.TextBox.Size = new System.Drawing.Size(152, 21);
+            this.TextBox.TabIndex = 1;
+            // 
+            // PLAYVOICE
+            // 
+            this.PLAYVOICE.Location = new System.Drawing.Point(12, 175);
+            this.PLAYVOICE.Name = "PLAYVOICE";
+            this.PLAYVOICE.Size = new System.Drawing.Size(61, 30);
+            this.PLAYVOICE.TabIndex = 2;
+            this.PLAYVOICE.Text = "播放声音";
+            this.PLAYVOICE.UseVisualStyleBackColor = true;
+            this.PLAYVOICE.Click += new System.EventHandler(this.播放语音_Click);
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(12, 81);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(29, 12);
+            this.label1.TabIndex = 3;
+            this.label1.Text = "文本";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(12, 50);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(29, 12);
+            this.label2.TabIndex = 4;
+            this.label2.Text = "窗口";
+            // 
+            // TextBox_WID
+            // 
+            this.TextBox_WID.Location = new System.Drawing.Point(43, 47);
+            this.TextBox_WID.Name = "TextBox_WID";
+            this.TextBox_WID.Size = new System.Drawing.Size(42, 21);
+            this.TextBox_WID.TabIndex = 5;
+            // 
+            // BUTTON_DEMO1
+            // 
+            this.BUTTON_DEMO1.Location = new System.Drawing.Point(11, 221);
+            this.BUTTON_DEMO1.Name = "BUTTON_DEMO1";
+            this.BUTTON_DEMO1.Size = new System.Drawing.Size(62, 28);
+            this.BUTTON_DEMO1.TabIndex = 6;
+            this.BUTTON_DEMO1.Text = "模板1";
+            this.BUTTON_DEMO1.UseVisualStyleBackColor = true;
+            this.BUTTON_DEMO1.Click += new System.EventHandler(this.BUTTON_DEMO1_Click);
+            // 
+            // BUTTON_DEMO2
+            // 
+            this.BUTTON_DEMO2.Location = new System.Drawing.Point(83, 221);
+            this.BUTTON_DEMO2.Name = "BUTTON_DEMO2";
+            this.BUTTON_DEMO2.Size = new System.Drawing.Size(62, 28);
+            this.BUTTON_DEMO2.TabIndex = 7;
+            this.BUTTON_DEMO2.Text = "模板2";
+            this.BUTTON_DEMO2.UseVisualStyleBackColor = true;
+            this.BUTTON_DEMO2.Click += new System.EventHandler(this.BUTTON_DEMO2_Click);
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(283, 145);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(75, 23);
+            this.button1.TabIndex = 8;
+            this.button1.Text = "音量+";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
+            // button2
+            // 
+            this.button2.Location = new System.Drawing.Point(283, 194);
+            this.button2.Name = "button2";
+            this.button2.Size = new System.Drawing.Size(75, 23);
+            this.button2.TabIndex = 9;
+            this.button2.Text = "音量-";
+            this.button2.UseVisualStyleBackColor = true;
+            this.button2.Click += new System.EventHandler(this.button2_Click);
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Location = new System.Drawing.Point(259, 78);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(35, 12);
+            this.label3.TabIndex = 10;
+            this.label3.Text = "音量:";
+            // 
+            // slider1
+            // 
+            // 
+            // 
+            // 
+            this.slider1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
+            this.slider1.Location = new System.Drawing.Point(222, 105);
+            this.slider1.Name = "slider1";
+            this.slider1.Size = new System.Drawing.Size(150, 23);
+            this.slider1.Step = 4;
+            this.slider1.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
+            this.slider1.TabIndex = 11;
+            this.slider1.Text = "音量";
+            this.slider1.Value = 10;
+            this.slider1.ValueChanged += new System.EventHandler(this.slider1_ValueChanged);
+            // 
+            // button3
+            // 
+            this.button3.Location = new System.Drawing.Point(283, 240);
+            this.button3.Name = "button3";
+            this.button3.Size = new System.Drawing.Size(75, 23);
+            this.button3.TabIndex = 12;
+            this.button3.Text = "重启";
+            this.button3.UseVisualStyleBackColor = true;
+            this.button3.Click += new System.EventHandler(this.button3_Click);
+            // 
+            // button4
+            // 
+            this.button4.Location = new System.Drawing.Point(83, 175);
+            this.button4.Name = "button4";
+            this.button4.Size = new System.Drawing.Size(92, 30);
+            this.button4.TabIndex = 13;
+            this.button4.Text = "超限提示";
+            this.button4.UseVisualStyleBackColor = true;
+            this.button4.Click += new System.EventHandler(this.button4_Click);
+            // 
+            // button5
+            // 
+            this.button5.Location = new System.Drawing.Point(83, 129);
+            this.button5.Name = "button5";
+            this.button5.Size = new System.Drawing.Size(92, 30);
+            this.button5.TabIndex = 14;
+            this.button5.Text = "显示已存文字";
+            this.button5.UseVisualStyleBackColor = true;
+            this.button5.Click += new System.EventHandler(this.button5_Click);
+            // 
+            // textBox_ip
+            // 
+            this.textBox_ip.Location = new System.Drawing.Point(462, 47);
+            this.textBox_ip.Name = "textBox_ip";
+            this.textBox_ip.Size = new System.Drawing.Size(152, 21);
+            this.textBox_ip.TabIndex = 18;
+            this.textBox_ip.Text = "192.168.0.188";
+            // 
+            // label4
+            // 
+            this.label4.AutoSize = true;
+            this.label4.Location = new System.Drawing.Point(415, 50);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(41, 12);
+            this.label4.TabIndex = 17;
+            this.label4.Text = "ip地址";
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Location = new System.Drawing.Point(427, 78);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(29, 12);
+            this.label5.TabIndex = 16;
+            this.label5.Text = "端口";
+            // 
+            // textBox_port
+            // 
+            this.textBox_port.Location = new System.Drawing.Point(462, 78);
+            this.textBox_port.Name = "textBox_port";
+            this.textBox_port.Size = new System.Drawing.Size(53, 21);
+            this.textBox_port.TabIndex = 15;
+            this.textBox_port.Text = "10000";
+            // 
+            // button6
+            // 
+            this.button6.Location = new System.Drawing.Point(462, 129);
+            this.button6.Name = "button6";
+            this.button6.Size = new System.Drawing.Size(101, 30);
+            this.button6.TabIndex = 19;
+            this.button6.Text = "更改IP与端口";
+            this.button6.UseVisualStyleBackColor = true;
+            this.button6.Click += new System.EventHandler(this.button6_Click);
+            // 
+            // button7
+            // 
+            this.button7.Location = new System.Drawing.Point(283, 21);
+            this.button7.Name = "button7";
+            this.button7.Size = new System.Drawing.Size(75, 23);
+            this.button7.TabIndex = 20;
+            this.button7.Text = "刷新";
+            this.button7.UseVisualStyleBackColor = true;
+            this.button7.Click += new System.EventHandler(this.button7_Click);
+            // 
+            // button8
+            // 
+            this.button8.Location = new System.Drawing.Point(99, 20);
+            this.button8.Name = "button8";
+            this.button8.Size = new System.Drawing.Size(75, 23);
+            this.button8.TabIndex = 21;
+            this.button8.Text = "CRC16";
+            this.button8.UseVisualStyleBackColor = true;
+            this.button8.Click += new System.EventHandler(this.button8_Click);
+            // 
+            // Form1
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(661, 287);
+            this.Controls.Add(this.button8);
+            this.Controls.Add(this.button7);
+            this.Controls.Add(this.button6);
+            this.Controls.Add(this.textBox_ip);
+            this.Controls.Add(this.label4);
+            this.Controls.Add(this.label5);
+            this.Controls.Add(this.textBox_port);
+            this.Controls.Add(this.button5);
+            this.Controls.Add(this.button4);
+            this.Controls.Add(this.button3);
+            this.Controls.Add(this.slider1);
+            this.Controls.Add(this.label3);
+            this.Controls.Add(this.button2);
+            this.Controls.Add(this.button1);
+            this.Controls.Add(this.BUTTON_DEMO2);
+            this.Controls.Add(this.BUTTON_DEMO1);
+            this.Controls.Add(this.TextBox_WID);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.PLAYVOICE);
+            this.Controls.Add(this.TextBox);
+            this.Controls.Add(this.DISTEXT);
+            this.Name = "Form1";
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Button DISTEXT;
+        private System.Windows.Forms.TextBox TextBox;
+        private System.Windows.Forms.Button PLAYVOICE;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.TextBox TextBox_WID;
+        private System.Windows.Forms.Button BUTTON_DEMO1;
+        private System.Windows.Forms.Button BUTTON_DEMO2;
+        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.Button button2;
+        private System.Windows.Forms.Label label3;
+        private DevComponents.DotNetBar.Controls.Slider slider1;
+        private System.Windows.Forms.Button button3;
+        private System.Windows.Forms.Button button4;
+        private System.Windows.Forms.Button button5;
+        private System.Windows.Forms.TextBox textBox_ip;
+        private System.Windows.Forms.Label label4;
+        private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.TextBox textBox_port;
+        private System.Windows.Forms.Button button6;
+        private System.Windows.Forms.Button button7;
+        private System.Windows.Forms.Button button8;
+    }
+}
+

+ 517 - 0
DUCP_Demo/Form1.cs

@@ -0,0 +1,517 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using System.Runtime.InteropServices;
+using System.Net;
+using System.Net.Sockets;
+
+namespace DUCP_Demo
+{
+    public partial class Form1 : Form
+    {
+        /*定义网络环境变量 默认IP为192.168.0.10,端口为7*/
+        public static UdpClient DUCP_NetSocket;
+        public static IPAddress DeviceIP = IPAddress.Parse("192.168.0.60");
+        public static IPEndPoint RPoint = new IPEndPoint(DeviceIP, 8888);
+        public static IPEndPoint TPoint = new IPEndPoint(DeviceIP, 8888);
+        public static int volume = 10;
+        /*
+            #0.实现协议栈数据输出回调函数
+        */
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+        unsafe public delegate byte cbDUCP_DataOutType(byte* Data, int Size);
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static void MB_STK_SetOutCallback(cbDUCP_DataOutType cb);
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static sbyte MB_STK_In(byte* Data, int Size);
+        private static cbDUCP_DataOutType cbDuCP_dataout;
+        unsafe static byte cbDUCP_DataOut(byte* Data, int Size)
+        {
+            sbyte Ret;
+            byte[] buff = new byte[256];
+            byte[] RxBuff = new byte[256];
+            for (int i = 0; i < Size; i++)
+            {
+                buff[i] = Data[i];
+            }
+
+            /*发送数据到显示屏*/
+            DUCP_NetSocket.Send(buff, Size, TPoint);
+
+            /*接收显示屏回复的数据*/
+            RxBuff = DUCP_NetSocket.Receive(ref RPoint);
+
+            /*将显示屏的回复的数据传输给协议栈*/
+            unsafe
+            {
+                fixed (byte* pArray = RxBuff)
+                    Ret = MB_STK_In(pArray, RxBuff.Length);
+            }
+            return (byte)Ret;
+        }
+
+        public Form1()
+        {
+            InitializeComponent();
+            /*#1.设置协议栈的回调函数*/
+            unsafe
+            {
+                cbDuCP_dataout = new cbDUCP_DataOutType(cbDUCP_DataOut);
+                MB_STK_SetOutCallback(cbDuCP_dataout);
+            }
+            //GC.KeepAlive(cbDuCP_dataout);
+            /*#2.创建UDP网络套接字*/
+            DUCP_NetSocket = new UdpClient();
+
+            TextBox.Text = "请缴费100元";
+            TextBox_WID.Text = "0";
+            DUCP_HOST_SYS_SetVol(volume);
+
+        }
+
+        //调节音量
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_SYS_SetVol(int vol);
+        //播放语音
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_TTS_Play(byte* pText, byte Opt);
+        //停止播放语音
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_TTS_Stop();
+        //重启系统
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_SYS_Reset();
+        //显示文本
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_TWIN_DisText(int WinID,
+                                                            byte* pText,
+                                                            int EnterMode,
+                                                            int EnterSpeed,
+                                                            int DelayMode,
+                                                            int DelayTime,
+                                                            int EixtMode,
+                                                            int EixtSpeed,
+                                                            int FontIndex,
+                                                            int TextColor,
+                                                            int BkColor,
+                                                            int DisTimes);
+        private void DISTEXT_Click(object sender, EventArgs e)
+        {
+
+            unsafe
+            {
+                byte[] Buff = System.Text.Encoding.Default.GetBytes(TextBox.Text);
+                //byte[] Str = new byte[Buff.Length + 1];
+                int WID;
+                //int i;
+                //for(i = 0;i < Buff.Length;i ++) {
+                //    Str[i] = Buff[i];
+                //}
+                //Str[i] = 0;
+                int.TryParse(TextBox_WID.Text, out WID);
+                fixed (byte* pArray = Buff)
+                    try
+                    {
+                        DUCP_HOST_TWIN_DisText(WID, pArray,
+                            0X15, 1,
+                            0X0B, 3,
+                            0X15, 1,
+                            3, 0Xff, 0X00, 0);
+                    }
+                    catch (Exception ex) { Console.WriteLine(ex.Message); }
+            }
+        }
+
+        private void 播放语音_Click(object sender, EventArgs e)
+        {
+            unsafe
+            {
+                try
+                {
+                    byte[] Buff = System.Text.Encoding.Default.GetBytes(TextBox.Text);
+                    fixed (byte* pArray = Buff)
+                    {
+                        DUCP_HOST_TTS_Stop();
+                        DUCP_HOST_TTS_Play(pArray, 0x01);
+                    }
+                }
+                catch (Exception ex)
+                { Console.WriteLine(ex.Message); }
+            }
+        }
+
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_TWIN_Create(int WinID, int Stile, int x0, int y0, int xSize, int ySize);
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_TWIN_DelFile(int WinID, int FileID);
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_TWIN_Del(int WinID);
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_PIC_Del(int WinID);
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_2D_SetColor(int Color);
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_2D_FillRect(int x0, int y0, int x1, int y1);
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_2D_DrawSysIcon(int x0, int y0, int Num, int Denom, int IconIndex);
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_PIC_Create(int WinID, int x0, int y0, int xSize, int ySize);
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_PIC_Add(int WinID, int FID, byte EnterMode, byte EnterSpeed,
+                                            byte StopMode, byte StopTime, byte ExitMode, byte ExitSpeed);
+        //更新IP
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_SYS_SetIP(byte* ip);
+        //更新端口
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_SYS_SetPort(int port);
+        //显示已存文件
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_TWIN_DisFile(int WinID, int FileID);
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_TWIN_DownTextFile(int WinID,
+                                                                int FileID,
+                                                                byte* pText,
+                                                                int EnterMode,
+                                                                int EnterSpeed,
+                                                                int DelayMode,
+                                                                int DelayTime,
+                                                                int EixtMode,
+                                                                int EixtSpeed,
+                                                                int FontIndex,
+                                                                int TextColor,
+                                                                int BkColor);
+
+        /// <summary>
+        /// CRC16 
+        /// </summary>
+        /// <param name="data">要进行计算的数组</param>
+        /// <returns>计算后的数组</returns>
+        private static byte[] CRC16(byte[] crcbuf)
+        {
+            int crc = 0xffff;
+            int len = crcbuf.Length;
+            byte[] redata = new byte[2];
+            for (int n = 0; n < len; n++)
+            {
+                byte i;
+                crc = crc ^ crcbuf[n];
+                for (i = 0; i < 8; i++)
+                {
+                    int TT;
+                    TT = crc & 1;
+                    crc = crc >> 1;
+                    crc = crc & 0x7fff;
+                    if (TT == 1)
+                    {
+                        crc = crc ^ 0xa001;
+                    }
+                    crc = crc & 0xffff;
+                }
+            }
+            redata[1] = (byte)((crc >> 8) & 0xff);
+            redata[0] = (byte)((crc & 0xff));
+            return redata;
+        }
+
+        private void BUTTON_DEMO1_Click(object sender, EventArgs e)
+        {
+            DUCP_HOST_TWIN_Del(0);
+            DUCP_HOST_TWIN_Del(1);
+            DUCP_HOST_TWIN_Del(2);
+            DUCP_HOST_TWIN_Del(3);
+            DUCP_HOST_TWIN_Create(0, 0, 0, 0, 64, 16);
+            DUCP_HOST_TWIN_Create(1, 0, 0, 16, 64, 16);
+            DUCP_HOST_TWIN_Create(2, 0, 0, 32, 64, 16);
+            DUCP_HOST_TWIN_Create(3, 0, 0, 48, 64, 16);
+            //DUCP_HOST_TWIN_Create(4, 0, 0, 64, 64, 16);
+            //DUCP_HOST_TWIN_Create(5, 0, 0, 80, 64, 16);
+            //DUCP_HOST_TWIN_Create(6, 0, 0, 96, 64, 16);
+            //DUCP_HOST_TWIN_Create(7, 0, 0, 112, 64, 16);
+
+            unsafe
+            {
+                byte[] Buff = System.Text.Encoding.Default.GetBytes("现在时间`C`Y年`M月`D日 星期`V `H:`N:`S");
+                fixed (byte* pArray = Buff)
+                    DUCP_HOST_TWIN_DownTextFile(0,
+                                                0,
+                                                pArray,
+                                                0X15,
+                                                1,
+                                                0X00,
+                                                2,
+                                                0X15,
+                                                1,
+                                                3,
+                                                0XFF,
+                                                0);
+                Buff = System.Text.Encoding.Default.GetBytes("刚才星期`V `H:`N:`S");
+                fixed (byte* pArray = Buff)
+                    DUCP_HOST_TWIN_DownTextFile(0,
+                                                1,
+                                                pArray,
+                                                0X15,
+                                                1,
+                                                0X00,
+                                                2,
+                                                0X15,
+                                                1,
+                                                3,
+                                                0XFF,
+                                                0);
+                Buff = System.Text.Encoding.Default.GetBytes("这是第三个`C`Y年`M月`D日");
+                fixed (byte* pArray = Buff)
+                    DUCP_HOST_TWIN_DownTextFile(0,
+                                                2,
+                                                pArray,
+                                                0X15,
+                                                1,
+                                                0X00,
+                                                2,
+                                                0X15,
+                                                1,
+                                                3,
+                                                0XFF,
+                                                0);
+                Buff = System.Text.Encoding.Default.GetBytes("这是第四个`C`Y年`M月`D日");
+                fixed (byte* pArray = Buff)
+                    DUCP_HOST_TWIN_DownTextFile(0,
+                                                3,
+                                                pArray,
+                                                0X15,
+                                                1,
+                                                0X00,
+                                                2,
+                                                0X15,
+                                                1,
+                                                3,
+                                                0XFF,
+                                                0);
+                byte[] Buff2 = System.Text.Encoding.Default.GetBytes("欢迎光临");
+                fixed (byte* pArray = Buff2)
+                    for (int i = 1; i < 8; i++)
+                    {
+                        DUCP_HOST_TWIN_DownTextFile(i,
+                                                    0,
+                                                    pArray,
+                                                    0X15,
+                                                    1,
+                                                    0X00,
+                                                    2,
+                                                    0X15,
+                                                    1,
+                                                    3,
+                                                    0XFF,
+                                                    0);
+                    }
+            }
+        }
+
+        private void BUTTON_DEMO2_Click(object sender, EventArgs e)
+        {
+            // TODO:  在此添加控件通知处理程序代码
+            //删除文本控件
+            DUCP_HOST_TWIN_Del(0);
+            DUCP_HOST_TWIN_Del(1);
+            //删除图片控件
+            DUCP_HOST_PIC_Del(4);
+            DUCP_HOST_PIC_Del(5);
+
+            DUCP_HOST_2D_SetColor(0);
+            //DUCP_HOST_2D_FillRect(0, 0, 63, 31);
+            DUCP_HOST_2D_DrawSysIcon(-7, 0, 1, 3, 43);
+
+            DUCP_HOST_PIC_Create(4, 24, 16, 48, 16);
+            DUCP_HOST_PIC_Add(4, 45, 1, 2, 0, 0, 6, 6);
+
+            DUCP_HOST_TWIN_Create(0, 0, 19, 0, 48, 8);
+            DUCP_HOST_TWIN_Create(1, 0, 17, 8, 48, 8);
+
+            unsafe
+            {
+                byte[] Buff = System.Text.Encoding.Default.GetBytes("`H:`N:`S");
+                fixed (byte* pArray = Buff)
+                    DUCP_HOST_TWIN_DisText(0,
+                                            pArray,
+                                            0X00,
+                                            1,
+                                            0X08,
+                                            255,
+                                            0x00,
+                                            1,
+                                            0,
+                                            0XFF,
+                                            0, 0);
+                byte[] Buff2 = System.Text.Encoding.Default.GetBytes("`D-`M-`Y");
+                fixed (byte* pArray = Buff2)
+                    DUCP_HOST_TWIN_DisText(1,
+                                            pArray,
+                                            0X00,
+                                            1,
+                                            0X08,
+                                            255,
+                                            0x00,
+                                            1,
+                                            0,
+                                            0XFF,
+                                            0, 0);
+            }
+        }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            DUCP_HOST_SYS_SetVol(++volume);
+            label3.Text = "音量:" + volume;
+        }
+
+        private void button2_Click(object sender, EventArgs e)
+        {
+            DUCP_HOST_SYS_SetVol(--volume);
+            label3.Text = "音量:" + volume;
+        }
+
+        private void slider1_ValueChanged(object sender, EventArgs e)
+        {
+            volume = slider1.Value / 2;
+            try
+            {
+                DUCP_HOST_SYS_SetVol(volume);
+            }
+            catch (Exception ex) { Console.WriteLine(ex.Message); }
+            label3.Text = "音量:" + volume;
+        }
+
+        private void button3_Click(object sender, EventArgs e)
+        {
+            DUCP_HOST_SYS_Reset();
+        }
+
+        private void button4_Click(object sender, EventArgs e)
+        {
+            DUCP_HOST_TWIN_Del(0);
+            DUCP_HOST_TWIN_Del(1);
+            DUCP_HOST_TWIN_Del(2);
+            DUCP_HOST_TWIN_Del(3);
+            DUCP_HOST_TWIN_Create(0, 0, 0, 0, 64, 16);
+            DUCP_HOST_TWIN_Create(1, 0, 0, 16, 64, 16);
+            DUCP_HOST_TWIN_Create(2, 0, 0, 32, 64, 16);
+            DUCP_HOST_TWIN_Create(3, 0, 0, 48, 64, 16);
+            byte[] Buff1 = System.Text.Encoding.Default.GetBytes("*请重新停车*");
+            byte[] Buff2 = System.Text.Encoding.Default.GetBytes("X轴超限");
+            byte[] Buff3 = System.Text.Encoding.Default.GetBytes("Y轴超限");
+            byte[] Buff4 = System.Text.Encoding.Default.GetBytes("角度超限");
+            byte[][] Buffs = new byte[4][];
+            Buffs[0] = Buff1;
+            Buffs[1] = Buff2;
+            Buffs[2] = Buff3;
+            Buffs[3] = Buff4;
+            unsafe
+            {
+                for (int i = 0; i < 4; i++)
+                {
+                    fixed (byte* pArray = Buffs[i])
+
+                        DUCP_HOST_TWIN_DownTextFile(i,
+                                                    0,
+                                                    pArray,
+                                                    0X15,
+                                                    1,
+                                                    0X00,
+                                                    2,
+                                                    0X15,
+                                                    1,
+                                                    3,
+                                                    0XFF,
+                                                    0);
+                }
+            }
+        }
+
+        private void button5_Click(object sender, EventArgs e)
+        {
+            DUCP_HOST_TWIN_DisFile(0, 0);
+        }
+
+        private void button6_Click(object sender, EventArgs e)
+        {
+            IPAddress ipa = null;
+            int port = 0;
+            try
+            {
+                ipa = IPAddress.Parse(textBox_ip.Text);
+                port = Int32.Parse(textBox_port.Text);
+            }
+            catch (Exception ex) { Console.WriteLine(ex.Message); }
+            if (ipa != null)
+            {
+
+                unsafe
+                {
+                    try
+                    {
+                        byte[] protocol = new byte[] {
+                            0x00,0x64,0xff,0xff,0x08,0x04,
+                            0x00,0x00,0x00,0x00,
+                            0xE6,0x17
+                        };
+                        byte[] Buff = ipa.GetAddressBytes();
+                        Buff.CopyTo(protocol, 6);
+
+                        byte[] temp = new byte[10];
+                        Array.Copy(protocol, temp, 10);
+                        byte[] crc = CRC16(temp);
+                        Array.Copy(crc,0,protocol,10,2);
+                        
+                        //byte[] Buff2 = new byte[8];
+                        //Buff.CopyTo(Buff2, 0);
+                        //Buff.CopyTo(Buff2, 4);
+                        fixed (byte* pArray = protocol)
+                        {
+                            cbDUCP_DataOut(pArray, 12);
+                            //DUCP_HOST_SYS_SetIP(pArray);
+                        }
+                    }
+                    catch (Exception ex)
+                    { Console.WriteLine(ex.Message); }
+                }
+                DUCP_HOST_SYS_SetPort(port);
+            }
+        }
+
+        /// <summary>
+        /// 刷新屏幕
+        /// </summary>
+        public void DispRefresh()
+        {
+            DUCP_HOST_TWIN_Del(0);
+            DUCP_HOST_TWIN_Del(1);
+            DUCP_HOST_TWIN_Del(2);
+            DUCP_HOST_TWIN_Del(3);
+            DUCP_HOST_TWIN_Create(0, 0, 0, 0, 64, 16);
+            DUCP_HOST_TWIN_Create(1, 0, 0, 16, 64, 16);
+            DUCP_HOST_TWIN_Create(2, 0, 0, 32, 64, 16);
+            DUCP_HOST_TWIN_Create(3, 0, 0, 48, 64, 16);
+        }
+
+        private void button7_Click(object sender, EventArgs e)
+        {
+            DispRefresh();
+        }
+
+        private void button8_Click(object sender, EventArgs e)
+        {
+            byte[] protocol = new byte[] {
+                            0x00,0x64,0xff,0xff,0x08,0x04,
+                            0xc0,0xa8,0x00,0xbc,
+                        };
+            byte[] temp = CRC16(protocol);
+            //Console.WriteLine(Convert.ToString(temp[0],2)+","+ Convert.ToString(temp[1], 2));
+        }
+    }
+}

+ 120 - 0
DUCP_Demo/Form1.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 22 - 0
DUCP_Demo/Program.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace DUCP_Demo
+{
+    static class Program
+    {
+        /// <summary>
+        /// 应用程序的主入口点。
+        /// </summary>
+        [STAThread]
+        static void Main()
+        {
+            Application.EnableVisualStyles();
+            Application.SetCompatibleTextRenderingDefault(false);
+            Application.Run(new Form1());
+        }
+    }
+}

+ 36 - 0
DUCP_Demo/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的常规信息通过以下
+// 特性集控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("DUCP_Demo")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("DUCP_Demo")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 使此程序集中的类型
+// 对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
+// 则将该类型上的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("02ca360b-025b-4f23-bc86-3a39ae84cc2d")]
+
+// 程序集的版本信息由下面四个值组成: 
+//
+//      主版本
+//      次版本 
+//      生成号
+//      修订号
+//
+// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”: 
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 71 - 0
DUCP_Demo/Properties/Resources.Designer.cs

@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本: 4.0.30319.18408
+//
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace DUCP_Demo.Properties
+{
+
+
+    /// <summary>
+    ///   一个强类型的资源类,用于查找本地化的字符串等。
+    /// </summary>
+    // 此类是由 StronglyTypedResourceBuilder
+    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+    // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+    // (以 /str 作为命令选项),或重新生成 VS 项目。
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resources
+    {
+
+        private static global::System.Resources.ResourceManager resourceMan;
+
+        private static global::System.Globalization.CultureInfo resourceCulture;
+
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources()
+        {
+        }
+
+        /// <summary>
+        ///   返回此类使用的、缓存的 ResourceManager 实例。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager
+        {
+            get
+            {
+                if ((resourceMan == null))
+                {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DUCP_Demo.Properties.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+
+        /// <summary>
+        ///   为所有资源查找重写当前线程的 CurrentUICulture 属性,
+        ///   方法是使用此强类型资源类。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture
+        {
+            get
+            {
+                return resourceCulture;
+            }
+            set
+            {
+                resourceCulture = value;
+            }
+        }
+    }
+}

+ 117 - 0
DUCP_Demo/Properties/Resources.resx

@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 30 - 0
DUCP_Demo/Properties/Settings.Designer.cs

@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.18408
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace DUCP_Demo.Properties
+{
+
+
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+    {
+
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+        public static Settings Default
+        {
+            get
+            {
+                return defaultInstance;
+            }
+        }
+    }
+}

+ 7 - 0
DUCP_Demo/Properties/Settings.settings

@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
+  <Profiles>
+    <Profile Name="(Default)" />
+  </Profiles>
+  <Settings />
+</SettingsFile>

BIN
DUCP协议栈/DLL/DUCP.dll


+ 202 - 0
DUCP协议栈/DLL/DUCP.h

@@ -0,0 +1,202 @@
+/*
+****************************************************************************************************
+*                                                DUCP
+*                      				Displayer universal control protocal
+*                                      	   Master Head File
+*
+*                          			(c) Copyright 2016-2017, KF 
+*                                        All Rights Reserved
+*
+* File : DUCP.h
+* By   : Lyon 
+* Date : 2016-1-1
+* Email: yangzhonglai@163.com
+****************************************************************************************************
+*/
+#ifndef _DUCP_H_
+#define _DUCP_H_
+
+#define DUCP_PATH_LEN_MAX		(125)
+
+
+#define DUCP_FM_READ			(0X01)
+#define DUCP_FM_WRITE			(0X02)
+#define DUCP_FM_OPEN_ALWAYS		(0X10)
+#define DUCP_FM_FLLOW_PATH		(0X80)
+
+
+#define SEND_MSG_OVERTIME_DEF		(100)
+#define READ_MSG_OVERTIME_DEF		(100)
+
+
+#define DUCP_TTS_PLAY_OPT_A			(0x00)	/*添加到语音队列但是不开始播放*/
+#define DUCP_TTS_PLAY_OPT_AS		(0x01)	/*添加到语音队列并且开始播放*/
+#define DUCP_TTS_PLAY_OPT_CAS		(0x02)	/*先清除队列,再添加新语音到队列,然后开始播放*/
+
+/*错误类型*/
+#define DUCP_ERR_NONE				(0x00) /*无错误*/
+typedef uint8_t DUCP_ERR_T;
+
+/*-------------------------UDCP指令集----------------------------*/
+#define DUCP_CMD_SYS_BASE		(0)
+#define DUCP_CMD_FM_BASE		(0X20)
+#define DUCP_CMD_TTS_BASE		(0X30)
+#define DUCP_CMD_2D_BASE		(0X38)
+#define DUCP_CMD_WM_BASE		(0X50)
+#define DUCP_CMD_TWIN_BASE		(0X60)
+#define DUCP_CMD_PIC_BASE		(0X80)
+
+typedef enum {
+			/*--------------------系统管理------------------------------*/
+			DUCP_CMD_SYS_CONNECT = DUCP_CMD_SYS_BASE, /*0登录并连接UDCP服务器 OK*/		
+			DUCP_CMD_SYS_SYN_PN,			/*1同步包序列 OK*/		
+			DUCP_CMD_SYS_SET_PASSWAORD,		/*2修改登录密码 NOTEST*/
+			DUCP_CMD_SYS_GET_PASSWAORD,		/*3获取登录密码 NOTEST*/
+			DUCP_CMD_SYS_GET_FIRMWARE,		/*4获取固件信息OK*/
+			DUCP_CMD_SYS_UPTIME,			/*5更新时间OK*/
+			DUCP_CMD_SYS_RESET,				/*6重启系统 OK*/
+
+			DUCP_CMD_SYS_SET_ADDR,			/*7设置485地址 OK*/
+			DUCP_CMD_SYS_SET_IP,			/*8设置IP地址 OK*/
+			DUCP_CMD_SYS_SET_PORT,			/*9设置端口 OK*/
+			DUCP_CMD_SYS_SET_BAUD,			/*10设置波特率OK*/
+			DUCP_CMD_SYS_SET_SCAN_FRE,		/*11设置扫描频率OK*/
+			DUCP_CMD_SYS_SET_LIGHT,	 		/*12调整亮度OK*/
+			DUCP_CMD_SYS_SET_VOL,		 	/*13设置音量OK*/
+			
+			DUCP_CMD_SYS_CFG_IO,			/*14配置IO口功能OK*/
+			DUCP_CMD_SYS_SET_IO,			/*15设置IO口状态OK*/
+			DUCP_CMD_SYS_READ_IO,			/*16读取IO口状态OK*/
+
+			DUCP_CMD_SYS_SET_DRV,			/*17设置LED驱动OK*/
+			DUCP_CMD_SYS_SET_OEP,			/*18设置OE极性OK*/
+			DUCP_CMD_SYS_SET_DP,			/*19设置数据极性OK*/
+			DUCP_CMD_SYS_SET_LE,			/*20设置LE信号延时OK*/
+			DUCP_CMD_SYS_SET_GW_AND_MASK,	/*21设置网关和掩码OK*/
+			DUCP_CMD_SYS_SET_SAF_MODE,		/*22进入安全模式OK*/
+			DUCP_CMD_SYS_CLIC,				/*23Passport OK*/
+			DUCP_CMD_SYS_SET_DIS_SIZE,		/*24设置显示尺寸OK*/
+			DUCP_CMD_SYS_SET_XYMIR,			/*25设置显示镜像OK*/
+			DUCP_CMD_SYS_SET_485MODE,		/*26设置485工作模式OK*/
+			DUCP_CMD_SYS_GET_ALL,			/*27获取所有参数OK*/
+			DUCP_CMD_SYS_SET_ALL,			/*28设置所有参数OK*/
+			DUCP_CMD_SYS_SET_TTSEN,			/*29使能播报所有文本OK*/
+			
+			/*--------------------文件管理------------------------------*/
+			DUCP_CMD_FM_MOUNT = DUCP_CMD_FM_BASE,/*挂载目录 INVOLID*/
+			DUCP_CMD_FM_OPEN,				/*打开或创建文件 INVOLID*/
+			DUCP_CMD_FM_SEEK,				/*设置文件读写位置 INVOLID*/
+			DUCP_CMD_FM_WRITE,				/*写文件 INVOLID*/
+			DUCP_CMD_FM_READ,				/*读文件 INVOLID*/
+			DUCP_CMD_FM_SYNBUFF,			/*同步文件缓存 INVOLID*/
+			DUCP_CMD_FM_COLOSE,				/*关闭文件 INVOLID*/
+			DUCP_CMD_FM_DEL,				/*删除文件 INVOLID*/
+			DUCP_CMD_FM_COPY,				/*复制文件 INVOLID*/
+			DUCP_CMD_FM_FDISK,				/*格式化磁盘 INVOLID*/
+			DUCP_CMD_FM_WLIC,				/*写授权文件*/
+			DUCP_CMD_FM_RLIC,				/*读授权文件*/
+			DUCP_CMD_FM_CULIC,				/*校验用户授权文件*/
+
+			/*-------------------TTS语音接口----------------------------*/
+			DUCP_CMD_TTS_PLAY = DUCP_CMD_TTS_BASE,/*播放语音OK*/
+			DUCP_CMD_TTS_STOP,				/*停止播放语音OK*/
+
+
+			/*-------------------2D图形接口-----------------------------*/
+			DUCP_CMD_2D_DRAW_POINT = DUCP_CMD_2D_BASE,/*画点 OK*/
+			DUCP_CMD_2D_DRAW_LINE,			/*画线 OK*/
+			DUCP_CMD_2D_DRAW_RECT,			/*画矩形 OK*/
+			DUCP_CMD_2D_FILL_RECT,			/*填充矩形 OK*/
+			DUCP_CMD_2D_DRAW_CICLE,			/*画圆 OK*/
+			DUCP_CMD_2D_FILL_CICLE,			/*填充圆 OK*/
+			DUCP_CMD_2D_DRAW_BITMAP,		/*绘制位图*/
+			DUCP_CMD_2D_DIS_TEXT,			/*显示文本 OK*/
+			DUCP_CMD_2D_SET_TCOLOR,	 		/*设置文本颜色 OK*/
+			DUCP_CMD_2D_SET_BCOLOR,			/*设置背景颜色 OK*/
+			DUCP_CMD_2D_SET_FONT,			/*设置字体 OK*/
+			DUCP_CMD_2D_DRAW_SYSICON,		/*绘制系统自带的图标OK*/
+			
+			/*----------------------窗口管理---------------------------*/
+			DUCP_CMD_WIN_SHOW = DUCP_CMD_WM_BASE,/*显示窗口 OK*/
+			DUCP_CMD_WIN_HIDLE,				/*隐藏窗口 OK*/
+			DUCP_CMD_WIN_DEL,				/*删除窗口 OK*/
+			DUCP_CMD_WIN_AUTO_SYN,			/*自动同步窗口显示 OK*/
+			
+			/*----------------------文本控件---------------------------*/
+			DUCP_CMD_TWIN_CREATE = DUCP_CMD_TWIN_BASE,/*创建文本窗口 OK*/
+			DUCP_CMD_TWIN_DEL,				/*删除文本窗口 OK*/
+			DUCP_CMD_TWIN_DIS_TEXT,			/*显示临时文本 OK*/
+			DUCP_CMD_TWIN_SET_FONT,	 		/*设置字体 OK*/
+			DUCP_CMD_TWIN_SET_TCOLOR,		/*设置文本颜色 OK*/
+			DUCP_CMD_TWIN_SET_BCOLOR,		/*设置背景颜色 OK*/
+			DUCP_CMD_TWIN_STOP_DIS,			/*停止显示 OK*/
+			DUCP_CMD_TWIN_DOWN_TFILE,		/*下载文本文件 OK*/
+			DUCP_CMD_TWIN_DIS_TFILE,		/*显示文本文件 OK*/
+			DUCP_CMD_TWIN_OPEN_TFILE,		/*打开文本文件 OK*/
+			DUCP_CMD_TWIN_CLOSE_TFILE,		/*关闭文本文件 OK*/
+			DUCP_CMD_TWIN_DEL_TFILE,		/*删除文本文件 OK*/
+			DUCP_CMD_TWIN_SYN_DIS,			/*同步显示多个文本控件*/
+			DUCP_CMD_TWIN_SYN_DISEX,		/*多行显示,同时播报语音*/
+
+			/*----------------------图片控件---------------------------*/
+			DUCP_CMD_PIC_CREATE = DUCP_CMD_PIC_BASE,/*创建图片窗口 OK*/
+			DUCP_CMD_PIC_DEL,
+			DUCP_CMD_PIC_ADD,
+			DUCP_CMD_PIC_CLR,
+
+} DUCP_CMD_E;
+
+
+typedef struct {
+	char			DevName[8];/*设备名称*/
+	char			SVR[8];		/*软件版本X.YZ*/
+	uint32_t		XSize;		/*X尺寸*/
+	uint32_t		YSize;		/*Y尺寸*/
+	uint32_t		LstUpTime;	/*最后更新时间*/
+	uint8_t			SN[12];		/*序列号*/
+}DEVICE_FRAMWARE_T;
+
+/*IO引脚标识*/
+typedef enum {
+	IO_PIN_1 = 0,
+	IO_PIN_2,
+	IO_PIN_3,
+	IO_PIN_4,
+	IO_PIN_ALL = 0XF0, /*对所以IO口进行赋值操作*/
+	IO_PIN_OR,/*对所有IO口进行 或 操作*/
+	IO_PIN_AND,/*对所有IO口进行 与 操作*/
+	IO_PIN_NOT/*对所有IO口进行 非 操作*/
+} IO_PIN_ID_E;
+
+/*IO 功能枚举*/
+typedef enum {
+	IO_FUN_IN = 0, 	/*输入*/
+	IO_FUN_PP,		/*推挽输出*/
+	IO_FUN_OD,		/*开漏输出*/
+} IO_PIN_FUN_E;
+
+
+/*系统参数描述符*/
+typedef struct {
+	uint32_t 	Baud;	/*波特率 最高115200*/
+	uint8_t  	_485Addr;/*485地址*/
+	uint8_t  	_485CM;/*485工作模式 0:半双工 1:半工*/
+	uint8_t  	IP[4];/*IP地址*/
+	uint32_t  	Port;/*端口号*/
+	uint8_t	 	GW[4];/*网关地址*/
+	uint8_t	 	Mask[4];/*子网掩码*/
+	uint16_t 	Fre;/*扫描频率 30Hz ~ 960Hz*/
+	uint8_t  	LightLevel;/*亮度级别 10~100 对应10% ~ 100%*/
+	uint8_t  	VoiceLevel;/*声音级别 10~100 对应10% ~ 100%*/
+	uint8_t	 	OEP;/*OE极性,0:正极性 1:负极性*/
+	uint8_t  	DP;/*数据极性,0:正极性 1:负极性*/
+	uint8_t  	LEDey;/*LE信号延时,0:关闭 1:打开*/
+	uint8_t  	LEDDrv;/*LED驱动程序 0:08双色16分之一扫描 1:12双色4分之一扫描 2:12双色8分之一扫描*/
+	uint16_t 	XSize;/*显示屏长度尺寸 像素*/
+	uint16_t 	YSize;/*显示屏高度尺寸 像素*/
+	uint8_t	 	XYMir;/*XY镜像使能 0:原点坐标在左上角 1:原点坐标在右下角*/
+	uint8_t		TTSAEn;/*0:定制语音。1:可以播报所有文字(需要配置外部TTS解码模块)*/
+} SysSettings_t;
+
+#endif
+

+ 476 - 0
DUCP协议栈/DLL/DUCP_Host.h

@@ -0,0 +1,476 @@
+/*
+****************************************************************************************************
+*                                             DUCP HOST
+*                      			Displayer universal control protocal for host
+*                                      	   Master Head File
+*
+*                          			(c) Copyright 2016-2017, KF 
+*                                        All Rights Reserved
+*
+* File : DUCP_Host.h
+* By   : Lyon 
+* Date : 2016-1-1
+* Email: yangzhonglai@163.com
+****************************************************************************************************
+*/
+#ifndef _DUCP_DEVICE_H_
+#define _DUCP_DEVICE_H_
+
+#include "MBmsg.h"
+#include "DUCP.H"
+
+// 下列 ifdef 块是创建使从 DLL 导出更简单的
+// 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 DUCP_EXPORTS
+// 符号编译的。在使用此 DLL 的
+// 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
+// DUCP_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
+// 符号视为是被导出的。
+#ifdef DUCP_EXPORTS
+#define DUCP_API __declspec(dllexport)
+#else
+#define DUCP_API __declspec(dllimport)
+#endif
+
+
+#if defined(__cplusplus)
+extern "C" {     /* Make sure we have C-declarations in C++ programs */
+#endif
+
+
+/*
+登录和连接DUCP服务器
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_Connet(const char * Password);
+
+/*
+同步包序列
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SYNPN(int PN);
+
+/*
+更改登录密码
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetPassword(const char * Password);
+
+/*
+获取登录密码
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_GetPassword(char * Password);
+
+/*
+获取固件信息
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_GetFirmware(DEVICE_FRAMWARE_T * pFirmware);
+
+/*
+更新本地时间
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_UpdateTime(uint16_t Year,
+									uint8_t Month,
+									uint8_t Day,
+									uint8_t Week,
+									uint8_t Hour,
+									uint8_t Minute,
+									uint8_t Second);
+
+/*
+设置地址
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetAddr(uint8_t Addr);
+
+/*
+设置IP地址
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetIP(const char * IP);
+/*
+设置端口
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetPort(uint32_t Port);
+
+/*
+设置波特率
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetBaud(uint32_t Baud);
+
+/*
+设置扫描频率
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetScanFre(uint16_t Fre);
+
+/*
+设置亮度
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetLight(uint8_t Light);
+
+/*
+设置音量
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetVol(uint8_t Vol);
+
+/*
+重启系统
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_Reset(void);
+
+/*
+	配置IO口功能
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_CfgIO(IO_PIN_ID_E Pin,IO_PIN_FUN_E Fun);
+
+/*
+	设置IO口输出状态
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetOutState(IO_PIN_ID_E Pin,int OnOff);
+
+/*
+	读取IO口输入状态
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_ReadInputState(IO_PIN_ID_E Pin,int * pRetState);
+
+/*
+	设置LED驱动程序
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetDrv(int v);
+
+/*
+	设置OE极性
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetOEPolarity(int v);
+
+/*
+	设置数据极性
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetDataPolarity(int v);
+
+/*
+	设置LE信号延时
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetLEDelay(int En);
+
+/*
+	设置网关和掩码
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetGWAndMask(const char * GW,const char * Mask);
+
+/*
+	进入安全模式
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_EnterSafMode(const char * pswd);
+
+/*
+	计算验证码
+	
+	Msg: 消息地址
+	MsgLen: 消息长度,最多255个字节,如果大于255,只会计算前255个字节。
+	pOutResult:返回的32位结果
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_Clic(const char * Msg,int MsgLen,int * pOutResult);
+
+/*
+	设置显示尺寸
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetDisSize(int XSize,int YSize);
+
+/*
+	设置显示镜像
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetXYMIR(int Flag);
+
+/*
+	设置485工作模式
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_Set485Mode(int ModeIndex);
+
+/*
+	获取所有参数
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_GetAll(SysSettings_t * pSet);
+
+/*
+	设置所有参数
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetAll(SysSettings_t * pSet);
+
+/*
+	使能TTS播放所有文字(需要配置外部TTS硬件解码模块)
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_TTSEn(int Enable);
+
+/*
+	挂载目录
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_Mount(const char * Path);
+
+/*
+	打开文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_Open(const char * Path,int Opt);
+
+/*
+	设置文件的读写位置
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_Seek(int Offset);
+
+/*
+	写文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_Write(const uint8_t * pData,uint32_t Size);
+
+/*
+	读文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_Read(uint8_t * pData,uint32_t Size,uint32_t * pRetSize);
+
+/*
+	同步文件缓存数据
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_SynBuff(void);
+
+/*
+	关闭当前文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_Close(void);
+
+/*
+	删除当前文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_Del(const char * Path);
+
+/*
+	复制文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_Copy(const char * DesPath,const char * SrcPath,int Opt);
+
+/*
+	格式化磁盘
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_FDisk(void);
+
+/*
+播放语音
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_TTS_Play(const char * pText, uint8_t Opt);
+
+/*
+停止播放语音
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_TTS_Stop(void);
+
+/*
+绘制点
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_DrawPoint(int x0, int y0);
+
+/*
+绘制线
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_DrawLine(int x0, int y0, int x1, int y1);
+
+/*
+绘制矩形
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_DrawRect(int x0, int y0, int x1, int y1);
+
+/*
+填充矩形
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_FillRect(int x0, int y0, int x1, int y1);
+
+/*
+绘制圆
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_DrawCircle(int x0, int y0, int r);
+
+/*
+填充圆
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_FillCircle(int x0, int y0, int r);
+
+/*
+绘制位图
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_DrawBitmap(int x0, int y0, int xSize, int ySize,
+									int BitsPerPixle, int BytesPerLine,
+									int DataSize, int ColorTabelSize,
+									const uint8_t * pData);
+
+/*
+显示文本
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_DisText(int x0, int y0, const char * pText);
+
+/*
+设置绘图颜色
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_SetColor(int Color);
+
+/*
+设置背景颜色
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_SetBkColor(int Color);
+
+/*
+设置字体
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_SetFont(int FontIndex);
+
+/*
+绘制系统自带的位图
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_DrawSysIcon(int x0, int y0, int Num,int Denom,int IconIndex);
+
+/*
+显示所有窗口
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_WM_ShowWindow(int WinID);
+
+/*
+隐藏所有窗口
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_WM_HideWindow(int WinID);
+
+/*
+删除所有窗口
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_WM_DelWindow(int WinID);
+
+/*
+	设置窗口自动同步显示
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_WM_AutoSyn(int En);
+
+
+/*
+创建文本控件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_Create(int WinID, int Stile, int x0, int y0, int xSize, int ySize);
+
+/*
+删除文本控件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_Del(int WinID);
+
+
+/*
+在文本控件上显示文本。这个接口下载的文字掉电后不能保存。推荐使用这个接口显示经常更改的内容。
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_DisText(	int WinID,
+									const char * pText,
+									int EnterMode,
+									int EnterSpeed,
+									int DelayMode,
+									int DelayTime,
+									int EixtMode,
+									int EixtSpeed,
+									int FontIndex,
+									int TextColor,
+									int BkColor,
+									int DisTimes);
+
+/*
+设置文本控件的字体
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_SetFont(int WinID, int FontIndex);
+
+/*
+设置文本控件的文本颜色
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_SetTextColor(int WinID, int Color);
+
+/*
+设置文本控件的背景颜色
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_SetBkColor(int WinID, int Color);
+
+/*
+停止显示文本控件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_StopDis(int WinID);
+
+/*
+下载文本文件与文本控件关联。这个接口下载的文字会保存在磁盘中,掉电会保存。
+不建议频繁使用这个接口,这样会对降低FLASH的使用寿命。
+建议对不经常更改的内容下载到磁盘中。例如 广告语等。
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_DownTextFile(	int WinID,
+										int FileID,
+										const char * pText,
+										int EnterMode,
+										int EnterSpeed,
+										int DelayMode,
+										int DelayTime,
+										int EixtMode,
+										int EixtSpeed,
+										int FontIndex,
+										int TextColor,
+										int BkColor);
+/*
+显示文本控件的文本文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_DisFile(int WinID, int FileID);
+
+/*
+打开文本控件的文本文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_OpenFile(int WinID, int FileID);
+
+/*
+关闭文本控件的文本文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_CloseFile(int WinID, int FileID);
+
+/*
+删除文本控件的文本文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_DelFile(int WinID, int FileID);
+
+/*
+	同步显示多个文本控件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_SynDis(char * pList,int NumBytes);
+
+/*
+	多行显示并且播报语音
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_SYN_DisEx(	int StartWinID,
+													const char * pText,
+													int EnterMode,
+													int EnterSpeed,
+													int DelayMode,
+													int DelayTime,
+													int EixtMode,
+													int EixtSpeed,
+													int FontIndex,
+													int TextColor,
+													int BkColor,
+													int DisTimes,
+													const char * pVoice);
+
+/*
+创建图片控件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_PIC_Create(int WinID,int x0, int y0, int xSize, int ySize);
+
+/*
+删除图片控件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_PIC_Del(int WinID);
+
+/*
+向图片控件追加图片
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_PIC_Add(int WinID,int FID,uint8_t EnterMode,uint8_t EnterSpeed,
+							uint8_t StopMode,uint8_t StopTime,uint8_t ExitMode,uint8_t ExitSpeed);
+
+/*
+删除所有图片
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_PIC_Clr(int WinID);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+
+

+ 94 - 0
DUCP协议栈/DLL/MBmsg.h

@@ -0,0 +1,94 @@
+
+#ifndef _MBMSG_H_
+#define _MBMSG_H_
+
+#include <stdint.h>
+
+// 下列 ifdef 块是创建使从 DLL 导出更简单的
+// 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 DUCP_EXPORTS
+// 符号编译的。在使用此 DLL 的
+// 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
+// DUCP_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
+// 符号视为是被导出的。
+#ifdef DUCP_EXPORTS
+#define DUCP_API __declspec(dllexport)
+#else
+#define DUCP_API __declspec(dllimport)
+#endif
+
+#if defined(__cplusplus)
+extern "C" {     /* Make sure we have C-declarations in C++ programs */
+#endif
+
+#define MB_STK_ADDR_DEF		(0x00)	/*默认的地址*/
+#define MB_STK_FC_DEF		(100)	/*默认的功能码*/
+
+
+#define MB_MSG_SIZE_MAX		(255)
+
+/*
+	消息结构
+*/
+typedef struct {
+	uint8_t 	PN[2];
+	uint8_t  	MsgId;
+	uint8_t 	DLen;
+	uint8_t  	Data[MB_MSG_SIZE_MAX];
+} MB_MSG_T;
+
+/*
+	消息接收完成回调函数类型
+*/
+typedef int8_t (*cbMsgRdy_t)(MB_MSG_T *);
+
+typedef int8_t (*cbSTKOut_t)(uint8_t * p,uint32_t size);
+
+/*
+    CRC16校验函数
+*/
+EXTERN_C DUCP_API uint16_t MB_CRC16(uint8_t *pFrame, uint16_t count);
+
+/*
+	设置协议数据输出回调函数
+*/
+EXTERN_C DUCP_API void MB_STK_SetOutCallback(cbSTKOut_t cb);
+
+/*
+	协议栈数据输入
+*/
+EXTERN_C DUCP_API int8_t MB_STK_In(uint8_t * pBuff, uint16_t Size);
+/*
+	设置地址
+*/
+EXTERN_C DUCP_API uint8_t MB_STK_SetAddr(uint8_t NewAddr);
+
+/*
+	设置消息就绪回调函数
+*/
+EXTERN_C DUCP_API void MB_MSG_SetMsgRdyCallback(cbMsgRdy_t cb);
+
+
+/*
+	发送消息
+	PN + MSGID + DLEN + DATA
+*/
+EXTERN_C DUCP_API int8_t MB_MSG_Send(MB_MSG_T * pMsg, uint32_t Ovtime);
+
+/*
+	读消息
+	PN + MSGID + DLEN + DATA
+*/
+EXTERN_C DUCP_API int8_t MB_MSG_Read(MB_MSG_T * pMsg, uint32_t Ovtime);
+
+/*
+	读消息
+	PN + MSGID + DLEN + DATA
+*/
+EXTERN_C DUCP_API MB_MSG_T * MB_MSG_ReadEx(uint32_t Ovtime);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+

BIN
DUCP协议栈/Tool/DUCP.dll


+ 202 - 0
DUCP协议栈/Tool/DUCP.h

@@ -0,0 +1,202 @@
+/*
+****************************************************************************************************
+*                                                DUCP
+*                      				Displayer universal control protocal
+*                                      	   Master Head File
+*
+*                          			(c) Copyright 2016-2017, KF 
+*                                        All Rights Reserved
+*
+* File : DUCP.h
+* By   : Lyon 
+* Date : 2016-1-1
+* Email: yangzhonglai@163.com
+****************************************************************************************************
+*/
+#ifndef _DUCP_H_
+#define _DUCP_H_
+
+#define DUCP_PATH_LEN_MAX		(125)
+
+
+#define DUCP_FM_READ			(0X01)
+#define DUCP_FM_WRITE			(0X02)
+#define DUCP_FM_OPEN_ALWAYS		(0X10)
+#define DUCP_FM_FLLOW_PATH		(0X80)
+
+
+#define SEND_MSG_OVERTIME_DEF		(100)
+#define READ_MSG_OVERTIME_DEF		(100)
+
+
+#define DUCP_TTS_PLAY_OPT_A			(0x00)	/*添加到语音队列但是不开始播放*/
+#define DUCP_TTS_PLAY_OPT_AS		(0x01)	/*添加到语音队列并且开始播放*/
+#define DUCP_TTS_PLAY_OPT_CAS		(0x02)	/*先清除队列,再添加新语音到队列,然后开始播放*/
+
+/*错误类型*/
+#define DUCP_ERR_NONE				(0x00) /*无错误*/
+typedef uint8_t DUCP_ERR_T;
+
+/*-------------------------UDCP指令集----------------------------*/
+#define DUCP_CMD_SYS_BASE		(0)
+#define DUCP_CMD_FM_BASE		(0X20)
+#define DUCP_CMD_TTS_BASE		(0X30)
+#define DUCP_CMD_2D_BASE		(0X38)
+#define DUCP_CMD_WM_BASE		(0X50)
+#define DUCP_CMD_TWIN_BASE		(0X60)
+#define DUCP_CMD_PIC_BASE		(0X80)
+
+typedef enum {
+			/*--------------------系统管理------------------------------*/
+			DUCP_CMD_SYS_CONNECT = DUCP_CMD_SYS_BASE, /*0登录并连接UDCP服务器 OK*/		
+			DUCP_CMD_SYS_SYN_PN,			/*1同步包序列 OK*/		
+			DUCP_CMD_SYS_SET_PASSWAORD,		/*2修改登录密码 NOTEST*/
+			DUCP_CMD_SYS_GET_PASSWAORD,		/*3获取登录密码 NOTEST*/
+			DUCP_CMD_SYS_GET_FIRMWARE,		/*4获取固件信息OK*/
+			DUCP_CMD_SYS_UPTIME,			/*5更新时间OK*/
+			DUCP_CMD_SYS_RESET,				/*6重启系统 OK*/
+
+			DUCP_CMD_SYS_SET_ADDR,			/*7设置485地址 OK*/
+			DUCP_CMD_SYS_SET_IP,			/*8设置IP地址 OK*/
+			DUCP_CMD_SYS_SET_PORT,			/*9设置端口 OK*/
+			DUCP_CMD_SYS_SET_BAUD,			/*10设置波特率OK*/
+			DUCP_CMD_SYS_SET_SCAN_FRE,		/*11设置扫描频率OK*/
+			DUCP_CMD_SYS_SET_LIGHT,	 		/*12调整亮度OK*/
+			DUCP_CMD_SYS_SET_VOL,		 	/*13设置音量OK*/
+			
+			DUCP_CMD_SYS_CFG_IO,			/*14配置IO口功能OK*/
+			DUCP_CMD_SYS_SET_IO,			/*15设置IO口状态OK*/
+			DUCP_CMD_SYS_READ_IO,			/*16读取IO口状态OK*/
+
+			DUCP_CMD_SYS_SET_DRV,			/*17设置LED驱动OK*/
+			DUCP_CMD_SYS_SET_OEP,			/*18设置OE极性OK*/
+			DUCP_CMD_SYS_SET_DP,			/*19设置数据极性OK*/
+			DUCP_CMD_SYS_SET_LE,			/*20设置LE信号延时OK*/
+			DUCP_CMD_SYS_SET_GW_AND_MASK,	/*21设置网关和掩码OK*/
+			DUCP_CMD_SYS_SET_SAF_MODE,		/*22进入安全模式OK*/
+			DUCP_CMD_SYS_CLIC,				/*23Passport OK*/
+			DUCP_CMD_SYS_SET_DIS_SIZE,		/*24设置显示尺寸OK*/
+			DUCP_CMD_SYS_SET_XYMIR,			/*25设置显示镜像OK*/
+			DUCP_CMD_SYS_SET_485MODE,		/*26设置485工作模式OK*/
+			DUCP_CMD_SYS_GET_ALL,			/*27获取所有参数OK*/
+			DUCP_CMD_SYS_SET_ALL,			/*28设置所有参数OK*/
+			DUCP_CMD_SYS_SET_TTSEN,			/*29使能播报所有文本OK*/
+			
+			/*--------------------文件管理------------------------------*/
+			DUCP_CMD_FM_MOUNT = DUCP_CMD_FM_BASE,/*挂载目录 INVOLID*/
+			DUCP_CMD_FM_OPEN,				/*打开或创建文件 INVOLID*/
+			DUCP_CMD_FM_SEEK,				/*设置文件读写位置 INVOLID*/
+			DUCP_CMD_FM_WRITE,				/*写文件 INVOLID*/
+			DUCP_CMD_FM_READ,				/*读文件 INVOLID*/
+			DUCP_CMD_FM_SYNBUFF,			/*同步文件缓存 INVOLID*/
+			DUCP_CMD_FM_COLOSE,				/*关闭文件 INVOLID*/
+			DUCP_CMD_FM_DEL,				/*删除文件 INVOLID*/
+			DUCP_CMD_FM_COPY,				/*复制文件 INVOLID*/
+			DUCP_CMD_FM_FDISK,				/*格式化磁盘 INVOLID*/
+			DUCP_CMD_FM_WLIC,				/*写授权文件*/
+			DUCP_CMD_FM_RLIC,				/*读授权文件*/
+			DUCP_CMD_FM_CULIC,				/*校验用户授权文件*/
+
+			/*-------------------TTS语音接口----------------------------*/
+			DUCP_CMD_TTS_PLAY = DUCP_CMD_TTS_BASE,/*播放语音OK*/
+			DUCP_CMD_TTS_STOP,				/*停止播放语音OK*/
+
+
+			/*-------------------2D图形接口-----------------------------*/
+			DUCP_CMD_2D_DRAW_POINT = DUCP_CMD_2D_BASE,/*画点 OK*/
+			DUCP_CMD_2D_DRAW_LINE,			/*画线 OK*/
+			DUCP_CMD_2D_DRAW_RECT,			/*画矩形 OK*/
+			DUCP_CMD_2D_FILL_RECT,			/*填充矩形 OK*/
+			DUCP_CMD_2D_DRAW_CICLE,			/*画圆 OK*/
+			DUCP_CMD_2D_FILL_CICLE,			/*填充圆 OK*/
+			DUCP_CMD_2D_DRAW_BITMAP,		/*绘制位图*/
+			DUCP_CMD_2D_DIS_TEXT,			/*显示文本 OK*/
+			DUCP_CMD_2D_SET_TCOLOR,	 		/*设置文本颜色 OK*/
+			DUCP_CMD_2D_SET_BCOLOR,			/*设置背景颜色 OK*/
+			DUCP_CMD_2D_SET_FONT,			/*设置字体 OK*/
+			DUCP_CMD_2D_DRAW_SYSICON,		/*绘制系统自带的图标OK*/
+			
+			/*----------------------窗口管理---------------------------*/
+			DUCP_CMD_WIN_SHOW = DUCP_CMD_WM_BASE,/*显示窗口 OK*/
+			DUCP_CMD_WIN_HIDLE,				/*隐藏窗口 OK*/
+			DUCP_CMD_WIN_DEL,				/*删除窗口 OK*/
+			DUCP_CMD_WIN_AUTO_SYN,			/*自动同步窗口显示 OK*/
+			
+			/*----------------------文本控件---------------------------*/
+			DUCP_CMD_TWIN_CREATE = DUCP_CMD_TWIN_BASE,/*创建文本窗口 OK*/
+			DUCP_CMD_TWIN_DEL,				/*删除文本窗口 OK*/
+			DUCP_CMD_TWIN_DIS_TEXT,			/*显示临时文本 OK*/
+			DUCP_CMD_TWIN_SET_FONT,	 		/*设置字体 OK*/
+			DUCP_CMD_TWIN_SET_TCOLOR,		/*设置文本颜色 OK*/
+			DUCP_CMD_TWIN_SET_BCOLOR,		/*设置背景颜色 OK*/
+			DUCP_CMD_TWIN_STOP_DIS,			/*停止显示 OK*/
+			DUCP_CMD_TWIN_DOWN_TFILE,		/*下载文本文件 OK*/
+			DUCP_CMD_TWIN_DIS_TFILE,		/*显示文本文件 OK*/
+			DUCP_CMD_TWIN_OPEN_TFILE,		/*打开文本文件 OK*/
+			DUCP_CMD_TWIN_CLOSE_TFILE,		/*关闭文本文件 OK*/
+			DUCP_CMD_TWIN_DEL_TFILE,		/*删除文本文件 OK*/
+			DUCP_CMD_TWIN_SYN_DIS,			/*同步显示多个文本控件*/
+			DUCP_CMD_TWIN_SYN_DISEX,		/*多行显示,同时播报语音*/
+
+			/*----------------------图片控件---------------------------*/
+			DUCP_CMD_PIC_CREATE = DUCP_CMD_PIC_BASE,/*创建图片窗口 OK*/
+			DUCP_CMD_PIC_DEL,
+			DUCP_CMD_PIC_ADD,
+			DUCP_CMD_PIC_CLR,
+
+} DUCP_CMD_E;
+
+
+typedef struct {
+	char			DevName[8];/*设备名称*/
+	char			SVR[8];		/*软件版本X.YZ*/
+	uint32_t		XSize;		/*X尺寸*/
+	uint32_t		YSize;		/*Y尺寸*/
+	uint32_t		LstUpTime;	/*最后更新时间*/
+	uint8_t			SN[12];		/*序列号*/
+}DEVICE_FRAMWARE_T;
+
+/*IO引脚标识*/
+typedef enum {
+	IO_PIN_1 = 0,
+	IO_PIN_2,
+	IO_PIN_3,
+	IO_PIN_4,
+	IO_PIN_ALL = 0XF0, /*对所以IO口进行赋值操作*/
+	IO_PIN_OR,/*对所有IO口进行 或 操作*/
+	IO_PIN_AND,/*对所有IO口进行 与 操作*/
+	IO_PIN_NOT/*对所有IO口进行 非 操作*/
+} IO_PIN_ID_E;
+
+/*IO 功能枚举*/
+typedef enum {
+	IO_FUN_IN = 0, 	/*输入*/
+	IO_FUN_PP,		/*推挽输出*/
+	IO_FUN_OD,		/*开漏输出*/
+} IO_PIN_FUN_E;
+
+
+/*系统参数描述符*/
+typedef struct {
+	uint32_t 	Baud;	/*波特率 最高115200*/
+	uint8_t  	_485Addr;/*485地址*/
+	uint8_t  	_485CM;/*485工作模式 0:半双工 1:半工*/
+	uint8_t  	IP[4];/*IP地址*/
+	uint32_t  	Port;/*端口号*/
+	uint8_t	 	GW[4];/*网关地址*/
+	uint8_t	 	Mask[4];/*子网掩码*/
+	uint16_t 	Fre;/*扫描频率 30Hz ~ 960Hz*/
+	uint8_t  	LightLevel;/*亮度级别 10~100 对应10% ~ 100%*/
+	uint8_t  	VoiceLevel;/*声音级别 10~100 对应10% ~ 100%*/
+	uint8_t	 	OEP;/*OE极性,0:正极性 1:负极性*/
+	uint8_t  	DP;/*数据极性,0:正极性 1:负极性*/
+	uint8_t  	LEDey;/*LE信号延时,0:关闭 1:打开*/
+	uint8_t  	LEDDrv;/*LED驱动程序 0:08双色16分之一扫描 1:12双色4分之一扫描 2:12双色8分之一扫描*/
+	uint16_t 	XSize;/*显示屏长度尺寸 像素*/
+	uint16_t 	YSize;/*显示屏高度尺寸 像素*/
+	uint8_t	 	XYMir;/*XY镜像使能 0:原点坐标在左上角 1:原点坐标在右下角*/
+	uint8_t		TTSAEn;/*0:定制语音。1:可以播报所有文字(需要配置外部TTS解码模块)*/
+} SysSettings_t;
+
+#endif
+

+ 476 - 0
DUCP协议栈/Tool/DUCP_Host.h

@@ -0,0 +1,476 @@
+/*
+****************************************************************************************************
+*                                             DUCP HOST
+*                      			Displayer universal control protocal for host
+*                                      	   Master Head File
+*
+*                          			(c) Copyright 2016-2017, KF 
+*                                        All Rights Reserved
+*
+* File : DUCP_Host.h
+* By   : Lyon 
+* Date : 2016-1-1
+* Email: yangzhonglai@163.com
+****************************************************************************************************
+*/
+#ifndef _DUCP_DEVICE_H_
+#define _DUCP_DEVICE_H_
+
+#include "MBmsg.h"
+#include "DUCP.H"
+
+// 下列 ifdef 块是创建使从 DLL 导出更简单的
+// 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 DUCP_EXPORTS
+// 符号编译的。在使用此 DLL 的
+// 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
+// DUCP_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
+// 符号视为是被导出的。
+#ifdef DUCP_EXPORTS
+#define DUCP_API __declspec(dllexport)
+#else
+#define DUCP_API __declspec(dllimport)
+#endif
+
+
+#if defined(__cplusplus)
+extern "C" {     /* Make sure we have C-declarations in C++ programs */
+#endif
+
+
+/*
+登录和连接DUCP服务器
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_Connet(const char * Password);
+
+/*
+同步包序列
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SYNPN(int PN);
+
+/*
+更改登录密码
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetPassword(const char * Password);
+
+/*
+获取登录密码
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_GetPassword(char * Password);
+
+/*
+获取固件信息
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_GetFirmware(DEVICE_FRAMWARE_T * pFirmware);
+
+/*
+更新本地时间
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_UpdateTime(uint16_t Year,
+									uint8_t Month,
+									uint8_t Day,
+									uint8_t Week,
+									uint8_t Hour,
+									uint8_t Minute,
+									uint8_t Second);
+
+/*
+设置地址
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetAddr(uint8_t Addr);
+
+/*
+设置IP地址
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetIP(const char * IP);
+/*
+设置端口
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetPort(uint32_t Port);
+
+/*
+设置波特率
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetBaud(uint32_t Baud);
+
+/*
+设置扫描频率
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetScanFre(uint16_t Fre);
+
+/*
+设置亮度
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetLight(uint8_t Light);
+
+/*
+设置音量
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetVol(uint8_t Vol);
+
+/*
+重启系统
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_Reset(void);
+
+/*
+	配置IO口功能
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_CfgIO(IO_PIN_ID_E Pin,IO_PIN_FUN_E Fun);
+
+/*
+	设置IO口输出状态
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetOutState(IO_PIN_ID_E Pin,int OnOff);
+
+/*
+	读取IO口输入状态
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_ReadInputState(IO_PIN_ID_E Pin,int * pRetState);
+
+/*
+	设置LED驱动程序
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetDrv(int v);
+
+/*
+	设置OE极性
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetOEPolarity(int v);
+
+/*
+	设置数据极性
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetDataPolarity(int v);
+
+/*
+	设置LE信号延时
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetLEDelay(int En);
+
+/*
+	设置网关和掩码
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetGWAndMask(const char * GW,const char * Mask);
+
+/*
+	进入安全模式
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_EnterSafMode(const char * pswd);
+
+/*
+	计算验证码
+	
+	Msg: 消息地址
+	MsgLen: 消息长度,最多255个字节,如果大于255,只会计算前255个字节。
+	pOutResult:返回的32位结果
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_Clic(const char * Msg,int MsgLen,int * pOutResult);
+
+/*
+	设置显示尺寸
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetDisSize(int XSize,int YSize);
+
+/*
+	设置显示镜像
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetXYMIR(int Flag);
+
+/*
+	设置485工作模式
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_Set485Mode(int ModeIndex);
+
+/*
+	获取所有参数
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_GetAll(SysSettings_t * pSet);
+
+/*
+	设置所有参数
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_SetAll(SysSettings_t * pSet);
+
+/*
+	使能TTS播放所有文字(需要配置外部TTS硬件解码模块)
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_SYS_TTSEn(int Enable);
+
+/*
+	挂载目录
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_Mount(const char * Path);
+
+/*
+	打开文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_Open(const char * Path,int Opt);
+
+/*
+	设置文件的读写位置
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_Seek(int Offset);
+
+/*
+	写文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_Write(const uint8_t * pData,uint32_t Size);
+
+/*
+	读文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_Read(uint8_t * pData,uint32_t Size,uint32_t * pRetSize);
+
+/*
+	同步文件缓存数据
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_SynBuff(void);
+
+/*
+	关闭当前文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_Close(void);
+
+/*
+	删除当前文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_Del(const char * Path);
+
+/*
+	复制文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_Copy(const char * DesPath,const char * SrcPath,int Opt);
+
+/*
+	格式化磁盘
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_FM_FDisk(void);
+
+/*
+播放语音
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_TTS_Play(const char * pText, uint8_t Opt);
+
+/*
+停止播放语音
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_TTS_Stop(void);
+
+/*
+绘制点
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_DrawPoint(int x0, int y0);
+
+/*
+绘制线
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_DrawLine(int x0, int y0, int x1, int y1);
+
+/*
+绘制矩形
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_DrawRect(int x0, int y0, int x1, int y1);
+
+/*
+填充矩形
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_FillRect(int x0, int y0, int x1, int y1);
+
+/*
+绘制圆
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_DrawCircle(int x0, int y0, int r);
+
+/*
+填充圆
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_FillCircle(int x0, int y0, int r);
+
+/*
+绘制位图
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_DrawBitmap(int x0, int y0, int xSize, int ySize,
+									int BitsPerPixle, int BytesPerLine,
+									int DataSize, int ColorTabelSize,
+									const uint8_t * pData);
+
+/*
+显示文本
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_DisText(int x0, int y0, const char * pText);
+
+/*
+设置绘图颜色
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_SetColor(int Color);
+
+/*
+设置背景颜色
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_SetBkColor(int Color);
+
+/*
+设置字体
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_SetFont(int FontIndex);
+
+/*
+绘制系统自带的位图
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_2D_DrawSysIcon(int x0, int y0, int Num,int Denom,int IconIndex);
+
+/*
+显示所有窗口
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_WM_ShowWindow(int WinID);
+
+/*
+隐藏所有窗口
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_WM_HideWindow(int WinID);
+
+/*
+删除所有窗口
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_WM_DelWindow(int WinID);
+
+/*
+	设置窗口自动同步显示
+*/
+EXTERN_C DUCP_API DUCP_ERR_T	DUCP_HOST_WM_AutoSyn(int En);
+
+
+/*
+创建文本控件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_Create(int WinID, int Stile, int x0, int y0, int xSize, int ySize);
+
+/*
+删除文本控件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_Del(int WinID);
+
+
+/*
+在文本控件上显示文本。这个接口下载的文字掉电后不能保存。推荐使用这个接口显示经常更改的内容。
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_DisText(	int WinID,
+									const char * pText,
+									int EnterMode,
+									int EnterSpeed,
+									int DelayMode,
+									int DelayTime,
+									int EixtMode,
+									int EixtSpeed,
+									int FontIndex,
+									int TextColor,
+									int BkColor,
+									int DisTimes);
+
+/*
+设置文本控件的字体
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_SetFont(int WinID, int FontIndex);
+
+/*
+设置文本控件的文本颜色
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_SetTextColor(int WinID, int Color);
+
+/*
+设置文本控件的背景颜色
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_SetBkColor(int WinID, int Color);
+
+/*
+停止显示文本控件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_StopDis(int WinID);
+
+/*
+下载文本文件与文本控件关联。这个接口下载的文字会保存在磁盘中,掉电会保存。
+不建议频繁使用这个接口,这样会对降低FLASH的使用寿命。
+建议对不经常更改的内容下载到磁盘中。例如 广告语等。
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_DownTextFile(	int WinID,
+										int FileID,
+										const char * pText,
+										int EnterMode,
+										int EnterSpeed,
+										int DelayMode,
+										int DelayTime,
+										int EixtMode,
+										int EixtSpeed,
+										int FontIndex,
+										int TextColor,
+										int BkColor);
+/*
+显示文本控件的文本文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_DisFile(int WinID, int FileID);
+
+/*
+打开文本控件的文本文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_OpenFile(int WinID, int FileID);
+
+/*
+关闭文本控件的文本文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_CloseFile(int WinID, int FileID);
+
+/*
+删除文本控件的文本文件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_DelFile(int WinID, int FileID);
+
+/*
+	同步显示多个文本控件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_SynDis(char * pList,int NumBytes);
+
+/*
+	多行显示并且播报语音
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_TWIN_SYN_DisEx(	int StartWinID,
+													const char * pText,
+													int EnterMode,
+													int EnterSpeed,
+													int DelayMode,
+													int DelayTime,
+													int EixtMode,
+													int EixtSpeed,
+													int FontIndex,
+													int TextColor,
+													int BkColor,
+													int DisTimes,
+													const char * pVoice);
+
+/*
+创建图片控件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_PIC_Create(int WinID,int x0, int y0, int xSize, int ySize);
+
+/*
+删除图片控件
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_PIC_Del(int WinID);
+
+/*
+向图片控件追加图片
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_PIC_Add(int WinID,int FID,uint8_t EnterMode,uint8_t EnterSpeed,
+							uint8_t StopMode,uint8_t StopTime,uint8_t ExitMode,uint8_t ExitSpeed);
+
+/*
+删除所有图片
+*/
+EXTERN_C DUCP_API DUCP_ERR_T DUCP_HOST_PIC_Clr(int WinID);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+
+

+ 94 - 0
DUCP协议栈/Tool/MBmsg.h

@@ -0,0 +1,94 @@
+
+#ifndef _MBMSG_H_
+#define _MBMSG_H_
+
+#include <stdint.h>
+
+// 下列 ifdef 块是创建使从 DLL 导出更简单的
+// 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 DUCP_EXPORTS
+// 符号编译的。在使用此 DLL 的
+// 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
+// DUCP_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
+// 符号视为是被导出的。
+#ifdef DUCP_EXPORTS
+#define DUCP_API __declspec(dllexport)
+#else
+#define DUCP_API __declspec(dllimport)
+#endif
+
+#if defined(__cplusplus)
+extern "C" {     /* Make sure we have C-declarations in C++ programs */
+#endif
+
+#define MB_STK_ADDR_DEF		(0x00)	/*默认的地址*/
+#define MB_STK_FC_DEF		(100)	/*默认的功能码*/
+
+
+#define MB_MSG_SIZE_MAX		(255)
+
+/*
+	消息结构
+*/
+typedef struct {
+	uint8_t 	PN[2];
+	uint8_t  	MsgId;
+	uint8_t 	DLen;
+	uint8_t  	Data[MB_MSG_SIZE_MAX];
+} MB_MSG_T;
+
+/*
+	消息接收完成回调函数类型
+*/
+typedef int8_t (*cbMsgRdy_t)(MB_MSG_T *);
+
+typedef int8_t (*cbSTKOut_t)(uint8_t * p,uint32_t size);
+
+/*
+    CRC16校验函数
+*/
+EXTERN_C DUCP_API uint16_t MB_CRC16(uint8_t *pFrame, uint16_t count);
+
+/*
+	设置协议数据输出回调函数
+*/
+EXTERN_C DUCP_API void MB_STK_SetOutCallback(cbSTKOut_t cb);
+
+/*
+	协议栈数据输入
+*/
+EXTERN_C DUCP_API int8_t MB_STK_In(uint8_t * pBuff, uint16_t Size);
+/*
+	设置地址
+*/
+EXTERN_C DUCP_API uint8_t MB_STK_SetAddr(uint8_t NewAddr);
+
+/*
+	设置消息就绪回调函数
+*/
+EXTERN_C DUCP_API void MB_MSG_SetMsgRdyCallback(cbMsgRdy_t cb);
+
+
+/*
+	发送消息
+	PN + MSGID + DLEN + DATA
+*/
+EXTERN_C DUCP_API int8_t MB_MSG_Send(MB_MSG_T * pMsg, uint32_t Ovtime);
+
+/*
+	读消息
+	PN + MSGID + DLEN + DATA
+*/
+EXTERN_C DUCP_API int8_t MB_MSG_Read(MB_MSG_T * pMsg, uint32_t Ovtime);
+
+/*
+	读消息
+	PN + MSGID + DLEN + DATA
+*/
+EXTERN_C DUCP_API MB_MSG_T * MB_MSG_ReadEx(uint32_t Ovtime);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+

BIN
DUCP协议栈/Tool/dll.rar


BIN
DUCP协议栈/Tool/mfc100d.dll


BIN
DUCP协议栈/Tool/mfc120d.dll


BIN
DUCP协议栈/Tool/msvcp120d.dll


BIN
DUCP协议栈/Tool/msvcr100d.dll


BIN
DUCP协议栈/Tool/msvcr120d.dll


+ 12 - 0
DUCP协议栈/readme.txt

@@ -0,0 +1,12 @@
+目录文档说明:
+DLL/DUCP.h 	   协议栈公共头文件。
+DLL/DUCP.dll 	   协议栈动态库。
+DLL/DUCP.lib 	   协议静态库。
+DLL/DUCP_Host.h	   协议栈主机端头文件。
+DLL/MBmsg.h	   协议栈消息层头文件。
+
+VC/MBPHY.c 	VC平台下的协议栈底层数据输入输出接口源文件,支持TCP/IP和串口设备。
+VC/MBPHY.h 	VC平台下的协议栈底层数据输入输出接口头文件,支持TCP/IP和串口设备。
+Tool/调试工具.exe  PC平台下的调试工具。
+
+SRC/xxx.c  	  C源代码

+ 172 - 0
DUCP协议栈/src/DUCP.h

@@ -0,0 +1,172 @@
+/*
+****************************************************************************************************
+*                                                DUCP
+*                      				Displayer universal control protocal
+*                                      	   Master Head File
+*
+*                          			(c) Copyright 2016-2017, KF 
+*                                        All Rights Reserved
+*
+* File : DUCP.h
+* By   : Lyon 
+* Date : 2016-1-1
+* Email: yangzhonglai@163.com
+****************************************************************************************************
+*/
+#ifndef _DUCP_H_
+#define _DUCP_H_
+
+#define DUCP_PATH_LEN_MAX		(125)
+
+
+#define DUCP_FM_READ			(0X01)
+#define DUCP_FM_WRITE			(0X02)
+#define DUCP_FM_OPEN_ALWAYS		(0X10)
+#define DUCP_FM_FLLOW_PATH		(0X80)
+
+
+#define SEND_MSG_OVERTIME_DEF		(100)
+#define READ_MSG_OVERTIME_DEF		(100)
+
+
+#define DUCP_TTS_PLAY_OPT_A			(0x00)	/*添加到语音队列但是不开始播放*/
+#define DUCP_TTS_PLAY_OPT_AS		(0x01)	/*添加到语音队列并且开始播放*/
+#define DUCP_TTS_PLAY_OPT_CAS		(0x02)	/*先清除队列,再添加新语音到队列,然后开始播放*/
+
+/*错误类型*/
+#define DUCP_ERR_NONE				(0x00) /*无错误*/
+typedef uint8_t DUCP_ERR_T;
+
+/*-------------------------UDCP指令集----------------------------*/
+#define DUCP_CMD_SYS_BASE		(0)
+#define DUCP_CMD_FM_BASE		(0X20)
+#define DUCP_CMD_TTS_BASE		(0X30)
+#define DUCP_CMD_2D_BASE		(0X38)
+#define DUCP_CMD_WM_BASE		(0X50)
+#define DUCP_CMD_TWIN_BASE		(0X60)
+#define DUCP_CMD_PIC_BASE		(0X80)
+
+typedef enum {
+			/*--------------------系统管理------------------------------*/
+			DUCP_CMD_SYS_CONNECT = DUCP_CMD_SYS_BASE, /*登录并连接UDCP服务器 OK*/		
+			DUCP_CMD_SYS_SYN_PN,			/*同步包序列 OK*/		
+			DUCP_CMD_SYS_SET_PASSWAORD,		/*修改登录密码 NOTEST*/
+			DUCP_CMD_SYS_GET_PASSWAORD,		/*获取登录密码 NOTEST*/
+			DUCP_CMD_SYS_GET_FIRMWARE,		/*获取固件信息OK*/
+			DUCP_CMD_SYS_UPTIME,			/*更新时间OK*/
+			DUCP_CMD_SYS_RESET,				/*重启系统 OK*/
+
+			DUCP_CMD_SYS_SET_ADDR,			/*设置485地址 OK*/
+			DUCP_CMD_SYS_SET_IP,			/*设置IP地址 OK*/
+			DUCP_CMD_SYS_SET_PORT,			/*设置端口 OK*/
+			DUCP_CMD_SYS_SET_BAUD,			/*设置波特率OK*/
+			DUCP_CMD_SYS_SET_SCAN_FRE,		/*设置扫描频率OK*/
+			DUCP_CMD_SYS_SET_LIGHT,	 		/*调整亮度OK*/
+			DUCP_CMD_SYS_SET_VOL,		 	/*设置音量OK*/
+			
+			DUCP_CMD_SYS_CFG_IO,			/*配置IO口功能OK*/
+			DUCP_CMD_SYS_SET_IO,			/*设置IO口状态OK*/
+			DUCP_CMD_SYS_READ_IO,			/*读取IO口状态OK*/
+
+			DUCP_CMD_SYS_SET_DRV,			/*设置LED驱动*/
+			DUCP_CMD_SYS_SET_OEP,			/*设置OE极性*/
+			DUCP_CMD_SYS_SET_DP,			/*设置数据极性*/
+			DUCP_CMD_SYS_SET_LE,			/*设置LE信号延时*/
+			DUCP_CMD_SYS_SET_GW_AND_MASK,	/*设置网关和掩码*/
+			DUCP_CMD_SYS_SET_SAF_MODE,		/*进入安全模式*/
+			DUCP_CMD_SYS_CLIC,				/*Passport*/
+			DUCP_CMD_SYS_SET_DIS_SIZE,		/*设置显示尺寸*/
+			DUCP_CMD_SYS_SET_XYMIR,			/*设置显示镜像*/
+			
+			/*--------------------文件管理------------------------------*/
+			DUCP_CMD_FM_MOUNT = DUCP_CMD_FM_BASE,/*挂载目录 INVOLID*/
+			DUCP_CMD_FM_OPEN,				/*打开或创建文件 INVOLID*/
+			DUCP_CMD_FM_SEEK,				/*设置文件读写位置 INVOLID*/
+			DUCP_CMD_FM_WRITE,				/*写文件 INVOLID*/
+			DUCP_CMD_FM_READ,				/*读文件 INVOLID*/
+			DUCP_CMD_FM_SYNBUFF,			/*同步文件缓存 INVOLID*/
+			DUCP_CMD_FM_COLOSE,				/*关闭文件 INVOLID*/
+			DUCP_CMD_FM_DEL,				/*删除文件 INVOLID*/
+			DUCP_CMD_FM_COPY,				/*复制文件 INVOLID*/
+			DUCP_CMD_FM_FDISK,				/*格式化磁盘 INVOLID*/
+
+			/*-------------------TTS语音接口----------------------------*/
+			DUCP_CMD_TTS_PLAY = DUCP_CMD_TTS_BASE,/*播放语音OK*/
+			DUCP_CMD_TTS_STOP,				/*停止播放语音OK*/
+
+
+			/*-------------------2D图形接口-----------------------------*/
+			DUCP_CMD_2D_DRAW_POINT = DUCP_CMD_2D_BASE,/*画点 OK*/
+			DUCP_CMD_2D_DRAW_LINE,			/*画线 OK*/
+			DUCP_CMD_2D_DRAW_RECT,			/*画矩形 OK*/
+			DUCP_CMD_2D_FILL_RECT,			/*填充矩形 OK*/
+			DUCP_CMD_2D_DRAW_CICLE,			/*画圆 OK*/
+			DUCP_CMD_2D_FILL_CICLE,			/*填充圆 OK*/
+			DUCP_CMD_2D_DRAW_BITMAP,		/*绘制位图*/
+			DUCP_CMD_2D_DIS_TEXT,			/*显示文本 OK*/
+			DUCP_CMD_2D_SET_TCOLOR,	 		/*设置文本颜色 OK*/
+			DUCP_CMD_2D_SET_BCOLOR,			/*设置背景颜色 OK*/
+			DUCP_CMD_2D_SET_FONT,			/*设置字体 OK*/
+			DUCP_CMD_2D_DRAW_SYSICON,		/*绘制系统自带的图标OK*/
+			
+			/*----------------------窗口管理---------------------------*/
+			DUCP_CMD_WIN_SHOW = DUCP_CMD_WM_BASE,/*显示窗口 OK*/
+			DUCP_CMD_WIN_HIDLE,				/*隐藏窗口 OK*/
+			DUCP_CMD_WIN_DEL,				/*删除窗口 OK*/
+			DUCP_CMD_WIN_AUTO_SYN,			/*自动同步窗口显示 OK*/
+			
+			/*----------------------文本控件---------------------------*/
+			DUCP_CMD_TWIN_CREATE = DUCP_CMD_TWIN_BASE,/*创建文本窗口 OK*/
+			DUCP_CMD_TWIN_DEL,				/*删除文本窗口 OK*/
+			DUCP_CMD_TWIN_DIS_TEXT,			/*显示临时文本 OK*/
+			DUCP_CMD_TWIN_SET_FONT,	 		/*设置字体 OK*/
+			DUCP_CMD_TWIN_SET_TCOLOR,		/*设置文本颜色 OK*/
+			DUCP_CMD_TWIN_SET_BCOLOR,		/*设置背景颜色 OK*/
+			DUCP_CMD_TWIN_STOP_DIS,			/*停止显示 OK*/
+			DUCP_CMD_TWIN_DOWN_TFILE,		/*下载文本文件 OK*/
+			DUCP_CMD_TWIN_DIS_TFILE,		/*显示文本文件 OK*/
+			DUCP_CMD_TWIN_OPEN_TFILE,		/*打开文本文件 OK*/
+			DUCP_CMD_TWIN_CLOSE_TFILE,		/*关闭文本文件 OK*/
+			DUCP_CMD_TWIN_DEL_TFILE,		/*删除文本文件 OK*/
+			DUCP_CMD_TWIN_SYN_DIS,			/*同步显示多个文本控件*/
+			DUCP_CMD_TWIN_SYN_DISEX,		/*多行显示,同时播报语音*/
+
+			/*----------------------图片控件---------------------------*/
+			DUCP_CMD_PIC_CREATE = DUCP_CMD_PIC_BASE,/*创建图片窗口 OK*/
+			DUCP_CMD_PIC_DEL,
+			DUCP_CMD_PIC_ADD,
+			DUCP_CMD_PIC_CLR,
+
+} DUCP_CMD_E;
+
+
+typedef struct {
+	char			DevName[8];/*设备名称*/
+	char			SVR[8];		/*软件版本X.YZ*/
+	uint32_t		XSize;		/*X尺寸*/
+	uint32_t		YSize;		/*Y尺寸*/
+	uint32_t		LstUpTime;	/*最后更新时间*/
+}DEVICE_FRAMWARE_T;
+
+/*IO引脚标识*/
+typedef enum {
+	IO_PIN_1 = 0,
+	IO_PIN_2,
+	IO_PIN_3,
+	IO_PIN_4,
+	IO_PIN_ALL = 0XF0, /*对所以IO口进行赋值操作*/
+	IO_PIN_OR,/*对所有IO口进行 或 操作*/
+	IO_PIN_AND,/*对所有IO口进行 与 操作*/
+	IO_PIN_NOT/*对所有IO口进行 非 操作*/
+} IO_PIN_ID_E;
+
+/*IO 功能枚举*/
+typedef enum {
+	IO_FUN_IN = 0, 	/*输入*/
+	IO_FUN_PP,		/*推挽输出*/
+	IO_FUN_OD,		/*开漏输出*/
+} IO_PIN_FUN_E;
+
+
+#endif
+

File diff suppressed because it is too large
+ 1939 - 0
DUCP协议栈/src/DUCP_Host.c


+ 444 - 0
DUCP协议栈/src/DUCP_Host.h

@@ -0,0 +1,444 @@
+/*
+****************************************************************************************************
+*                                             DUCP HOST
+*                      			Displayer universal control protocal for host
+*                                      	   Master Head File
+*
+*                          			(c) Copyright 2016-2017, KF 
+*                                        All Rights Reserved
+*
+* File : DUCP_Host.h
+* By   : Lyon 
+* Date : 2016-1-1
+* Email: yangzhonglai@163.com
+****************************************************************************************************
+*/
+#ifndef _DUCP_DEVICE_H_
+#define _DUCP_DEVICE_H_
+
+#include "MBmsg.h"
+#include "DUCP.H"
+
+
+#if defined(__cplusplus)
+extern "C" {     /* Make sure we have C-declarations in C++ programs */
+#endif
+
+
+/*
+登录和连接UDCP服务器
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_Connet(const char * Password);
+
+/*
+同步包序列
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SYNPN(int PN);
+
+/*
+更改登录密码
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SetPassword(const char * Password);
+
+/*
+获取登录密码
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_GetPassword(char * Password);
+
+/*
+获取固件信息
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_GetFirmware(DEVICE_FRAMWARE_T * pFirmware);
+
+/*
+更新本地时间
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_UpdateTime(uint16_t Year,
+									uint8_t Month,
+									uint8_t Day,
+									uint8_t Week,
+									uint8_t Hour,
+									uint8_t Minute,
+									uint8_t Second);
+
+/*
+设置地址
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SetAddr(uint8_t Addr);
+
+/*
+设置IP地址
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SetIP(const char * IP);
+/*
+设置端口
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SetPort(uint32_t Port);
+
+/*
+设置波特率
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SetBaud(uint32_t Baud);
+
+/*
+设置扫描频率
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SetScanFre(uint16_t Fre);
+
+/*
+设置亮度
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SetLight(uint8_t Light);
+
+/*
+设置音量
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SetVol(uint8_t Vol);
+
+/*
+重启系统
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_Reset(void);
+
+/*
+	配置IO口功能
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_CfgIO(IO_PIN_ID_E Pin,IO_PIN_FUN_E Fun);
+
+/*
+	设置IO口输出状态
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SetOutState(IO_PIN_ID_E Pin,int OnOff);
+
+/*
+	读取IO口输入状态
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_ReadInputState(IO_PIN_ID_E Pin,int * pRetState);
+
+/*
+	设置LED驱动程序
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SetDrv(int v);
+
+/*
+	设置OE极性
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SetOEPolarity(int v);
+
+/*
+	设置数据极性
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SetDataPolarity(int v);
+
+/*
+	设置LE信号延时
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SetLEDelay(int En);
+
+/*
+	设置网关和掩码
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SetGWAndMask(const char * GW,const char * Mask);
+
+/*
+	进入安全模式
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_EnterSafMode(const char * pswd);
+
+/*
+	计算验证码
+	
+	Msg: 消息地址
+	MsgLen: 消息长度,最多255个字节,如果大于255,只会计算前255个字节。
+	pOutResult:返回的32位结果
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_Clic(const char * Msg,int MsgLen,int * pOutResult);
+
+/*
+	设置显示尺寸
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SetDisSize(int XSize,int YSize);
+
+/*
+	设置显示镜像
+*/
+DUCP_ERR_T	DUCP_HOST_SYS_SetXYMIR(int Flag);
+
+/*
+	挂载目录
+*/
+DUCP_ERR_T	DUCP_HOST_FM_Mount(const char * Path);
+
+/*
+	打开文件
+*/
+DUCP_ERR_T	DUCP_HOST_FM_Open(const char * Path,int Opt);
+
+/*
+	设置文件的读写位置
+*/
+DUCP_ERR_T	DUCP_HOST_FM_Seek(int Offset);
+
+/*
+	写文件
+*/
+DUCP_ERR_T	DUCP_HOST_FM_Write(const uint8_t * pData,uint32_t Size);
+
+/*
+	读文件
+*/
+DUCP_ERR_T	DUCP_HOST_FM_Read(uint8_t * pData,uint32_t Size,uint32_t * pRetSize);
+
+/*
+	同步文件缓存数据
+*/
+DUCP_ERR_T	DUCP_HOST_FM_SynBuff(void);
+
+/*
+	关闭当前文件
+*/
+DUCP_ERR_T	DUCP_HOST_FM_Close(void);
+
+/*
+	删除当前文件
+*/
+DUCP_ERR_T	DUCP_HOST_FM_Del(const char * Path);
+
+/*
+	复制文件
+*/
+DUCP_ERR_T	DUCP_HOST_FM_Copy(const char * DesPath,const char * SrcPath,int Opt);
+
+/*
+	格式化磁盘
+*/
+DUCP_ERR_T	DUCP_HOST_FM_FDisk(void);
+
+/*
+播放语音
+*/
+DUCP_ERR_T	DUCP_HOST_TTS_Play(const char * pText, uint8_t Opt);
+
+/*
+停止播放语音
+*/
+DUCP_ERR_T	DUCP_HOST_TTS_Stop(void);
+
+/*
+绘制点
+*/
+DUCP_ERR_T	DUCP_HOST_2D_DrawPoint(int x0, int y0);
+
+/*
+绘制线
+*/
+DUCP_ERR_T	DUCP_HOST_2D_DrawLine(int x0, int y0, int x1, int y1);
+
+/*
+绘制矩形
+*/
+DUCP_ERR_T	DUCP_HOST_2D_DrawRect(int x0, int y0, int x1, int y1);
+
+/*
+填充矩形
+*/
+DUCP_ERR_T	DUCP_HOST_2D_FillRect(int x0, int y0, int x1, int y1);
+
+/*
+绘制圆
+*/
+DUCP_ERR_T	DUCP_HOST_2D_DrawCircle(int x0, int y0, int r);
+
+/*
+填充圆
+*/
+DUCP_ERR_T	DUCP_HOST_2D_FillCircle(int x0, int y0, int r);
+
+/*
+绘制位图
+*/
+DUCP_ERR_T	DUCP_HOST_2D_DrawBitmap(int x0, int y0, int xSize, int ySize,
+									int BitsPerPixle, int BytesPerLine,
+									int DataSize, int ColorTabelSize,
+									const uint8_t * pData);
+
+/*
+显示文本
+*/
+DUCP_ERR_T	DUCP_HOST_2D_DisText(int x0, int y0, const char * pText);
+
+/*
+设置绘图颜色
+*/
+DUCP_ERR_T	DUCP_HOST_2D_SetColor(int Color);
+
+/*
+设置背景颜色
+*/
+DUCP_ERR_T	DUCP_HOST_2D_SetBkColor(int Color);
+
+/*
+设置字体
+*/
+DUCP_ERR_T	DUCP_HOST_2D_SetFont(int FontIndex);
+
+/*
+绘制系统自带的位图
+*/
+DUCP_ERR_T	DUCP_HOST_2D_DrawSysIcon(int x0, int y0, int Num,int Denom,int IconIndex);
+
+/*
+显示所有窗口
+*/
+DUCP_ERR_T	DUCP_HOST_WM_ShowWindow(int WinID);
+
+/*
+隐藏所有窗口
+*/
+DUCP_ERR_T	DUCP_HOST_WM_HideWindow(int WinID);
+
+/*
+删除所有窗口
+*/
+DUCP_ERR_T	DUCP_HOST_WM_DelWindow(int WinID);
+
+/*
+	设置窗口自动同步显示
+*/
+DUCP_ERR_T	DUCP_HOST_WM_AutoSyn(int En);
+
+
+/*
+创建文本控件
+*/
+DUCP_ERR_T DUCP_HOST_TWIN_Create(int WinID, int Stile, int x0, int y0, int xSize, int ySize);
+
+/*
+删除文本控件
+*/
+DUCP_ERR_T DUCP_HOST_TWIN_Del(int WinID);
+
+
+/*
+在文本控件上显示文本。这个接口下载的文字掉电后不能保存。推荐使用这个接口显示经常更改的内容。
+*/
+DUCP_ERR_T DUCP_HOST_TWIN_DisText(	int WinID,
+									const char * pText,
+									int EnterMode,
+									int EnterSpeed,
+									int DelayMode,
+									int DelayTime,
+									int EixtMode,
+									int EixtSpeed,
+									int FontIndex,
+									int TextColor,
+									int BkColor,
+									int DisTimes);
+
+/*
+设置文本控件的字体
+*/
+DUCP_ERR_T DUCP_HOST_TWIN_SetFont(int WinID, int FontIndex);
+
+/*
+设置文本控件的文本颜色
+*/
+DUCP_ERR_T DUCP_HOST_TWIN_SetTextColor(int WinID, int Color);
+
+/*
+设置文本控件的背景颜色
+*/
+DUCP_ERR_T DUCP_HOST_TWIN_SetBkColor(int WinID, int Color);
+
+/*
+停止显示文本控件
+*/
+DUCP_ERR_T DUCP_HOST_TWIN_StopDis(int WinID);
+
+/*
+下载文本文件与文本控件关联。这个接口下载的文字会保存在磁盘中,掉电会保存。
+不建议频繁使用这个接口,这样会对降低FLASH的使用寿命。
+建议对不经常更改的内容下载到磁盘中。例如 广告语等。
+*/
+DUCP_ERR_T DUCP_HOST_TWIN_DownTextFile(	int WinID,
+										int FileID,
+										const char * pText,
+										int EnterMode,
+										int EnterSpeed,
+										int DelayMode,
+										int DelayTime,
+										int EixtMode,
+										int EixtSpeed,
+										int FontIndex,
+										int TextColor,
+										int BkColor);
+/*
+显示文本控件的文本文件
+*/
+DUCP_ERR_T DUCP_HOST_TWIN_DisFile(int WinID, int FileID);
+
+/*
+打开文本控件的文本文件
+*/
+DUCP_ERR_T DUCP_HOST_TWIN_OpenFile(int WinID, int FileID);
+
+/*
+关闭文本控件的文本文件
+*/
+DUCP_ERR_T DUCP_HOST_TWIN_CloseFile(int WinID, int FileID);
+
+/*
+删除文本控件的文本文件
+*/
+DUCP_ERR_T DUCP_HOST_TWIN_DelFile(int WinID, int FileID);
+
+/*
+	同步显示多个文本控件
+*/
+DUCP_ERR_T DUCP_HOST_TWIN_SynDis(char * pList,int NumBytes);
+
+/*
+	多行显示并且播报语音
+*/
+DUCP_ERR_T DUCP_HOST_TWIN_SYN_DisEx(	int StartWinID,
+													const char * pText,
+													int EnterMode,
+													int EnterSpeed,
+													int DelayMode,
+													int DelayTime,
+													int EixtMode,
+													int EixtSpeed,
+													int FontIndex,
+													int TextColor,
+													int BkColor,
+													int DisTimes,
+													const char * pVoice);
+
+/*
+创建图片控件
+*/
+DUCP_ERR_T DUCP_HOST_PIC_Create(int WinID,int x0, int y0, int xSize, int ySize);
+
+/*
+删除图片控件
+*/
+DUCP_ERR_T DUCP_HOST_PIC_Del(int WinID);
+
+/*
+向图片控件追加图片
+*/
+DUCP_ERR_T DUCP_HOST_PIC_Add(int WinID,int FID,uint8_t EnterMode,uint8_t EnterSpeed,
+							uint8_t StopMode,uint8_t StopTime,uint8_t ExitMode,uint8_t ExitSpeed);
+
+/*
+删除所有图片
+*/
+DUCP_ERR_T DUCP_HOST_PIC_Clr(int WinID);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+
+

+ 254 - 0
DUCP协议栈/src/MBMsg.c

@@ -0,0 +1,254 @@
+
+
+#include <stdint.h>
+#include "MBMsg.h"
+
+#define BRODADDR0_DEF	           (200)/*默认的广播地址*/
+
+
+#define MB_PAK_BUFF_SIZE		(MB_MSG_SIZE_MAX + 8)
+
+static cbSTKOut_t _cbSTKOut = 0;
+static cbMsgRdy_t _cbMsgRdy = 0;
+static uint8_t 	_RxBuff[MB_PAK_BUFF_SIZE];
+static uint16_t _RxIndex = 0;
+static uint16_t _RxRdy = 0;
+static uint8_t 	_TxBuff[MB_PAK_BUFF_SIZE];
+static uint16_t _TxRdy = 0;
+static uint8_t  _Addr = MB_STK_ADDR_DEF;
+static uint8_t  _LstAddr = 0;
+static uint8_t  _FC = MB_STK_FC_DEF;;
+
+
+/*Private variables-----------------------------------------------------------*/
+static const uint8_t _CRCHi[] = {
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
+    0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 
+    0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40
+};
+static const uint8_t _CRCLo[] = {
+    0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, 0x07, 0xC7,
+    0x05, 0xC5, 0xC4, 0x04, 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E,
+    0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, 0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9,
+    0x1B, 0xDB, 0xDA, 0x1A, 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC,
+    0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, 0x12, 0x13, 0xD3,
+    0x11, 0xD1, 0xD0, 0x10, 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32,
+    0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4, 0x3C, 0xFC, 0xFD, 0x3D,
+    0xFF, 0x3F, 0x3E, 0xFE, 0xFA, 0x3A, 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38, 
+    0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, 0x2A, 0xEA, 0xEE, 0x2E, 0x2F, 0xEF,
+    0x2D, 0xED, 0xEC, 0x2C, 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26,
+    0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, 0xA0, 0x60, 0x61, 0xA1,
+    0x63, 0xA3, 0xA2, 0x62, 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4,
+    0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, 0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB, 
+    0x69, 0xA9, 0xA8, 0x68, 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA,
+    0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, 0x74, 0x75, 0xB5,
+    0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0,
+    0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92, 0x96, 0x56, 0x57, 0x97,
+    0x55, 0x95, 0x94, 0x54, 0x9C, 0x5C, 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E,
+    0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98, 0x88, 0x48, 0x49, 0x89,
+    0x4B, 0x8B, 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C,
+    0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, 0x43, 0x83,
+    0x41, 0x81, 0x80, 0x40
+};
+
+/*
+    CRC16校验函数
+*/
+uint16_t MB_CRC16(uint8_t *pFrame, uint16_t count)
+{
+    uint8_t CRCHi = 0xFF;
+    uint8_t CRCLo = 0xFF;
+    int32_t index;
+    while(count--) {
+        index = CRCLo ^ *(pFrame++);
+        CRCLo = (uint8_t)(CRCHi ^ _CRCHi[index]);
+        CRCHi = _CRCLo[index];
+    }
+    return (uint16_t)(CRCHi << 8 | CRCLo );
+}
+
+/*
+	协议栈数据输入
+	Addr + FC + PN[2] + MSGID + DLEN + DATA[...] + CRC[2]
+*/
+int8_t MB_STK_In(uint8_t * pBuff,uint16_t Size)
+{
+	uint16_t i;
+	uint8_t Data;
+	
+	if(_RxRdy) {
+		return -1;
+	}
+
+	for(i = 0;i < Size;i ++) {
+		Data = pBuff[i];
+		if(_RxIndex == 0) {
+			if((Data == _Addr) || (Data == BRODADDR0_DEF)) {
+				_RxBuff[_RxIndex ++] = Data;
+				_LstAddr = Data;
+			}
+		} else if(_RxIndex == 1) {
+			if(Data == _FC) {
+				_RxBuff[_RxIndex ++] = Data;
+			} else {
+				_RxIndex = 0;
+			}
+		} else if(_RxIndex < MB_PAK_BUFF_SIZE) {
+			_RxBuff[_RxIndex ++] = Data;
+			if(_RxIndex == 6) {
+				if(Data > (Size - i - 1)) {
+					Data = (Size - i - 1);
+				}
+				while(Data --) {
+					_RxBuff[_RxIndex ++] = pBuff[++i];
+				}
+			} else if(_RxIndex > 6) {
+				if(_RxIndex >= (_RxBuff[5] + 2 + 6)) {
+					uint16_t CRC16;
+					uint16_t CheckCode;
+					CRC16 = MB_CRC16(&_RxBuff[0],_RxIndex - 2);
+					CheckCode = _RxBuff[_RxIndex - 2];
+					CheckCode |= _RxBuff[_RxIndex - 1] << 8;
+					if(CRC16 == CheckCode) {
+						_RxRdy = 1;
+						if(_cbMsgRdy) {
+							if(_cbMsgRdy((MB_MSG_T *) &_RxBuff[2]) == 0) {
+								_RxRdy = 0;
+							}
+						}
+					}
+					_RxIndex = 0;
+				} 
+			}
+		} else {
+			_RxIndex = 0;
+		}
+	}
+	return 1;
+}
+
+/*
+	设置地址
+*/
+uint8_t MB_STK_SetAddr(uint8_t NewAddr)
+{
+	uint8_t Old;
+	Old = _Addr;
+	_Addr = NewAddr;
+	return Old;
+}
+
+/*
+	设置消息就绪回调函数
+*/
+void MB_STK_SetOutCallback(cbSTKOut_t cb)
+{
+	_cbSTKOut = cb;
+}
+
+/*
+	设置消息就绪回调函数
+*/
+void MB_MSG_SetMsgRdyCallback(cbMsgRdy_t cb)
+{
+	_cbMsgRdy = cb;
+}
+
+
+/*
+	发送消息
+	PN + MSGID + DLEN + DATA
+*/
+int8_t MB_MSG_Send(MB_MSG_T * pMsg,uint32_t Ovtime)
+{
+	uint16_t 	CRC16;
+	int8_t 		Ret;
+	uint16_t 	Index;
+	uint16_t 	i;
+	
+	if(_TxRdy || (!pMsg)) {
+		return -1;
+	}
+	if(sizeof(MB_MSG_T) > sizeof(_TxBuff)) {
+		return -2;
+	}
+	
+	_RxRdy	= 0;
+	_TxRdy 	= 1;
+	Index	= 0;
+	_TxBuff[Index ++] = _LstAddr;//_Addr;
+	_TxBuff[Index ++] = _FC;
+	_TxBuff[Index ++] = pMsg->PN[0];
+	_TxBuff[Index ++] = pMsg->PN[1];
+	_TxBuff[Index ++] = pMsg->MsgId;
+	_TxBuff[Index ++] = pMsg->DLen;
+	for(i = 0;i < pMsg->DLen;i ++) {
+		_TxBuff[Index ++] = pMsg->Data[i];
+	}
+	CRC16 = MB_CRC16(&_TxBuff[0],Index);
+	_TxBuff[Index ++] = CRC16 & 0XFF;
+	_TxBuff[Index ++] = (CRC16 >> 8) & 0XFF;
+	
+	if(_cbSTKOut) {
+		Ret = _cbSTKOut(_TxBuff,Index);
+	} else {
+		Ret = 0;
+	}
+	_TxRdy = 0;
+	
+	return Ret;
+}
+
+/*
+	读消息
+	PN + MSGID + DLEN + DATA
+*/
+int8_t MB_MSG_Read(MB_MSG_T * pMsg,uint32_t Ovtime)
+{
+	uint16_t i;
+	if(!_RxRdy || (!pMsg)) {
+		return -1;
+	}
+	pMsg->PN[0] = _RxBuff[2];
+	pMsg->PN[1] = _RxBuff[3];
+	pMsg->MsgId = _RxBuff[4];
+	pMsg->DLen  = _RxBuff[5];
+	for(i = 0;i < pMsg->DLen;i ++) {
+		pMsg->Data[i] = _RxBuff[6 + i];
+	}
+	_RxRdy = 0;
+	return 0;
+}
+
+
+/*
+	读消息
+	PN + MSGID + DLEN + DATA
+*/
+MB_MSG_T * MB_MSG_ReadEx(uint32_t Ovtime)
+{
+	if(!_RxRdy) {
+		return 0;
+	}
+	_RxRdy = 0;
+	return (MB_MSG_T *)&_RxBuff[2];
+}

+ 82 - 0
DUCP协议栈/src/MBmsg.h

@@ -0,0 +1,82 @@
+
+#ifndef _MBMSG_H_
+#define _MBMSG_H_
+
+#include <stdint.h>
+
+#if defined(__cplusplus)
+extern "C" {     /* Make sure we have C-declarations in C++ programs */
+#endif
+
+#define MB_STK_ADDR_DEF		(0x00)	/*默认的地址*/
+#define MB_STK_FC_DEF		(100)	/*默认的功能码*/
+
+
+#define MB_MSG_SIZE_MAX		(255)
+
+/*
+	消息结构
+*/
+typedef struct {
+	uint8_t 	PN[2];
+	uint8_t  	MsgId;
+	uint8_t 	DLen;
+	uint8_t  	Data[MB_MSG_SIZE_MAX];
+} MB_MSG_T;
+
+/*
+	消息接收完成回调函数类型
+*/
+typedef int8_t (*cbMsgRdy_t)(MB_MSG_T *);
+
+typedef int8_t (*cbSTKOut_t)(uint8_t * p,uint32_t size);
+
+/*
+    CRC16校验函数
+*/
+uint16_t MB_CRC16(uint8_t *pFrame, uint16_t count);
+
+/*
+	设置协议数据输出回调函数
+*/
+void MB_STK_SetOutCallback(cbSTKOut_t cb);
+
+/*
+	协议栈数据输入
+*/
+int8_t MB_STK_In(uint8_t * pBuff,uint16_t Size);
+/*
+	设置地址
+*/
+uint8_t MB_STK_SetAddr(uint8_t NewAddr);
+
+/*
+	设置消息就绪回调函数
+*/
+void MB_MSG_SetMsgRdyCallback(cbMsgRdy_t cb);
+
+
+/*
+	发送消息
+	PN + MSGID + DLEN + DATA
+*/
+int8_t MB_MSG_Send(MB_MSG_T * pMsg,uint32_t Ovtime);
+
+/*
+	读消息
+	PN + MSGID + DLEN + DATA
+*/
+int8_t MB_MSG_Read(MB_MSG_T * pMsg,uint32_t Ovtime);
+
+/*
+	读消息
+	PN + MSGID + DLEN + DATA
+*/
+MB_MSG_T * MB_MSG_ReadEx(uint32_t Ovtime);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+

+ 390 - 0
DUCP协议栈/vc/MBPHY.c

@@ -0,0 +1,390 @@
+
+
+#include <stdint.h>
+#include <stdio.h>                      //用于输入、输出函数的调用,printf, gets
+#include <winsock2.h>                   //socket头文件
+#include <Windows.h>                    //为了方便调试,所以加入了等待2秒才进行连接server,这里用到了sleep函数
+#include "Comm.h"
+#include "mbmsg.h"
+#include "mbphy.h"
+#pragma comment (lib, "ws2_32")         //socket库文件
+
+static char _IP[32] = "192.168.100.100";
+static int  _Port;
+static int _DevID = 0;
+static HANDLE _hComm;
+static char  _strComm[32] = "";
+static uint32_t _Baud = 19200;
+static uint8_t _RxBuff[512];
+static uint16_t _RxSize;
+static uint8_t _TxBuff[512];
+static uint16_t _TxSize;
+
+
+static pfcbSTK_t _cbOut = 0;
+static pfcbSTK_t _cbIn = 0;
+
+
+int8_t MB_STK_Out(uint8_t * pBuff, uint16_t Size);
+/*
+	选择物理设备
+*/
+void MB_PHY_SelPHY(int ID)
+{
+	_DevID = ID;
+}
+
+/*
+	设置IP地址和端口
+*/
+void MB_PHY_SetIP(const char * IP, int Port)
+{
+	strcpy(_IP, IP);
+	_Port = Port;
+	MB_STK_SetOutCallback(MB_STK_Out);
+}
+
+/*
+设置串口号和波特率
+*/
+void MB_PHY_SetBaud(const char * CommName, int Baud)
+{
+	strcpy(_strComm, CommName);
+	_Baud = Baud;
+	MB_STK_SetOutCallback(MB_STK_Out);
+}
+
+/*设置输入输出回调*/
+void MB_PHY_SetCallback(pfcbSTK_t cbOut, pfcbSTK_t cbIn)
+{
+	_cbOut = cbOut;
+	_cbIn = cbIn;
+}
+
+
+#if 0
+void Connect(void)
+{
+	WSADATA wsd;
+	SOCKET cClient;
+	int ret;
+	struct sockaddr_in server;
+	hostent *host = NULL;
+
+	if (WSAStartup(MAKEWORD(2, 0), &wsd)){ return 0; }
+	cClient = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+	if (cClient == INVALID_SOCKET){ return 0; }
+	//set Recv and Send time out
+	int TimeOut = 6000; //设置发送超时6秒
+	if (setsockopt(cClient, SOL_SOCKET, SO_SNDTIMEO, (char *)&TimeOut, sizeof(TimeOut)) == SOCKET_ERROR){
+		return 0;
+	}
+	TimeOut = 6000;//设置接收超时6秒
+	if (setsockopt(cClient, SOL_SOCKET, SO_RCVTIMEO, (char *)&TimeOut, sizeof(TimeOut)) == SOCKET_ERROR){
+		return 0;
+	}
+	//设置非阻塞方式连接
+	unsigned long ul = 1;
+	ret = ioctlsocket(cClient, FIONBIO, (unsigned long*)&ul);
+	if (ret == SOCKET_ERROR)return 0;
+
+	//连接
+	server.sin_family = AF_INET;
+	server.sin_port = htons(25);
+	server.sin_addr.s_addr = inet_addr((LPCSTR)pSmtp);
+	if (server.sin_addr.s_addr == INADDR_NONE){ return 0; }
+
+	connect(cClient, (const struct sockaddr *)&server, sizeof(server));
+
+	//select 模型,即设置超时
+	struct timeval timeout;
+	fd_set r;
+
+	FD_ZERO(&r);
+	FD_SET(cClient, &r);
+	timeout.tv_sec = 15; //连接超时15秒
+	timeout.tv_usec = 0;
+	ret = select(0, 0, &r, 0, &timeout);
+	if (ret <= 0)
+	{
+		closesocket(cClient);
+		return 0;
+	}
+	//一般非锁定模式套接比较难控制,可以根据实际情况考虑 再设回阻塞模式
+	unsigned long ul1 = 0;
+	ret = ioctlsocket(cClient, FIONBIO, (unsigned long*)&ul1);
+	if (ret == SOCKET_ERROR){
+		closesocket(cClient);
+		return 0;
+	}
+}
+#endif
+
+#if 0
+/*
+	收发数据
+*/
+int8_t MB_PHY_TCP_SendReceve(uint8_t * pBuff, uint16_t Size, uint8_t * pRBuff, uint16_t *pRSize)
+{
+	WSADATA         wd;
+	int ret = 0;
+	static SOCKET c = 0;
+	SOCKADDR_IN saddr;
+	uint8_t recvBuf[1000];
+
+	/*1.初始化操作*/
+	ret = WSAStartup(MAKEWORD(2, 2), &wd);
+	if (ret != 0) {
+		return -1;
+	}
+	if (HIBYTE(wd.wVersion) != 2 || LOBYTE(wd.wVersion) != 2) {
+		WSACleanup();
+		return -1;
+	}
+	if (c == 0) {
+		/*2.创建客户端socket*/
+		c = socket(AF_INET, SOCK_STREAM, 0);
+		int nNetTimeout = 2000;
+		if (SOCKET_ERROR == setsockopt(c, SOL_SOCKET, SO_RCVTIMEO, (char *)&nNetTimeout, sizeof(int)))
+		{
+			closesocket(c);
+			WSACleanup();
+			return -1;
+		}
+		if (SOCKET_ERROR == setsockopt(c, SOL_SOCKET, SO_SNDTIMEO, (char *)&nNetTimeout, sizeof(int)))
+		{
+			closesocket(c);
+			WSACleanup();
+			return -1;
+		}
+
+		/*3.定义要连接的服务端信息*/
+		saddr.sin_addr.S_un.S_addr = inet_addr(_IP);
+		saddr.sin_family = AF_INET;
+		saddr.sin_port = htons(_Port);
+
+		/*4.连接服务端*/
+		ret = connect(c, (SOCKADDR*)&saddr, sizeof(SOCKADDR));
+		if (ret != 0)
+		{
+			closesocket(c);
+			WSACleanup();
+			return -1;
+		}
+	}
+
+	/*5。发送数据到服务器*/
+	ret = send(c, pBuff, Size, 0);
+	if (ret == SOCKET_ERROR) {
+		//closesocket(c);
+		WSACleanup();
+		return -1;
+	}
+	/*6.接受服务器的返回*/
+	ret = recv(c, recvBuf, sizeof(recvBuf), 0);
+	if (ret != SOCKET_ERROR) {
+		if (pRBuff) {
+			memcpy(pRBuff, recvBuf, ret);
+			if (pRSize) {
+				*pRSize = ret;
+			}
+		}
+		memcpy(_RxBuff, recvBuf, ret);
+		_RxSize = ret;
+		if (_cbIn) {
+			_cbIn(_RxBuff, _RxSize);
+		}
+		MB_STK_In(recvBuf, ret);
+	}
+	//closesocket(c);
+	//WSACleanup();
+
+	return 0;
+}
+
+#else
+/*
+收发数据
+*/
+int8_t MB_PHY_TCP_SendReceve(uint8_t * pBuff, uint16_t Size, uint8_t * pRBuff, uint16_t *pRSize)
+{
+	WSADATA         wd;
+	int ret = 0;
+	SOCKET c = 0;
+	SOCKADDR_IN saddr;
+	uint8_t recvBuf[1000];
+
+	/*1.初始化操作*/
+	ret = WSAStartup(MAKEWORD(2, 2), &wd);
+	if (ret != 0) {
+		return -1;
+	}
+	if (HIBYTE(wd.wVersion) != 2 || LOBYTE(wd.wVersion) != 2) {
+		WSACleanup();
+		return -1;
+	}
+	/*2.创建客户端socket*/
+	c = socket(AF_INET, SOCK_STREAM, 0);
+	int nNetTimeout = 2000;
+	if (SOCKET_ERROR == setsockopt(c, SOL_SOCKET, SO_RCVTIMEO, (char *)&nNetTimeout, sizeof(int)))
+	{
+		closesocket(c);
+		WSACleanup();
+		return -1;
+	}
+	if (SOCKET_ERROR == setsockopt(c, SOL_SOCKET, SO_SNDTIMEO, (char *)&nNetTimeout, sizeof(int)))
+	{
+		closesocket(c);
+		WSACleanup();
+		return -1;
+	}
+
+	/*3.定义要连接的服务端信息*/
+	saddr.sin_addr.S_un.S_addr = inet_addr(_IP);
+	saddr.sin_family = AF_INET;
+	saddr.sin_port = htons(_Port);
+
+	/*4.连接服务端*/
+	ret = connect(c, (SOCKADDR*)&saddr, sizeof(SOCKADDR));
+	if (ret != 0)
+	{
+		closesocket(c);
+		WSACleanup();
+		return -1;
+	}
+
+	/*5。发送数据到服务器*/
+	ret = send(c, pBuff, Size, 0);
+	if (ret == SOCKET_ERROR) {
+		closesocket(c);
+		WSACleanup();
+		return -1;
+	}
+	/*6.接受服务器的返回*/
+	ret = recv(c, recvBuf, sizeof(recvBuf), 0);
+	if (ret != SOCKET_ERROR) {
+		if (pRBuff) {
+			memcpy(pRBuff, recvBuf, ret);
+			if (pRSize) {
+				*pRSize = ret;
+			}
+		}
+		memcpy(_RxBuff, recvBuf, ret);
+		_RxSize = ret;
+		if (_cbIn) {
+			_cbIn(_RxBuff, _RxSize);
+		}
+		MB_STK_In(recvBuf, ret);
+	}
+
+	closesocket(c);
+	WSACleanup();
+
+	return 0;
+}
+#endif
+
+int8_t MB_PHY_UDP_SendReceve(uint8_t * pBuff, uint16_t Size, uint8_t * pRBuff, uint16_t *pRSize)
+{
+	WSADATA         wd;
+	int ret = 0;
+	static SOCKET c = 0;
+	SOCKADDR_IN saddr;
+	uint8_t recvBuf[1000];
+
+	/*1.初始化操作*/
+	ret = WSAStartup(MAKEWORD(2, 2), &wd);
+	if (ret != 0) {
+		return -1;
+	}
+	if (HIBYTE(wd.wVersion) != 2 || LOBYTE(wd.wVersion) != 2) {
+		WSACleanup();
+		return -1;
+	}
+
+	/*2.创建客户端socket*/
+	if (c == 0) {
+		c = socket(AF_INET, SOCK_DGRAM, 0);
+	}
+	/*5。发送数据到服务器*/
+	saddr.sin_addr.S_un.S_addr = inet_addr(_IP);
+	saddr.sin_family = AF_INET;
+	saddr.sin_port = htons(_Port);
+	sendto(c, pBuff, Size, 0, (SOCKADDR*)&saddr, sizeof(SOCKADDR));
+
+	
+	/*6.接受服务器的返回*/
+	ret = recvfrom(c, recvBuf, sizeof(recvBuf), 0, 0, 0);
+	if (ret != SOCKET_ERROR) {
+		if (pRBuff) {
+			memcpy(pRBuff, recvBuf, ret);
+			if (pRSize) {
+				*pRSize = ret;
+			}
+		}
+		memcpy(_RxBuff, recvBuf, ret);
+		_RxSize = ret;
+		if (_cbIn) {
+			_cbIn(_RxBuff, _RxSize);
+		}
+		MB_STK_In(recvBuf, ret);
+	}
+
+	return 0;
+}
+/*
+协议栈数据输出
+*/
+int8_t MB_STK_OutEx(uint8_t * pBuff, uint16_t Size,uint8_t * pRBuff,uint16_t *pRSize)
+{
+	int MsgSizeMax;
+	int TimeConst;
+
+	//memcpy(_TxBuff, pBuff, Size);
+	//_TxSize = Size;
+
+	if (_cbOut) {
+		_cbOut(pBuff, Size);
+	}
+	switch (_DevID) {
+	case 0:
+		return MB_PHY_TCP_SendReceve(pBuff, Size, pRBuff, pRSize);
+	case 2:
+		return MB_PHY_UDP_SendReceve(pBuff, Size, pRBuff, pRSize);
+	case 1:
+		MsgSizeMax = sizeof(MB_MSG_T)+5;
+		TimeConst = (MsgSizeMax * 1000 / _Baud) + 200;/*通信时间 加上 设备的处理时间(预留200MS)*/
+		_hComm = COMM_OpenEx3(_strComm, _Baud, 8, NOPARITY, ONESTOPBIT, TimeConst, 0, 5, 1000, 2, 0);
+		if (_hComm == 0) {
+			return -1;
+		}
+
+		Sleep(5);
+		//PurgeComm(_hComm, PURGE_TXCLEAR | PURGE_TXABORT);
+		//PurgeComm(_hComm, PURGE_RXCLEAR | PURGE_RXABORT);
+		COMM_Write(_hComm, pBuff, Size);
+		uint32_t rSize = COMM_Read(_hComm, _RxBuff, MsgSizeMax);
+		MB_STK_In(_RxBuff, rSize);
+		if (pRBuff && rSize) {
+			memcpy(pRBuff, _RxBuff, rSize);
+			if (pRSize) {
+				*pRSize = rSize;
+			}
+			_RxSize = rSize;
+			if (_cbIn) {
+				_cbIn(_RxBuff, _RxSize);
+			}
+		}
+		COMM_Close(&_hComm);
+		return 0;
+	}
+	return -1;
+}
+
+/*
+	协议栈数据输出
+*/
+int8_t MB_STK_Out(uint8_t * pBuff, uint16_t Size)
+{
+	return MB_STK_OutEx(pBuff, Size, 0, 0);
+}

+ 23 - 0
DUCP协议栈/vc/MBPHY.h

@@ -0,0 +1,23 @@
+
+
+#ifndef _MB_PHY_
+#define _MB_PHY_
+
+#if defined(__cplusplus)
+extern "C" {     /* Make sure we have C-declarations in C++ programs */
+#endif
+
+typedef void(*pfcbSTK_t)(uint8_t * pBuff, uint16_t Size);
+
+void MB_PHY_SetCallback(pfcbSTK_t cbOut, pfcbSTK_t cbIn);
+void MB_PHY_SelPHY(int ID);
+void MB_PHY_SetIP(const char * IP, int Port);
+void MB_PHY_SetBaud(const char * CommName, int Baud);
+int8_t MB_STK_Out(uint8_t * pBuff, uint16_t Size);
+int8_t MB_STK_OutEx(uint8_t * pBuff, uint16_t Size, uint8_t * pRBuff, uint16_t *pRSize);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif

+ 447 - 0
broadcastDLL/BroadcastModule.cs

@@ -0,0 +1,447 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BroadcastModule
+{
+    public class BroadcastBoard
+    {
+        private UdpClient DUCP_NetSocket;
+        private IPAddress DeviceIP;
+        private IPEndPoint RPoint = null;
+        private IPEndPoint TPoint = null;
+        private int volume = 10;
+        //*********************************************** 动态引用dll ******************************************
+        //实现协议栈数据输出回调函数
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+        unsafe delegate byte cbDUCP_DataOutType(byte* Data, int Size);
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static void MB_STK_SetOutCallback(cbDUCP_DataOutType cb);
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static sbyte MB_STK_In(byte* Data, int Size);
+        //回调对象
+        private cbDUCP_DataOutType cbDuCP_dataout;
+        //回调函数实现
+        unsafe byte cbDUCP_DataOut(byte* Data, int Size)
+        {
+            sbyte Ret;
+            byte[] buff = new byte[256];
+            byte[] RxBuff = new byte[256];
+            for (int i = 0; i < Size; i++)
+            {
+                buff[i] = Data[i];
+            }
+
+            /*发送数据到显示屏*/
+            DUCP_NetSocket.Send(buff, Size, TPoint);
+
+            /*接收显示屏回复的数据*/
+            RxBuff = DUCP_NetSocket.Receive(ref RPoint);
+
+            /*将显示屏的回复的数据传输给协议栈*/
+            unsafe
+            {
+                fixed (byte* pArray = RxBuff)
+                    Ret = MB_STK_In(pArray, RxBuff.Length);
+            }
+            return (byte)Ret;
+        }
+        //调节音量
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_SYS_SetVol(int vol);
+        //播放语音
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_TTS_Play(byte* pText, byte Opt);
+        //停止播放语音
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_TTS_Stop();
+        //重启系统
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_SYS_Reset();
+        //显示已存文件
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_TWIN_DisFile(int WinID, int FileID);
+        //显示文本
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_TWIN_DisText(int WinID,
+                                                            byte* pText,
+                                                            int EnterMode,
+                                                            int EnterSpeed,
+                                                            int DelayMode,
+                                                            int DelayTime,
+                                                            int EixtMode,
+                                                            int EixtSpeed,
+                                                            int FontIndex,
+                                                            int TextColor,
+                                                            int BkColor,
+                                                            int DisTimes);
+        //创建文本控件
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_TWIN_Create(int WinID, int Stile, int x0, int y0, int xSize, int ySize);
+        //删除文本控件中文本文件
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_TWIN_DelFile(int WinID, int FileID);
+        //删除文本控件
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_TWIN_Del(int WinID);
+        //删除图片控件
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_PIC_Del(int WinID);
+        //设置绘图颜色
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_2D_SetColor(int Color);
+        //填充矩形
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_2D_FillRect(int x0, int y0, int x1, int y1);
+        //绘制系统自带位图
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_2D_DrawSysIcon(int x0, int y0, int Num, int Denom, int IconIndex);
+        //创建图片控件
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_PIC_Create(int WinID, int x0, int y0, int xSize, int ySize);
+        //图片控件追加图片
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_PIC_Add(int WinID, int FID, byte EnterMode, byte EnterSpeed,
+                                            byte StopMode, byte StopTime, byte ExitMode, byte ExitSpeed);
+        //更新本地时间
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_SYS_UpdateTime(short Year, byte Month, byte Day, byte Week, byte Hour, byte Minute, byte Second);
+        //更新端口(更新ip方法异常,手动更新)
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_SYS_SetPort(int port);
+        //下载文本文件并与文本控件关联
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_TWIN_DownTextFile(int WinID,
+                                                                int FileID,
+                                                                byte* pText,
+                                                                int EnterMode,
+                                                                int EnterSpeed,
+                                                                int DelayMode,
+                                                                int DelayTime,
+                                                                int EixtMode,
+                                                                int EixtSpeed,
+                                                                int FontIndex,
+                                                                int TextColor,
+                                                                int BkColor);
+
+        //************************************************ 方法块 **************************************************
+        //构造函数
+        public BroadcastBoard(string ip, int port, int volume = 10)
+        {
+            //初始化网络连接配置
+            DeviceIP = IPAddress.Parse(ip);
+            RPoint = new IPEndPoint(DeviceIP, port);
+            TPoint = new IPEndPoint(DeviceIP, port);
+
+            //设置协议栈的回调函数
+            unsafe
+            {
+                cbDuCP_dataout = new cbDUCP_DataOutType(cbDUCP_DataOut);
+                MB_STK_SetOutCallback(cbDuCP_dataout);
+            }
+            //GC.KeepAlive(cbDuCP_dataout);
+            /*#2.创建UDP网络套接字*/
+            DUCP_NetSocket = new UdpClient();
+            this.volume = volume;
+            DUCP_HOST_SYS_SetVol(volume);
+
+            //Refresh();
+        }
+        public void UpdateTime()
+        {
+            DateTime dt = DateTime.Now;
+            DUCP_HOST_SYS_UpdateTime((short)dt.Year, (byte)dt.Month, (byte)dt.Day, (byte)dt.DayOfWeek, (byte)dt.Hour, (byte)dt.Minute, (byte)dt.Second);
+        }
+        /// <summary>
+        /// 刷新屏幕
+        /// </summary>
+        public void Refresh()
+        {
+            DUCP_HOST_TWIN_Del(0);
+            DUCP_HOST_TWIN_Del(1);
+            DUCP_HOST_TWIN_Del(2);
+            DUCP_HOST_TWIN_Del(3);
+            DUCP_HOST_TWIN_Create(0, 0, 0, 0, 64, 16);
+            DUCP_HOST_TWIN_Create(1, 0, 0, 16, 64, 16);
+            DUCP_HOST_TWIN_Create(2, 0, 0, 32, 64, 16);
+            DUCP_HOST_TWIN_Create(3, 0, 0, 48, 64, 16);
+        }
+        /// <summary>
+        /// 显示特定行文字
+        /// </summary>
+        /// <param name="winID"></param>
+        /// <param name="str"></param>
+        /// <returns></returns>
+        public bool DispString(int winID, string str, int time)
+        {
+            byte[] buffer = Encoding.Default.GetBytes(str);
+            if (winID < 0 || winID > 3) { return false; }
+            unsafe
+            {
+                fixed (byte* pArray = buffer)
+                {
+                    try
+                    {
+                        if (time >= 0 && time <= 255)
+                        {
+                            DUCP_HOST_TWIN_DisText(winID, pArray,
+                                0X15, 1,
+                                0X00, time,
+                                0X15, 1,
+                                3, 0Xff, 0X00, 0);
+                        }
+                        else
+                        {
+                            DUCP_HOST_TWIN_DisText(winID, pArray,
+                                0X15, 1,
+                                0X02, 255,
+                                0X15, 1,
+                                3, 0Xff, 0X00, 0);
+                        }
+                    }
+                    catch (Exception ex) { Console.WriteLine(ex.Message); return false; }
+                }
+            }
+            return true;
+        }
+        /// <summary>
+        /// 显示多行文字
+        /// </summary>
+        /// <param name="strs"></param>
+        /// <returns></returns>
+        public bool DispString(string[] strs, bool refresh)
+        {
+            bool normal = true;
+            for (int i = 0; i < 4; i++)
+            {
+                normal = DispString(i, strs[i], 0);
+                if (!normal)
+                {
+                    break;
+                }
+            }
+            return normal;
+        }
+        /// <summary>
+        /// 配置需循环显示的文字,将导致存储器擦写,请勿频繁调用
+        /// </summary>
+        /// <param name="winID"></param>
+        /// <param name="str"></param>
+        public void DownloadString(int winID, string str, int index)
+        {
+            unsafe
+            {
+                byte[] Buff;
+                if (str.Equals("time"))
+                {
+                    Buff = Encoding.Default.GetBytes("`H:`N:`S");
+                    fixed (byte* pArray = Buff)
+                        DUCP_HOST_TWIN_DownTextFile(winID,
+                                                    index >= 0 ? (index <= 15 ? index : 15) : 0,
+                                                    pArray,
+                                                    0X15,
+                                                    1,
+                                                    0X08,
+                                                    255,
+                                                    0X15,
+                                                    1,
+                                                    3,
+                                                    0XFF,
+                                                    0);
+                }
+                else if (str.Equals("date"))
+                {
+                    Buff = Encoding.Default.GetBytes("`M月`D日");
+                    fixed (byte* pArray = Buff)
+                        DUCP_HOST_TWIN_DownTextFile(winID,
+                                                    index >= 0 ? (index <= 15 ? index : 15) : 0,
+                                                    pArray,
+                                                    0X15,
+                                                    1,
+                                                    0X09,
+                                                    255,
+                                                    0X15,
+                                                    1,
+                                                    3,
+                                                    0XFF,
+                                                    0);
+                }
+                else
+                {
+                    Buff = Encoding.Default.GetBytes(str);
+                    fixed (byte* pArray = Buff)
+                        DUCP_HOST_TWIN_DownTextFile(winID,
+                                                    index >= 0 ? (index <= 15 ? index : 15) : 0,
+                                                    pArray,
+                                                    0X15,
+                                                    1,
+                                                    0X02,
+                                                    255,
+                                                    0X15,
+                                                    1,
+                                                    3,
+                                                    0XFF,
+                                                    0);
+                }
+
+            }
+        }
+        /// <summary>
+        /// 配置需循环显示的文字,将导致存储器擦写,请勿频繁调用。写入多个字符串
+        /// </summary>
+        /// <param name="winID"></param>
+        /// <param name="strs"></param>
+        public void DownloadString(int winID, string[] strs)
+        {
+            for (int i = 0; i < Math.Min(16, strs.Length) && strs[i] != ""; i++)
+            {
+                DownloadString(winID, strs[i], i);
+            }
+        }
+        /// <summary>
+        /// 显示已载入文本文件
+        /// </summary>
+        /// <param name="winID"></param>
+        /// <param name="fieldID"></param>
+        public void DispDownStr(int winID, int fieldID)
+        {
+            DUCP_HOST_TWIN_DisFile(winID, fieldID);
+        }
+        /// <summary>
+        /// 播放语音
+        /// </summary>
+        /// <param name="str"></param>
+        public void AudioPlay(string str)
+        {
+            unsafe
+            {
+                try
+                {
+                    byte[] Buff = System.Text.Encoding.Default.GetBytes(str);
+                    fixed (byte* pArray = Buff)
+                    {
+                        DUCP_HOST_TTS_Stop();
+                        DUCP_HOST_TTS_Play(pArray, 0x01);
+                    }
+                }
+                catch (Exception ex)
+                { Console.WriteLine(ex.Message); }
+            }
+        }
+        /// <summary>
+        /// 音量控制
+        /// </summary>
+        /// <param name="offset"></param>
+        public void VolumeControl(int offset, out int vol)
+        {
+            volume += offset;
+            DUCP_HOST_SYS_SetVol(volume);
+            vol = volume;
+        }
+        public void VolumeControl(int vol)
+        {
+            DUCP_HOST_SYS_SetVol(volume >= 0 ? (volume <= 50 ? volume : 50) : 0);
+        }
+        /// <summary>
+        /// 重启机器
+        /// </summary>
+        public void Restart()
+        {
+            DUCP_HOST_SYS_Reset();
+        }
+        /// <summary>
+        /// 删除已下载文本文件
+        /// </summary>
+        /// <param name="winID"></param>
+        /// <param name="startIndex"></param>
+        /// <param name="endIndex"></param>
+        public void DelFile(int winID, int startIndex, int endIndex)
+        {
+            if (winID >= 0 && winID < 4)
+            {
+                for (int i = (startIndex >= 0 ? startIndex : 0); i < (endIndex >= 15 ? 15 : endIndex); i++)
+                {
+                    DUCP_HOST_TWIN_DelFile(winID, i);
+                }
+            }
+        }
+        /// <summary>
+        /// CRC16 
+        /// </summary>
+        /// <param name="data">要进行计算的数组</param>
+        /// <returns>计算后的数组</returns>
+        private static byte[] CRC16(byte[] crcbuf)
+        {
+            int crc = 0xffff;
+            int len = crcbuf.Length;
+            byte[] redata = new byte[2];
+            for (int n = 0; n < len; n++)
+            {
+                byte i;
+                crc = crc ^ crcbuf[n];
+                for (i = 0; i < 8; i++)
+                {
+                    int TT;
+                    TT = crc & 1;
+                    crc = crc >> 1;
+                    crc = crc & 0x7fff;
+                    if (TT == 1)
+                    {
+                        crc = crc ^ 0xa001;
+                    }
+                    crc = crc & 0xffff;
+                }
+            }
+            redata[1] = (byte)((crc >> 8) & 0xff);
+            redata[0] = (byte)((crc & 0xff));
+            return redata;
+        }
+        /// <summary>
+        /// 配置ip与端口
+        /// </summary>
+        /// <param name="ip"></param>
+        /// <param name="port"></param>
+        public void IpConfig(string ip, int port)
+        {
+            IPAddress ipa = null;
+            try
+            {
+                ipa = IPAddress.Parse(ip);
+                if (ipa != null)
+                {
+                    unsafe
+                    {
+                        try
+                        {
+                            byte[] protocol = new byte[] {
+                            0x00,0x64,0xff,0xff,0x08,0x04,
+                            0x00,0x00,0x00,0x00,
+                            0xE6,0x17
+                        };
+                            byte[] Buff = ipa.GetAddressBytes();
+                            Buff.CopyTo(protocol, 6);
+
+                            byte[] temp = new byte[10];
+                            Array.Copy(protocol, temp, 10);
+                            byte[] crc = CRC16(temp);
+                            Array.Copy(crc, 0, protocol, 10, 2);
+                            fixed (byte* pArray = protocol)
+                            {
+                                cbDUCP_DataOut(pArray, 12);
+                            }
+                        }
+                        catch (Exception ex)
+                        { Console.WriteLine(ex.Message); }
+                    }
+                    DUCP_HOST_SYS_SetPort(port);
+                }
+            }
+            catch (Exception ex) { Console.WriteLine(ex.Message); }
+        }
+    }
+}

+ 36 - 0
broadcastDLL/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("broadcastDLL")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("broadcastDLL")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2018")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("7e9331f6-711f-4f82-92fa-500178d89465")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 50 - 0
broadcastDLL/broadcastDLL.csproj

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{7E9331F6-711F-4F82-92FA-500178D89465}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>broadcastDLL</RootNamespace>
+    <AssemblyName>broadcastDLL</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="BroadcastModule.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 6 - 0
broadcastModule/App.config

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
+    </startup>
+</configuration>

+ 447 - 0
broadcastModule/BroadcastModule.cs

@@ -0,0 +1,447 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BroadcastModule
+{
+    public class BroadcastBoard
+    {
+        private UdpClient DUCP_NetSocket;
+        private IPAddress DeviceIP;
+        private IPEndPoint RPoint = null;
+        private IPEndPoint TPoint = null;
+        private int volume = 10;
+        //*********************************************** 动态引用dll ******************************************
+        //实现协议栈数据输出回调函数
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+        unsafe delegate byte cbDUCP_DataOutType(byte* Data, int Size);
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static void MB_STK_SetOutCallback(cbDUCP_DataOutType cb);
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static sbyte MB_STK_In(byte* Data, int Size);
+        //回调对象
+        private cbDUCP_DataOutType cbDuCP_dataout;
+        //回调函数实现
+        unsafe byte cbDUCP_DataOut(byte* Data, int Size)
+        {
+            sbyte Ret;
+            byte[] buff = new byte[256];
+            byte[] RxBuff = new byte[256];
+            for (int i = 0; i < Size; i++)
+            {
+                buff[i] = Data[i];
+            }
+
+            /*发送数据到显示屏*/
+            DUCP_NetSocket.Send(buff, Size, TPoint);
+
+            /*接收显示屏回复的数据*/
+            RxBuff = DUCP_NetSocket.Receive(ref RPoint);
+
+            /*将显示屏的回复的数据传输给协议栈*/
+            unsafe
+            {
+                fixed (byte* pArray = RxBuff)
+                    Ret = MB_STK_In(pArray, RxBuff.Length);
+            }
+            return (byte)Ret;
+        }
+        //调节音量
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_SYS_SetVol(int vol);
+        //播放语音
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_TTS_Play(byte* pText, byte Opt);
+        //停止播放语音
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_TTS_Stop();
+        //重启系统
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_SYS_Reset();
+        //显示已存文件
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_TWIN_DisFile(int WinID, int FileID);
+        //显示文本
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_TWIN_DisText(int WinID,
+                                                            byte* pText,
+                                                            int EnterMode,
+                                                            int EnterSpeed,
+                                                            int DelayMode,
+                                                            int DelayTime,
+                                                            int EixtMode,
+                                                            int EixtSpeed,
+                                                            int FontIndex,
+                                                            int TextColor,
+                                                            int BkColor,
+                                                            int DisTimes);
+        //创建文本控件
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_TWIN_Create(int WinID, int Stile, int x0, int y0, int xSize, int ySize);
+        //删除文本控件中文本文件
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_TWIN_DelFile(int WinID, int FileID);
+        //删除文本控件
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_TWIN_Del(int WinID);
+        //删除图片控件
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_PIC_Del(int WinID);
+        //设置绘图颜色
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_2D_SetColor(int Color);
+        //填充矩形
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_2D_FillRect(int x0, int y0, int x1, int y1);
+        //绘制系统自带位图
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_2D_DrawSysIcon(int x0, int y0, int Num, int Denom, int IconIndex);
+        //创建图片控件
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_PIC_Create(int WinID, int x0, int y0, int xSize, int ySize);
+        //图片控件追加图片
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_PIC_Add(int WinID, int FID, byte EnterMode, byte EnterSpeed,
+                                            byte StopMode, byte StopTime, byte ExitMode, byte ExitSpeed);
+        //更新本地时间
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        extern static byte DUCP_HOST_SYS_UpdateTime(short Year, byte Month, byte Day, byte Week, byte Hour, byte Minute, byte Second);
+        //更新端口(更新ip方法异常,手动更新)
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_SYS_SetPort(int port);
+        //下载文本文件并与文本控件关联
+        [DllImport("DUCP.dll", CallingConvention = CallingConvention.Cdecl)]
+        unsafe extern static byte DUCP_HOST_TWIN_DownTextFile(int WinID,
+                                                                int FileID,
+                                                                byte* pText,
+                                                                int EnterMode,
+                                                                int EnterSpeed,
+                                                                int DelayMode,
+                                                                int DelayTime,
+                                                                int EixtMode,
+                                                                int EixtSpeed,
+                                                                int FontIndex,
+                                                                int TextColor,
+                                                                int BkColor);
+
+        //************************************************ 方法块 **************************************************
+        //构造函数
+        public BroadcastBoard(string ip, int port, int volume = 10)
+        {
+            //初始化网络连接配置
+            DeviceIP = IPAddress.Parse(ip);
+            RPoint = new IPEndPoint(DeviceIP, port);
+            TPoint = new IPEndPoint(DeviceIP, port);
+
+            //设置协议栈的回调函数
+            unsafe
+            {
+                cbDuCP_dataout = new cbDUCP_DataOutType(cbDUCP_DataOut);
+                MB_STK_SetOutCallback(cbDuCP_dataout);
+            }
+            //GC.KeepAlive(cbDuCP_dataout);
+            /*#2.创建UDP网络套接字*/
+            DUCP_NetSocket = new UdpClient();
+            this.volume = volume;
+            DUCP_HOST_SYS_SetVol(volume);
+
+            //Refresh();
+        }
+        public void UpdateTime()
+        {
+            DateTime dt = DateTime.Now;
+            DUCP_HOST_SYS_UpdateTime((short)dt.Year, (byte)dt.Month, (byte)dt.Day, (byte)dt.DayOfWeek, (byte)dt.Hour, (byte)dt.Minute, (byte)dt.Second);
+        }
+        /// <summary>
+        /// 刷新屏幕
+        /// </summary>
+        public void Refresh()
+        {
+            DUCP_HOST_TWIN_Del(0);
+            DUCP_HOST_TWIN_Del(1);
+            DUCP_HOST_TWIN_Del(2);
+            DUCP_HOST_TWIN_Del(3);
+            DUCP_HOST_TWIN_Create(0, 0, 0, 0, 64, 16);
+            DUCP_HOST_TWIN_Create(1, 0, 0, 16, 64, 16);
+            DUCP_HOST_TWIN_Create(2, 0, 0, 32, 64, 16);
+            DUCP_HOST_TWIN_Create(3, 0, 0, 48, 64, 16);
+        }
+        /// <summary>
+        /// 显示特定行文字
+        /// </summary>
+        /// <param name="winID"></param>
+        /// <param name="str"></param>
+        /// <returns></returns>
+        public bool DispString(int winID, string str, int time)
+        {
+            byte[] buffer = Encoding.Default.GetBytes(str);
+            if (winID < 0 || winID > 3) { return false; }
+            unsafe
+            {
+                fixed (byte* pArray = buffer)
+                {
+                    try
+                    {
+                        if (time >= 0 && time <= 255)
+                        {
+                            DUCP_HOST_TWIN_DisText(winID, pArray,
+                                0X15, 1,
+                                0X00, time,
+                                0X15, 1,
+                                3, 0Xff, 0X00, 0);
+                        }
+                        else
+                        {
+                            DUCP_HOST_TWIN_DisText(winID, pArray,
+                                0X15, 1,
+                                0X02, 255,
+                                0X15, 1,
+                                3, 0Xff, 0X00, 0);
+                        }
+                    }
+                    catch (Exception ex) { Console.WriteLine(ex.Message); return false; }
+                }
+            }
+            return true;
+        }
+        /// <summary>
+        /// 显示多行文字
+        /// </summary>
+        /// <param name="strs"></param>
+        /// <returns></returns>
+        public bool DispString(string[] strs, bool refresh)
+        {
+            bool normal = true;
+            for (int i = 0; i < 4; i++)
+            {
+                normal = DispString(i, strs[i], 0);
+                if (!normal)
+                {
+                    break;
+                }
+            }
+            return normal;
+        }
+        /// <summary>
+        /// 配置需循环显示的文字,将导致存储器擦写,请勿频繁调用
+        /// </summary>
+        /// <param name="winID"></param>
+        /// <param name="str"></param>
+        public void DownloadString(int winID, string str, int index)
+        {
+            unsafe
+            {
+                byte[] Buff;
+                if (str.Equals("time"))
+                {
+                    Buff = Encoding.Default.GetBytes("`H:`N:`S");
+                    fixed (byte* pArray = Buff)
+                        DUCP_HOST_TWIN_DownTextFile(winID,
+                                                    index >= 0 ? (index <= 15 ? index : 15) : 0,
+                                                    pArray,
+                                                    0X15,
+                                                    1,
+                                                    0X08,
+                                                    255,
+                                                    0X15,
+                                                    1,
+                                                    3,
+                                                    0XFF,
+                                                    0);
+                }
+                else if (str.Equals("date"))
+                {
+                    Buff = Encoding.Default.GetBytes("`M月`D日");
+                    fixed (byte* pArray = Buff)
+                        DUCP_HOST_TWIN_DownTextFile(winID,
+                                                    index >= 0 ? (index <= 15 ? index : 15) : 0,
+                                                    pArray,
+                                                    0X15,
+                                                    1,
+                                                    0X09,
+                                                    255,
+                                                    0X15,
+                                                    1,
+                                                    3,
+                                                    0XFF,
+                                                    0);
+                }
+                else
+                {
+                    Buff = Encoding.Default.GetBytes(str);
+                    fixed (byte* pArray = Buff)
+                        DUCP_HOST_TWIN_DownTextFile(winID,
+                                                    index >= 0 ? (index <= 15 ? index : 15) : 0,
+                                                    pArray,
+                                                    0X15,
+                                                    1,
+                                                    0X02,
+                                                    255,
+                                                    0X15,
+                                                    1,
+                                                    3,
+                                                    0XFF,
+                                                    0);
+                }
+
+            }
+        }
+        /// <summary>
+        /// 配置需循环显示的文字,将导致存储器擦写,请勿频繁调用。写入多个字符串
+        /// </summary>
+        /// <param name="winID"></param>
+        /// <param name="strs"></param>
+        public void DownloadString(int winID, string[] strs)
+        {
+            for (int i = 0; i < Math.Min(16, strs.Length) && strs[i] != ""; i++)
+            {
+                DownloadString(winID, strs[i], i);
+            }
+        }
+        /// <summary>
+        /// 显示已载入文本文件
+        /// </summary>
+        /// <param name="winID"></param>
+        /// <param name="fieldID"></param>
+        public void DispDownStr(int winID, int fieldID)
+        {
+            DUCP_HOST_TWIN_DisFile(winID, fieldID);
+        }
+        /// <summary>
+        /// 播放语音
+        /// </summary>
+        /// <param name="str"></param>
+        public void AudioPlay(string str)
+        {
+            unsafe
+            {
+                try
+                {
+                    byte[] Buff = System.Text.Encoding.Default.GetBytes(str);
+                    fixed (byte* pArray = Buff)
+                    {
+                        DUCP_HOST_TTS_Stop();
+                        DUCP_HOST_TTS_Play(pArray, 0x01);
+                    }
+                }
+                catch (Exception ex)
+                { Console.WriteLine(ex.Message); }
+            }
+        }
+        /// <summary>
+        /// 音量控制
+        /// </summary>
+        /// <param name="offset"></param>
+        public void VolumeControl(int offset, out int vol)
+        {
+            volume += offset;
+            DUCP_HOST_SYS_SetVol(volume);
+            vol = volume;
+        }
+        public void VolumeControl(int vol)
+        {
+            DUCP_HOST_SYS_SetVol(volume >= 0 ? (volume <= 50 ? volume : 50) : 0);
+        }
+        /// <summary>
+        /// 重启机器
+        /// </summary>
+        public void Restart()
+        {
+            DUCP_HOST_SYS_Reset();
+        }
+        /// <summary>
+        /// 删除已下载文本文件
+        /// </summary>
+        /// <param name="winID"></param>
+        /// <param name="startIndex"></param>
+        /// <param name="endIndex"></param>
+        public void DelFile(int winID, int startIndex, int endIndex)
+        {
+            if (winID >= 0 && winID < 4)
+            {
+                for (int i = (startIndex >= 0 ? startIndex : 0); i < (endIndex >= 15 ? 15 : endIndex); i++)
+                {
+                    DUCP_HOST_TWIN_DelFile(winID, i);
+                }
+            }
+        }
+        /// <summary>
+        /// CRC16 
+        /// </summary>
+        /// <param name="data">要进行计算的数组</param>
+        /// <returns>计算后的数组</returns>
+        private static byte[] CRC16(byte[] crcbuf)
+        {
+            int crc = 0xffff;
+            int len = crcbuf.Length;
+            byte[] redata = new byte[2];
+            for (int n = 0; n < len; n++)
+            {
+                byte i;
+                crc = crc ^ crcbuf[n];
+                for (i = 0; i < 8; i++)
+                {
+                    int TT;
+                    TT = crc & 1;
+                    crc = crc >> 1;
+                    crc = crc & 0x7fff;
+                    if (TT == 1)
+                    {
+                        crc = crc ^ 0xa001;
+                    }
+                    crc = crc & 0xffff;
+                }
+            }
+            redata[1] = (byte)((crc >> 8) & 0xff);
+            redata[0] = (byte)((crc & 0xff));
+            return redata;
+        }
+        /// <summary>
+        /// 配置ip与端口
+        /// </summary>
+        /// <param name="ip"></param>
+        /// <param name="port"></param>
+        public void IpConfig(string ip, int port)
+        {
+            IPAddress ipa = null;
+            try
+            {
+                ipa = IPAddress.Parse(ip);
+                if (ipa != null)
+                {
+                    unsafe
+                    {
+                        try
+                        {
+                            byte[] protocol = new byte[] {
+                            0x00,0x64,0xff,0xff,0x08,0x04,
+                            0x00,0x00,0x00,0x00,
+                            0xE6,0x17
+                        };
+                            byte[] Buff = ipa.GetAddressBytes();
+                            Buff.CopyTo(protocol, 6);
+
+                            byte[] temp = new byte[10];
+                            Array.Copy(protocol, temp, 10);
+                            byte[] crc = CRC16(temp);
+                            Array.Copy(crc, 0, protocol, 10, 2);
+                            fixed (byte* pArray = protocol)
+                            {
+                                cbDUCP_DataOut(pArray, 12);
+                            }
+                        }
+                        catch (Exception ex)
+                        { Console.WriteLine(ex.Message); }
+                    }
+                    DUCP_HOST_SYS_SetPort(port);
+                }
+            }
+            catch (Exception ex) { Console.WriteLine(ex.Message); }
+        }
+    }
+}

+ 69 - 0
broadcastModule/Program.cs

@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace BroadcastModule
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+            BroadcastBoard bm1 = new BroadcastBoard("192.168.0.60", 8888);
+
+            //bm1.IpConfig("192.168.0.60", 8888);
+            //bm1.Restart();
+            //Console.WriteLine("wake up");
+
+
+            ////Task.Factory.StartNew(() =>
+            ////{
+            ////    int count = 500;
+            ////    while (count-- > 0)
+            ////    {
+            ////        bm1.VolumeControl((int)Math.Sin(count / 10.0 * Math.PI) * 8, out int vol);
+            ////        Thread.Sleep(200);
+            ////    }
+            ////});
+            ////for (int i = 0; i < 4; i++)
+            ////{
+            ////    bm1.DelFile(i, 0, 1);
+            ////}
+            ////Console.WriteLine(DateTime.Now.Hour+","+DateTime.Now.Minute+","+DateTime.Now.Second);
+            //bm1 = new BroadcastBoard("192.168.0.60", 9999);
+            bm1.UpdateTime();
+            bm1.Refresh();
+            bm1.DownloadString(0, "欢迎光临", 0);
+            bm1.DispString(1, "yah hoo!", 0);
+            bm1.DownloadString(2, "date", 0);
+            bm1.DownloadString(3, "time", 0);
+            bm1.DispDownStr(2, 0);
+            bm1.DispDownStr(3, 0);
+
+            //Task.Factory.StartNew(() =>
+            //{
+            //    int count = 33;
+            //    while (count-- > 0)
+            //    {
+            //        //bm1.DispString(0, "欢迎光临",255);
+            //        bm1.DispString(1, "",0);
+            //        //bm1.DispString(2, "`Y年`M月`D日");
+            //        //bm1.DispString(3, "`H:`N:`S");
+            //        for (int i = 0; i < 20; i++)
+            //        {
+            //            //bm1.AudioPlay("欢迎光临");
+            //            Thread.Sleep(500);
+            //        }
+            //        //bm1.AudioPlay("欢迎光临");
+            //        //Thread.Sleep(1500);
+            //        //bm1.AudioPlay("鄂ABCDEFGHIJ");
+            //        //Thread.Sleep(3000);
+            //    }
+            //});
+            //bm1.VolumeControl(5);
+            Console.ReadLine();
+        }
+    }
+}

+ 36 - 0
broadcastModule/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("broadcastModule")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("broadcastModule")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2018")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("f78e4cf1-009d-4438-a3bf-b7ead3463e87")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
+// 方法是按如下所示使用“*”: :
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 55 - 0
broadcastModule/broadcastModule.csproj

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{F78E4CF1-009D-4438-A3BF-B7EAD3463E87}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>broadcastModule</RootNamespace>
+    <AssemblyName>broadcastModule</AssemblyName>
+    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="BroadcastModule.cs" />
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 33 - 0
linkTest.txt

@@ -0,0 +1,33 @@
+---error
+【Receive from 192.168.0.100 :55188】:
+【2018-09-10 16:50:46:359】00 64 FF FF 0D 01 0A 27 70 
+【2018-09-10 16:50:51:083】00 64 FF FF 01 02 00 00 C5 EA 
+【2018-09-10 16:50:54:914】00 64 FF FF 62 1B 01 15 01 00 00 15 01 03 00 FF 00 00 00 00 00 00 00 08 00 79 61 68 20 68 6F 6F 21 9D 53 
+【2018-09-10 16:50:55:864】00 64 FF FF 61 01 00 67 6A 
+【2018-09-10 16:50:56:412】00 64 FF FF 61 01 01 A6 AA 
+【2018-09-10 16:50:56:927】00 64 FF FF 61 01 02 E6 AB 
+【2018-09-10 16:50:58:593】00 64 FF FF 61 01 03 27 6B 
+【2018-09-10 16:50:59:536】00 64 FF FF 60 0A 00 00 00 00 00 00 40 00 10 00 C8 82 
+【2018-09-10 16:51:00:374】00 64 FF FF 60 0A 01 00 00 00 10 00 40 00 10 00 9B D7 
+【2018-09-10 16:51:01:134】00 64 FF FF 60 0A 02 00 00 00 20 00 40 00 10 00 6E 28 
+【2018-09-10 16:51:01:926】00 64 FF FF 60 0A 03 00 00 00 30 00 40 00 10 00 3D 7D 
+【2018-09-10 16:51:55:340】00 64 FF FF 08 04 C0 A8 00 50 E6 17 
+【2018-09-10 16:52:11:547】00 64 FF FF 09 04 B8 22 00 00 DF 3D 
+【2018-09-10 16:52:41:262】00 64 FF FF 06 00 72 57 
+
+---correct
+【Receive from 192.168.0.100 :54973】:
+【2018-09-10 17:00:37:949】00 64 FF FF 0D 01 0A 27 70 
+【2018-09-10 17:00:58:909】00 64 FF FF 01 02 00 00 C5 EA 
+【2018-09-10 17:01:01:324】00 64 FF FF 62 1B 01 15 01 0B 03 15 01 03 00 FF 00 00 00 00 00 00 00 08 00 79 61 68 20 68 6F 6F 21 CA A3 
+【2018-09-10 17:01:08:771】00 64 FF FF 61 01 00 67 6A 
+【2018-09-10 17:01:10:954】00 64 FF FF 61 01 01 A6 AA 
+【2018-09-10 17:01:12:083】00 64 FF FF 61 01 02 E6 AB 
+【2018-09-10 17:01:12:770】00 64 FF FF 61 01 03 27 6B 
+【2018-09-10 17:01:13:687】00 64 FF FF 60 0A 00 00 00 00 00 00 40 00 10 00 C8 82 
+【2018-09-10 17:01:15:258】00 64 FF FF 60 0A 01 00 00 00 10 00 40 00 10 00 9B D7 
+【2018-09-10 17:01:16:210】00 64 FF FF 60 0A 02 00 00 00 20 00 40 00 10 00 6E 28 
+【2018-09-10 17:01:16:914】00 64 FF FF 60 0A 03 00 00 00 30 00 40 00 10 00 3D 7D 
+【2018-09-10 17:01:32:597】00 64 FF FF 08 04 C0 A8 00 50 E6 17 
+【2018-09-10 17:01:36:011】00 64 FF FF 09 04 B8 22 00 00 DF 3D 
+【2018-09-10 17:01:43:663】00 64 FF FF 06 00 72 57 

+ 15 - 0
linkTest2.txt

@@ -0,0 +1,15 @@
+【Receive from 192.168.0.100 :54973】:
+【2018-09-10 17:00:37:949】00 64 FF FF 0D 01 0A 27 70 
+【2018-09-10 17:00:58:909】00 64 FF FF 01 02 00 00 C5 EA 
+【2018-09-10 17:01:01:324】00 64 FF FF 62 1B 01 15 01 0B 03 15 01 03 00 FF 00 00 00 00 00 00 00 08 00 79 61 68 20 68 6F 6F 21 -CA -A3 
+【2018-09-10 17:01:08:771】00 64 FF FF 61 01 00 67 6A 
+【2018-09-10 17:01:10:954】00 64 FF FF 61 01 01 A6 AA 
+【2018-09-10 17:01:12:083】00 64 FF FF 61 01 02 E6 AB 
+【2018-09-10 17:01:12:770】00 64 FF FF 61 01 03 27 6B 
+【2018-09-10 17:01:13:687】00 64 FF FF 60 0A 00 00 00 00 00 00 40 00 10 00 C8 82 
+【2018-09-10 17:01:15:258】00 64 FF FF 60 0A 01 00 00 00 10 00 40 00 10 00 9B D7 
+【2018-09-10 17:01:16:210】00 64 FF FF 60 0A 02 00 00 00 20 00 40 00 10 00 6E 28 
+【2018-09-10 17:01:16:914】00 64 FF FF 60 0A 03 00 00 00 30 00 40 00 10 00 3D 7D 
+【2018-09-10 17:01:32:597】00 64 FF FF 08 04 C0 A8 00 50 E6 17 
+【2018-09-10 17:01:36:011】00 64 FF FF 09 04 B8 22 00 00 DF 3D 
+【2018-09-10 17:01:43:663】00 64 FF FF 06 00 72 57 

BIN
显示屏使用说明书DC297_v1.04_中性版本.pdf