├── .gitignore
├── AllExamples.sln
├── AnotherStorageImplementation
├── AnotherStorageImplementation.csproj
├── BacnetActivity.cs
├── BacnetObjects
│ ├── AnalogInput.cs
│ ├── AnalogObject.cs
│ ├── AnalogObjectEvent.cs
│ ├── AnalogOutput.cs
│ ├── BaCSharpObject.cs
│ ├── BaCSharpType.cs
│ ├── BacnetFile.cs
│ ├── BinaryInput.cs
│ ├── BinaryObject.cs
│ ├── BinaryOutput.cs
│ ├── Calendar.cs
│ ├── CharacterString.cs
│ ├── DeviceObject.cs
│ ├── MultiStateInput.cs
│ ├── MultiStateOutput.cs
│ ├── NotificationClass.cs
│ ├── Schedule.cs
│ ├── StructuredView.cs
│ ├── TrendLog.cs
│ └── TrendLogCustom.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── Subscription.cs
├── nuget.config
└── packages.config
├── Bacnet.Room.Simulator
├── BACnetActivity.cs
├── Bacnet.Room.Simulator.csproj
├── DeviceStorage.xml
├── DeviceStorageUs.xml
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── ImgMode
│ ├── HArret.png
│ ├── H_Chaud.png
│ └── H_Froid.png
├── Ini.cs
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── README.md
├── RoomModel.cs
├── app.config
├── nuage-soleil-meteo-icone-8152.ico
├── nuget.config
└── packages.config
├── BacnetToDatabase
├── BacnetToDatabase.csproj
├── Main.Designer.cs
├── Main.cs
├── Main.resx
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── nuget.config
└── packages.config
├── BasicAdviseCOV
├── BasicAdviseCOV.csproj
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── nuget.config
└── packages.config
├── BasicAlarmListener
├── BasicAlarmListener.csproj
├── DeviceDescriptor.xml
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── nuget.config
└── packages.config
├── BasicReadWrite
├── BasicReadWrite.csproj
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── nuget.config
└── packages.config
├── BasicServer
├── BasicServer.csproj
├── DeviceDescriptor.xml
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── nuget.config
└── packages.config
├── DemoBBMD
├── BACnetActivity.cs
├── Config.txt
├── DemoBBMD.csproj
├── DeviceStorage.xml
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── app.config
├── nuget.config
└── packages.config
├── MIT_license.txt
├── ObjectBrowseSample
├── App.config
├── ObjectBrowseSample.csproj
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── nuget.config
└── packages.config
├── README.md
└── RaspberrySample
├── DeviceDescriptor.xml
├── FileGPIO.cs
├── MemGPIO.cs
├── Program.cs
├── Properties
└── AssemblyInfo.cs
├── RaspberrySample.csproj
├── nuget.config
└── packages.config
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opendb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 | *.VC.db
84 | *.VC.VC.opendb
85 |
86 | # Visual Studio profiler
87 | *.psess
88 | *.vsp
89 | *.vspx
90 | *.sap
91 |
92 | # TFS 2012 Local Workspace
93 | $tf/
94 |
95 | # Guidance Automation Toolkit
96 | *.gpState
97 |
98 | # ReSharper is a .NET coding add-in
99 | _ReSharper*/
100 | *.[Rr]e[Ss]harper
101 | *.DotSettings.user
102 |
103 | # JustCode is a .NET coding add-in
104 | .JustCode
105 |
106 | # TeamCity is a build add-in
107 | _TeamCity*
108 |
109 | # DotCover is a Code Coverage Tool
110 | *.dotCover
111 |
112 | # NCrunch
113 | _NCrunch_*
114 | .*crunch*.local.xml
115 | nCrunchTemp_*
116 |
117 | # MightyMoose
118 | *.mm.*
119 | AutoTest.Net/
120 |
121 | # Web workbench (sass)
122 | .sass-cache/
123 |
124 | # Installshield output folder
125 | [Ee]xpress/
126 |
127 | # DocProject is a documentation generator add-in
128 | DocProject/buildhelp/
129 | DocProject/Help/*.HxT
130 | DocProject/Help/*.HxC
131 | DocProject/Help/*.hhc
132 | DocProject/Help/*.hhk
133 | DocProject/Help/*.hhp
134 | DocProject/Help/Html2
135 | DocProject/Help/html
136 |
137 | # Click-Once directory
138 | publish/
139 |
140 | # Publish Web Output
141 | *.[Pp]ublish.xml
142 | *.azurePubxml
143 | # TODO: Comment the next line if you want to checkin your web deploy settings
144 | # but database connection strings (with potential passwords) will be unencrypted
145 | *.pubxml
146 | *.publishproj
147 |
148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
149 | # checkin your Azure Web App publish settings, but sensitive information contained
150 | # in these scripts will be unencrypted
151 | PublishScripts/
152 |
153 | # NuGet Packages
154 | *.nupkg
155 | # The packages folder can be ignored because of Package Restore
156 | **/packages/*
157 | # except build/, which is used as an MSBuild target.
158 | !**/packages/build/
159 | # Uncomment if necessary however generally it will be regenerated when needed
160 | #!**/packages/repositories.config
161 | # NuGet v3's project.json files produces more ignoreable files
162 | *.nuget.props
163 | *.nuget.targets
164 |
165 | # Microsoft Azure Build Output
166 | csx/
167 | *.build.csdef
168 |
169 | # Microsoft Azure Emulator
170 | ecf/
171 | rcf/
172 |
173 | # Windows Store app package directories and files
174 | AppPackages/
175 | BundleArtifacts/
176 | Package.StoreAssociation.xml
177 | _pkginfo.txt
178 |
179 | # Visual Studio cache files
180 | # files ending in .cache can be ignored
181 | *.[Cc]ache
182 | # but keep track of directories ending in .cache
183 | !*.[Cc]ache/
184 |
185 | # Others
186 | ClientBin/
187 | ~$*
188 | *~
189 | *.dbmdl
190 | *.dbproj.schemaview
191 | *.pfx
192 | *.publishsettings
193 | node_modules/
194 | orleans.codegen.cs
195 |
196 | # Since there are multiple workflows, uncomment next line to ignore bower_components
197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
198 | #bower_components/
199 |
200 | # RIA/Silverlight projects
201 | Generated_Code/
202 |
203 | # Backup & report files from converting an old project file
204 | # to a newer Visual Studio version. Backup files are not needed,
205 | # because we have git ;-)
206 | _UpgradeReport_Files/
207 | Backup*/
208 | UpgradeLog*.XML
209 | UpgradeLog*.htm
210 |
211 | # SQL Server files
212 | *.mdf
213 | *.ldf
214 |
215 | # Business Intelligence projects
216 | *.rdl.data
217 | *.bim.layout
218 | *.bim_*.settings
219 |
220 | # Microsoft Fakes
221 | FakesAssemblies/
222 |
223 | # GhostDoc plugin setting file
224 | *.GhostDoc.xml
225 |
226 | # Node.js Tools for Visual Studio
227 | .ntvs_analysis.dat
228 |
229 | # Visual Studio 6 build log
230 | *.plg
231 |
232 | # Visual Studio 6 workspace options file
233 | *.opt
234 |
235 | # Visual Studio LightSwitch build output
236 | **/*.HTMLClient/GeneratedArtifacts
237 | **/*.DesktopClient/GeneratedArtifacts
238 | **/*.DesktopClient/ModelManifest.xml
239 | **/*.Server/GeneratedArtifacts
240 | **/*.Server/ModelManifest.xml
241 | _Pvt_Extensions
242 |
243 | # Paket dependency manager
244 | .paket/paket.exe
245 | paket-files/
246 |
247 | # FAKE - F# Make
248 | .fake/
249 |
250 | # JetBrains Rider
251 | .idea/
252 | *.sln.iml
--------------------------------------------------------------------------------
/AllExamples.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25123.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bacnet.Room.Simulator", "Bacnet.Room.Simulator\Bacnet.Room.Simulator.csproj", "{07552C4C-AD80-4645-AC91-D6138B5888AA}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnotherStorageImplementation", "AnotherStorageImplementation\AnotherStorageImplementation.csproj", "{EE8E3C58-371E-4164-93DA-13D055D5BDDE}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BacnetToDatabase", "BacnetToDatabase\BacnetToDatabase.csproj", "{AB80ADFC-41DD-4E98-87CB-89C358B9E65D}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicAdviseCOV", "BasicAdviseCOV\BasicAdviseCOV.csproj", "{C501E026-4977-49C6-8DCB-5B9600C17FF1}"
13 | EndProject
14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicAlarmListener", "BasicAlarmListener\BasicAlarmListener.csproj", "{91C94BC2-B863-4415-AB5F-2C4D02B2F2CE}"
15 | EndProject
16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicReadWrite", "BasicReadWrite\BasicReadWrite.csproj", "{28F7604F-7DCD-4330-8261-55AEB2B0BAC4}"
17 | EndProject
18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicServer", "BasicServer\BasicServer.csproj", "{DB89E653-7DBF-45BC-A92E-3754D8091E89}"
19 | EndProject
20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoBBMD", "DemoBBMD\DemoBBMD.csproj", "{A2CE9357-71B6-40F7-97C7-74AF1E5659A5}"
21 | EndProject
22 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RaspberrySample", "RaspberrySample\RaspberrySample.csproj", "{47FC9B60-CC4A-479C-8267-DCEEE53067AC}"
23 | EndProject
24 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObjectBrowseSample", "ObjectBrowseSample\ObjectBrowseSample.csproj", "{CD8499E5-8FB1-44FC-9B42-BB437C58AAA2}"
25 | EndProject
26 | Global
27 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
28 | Debug|Any CPU = Debug|Any CPU
29 | Release|Any CPU = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
32 | {07552C4C-AD80-4645-AC91-D6138B5888AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33 | {07552C4C-AD80-4645-AC91-D6138B5888AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
34 | {07552C4C-AD80-4645-AC91-D6138B5888AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
35 | {07552C4C-AD80-4645-AC91-D6138B5888AA}.Release|Any CPU.Build.0 = Release|Any CPU
36 | {EE8E3C58-371E-4164-93DA-13D055D5BDDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37 | {EE8E3C58-371E-4164-93DA-13D055D5BDDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
38 | {EE8E3C58-371E-4164-93DA-13D055D5BDDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
39 | {EE8E3C58-371E-4164-93DA-13D055D5BDDE}.Release|Any CPU.Build.0 = Release|Any CPU
40 | {AB80ADFC-41DD-4E98-87CB-89C358B9E65D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41 | {AB80ADFC-41DD-4E98-87CB-89C358B9E65D}.Debug|Any CPU.Build.0 = Debug|Any CPU
42 | {AB80ADFC-41DD-4E98-87CB-89C358B9E65D}.Release|Any CPU.ActiveCfg = Release|Any CPU
43 | {AB80ADFC-41DD-4E98-87CB-89C358B9E65D}.Release|Any CPU.Build.0 = Release|Any CPU
44 | {C501E026-4977-49C6-8DCB-5B9600C17FF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45 | {C501E026-4977-49C6-8DCB-5B9600C17FF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
46 | {C501E026-4977-49C6-8DCB-5B9600C17FF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
47 | {C501E026-4977-49C6-8DCB-5B9600C17FF1}.Release|Any CPU.Build.0 = Release|Any CPU
48 | {91C94BC2-B863-4415-AB5F-2C4D02B2F2CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
49 | {91C94BC2-B863-4415-AB5F-2C4D02B2F2CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
50 | {91C94BC2-B863-4415-AB5F-2C4D02B2F2CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
51 | {91C94BC2-B863-4415-AB5F-2C4D02B2F2CE}.Release|Any CPU.Build.0 = Release|Any CPU
52 | {28F7604F-7DCD-4330-8261-55AEB2B0BAC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
53 | {28F7604F-7DCD-4330-8261-55AEB2B0BAC4}.Debug|Any CPU.Build.0 = Debug|Any CPU
54 | {28F7604F-7DCD-4330-8261-55AEB2B0BAC4}.Release|Any CPU.ActiveCfg = Release|Any CPU
55 | {28F7604F-7DCD-4330-8261-55AEB2B0BAC4}.Release|Any CPU.Build.0 = Release|Any CPU
56 | {DB89E653-7DBF-45BC-A92E-3754D8091E89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
57 | {DB89E653-7DBF-45BC-A92E-3754D8091E89}.Debug|Any CPU.Build.0 = Debug|Any CPU
58 | {DB89E653-7DBF-45BC-A92E-3754D8091E89}.Release|Any CPU.ActiveCfg = Release|Any CPU
59 | {DB89E653-7DBF-45BC-A92E-3754D8091E89}.Release|Any CPU.Build.0 = Release|Any CPU
60 | {A2CE9357-71B6-40F7-97C7-74AF1E5659A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
61 | {A2CE9357-71B6-40F7-97C7-74AF1E5659A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
62 | {A2CE9357-71B6-40F7-97C7-74AF1E5659A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
63 | {A2CE9357-71B6-40F7-97C7-74AF1E5659A5}.Release|Any CPU.Build.0 = Release|Any CPU
64 | {47FC9B60-CC4A-479C-8267-DCEEE53067AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
65 | {47FC9B60-CC4A-479C-8267-DCEEE53067AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
66 | {47FC9B60-CC4A-479C-8267-DCEEE53067AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
67 | {47FC9B60-CC4A-479C-8267-DCEEE53067AC}.Release|Any CPU.Build.0 = Release|Any CPU
68 | {CD8499E5-8FB1-44FC-9B42-BB437C58AAA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
69 | {CD8499E5-8FB1-44FC-9B42-BB437C58AAA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
70 | {CD8499E5-8FB1-44FC-9B42-BB437C58AAA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
71 | {CD8499E5-8FB1-44FC-9B42-BB437C58AAA2}.Release|Any CPU.Build.0 = Release|Any CPU
72 | EndGlobalSection
73 | GlobalSection(SolutionProperties) = preSolution
74 | HideSolutionNode = FALSE
75 | EndGlobalSection
76 | EndGlobal
77 |
--------------------------------------------------------------------------------
/AnotherStorageImplementation/AnotherStorageImplementation.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | x86
6 | 8.0.30703
7 | 2.0
8 | {EE8E3C58-371E-4164-93DA-13D055D5BDDE}
9 | Exe
10 | Properties
11 | BaCSharp
12 | AnotherStorageImplementation
13 | v4.0
14 | Client
15 | 512
16 |
17 |
18 | true
19 | bin\Debug\
20 | DEBUG;TRACE
21 | full
22 | AnyCPU
23 | prompt
24 | MinimumRecommendedRules.ruleset
25 |
26 |
27 | bin\Release\
28 | TRACE
29 | true
30 | pdbonly
31 | AnyCPU
32 | prompt
33 | MinimumRecommendedRules.ruleset
34 |
35 |
36 |
37 | ..\packages\BACnet.1.0.8.5-alpha\lib\net40\BACnet.dll
38 | True
39 |
40 |
41 | ..\packages\Newtonsoft.Json.8.0.3\lib\net40\Newtonsoft.Json.dll
42 | True
43 |
44 |
45 | ..\packages\PacketDotNet.0.13.0\lib\net\PacketDotNet.dll
46 | True
47 |
48 |
49 | ..\packages\SharpPcap.4.2.0\lib\net\SharpPcap.dll
50 | True
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | Code
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
95 |
--------------------------------------------------------------------------------
/AnotherStorageImplementation/BacnetObjects/AnalogInput.cs:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (C) 2015 Frederic Chaxel
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining
7 | * a copy of this software and associated documentation files (the
8 | * "Software"), to deal in the Software without restriction, including
9 | * without limitation the rights to use, copy, modify, merge, publish,
10 | * distribute, sublicense, and/or sell copies of the Software, and to
11 | * permit persons to whom the Software is furnished to do so, subject to
12 | * the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included
15 | * in all copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 | *
25 | *********************************************************************/
26 | using System;
27 | using System.Collections.Generic;
28 | using System.Linq;
29 | using System.Text;
30 | using System.IO.BACnet;
31 |
32 | namespace BaCSharp
33 | {
34 | public class AnalogInput : AnalogObject
35 | {
36 | public AnalogInput(int ObjId, String ObjName, String Description, T InitialValue, BacnetUnitsId Unit)
37 | : base(new BacnetObjectId(BacnetObjectTypes.OBJECT_ANALOG_INPUT, (uint)ObjId), ObjName, Description, InitialValue, Unit)
38 | {
39 | m_PRESENT_VALUE_ReadOnly = true;
40 | }
41 | public AnalogInput(BacnetObjectId ObjId, String ObjName, String Description, T InitialValue, BacnetUnitsId Unit)
42 | : base(ObjId, ObjName, Description, InitialValue, Unit)
43 | {
44 | m_PRESENT_VALUE_ReadOnly = true;
45 | }
46 | public AnalogInput() { }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/AnotherStorageImplementation/BacnetObjects/AnalogObject.cs:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (C) 2015 Frederic Chaxel
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining
7 | * a copy of this software and associated documentation files (the
8 | * "Software"), to deal in the Software without restriction, including
9 | * without limitation the rights to use, copy, modify, merge, publish,
10 | * distribute, sublicense, and/or sell copies of the Software, and to
11 | * permit persons to whom the Software is furnished to do so, subject to
12 | * the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included
15 | * in all copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 | *
25 | *********************************************************************/
26 | using System;
27 | using System.Collections.Generic;
28 | using System.Linq;
29 | using System.Text;
30 | using System.IO.BACnet;
31 |
32 | namespace BaCSharp
33 | {
34 | public abstract partial class AnalogObject : BaCSharpObject
35 | {
36 | public uint m_PROP_UNITS;
37 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED)]
38 | public virtual uint PROP_UNITS
39 | {
40 | get { return m_PROP_UNITS; }
41 | }
42 | public uint m_PROP_EVENT_STATE = 0;
43 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED)]
44 | public virtual uint PROP_EVENT_STATE
45 | {
46 | get { return m_PROP_EVENT_STATE; } // See BacnetEventNotificationData.BacnetEventStates
47 | }
48 |
49 | public BacnetBitString m_PROP_STATUS_FLAGS = new BacnetBitString();
50 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_BIT_STRING)]
51 | public virtual BacnetBitString PROP_STATUS_FLAGS
52 | {
53 | get { return m_PROP_STATUS_FLAGS; }
54 | }
55 |
56 | public bool m_PROP_OUT_OF_SERVICE = false;
57 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_BOOLEAN)]
58 | public virtual bool PROP_OUT_OF_SERVICE
59 | {
60 | get { return m_PROP_OUT_OF_SERVICE; }
61 | set {
62 | m_PROP_OUT_OF_SERVICE=value;
63 | m_PROP_STATUS_FLAGS.SetBit((byte)3, value);
64 | ExternalCOVManagement(BacnetPropertyIds.PROP_OUT_OF_SERVICE);
65 | }
66 | }
67 |
68 | public bool m_PRESENT_VALUE_ReadOnly = false;
69 | public T m_PROP_PRESENT_VALUE;
70 | // BacnetSerialize made freely by the stack depending on the type
71 | public virtual T PROP_PRESENT_VALUE
72 | {
73 | get { return m_PROP_PRESENT_VALUE; }
74 | set
75 | {
76 | if (m_PRESENT_VALUE_ReadOnly == false)
77 | {
78 | internal_PROP_PRESENT_VALUE = value;
79 | }
80 | else
81 | ErrorCode_PropertyWrite = ErrorCodes.WriteAccessDenied;
82 | }
83 | }
84 |
85 | // This property shows the same attribut as the previous, but without restriction
86 | // for internal usage, not for network callbacks
87 | public virtual T internal_PROP_PRESENT_VALUE
88 | {
89 | get { return m_PROP_PRESENT_VALUE; }
90 | set
91 | {
92 | if (!value.Equals(m_PROP_PRESENT_VALUE))
93 | {
94 | m_PROP_PRESENT_VALUE = value;
95 | ExternalCOVManagement(BacnetPropertyIds.PROP_PRESENT_VALUE);
96 | IntrinsicReportingManagement();
97 | }
98 | }
99 | }
100 |
101 | public AnalogObject() {}
102 |
103 | public AnalogObject(BacnetObjectId ObjId, String ObjName, String Description, T InitialValue, BacnetUnitsId Unit)
104 | : base(ObjId, ObjName, Description)
105 | {
106 |
107 | m_PROP_STATUS_FLAGS.SetBit((byte)0, false);
108 | m_PROP_STATUS_FLAGS.SetBit((byte)1, false);
109 | m_PROP_STATUS_FLAGS.SetBit((byte)2, false);
110 | m_PROP_STATUS_FLAGS.SetBit((byte)3, false);
111 |
112 | m_PROP_UNITS = (uint)Unit;
113 |
114 | m_PROP_PRESENT_VALUE = InitialValue;
115 |
116 | AnalogObjectEvent();
117 |
118 | }
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/AnotherStorageImplementation/BacnetObjects/AnalogOutput.cs:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (C) 2015 Frederic Chaxel
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining
7 | * a copy of this software and associated documentation files (the
8 | * "Software"), to deal in the Software without restriction, including
9 | * without limitation the rights to use, copy, modify, merge, publish,
10 | * distribute, sublicense, and/or sell copies of the Software, and to
11 | * permit persons to whom the Software is furnished to do so, subject to
12 | * the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included
15 | * in all copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 | *
25 | *********************************************************************/
26 | using System;
27 | using System.Collections.Generic;
28 | using System.Linq;
29 | using System.Text;
30 | using System.IO.BACnet;
31 |
32 | namespace BaCSharp
33 | {
34 |
35 | public class AnalogOutput : AnalogValueAndOutput
36 | {
37 | public AnalogOutput(int ObjId, String ObjName, String Description, T InitialValue, BacnetUnitsId Unit)
38 | : base(new BacnetObjectId(BacnetObjectTypes.OBJECT_ANALOG_OUTPUT, (uint)ObjId), ObjName, Description, InitialValue, Unit, true)
39 | {
40 | }
41 | public AnalogOutput() { }
42 | }
43 |
44 | public class AnalogValue : AnalogValueAndOutput
45 | {
46 | public AnalogValue(int ObjId, String ObjName, String Description, T InitialValue, BacnetUnitsId Unit, bool WithPriorityArray)
47 | : base(new BacnetObjectId(BacnetObjectTypes.OBJECT_ANALOG_VALUE, (uint)ObjId), ObjName, Description, InitialValue, Unit, WithPriorityArray)
48 | {
49 | }
50 | public AnalogValue() { }
51 | }
52 |
53 | public class AnalogValueAndOutput : AnalogObject
54 | {
55 | public bool UsePriorityArray = false;
56 |
57 | protected T m_PROP_RELINQUISH_DEFAULT;
58 | // BacnetSerialize made freely by the stack depending on the type
59 | public virtual T PROP_RELINQUISH_DEFAULT
60 | {
61 | get { return m_PROP_RELINQUISH_DEFAULT; }
62 | set {
63 | m_PROP_RELINQUISH_DEFAULT=value;
64 | ExternalCOVManagement(BacnetPropertyIds.PROP_RELINQUISH_DEFAULT);
65 | }
66 | }
67 |
68 | public BacnetValue[] m_PROP_PRIORITY_ARRAY = new BacnetValue[16];
69 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_NULL)]
70 | public virtual BacnetValue[] PROP_PRIORITY_ARRAY
71 | {
72 | get { return m_PROP_PRIORITY_ARRAY; }
73 | }
74 |
75 | public AnalogValueAndOutput(BacnetObjectId ObjId, String ObjName, String Description, T InitialValue, BacnetUnitsId Unit, bool WithPriorityArray)
76 | : base(ObjId, ObjName, Description, InitialValue, Unit)
77 | {
78 | if (WithPriorityArray == true)
79 | {
80 | UsePriorityArray = true;
81 | m_PROP_RELINQUISH_DEFAULT = InitialValue;
82 | }
83 |
84 | this.m_PRESENT_VALUE_ReadOnly = false;
85 | }
86 |
87 | public AnalogValueAndOutput() { }
88 |
89 | public override void Post_NewtonSoft_Json_Deserialization(DeviceObject device)
90 | {
91 | base.Post_NewtonSoft_Json_Deserialization(device);
92 |
93 | // basic int becom int64 for instance during serialization/deserialization
94 | for (int i = 0; i < 16; i++)
95 | if (m_PROP_PRIORITY_ARRAY[i].Tag!=BacnetApplicationTags.BACNET_APPLICATION_TAG_NULL)
96 | m_PROP_PRIORITY_ARRAY[i] = new BacnetValue(m_PROP_PRIORITY_ARRAY[i].Tag,Convert.ChangeType(m_PROP_PRIORITY_ARRAY[i].Value,typeof(T)));
97 | }
98 |
99 | // Do not shows PROP_PRIORITY_ARRAY & PROP_RELINQUISH_DEFAULT if not in use
100 | protected override uint BacnetMethodNametoId(String Name)
101 | {
102 | if ((UsePriorityArray == false) && ((Name == "get_PROP_PRIORITY_ARRAY") || (Name == "get_PROP_RELINQUISH_DEFAULT"))) // Hide these properties
103 | return (uint)((int)BacnetPropertyIds.MAX_BACNET_PROPERTY_ID);
104 | else
105 | return base.BacnetMethodNametoId(Name);
106 | }
107 |
108 | // Since set_PROP_PRESENT_VALUE offered by the inherited property PROP_PRESENT_VALUE cannot
109 | // receive null value to clear the Priority Array, and do not have the priority
110 | // it is 'override' here with the set2_xxx (which replace set_xx in the call if exist)
111 | public virtual void set2_PROP_PRESENT_VALUE(IList Value, byte WritePriority)
112 | {
113 | if (UsePriorityArray == false)
114 | {
115 | PROP_PRESENT_VALUE = (T)Convert.ChangeType(Value[0].Value, typeof(T));
116 | //PROP_PRESENT_VALUE = (T) Value[0].Value;
117 | return;
118 | }
119 | else
120 | {
121 | m_PROP_PRIORITY_ARRAY[(int)WritePriority - 1] = Value[0];
122 |
123 | bool done = false;
124 | for (int i = 0; i < 16; i++)
125 | {
126 | if (m_PROP_PRIORITY_ARRAY[i].Value != null) // A value is OK
127 | {
128 | PROP_PRESENT_VALUE = (T)(T)Convert.ChangeType(m_PROP_PRIORITY_ARRAY[i].Value, typeof(T));
129 | //PROP_PRESENT_VALUE = (T)m_PROP_PRIORITY_ARRAY[i].Value;
130 | done = true;
131 | break;
132 | }
133 | }
134 | if (done == false) // Nothing in the array : PROP_PRESENT_VALUE = PROP_RELINQUISH_DEFAULT
135 | {
136 | PROP_PRESENT_VALUE = m_PROP_RELINQUISH_DEFAULT;
137 | }
138 |
139 | return;
140 | }
141 | }
142 |
143 | // This will shows a property which is only programmed with methods
144 | // ... just for the example
145 | protected bool binternal = true;
146 |
147 | public virtual IList get2_PROP_OPTIONAL()
148 | {
149 | return new BacnetValue[1] { new BacnetValue(BacnetApplicationTags.BACNET_APPLICATION_TAG_BOOLEAN, binternal) };
150 | }
151 |
152 | public virtual void set2_PROP_OPTIONAL(IList Value, byte WritePriority)
153 | {
154 | binternal = (bool)Value[0].Value;
155 | }
156 |
157 | }
158 | }
159 |
--------------------------------------------------------------------------------
/AnotherStorageImplementation/BacnetObjects/BaCSharpType.cs:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (C) 2015 Frederic Chaxel
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining
7 | * a copy of this software and associated documentation files (the
8 | * "Software"), to deal in the Software without restriction, including
9 | * without limitation the rights to use, copy, modify, merge, publish,
10 | * distribute, sublicense, and/or sell copies of the Software, and to
11 | * permit persons to whom the Software is furnished to do so, subject to
12 | * the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included
15 | * in all copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 | *
25 | *********************************************************************/
26 | using System;
27 | using System.Collections.Generic;
28 | using System.Linq;
29 | using System.Text;
30 | using System.IO.BACnet;
31 |
32 | namespace BaCSharp
33 | {
34 | class BaCSharpTypeAttribute : Attribute
35 | {
36 | public BacnetApplicationTags BacnetNativeType;
37 |
38 | public BaCSharpTypeAttribute(BacnetApplicationTags BacnetNativeType)
39 | {
40 | this.BacnetNativeType = BacnetNativeType;
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/AnotherStorageImplementation/BacnetObjects/BacnetFile.cs:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (C) 2015 Frederic Chaxel
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining
7 | * a copy of this software and associated documentation files (the
8 | * "Software"), to deal in the Software without restriction, including
9 | * without limitation the rights to use, copy, modify, merge, publish,
10 | * distribute, sublicense, and/or sell copies of the Software, and to
11 | * permit persons to whom the Software is furnished to do so, subject to
12 | * the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included
15 | * in all copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 | *
25 | *********************************************************************/
26 | using System;
27 | using System.Collections.Generic;
28 | using System.Linq;
29 | using System.Text;
30 | using System.IO.BACnet;
31 | using System.IO;
32 |
33 | namespace BaCSharp
34 | {
35 | public class BacnetFile:BaCSharpObject
36 | {
37 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_CHARACTER_STRING)]
38 | public virtual String PROP_FILE_TYPE
39 | {
40 | get { return "Binary"; }
41 | }
42 | public bool m_PROP_READ_ONLY;
43 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_BOOLEAN)]
44 | public virtual bool PROP_READ_ONLY
45 | {
46 | get { return m_PROP_READ_ONLY; }
47 | }
48 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_BOOLEAN)]
49 | public virtual bool PROP_ARCHIVE
50 | {
51 | get { return false; }
52 | }
53 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED)]
54 | public virtual uint PROP_FILE_ACCESS_METHOD
55 | {
56 | get { return 1; } // FILE_STREAM_ACCESS
57 | }
58 |
59 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_UNSIGNED_INT)]
60 | public virtual uint PROP_FILE_SIZE
61 | {
62 | get {
63 | try
64 | {
65 | FileInfo fi = new FileInfo(FilePath);
66 | return (uint)fi.Length;
67 | }
68 | catch { return 0; } // no way to return -1 or other
69 | }
70 | }
71 |
72 | public String FilePath;
73 |
74 | public BacnetFile(int ObjId, String ObjName, String Description, String FilePath, bool ReadOnly)
75 | : base(new BacnetObjectId(BacnetObjectTypes.OBJECT_FILE, (uint)ObjId), ObjName, Description)
76 | {
77 | m_PROP_READ_ONLY = ReadOnly;
78 | this.FilePath = FilePath;
79 | }
80 | public BacnetFile() { }
81 |
82 | public virtual byte[] ReadFileBlock(int position, int quantity)
83 | {
84 | try
85 | {
86 | byte[] b=new byte[quantity];
87 | FileStream fs = new FileStream(FilePath, FileMode.Open, FileAccess.Read);
88 | fs.Seek(position, SeekOrigin.Begin);
89 | fs.Read(b,0, quantity);
90 | fs.Close();
91 | return b;
92 | }
93 | catch{}
94 |
95 | return null;
96 | }
97 |
98 | public virtual bool WriteFileBlock(byte[] block, int position, int quantity)
99 | {
100 | try
101 | {
102 | FileStream fs;
103 | if (position==0)
104 | fs= new FileStream(FilePath, FileMode.Create);
105 | else
106 | fs = new FileStream(FilePath, FileMode.Append);
107 |
108 | fs.Write(block, 0, quantity);
109 | fs.Close();
110 | return true;
111 | }
112 | catch { }
113 |
114 | return false;
115 | }
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/AnotherStorageImplementation/BacnetObjects/BinaryInput.cs:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (C) 2015 Frederic Chaxel
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining
7 | * a copy of this software and associated documentation files (the
8 | * "Software"), to deal in the Software without restriction, including
9 | * without limitation the rights to use, copy, modify, merge, publish,
10 | * distribute, sublicense, and/or sell copies of the Software, and to
11 | * permit persons to whom the Software is furnished to do so, subject to
12 | * the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included
15 | * in all copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 | *
25 | *********************************************************************/
26 | using System;
27 | using System.Collections.Generic;
28 | using System.Linq;
29 | using System.Text;
30 | using System.IO.BACnet;
31 |
32 | namespace BaCSharp
33 | {
34 | public class BinaryInput : BinaryObject
35 | {
36 | public BinaryInput(int ObjId, String ObjName, String Description, bool InitialValue)
37 | : base(new BacnetObjectId(BacnetObjectTypes.OBJECT_BINARY_INPUT, (uint)ObjId), ObjName, Description, InitialValue)
38 | {
39 | m_PRESENT_VALUE_ReadOnly = true;
40 | }
41 | public BinaryInput() { }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/AnotherStorageImplementation/BacnetObjects/BinaryObject.cs:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (C) 2015 Frederic Chaxel
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining
7 | * a copy of this software and associated documentation files (the
8 | * "Software"), to deal in the Software without restriction, including
9 | * without limitation the rights to use, copy, modify, merge, publish,
10 | * distribute, sublicense, and/or sell copies of the Software, and to
11 | * permit persons to whom the Software is furnished to do so, subject to
12 | * the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included
15 | * in all copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 | *
25 | *********************************************************************/
26 | using System;
27 | using System.Collections.Generic;
28 | using System.Linq;
29 | using System.Text;
30 | using System.IO.BACnet;
31 |
32 | namespace BaCSharp
33 | {
34 | public abstract class BinaryObject : BaCSharpObject
35 | {
36 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED)]
37 | public virtual uint PROP_POLARITY
38 | {
39 | get { return 0; }
40 | }
41 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED)]
42 | public virtual uint PROP_EVENT_STATE
43 | {
44 | get { return 0; }
45 | }
46 |
47 | BacnetBitString m_PROP_STATUS_FLAGS = new BacnetBitString();
48 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_BIT_STRING)]
49 | public virtual BacnetBitString PROP_STATUS_FLAGS
50 | {
51 | get { return m_PROP_STATUS_FLAGS; }
52 | }
53 |
54 | public bool m_PROP_OUT_OF_SERVICE = false;
55 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_BOOLEAN)]
56 | public virtual bool PROP_OUT_OF_SERVICE
57 | {
58 | get { return m_PROP_OUT_OF_SERVICE; }
59 | set
60 | {
61 | m_PROP_OUT_OF_SERVICE = value;
62 | m_PROP_STATUS_FLAGS.SetBit((byte)3, value);
63 | ExternalCOVManagement(BacnetPropertyIds.PROP_OUT_OF_SERVICE);
64 | }
65 | }
66 |
67 | public bool m_PRESENT_VALUE_ReadOnly = false;
68 | public uint m_PROP_PRESENT_VALUE;
69 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED)]
70 | public virtual uint PROP_PRESENT_VALUE
71 | {
72 | get { return m_PROP_PRESENT_VALUE; }
73 | set
74 | {
75 | if (m_PRESENT_VALUE_ReadOnly == false)
76 | {
77 | if (((value == 0) || (value == 1)))
78 | {
79 | if (value != m_PROP_PRESENT_VALUE)
80 | {
81 | m_PROP_PRESENT_VALUE = value;
82 | ExternalCOVManagement(BacnetPropertyIds.PROP_PRESENT_VALUE);
83 | }
84 | }
85 | else
86 | ErrorCode_PropertyWrite = ErrorCodes.OutOfRange;
87 | }
88 | else
89 | ErrorCode_PropertyWrite = ErrorCodes.WriteAccessDenied;
90 | }
91 | }
92 |
93 | // This property shows the same attribut as the previous, but without restriction
94 | // for internal usage, not for network callbacks
95 | public virtual uint internal_PROP_PRESENT_VALUE
96 | {
97 | get { return m_PROP_PRESENT_VALUE; }
98 | set
99 | {
100 | if (value != m_PROP_PRESENT_VALUE)
101 | {
102 | m_PROP_PRESENT_VALUE = value; ExternalCOVManagement(BacnetPropertyIds.PROP_PRESENT_VALUE);
103 | }
104 | }
105 | }
106 |
107 | public BinaryObject(BacnetObjectId ObjId, String ObjName, String Description, bool InitialValue)
108 | : base(ObjId, ObjName, Description)
109 | {
110 | m_PROP_STATUS_FLAGS.SetBit((byte)0, false);
111 | m_PROP_STATUS_FLAGS.SetBit((byte)1, false);
112 | m_PROP_STATUS_FLAGS.SetBit((byte)2, false);
113 | m_PROP_STATUS_FLAGS.SetBit((byte)3, false);
114 |
115 | m_PROP_PRESENT_VALUE = InitialValue==true ? (uint)1 : 0;
116 |
117 | }
118 | public BinaryObject() { }
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/AnotherStorageImplementation/BacnetObjects/BinaryOutput.cs:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (C) 2015 Frederic Chaxel
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining
7 | * a copy of this software and associated documentation files (the
8 | * "Software"), to deal in the Software without restriction, including
9 | * without limitation the rights to use, copy, modify, merge, publish,
10 | * distribute, sublicense, and/or sell copies of the Software, and to
11 | * permit persons to whom the Software is furnished to do so, subject to
12 | * the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included
15 | * in all copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 | *
25 | *********************************************************************/
26 | using System;
27 | using System.Collections.Generic;
28 | using System.Linq;
29 | using System.Text;
30 | using System.IO.BACnet;
31 |
32 | namespace BaCSharp
33 | {
34 | public class BinaryOutput : BinaryValueAndOutput
35 | {
36 | public BinaryOutput(int ObjId, String ObjName, String Description, bool InitialValue)
37 | : base(new BacnetObjectId(BacnetObjectTypes.OBJECT_BINARY_OUTPUT, (uint)ObjId), ObjName, Description, InitialValue, true)
38 | {
39 | }
40 | public BinaryOutput(){}
41 | }
42 |
43 | [Serializable]
44 | public class BinaryValue : BinaryValueAndOutput
45 | {
46 | public BinaryValue(int ObjId, String ObjName, String Description, bool InitialValue, bool WithPriorityArray)
47 | : base(new BacnetObjectId(BacnetObjectTypes.OBJECT_BINARY_VALUE, (uint)ObjId), ObjName, Description, InitialValue, WithPriorityArray)
48 | {
49 | }
50 | public BinaryValue(){}
51 | }
52 |
53 | [Serializable]
54 | public abstract class BinaryValueAndOutput : BinaryObject
55 | {
56 | public bool UsePriorityArray = false;
57 |
58 | public uint m_PROP_RELINQUISH_DEFAULT;
59 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED)]
60 | public virtual uint PROP_RELINQUISH_DEFAULT
61 | {
62 | get { return m_PROP_RELINQUISH_DEFAULT; }
63 | set
64 | {
65 | m_PROP_RELINQUISH_DEFAULT = value;
66 | ExternalCOVManagement(BacnetPropertyIds.PROP_PRESENT_VALUE);
67 | }
68 | }
69 |
70 | public BacnetValue[] m_PROP_PRIORITY_ARRAY = new BacnetValue[16];
71 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_NULL)]
72 | public virtual BacnetValue[] PROP_PRIORITY_ARRAY
73 | {
74 | get { return m_PROP_PRIORITY_ARRAY; }
75 | }
76 |
77 | public BinaryValueAndOutput(BacnetObjectId ObjId, String ObjName, String Description, bool InitialValue, bool WithPriorityArray)
78 | : base(ObjId, ObjName, Description, InitialValue)
79 | {
80 | if (WithPriorityArray == true)
81 | {
82 | UsePriorityArray = true;
83 | m_PROP_RELINQUISH_DEFAULT = InitialValue == true ? (uint)1 : 0;
84 | }
85 |
86 | this.m_PRESENT_VALUE_ReadOnly = false;
87 | }
88 | public BinaryValueAndOutput() { }
89 |
90 | // Do not shows PROP_PRIORITY_ARRAY & PROP_RELINQUISH_DEFAULT if not in use
91 | protected override uint BacnetMethodNametoId(String Name)
92 | {
93 | if ((UsePriorityArray == false) && ((Name == "get_PROP_PRIORITY_ARRAY") || (Name == "get_PROP_RELINQUISH_DEFAULT"))) // Hide these properties
94 | return (uint)((int)BacnetPropertyIds.MAX_BACNET_PROPERTY_ID );
95 | else
96 | return base.BacnetMethodNametoId(Name);
97 | }
98 |
99 | // Since set_PROP_PRESENT_VALUE offered by the inherited property PROP_PRESENT_VALUE cannot
100 | // receive null value to clear the Priority Array, and do not have the priority
101 | // it is 'override' here with the set2_xxx (which replace set_xx in the call if exist)
102 | public virtual void set2_PROP_PRESENT_VALUE(IList Value, byte WritePriority)
103 | {
104 | if (UsePriorityArray == false)
105 | {
106 | PROP_PRESENT_VALUE = (uint)Value[0].Value;
107 | return;
108 | }
109 | else
110 | {
111 | m_PROP_PRIORITY_ARRAY[(int)WritePriority - 1] = Value[0];
112 |
113 | bool done = false;
114 | for (int i = 0; i < 16; i++)
115 | {
116 | if (m_PROP_PRIORITY_ARRAY[i].Value != null) // A value is OK
117 | {
118 | PROP_PRESENT_VALUE = (uint)m_PROP_PRIORITY_ARRAY[i].Value;
119 | done = true;
120 | break;
121 | }
122 | }
123 | if (done == false) // Nothing in the array : PROP_PRESENT_VALUE = PROP_RELINQUISH_DEFAULT
124 | {
125 | PROP_PRESENT_VALUE = m_PROP_RELINQUISH_DEFAULT;
126 | }
127 |
128 | return;
129 | }
130 | }
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/AnotherStorageImplementation/BacnetObjects/Calendar.cs:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | * MIT License
3 | *
4 | * Copyright (C) 2015 Frederic Chaxel
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining
7 | * a copy of this software and associated documentation files (the
8 | * "Software"), to deal in the Software without restriction, including
9 | * without limitation the rights to use, copy, modify, merge, publish,
10 | * distribute, sublicense, and/or sell copies of the Software, and to
11 | * permit persons to whom the Software is furnished to do so, subject to
12 | * the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included
15 | * in all copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 | *
25 | *********************************************************************/
26 | using System;
27 | using System.Collections.Generic;
28 | using System.Linq;
29 | using System.Text;
30 | using System.IO.BACnet;
31 | using System.Threading;
32 |
33 | namespace BaCSharp
34 | {
35 | class Calendar: BaCSharpObject
36 | {
37 |
38 | public bool m_PROP_PRESENT_VALUE=false;
39 | [BaCSharpType(BacnetApplicationTags.BACNET_APPLICATION_TAG_BOOLEAN)]
40 | public virtual bool PROP_PRESENT_VALUE
41 | {
42 | get { return m_PROP_PRESENT_VALUE; }
43 | }
44 |
45 | public BACnetCalendarEntry CalenarEntry = new BACnetCalendarEntry();
46 | public virtual object PROP_DATE_LIST
47 | {
48 | get { return CalenarEntry; }
49 | set
50 | {
51 | try // null value cause an exception, of course
52 | {
53 | CalenarEntry = (BACnetCalendarEntry)value;
54 | if (CalenarEntry.Entries == null)
55 | CalenarEntry.Entries = new List