# BACnet Client Example C#
A basic BACnet IP Client example written in CSharp using the [CAS BACnet Stack](https://store.chipkin.com/services/stacks/bacnet-stack). Client example is meant to be used with the [BACnet IP C# Server Example](https://github.com/chipkin/BACnetServerExampleCSharp). Supports WhoIs, ReadProperty, and WriteProperty services.
## Releases
Build versions of this example can be downloaded from the [Releases](https://github.com/chipkin/BACnetClientExampleCSharp/releases) page.
## Installation
Download the latest release zip file on the [Releases](https://github.com/chipkin/BACnetClientExampleCSharp/releases) page.
Copy CASBACnetStack_x64_Release.dll from the CAS BACnet Stack into the release folder. Please contact Chipkin Automation Systems for access to the CAS BACnet Stack. Launch client by using the following command:
```
dotnet BACnetClientExampleCSharp.dll
```
Requires [.NET Core 3.0+](https://dotnet.microsoft.com/download)
## Usage
#### Main Menu
- D - WhoIs Menu - Send various WhoIs messages
- F - RegisterForeignDevice message
- C - Send SubscribeCOV message
- R - Send ReadProperty message
- A - Send ReadProperty All message
- W - Send WriteProperty message
- M - Send ReadProperty Multiple Asynch message
- E - Send WriteProperty Multiple Asynch message
#### WhoIs Menu
- L - Send a Local Broadcast WhoIs message
- W - Send a Local Broadcast WhoIs message with Limits
- R - Send a Remote Broadcast WhoIs message
- G - Send a Global Broadcast WhoIs message
- Q - Exit WhoIs menu
Client expects a device with the following objects:
- Device: 389001 (Device name Rainbow)
- analog_input: 0 (AnalogInput Amber)
- analog_input: 1 (AnalogInput Bronze)
- analog_input: 2 (AnalogInput Chartreuse)
- analog_output: 0 (AnalogOutput Diamond)
- analog_output: 1 (AnalogOutput Emerald)
- analog_output: 2 (AnalogOutput Fuchsia)
- analog_value: 0 (AnalogValue Gold)
- analog_value: 1 (AnalogValue Hot Pink)
- analog_value: 2 (AnalogValue Indigo)
- binary_input: 0 (BinaryInput Kiwi)
- binary_input: 1 (BinaryInput Lilac)
- binary_input: 2 (BinaryInput Magenta)
- binary_value: 0 (BinaryValue Nickel)
- binary_value: 1 (BinaryValue Onyx)
- binary_value: 2 (BinaryValue Purple)
- multi_state_input: 0 (MultiStateInput Quartz)
- multi_state_input: 1 (MultiStateInput Red)
- multi_state_input: 2 (MultiStateInput Silver)
- multi_state_value: 0 (MultiStateValue Turquoise)
- multi_state_value: 1 (MultiStateValue Umber)
- multi_state_value: 2 (MultiStateValue Vermilion)
## Build
A [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/) project is included with this project. This project also auto built using [Gitlab CI](https://docs.gitlab.com/ee/ci/) on every commit.
1. Copy *CASBACnetStack_x64_Debug.dll*, *CASBACnetStack_x64_Debug.lib*, *CASBACnetStack_x64_Release.dll*, and *CASBACnetStack_x64_Release.lib* from the [CAS BACnet Stack](https://store.chipkin.com/services/stacks/bacnet-stack) project into the /bin/netcoreapp2.1/ folder.
2. Use [Visual Studio 2019](https://visualstudio.microsoft.com/vs/) to build the project. The solution can be found in the */BACnetClientExampleCSharp/* folder.
## Example output
```txt
Starting BACnet Client Example CSharp version 0.0.1.0
https://github.com/chipkin/BACnetClientExampleCSharp
FYI: BACnet Stack version: 3.8.1.0
FYI: CAS BACnet Stack Setup, successfuly
FYI: Starting main loop
You pressed the 'Spacebar' key. Not assigned
Help:
D - Send Whois message
F - RegisterForeignDevice message
C - Send SubscribeCOV message
R - Send ReadProperty message
A - Send ReadProperty All message
W - Send WriteProperty message
M - Send ReadProperty Multiple Asynch message
E - Send WriteProperty Multiple Asynch message
Q - Quit the server
FYI: Sending Whois message
FYI: Sending 12 bytes to 192.168.1.26:47808
FYI: Recving 25 bytes from 192.168.1.26:47808
::CASBACnetStack::BACnetUnconfirmedRequestProcessor::Process() in file: X:\chipkin\cas-bacnet-stack\source\BACnetUnconfirmedRequestProcessor.cpp(106) - Error - Unconfirmed Service=[0] is not supported by this device
FYI: Sending RegisterForeignDevice message
FYI: Sending 6 bytes to 192.168.1.26:47808
FYI: Sending SubscribeCOV message
FYI: Sending 23 bytes to 192.168.1.26:47808
FYI: Recving 9 bytes from 192.168.1.26:47808
CallbackHookSimpleAck originalInvokeId=[0], serverAckChoice=[5]
FYI: Recving 42 bytes from 192.168.1.26:47808
::CASBACnetStack::BACnetUnconfirmedRequestProcessor::Process() in file: X:\chipkin\cas-bacnet-stack\source\BACnetUnconfirmedRequestProcessor.cpp(106) - Error - Unconfirmed Service=[2] is not supported by this device
FYI: Recving 42 bytes from 192.168.1.26:47808
::CASBACnetStack::BACnetUnconfirmedRequestProcessor::Process() in file: X:\chipkin\cas-bacnet-stack\source\BACnetUnconfirmedRequestProcessor.cpp(106) - Error - Unconfirmed Service=[2] is not supported by this device
FYI: Recving 42 bytes from 192.168.1.26:47808
::CASBACnetStack::BACnetUnconfirmedRequestProcessor::Process() in file: X:\chipkin\cas-bacnet-stack\source\BACnetUnconfirmedRequestProcessor.cpp(106) - Error - Unconfirmed Service=[2] is not supported by this device
FYI: Recving 42 bytes from 192.168.1.26:47808
::CASBACnetStack::BACnetUnconfirmedRequestProcessor::Process() in file: X:\chipkin\cas-bacnet-stack\source\BACnetUnconfirmedRequestProcessor.cpp(106) - Error - Unconfirmed Service=[2] is not supported by this device
FYI: Recving 42 bytes from 192.168.1.26:47808
::CASBACnetStack::BACnetUnconfirmedRequestProcessor::Process() in file: X:\chipkin\cas-bacnet-stack\source\BACnetUnconfirmedRequestProcessor.cpp(106) - Error - Unconfirmed Service=[2] is not supported by this device
You pressed the 'Spacebar' key. Not assigned
Help:
D - Send Whois message
F - RegisterForeignDevice message
C - Send SubscribeCOV message
R - Send ReadProperty message
A - Send ReadProperty All message
W - Send WriteProperty message
M - Send ReadProperty Multiple Asynch message
E - Send WriteProperty Multiple Asynch message
Q - Quit the server
FYI: Recving 42 bytes from 192.168.1.26:47808
::CASBACnetStack::BACnetUnconfirmedRequestProcessor::Process() in file: X:\chipkin\cas-bacnet-stack\source\BACnetUnconfirmedRequestProcessor.cpp(106) - Error - Unconfirmed Service=[2] is not supported by this device
FYI: Sending ReadProperty message
FYI: Sending 17 bytes to 192.168.1.26:47808
FYI: Recving 23 bytes from 192.168.1.26:47808
CallbackHookPropertyReal id=[1], objectType=[0], objectInstance=[0], propertyIdentifier=[85], value=[3996.914]
Send this value to Azure
FYI: Recving 42 bytes from 192.168.1.26:47808
::CASBACnetStack::BACnetUnconfirmedRequestProcessor::Process() in file: X:\chipkin\cas-bacnet-stack\source\BACnetUnconfirmedRequestProcessor.cpp(106) - Error - Unconfirmed Service=[2] is not supported by this device
FYI: Sending ReadProperty message
FYI: Sending 17 bytes to 192.168.1.26:47808
FYI: Recving 23 bytes from 192.168.1.26:47808
CallbackHookPropertyReal id=[2], objectType=[0], objectInstance=[0], propertyIdentifier=[85], value=[3997.915]
Send this value to Azure
FYI: Recving 42 bytes from 192.168.1.26:47808
::CASBACnetStack::BACnetUnconfirmedRequestProcessor::Process() in file: X:\chipkin\cas-bacnet-stack\source\BACnetUnconfirmedRequestProcessor.cpp(106) - Error - Unconfirmed Service=[2] is not supported by this device
FYI: Recving 42 bytes from 192.168.1.26:47808
::CASBACnetStack::BACnetUnconfirmedRequestProcessor::Process() in file: X:\chipkin\cas-bacnet-stack\source\BACnetUnconfirmedRequestProcessor.cpp(106) - Error - Unconfirmed Service=[2] is not supported by this device
FYI: Sending ReadProperty All message
FYI: Sending 19 bytes to 192.168.1.26:47808
FYI: Recving 432 bytes from 192.168.1.26:47808
CallbackHookPropertyUInt id=[3], objectType=[8], objectInstance=[389999], propertyIdentifier=[11], value=[3000]
CallbackHookPropertyCharString id=[3], objectType=[8], objectInstance=[389999], prope
BACnetClientExampleCSharp:用CSharp编写的BACnet IP客户端示例
1星 需积分: 50 34 浏览量
2021-02-15
04:19:20
上传
评论 1
收藏 13KB ZIP 举报
LiuTitanium
- 粉丝: 23
- 资源: 4685
最新资源
- CVE-2019-0708漏洞检测与利用工具
- STM32单片机FPGA毕设电路原理论文报告利用c8051f020系列单片机实现智能仪器开发
- STM32单片机FPGA毕设电路原理论文报告利用8位单片机实现与Internet网络通信应用研究
- STM32单片机FPGA毕设电路原理论文报告利用80C196单片机测量三相异步电动机功率因数
- STM32单片机FPGA毕设电路原理论文报告力学传感器与单片机的接口设计
- p107-u07FLT2.wav
- STM32单片机FPGA毕设电路原理论文报告雷达幅频特性测试仪的智能化研究
- STM32单片机FPGA毕设电路原理论文报告可组网电子温湿度测量仪的设计与实现
- STM32单片机FPGA毕设电路原理论文报告可在单片机上实现的语音混沌保密通信方法
- STM32单片机FPGA毕设电路原理论文报告可实现的基于MCS51单片机的恒温控制系统的设计
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论2