adjust root folder
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
set print pretty on
|
||||
set print union on
|
||||
set print address on
|
||||
list
|
||||
@@ -0,0 +1,73 @@
|
||||
#Makefile to build BACnet Application for the GCC port
|
||||
|
||||
# tools - only if you need them.
|
||||
# Most platforms have this already defined
|
||||
# CC = gcc
|
||||
|
||||
# Executable file name
|
||||
TARGET = bacserv
|
||||
|
||||
TARGET_BIN = ${TARGET}$(TARGET_EXT)
|
||||
|
||||
SRC = main.c
|
||||
|
||||
OBJECT_SRC = \
|
||||
$(BACNET_OBJECT)/device.c \
|
||||
$(BACNET_OBJECT)/ai.c \
|
||||
$(BACNET_OBJECT)/ao.c \
|
||||
$(BACNET_OBJECT)/av.c \
|
||||
$(BACNET_OBJECT)/bi.c \
|
||||
$(BACNET_OBJECT)/bo.c \
|
||||
$(BACNET_OBJECT)/bv.c \
|
||||
$(BACNET_OBJECT)/channel.c \
|
||||
$(BACNET_OBJECT)/command.c \
|
||||
$(BACNET_OBJECT)/csv.c \
|
||||
$(BACNET_OBJECT)/iv.c \
|
||||
$(BACNET_OBJECT)/lc.c \
|
||||
$(BACNET_OBJECT)/lo.c \
|
||||
$(BACNET_OBJECT)/lsp.c \
|
||||
$(BACNET_OBJECT)/ms-input.c \
|
||||
$(BACNET_OBJECT)/mso.c \
|
||||
$(BACNET_OBJECT)/msv.c \
|
||||
$(BACNET_OBJECT)/osv.c \
|
||||
$(BACNET_OBJECT)/piv.c \
|
||||
$(BACNET_OBJECT)/nc.c \
|
||||
$(BACNET_OBJECT)/netport.c \
|
||||
$(BACNET_OBJECT)/trendlog.c \
|
||||
$(BACNET_OBJECT)/schedule.c \
|
||||
$(BACNET_OBJECT)/access_credential.c \
|
||||
$(BACNET_OBJECT)/access_door.c \
|
||||
$(BACNET_OBJECT)/access_point.c \
|
||||
$(BACNET_OBJECT)/access_rights.c \
|
||||
$(BACNET_OBJECT)/access_user.c \
|
||||
$(BACNET_OBJECT)/access_zone.c \
|
||||
$(BACNET_OBJECT)/credential_data_input.c \
|
||||
$(BACNET_OBJECT)/bacfile.c
|
||||
|
||||
SRCS = ${SRC} ${OBJECT_SRC}
|
||||
|
||||
OBJS = ${SRCS:.c=.o}
|
||||
|
||||
all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN}
|
||||
|
||||
${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET}
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
lib: ${BACNET_LIB_TARGET}
|
||||
|
||||
${BACNET_LIB_TARGET}:
|
||||
( cd ${BACNET_LIB_DIR} ; $(MAKE) clean ; $(MAKE) )
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} ${BACNET_LIB_TARGET} $(TARGET).map
|
||||
|
||||
include: .depend
|
||||
Binary file not shown.
@@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="BACnet Server Demo" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="bin\Debug\bacserv" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj\Debug\" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
<Add option="-g" />
|
||||
<Add directory="." />
|
||||
<Add directory="..\handler" />
|
||||
<Add directory="..\object" />
|
||||
<Add directory="..\..\..\bacnet-stack" />
|
||||
<Add directory="..\..\ports\win32" />
|
||||
</Compiler>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="bin\Release\bacserv" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj\Release\" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
<Add option="-Wall" />
|
||||
<Add directory="." />
|
||||
<Add directory="..\handler" />
|
||||
<Add directory="..\object" />
|
||||
<Add directory="..\..\..\bacnet-stack" />
|
||||
<Add directory="..\..\ports\win32" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-O" />
|
||||
<Add option="-Wall" />
|
||||
<Add option="-fexceptions" />
|
||||
<Add option="-DBACDL_BIP" />
|
||||
<Add option="-DPRINT_ENABLED=1" />
|
||||
<Add option="-DBACAPP_ALL" />
|
||||
<Add directory="..\..\include" />
|
||||
<Add directory="..\handler" />
|
||||
<Add directory="..\object" />
|
||||
<Add directory="..\..\ports\win32" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add library="..\..\lib\libbacnet.a" />
|
||||
<Add library="ws2_32" />
|
||||
<Add library="iphlpapi" />
|
||||
</Linker>
|
||||
<Unit filename="..\object\ai.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\object\ai.h" />
|
||||
<Unit filename="..\object\ao.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\object\ao.h" />
|
||||
<Unit filename="..\object\av.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\object\av.h" />
|
||||
<Unit filename="..\object\bacfile.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\object\bacfile.h" />
|
||||
<Unit filename="..\object\bi.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\object\bi.h" />
|
||||
<Unit filename="..\object\bo.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\object\bo.h" />
|
||||
<Unit filename="..\object\bv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\object\bv.h" />
|
||||
<Unit filename="..\object\csv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\object\csv.h" />
|
||||
<Unit filename="..\object\device.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\object\device.h" />
|
||||
<Unit filename="..\object\lc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\object\lc.h" />
|
||||
<Unit filename="..\object\lo.h" />
|
||||
<Unit filename="..\object\lsp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\object\lsp.h" />
|
||||
<Unit filename="..\object\ms-input.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\object\ms-input.h" />
|
||||
<Unit filename="..\object\mso.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\object\mso.h" />
|
||||
<Unit filename="..\object\msv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\object\msv.h" />
|
||||
<Unit filename="..\object\nc.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\object\nc.h" />
|
||||
<Unit filename="..\object\trendlog.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="..\object\trendlog.h" />
|
||||
<Unit filename="main.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
||||
@@ -0,0 +1,759 @@
|
||||
PICS 0
|
||||
BACnet Protocol Implementation Conformance Statement
|
||||
|
||||
--
|
||||
--
|
||||
-- BACnet Stack Demo
|
||||
-- bacnet.sourceforge.net
|
||||
-- Author: Steve Karg
|
||||
--
|
||||
--
|
||||
|
||||
Vendor Name: "ASHRAE"
|
||||
Product Name: "SimpleServer"
|
||||
Product Model Number: "GNU"
|
||||
Product Description: "server"
|
||||
|
||||
BIBBs Supported:
|
||||
{
|
||||
-- The BIBBs may be any of:
|
||||
-- DS-RP-A
|
||||
DS-RP-B
|
||||
-- DS-RPM-A DS-RPM-B
|
||||
-- DS-RPC-A DS-RPC-B
|
||||
-- DS-WP-A
|
||||
DS-WP-B
|
||||
-- DS-WPM-A DS-WPM-B
|
||||
-- DS-COV-A DS-COV-B
|
||||
-- DS-COVP-A DS-COVP-B
|
||||
-- DS-COVU-A DS-COVU-B
|
||||
-- AE-N-A AE-N-I-B AE-N-E-B
|
||||
-- AE-ACK-A AE-ACK-B
|
||||
-- AE-ASUM-A AE-ASUM-B
|
||||
-- AE-ESUM-A AE-ESUM-B
|
||||
-- AE-INFO-A AE-INFO-B
|
||||
-- AE-LS-A AE-LS-B
|
||||
-- SCHED-A SCHED-I-B SCHED-E-B
|
||||
-- T-VMT-A T-VMT-I-B T-VMT-E-B
|
||||
-- T-ATR-A T-ATR-B
|
||||
-- DM-DDB-A
|
||||
DM-DDB-B
|
||||
-- DM-DOB-A
|
||||
DM-DOB-B
|
||||
-- DM-DCC-A
|
||||
DM-DCC-B
|
||||
-- DM-PT-A DM-PT-B
|
||||
-- DM-TM-A DM-TM-B
|
||||
-- DM-TS-A
|
||||
DM-TS-B
|
||||
-- DM-UTC-A
|
||||
DM-UTC-B
|
||||
-- DM-RD-A
|
||||
DM-RD-B
|
||||
-- DM-BR-A DM-BR-B
|
||||
-- DM-R-A DM-R-B
|
||||
-- DM-LM-A DM-LM-B
|
||||
-- DM-OCD-A DM-OCD-B
|
||||
-- DM-VT-A DM-VT-B
|
||||
-- NM-CE-A NM-CE-B
|
||||
-- NM-RC-A NM-RC-B
|
||||
}
|
||||
|
||||
BACnet Standard Application Services Supported:
|
||||
{
|
||||
-- AcknowledgeAlarm Initiate Execute
|
||||
-- ConfirmedCOVNotification Initiate Execute
|
||||
UnconfirmedCOVNotification Initiate
|
||||
-- ConfirmedEventNotification Initiate Execute
|
||||
-- UnconfirmedEventNotification Initiate Execute
|
||||
-- GetAlarmSummary Initiate Execute
|
||||
-- GetEnrollmentSummary Initiate Execute
|
||||
AtomicReadFile Initiate Execute
|
||||
-- AtomicWriteFile Initiate Execute
|
||||
-- AddListElement Initiate Execute
|
||||
-- RemoveListElement Initiate Execute
|
||||
-- CreateObject Initiate Execute
|
||||
-- DeleteObject Initiate Execute
|
||||
ReadProperty Initiate Execute
|
||||
-- ReadpropertyConditional Initiate Execute
|
||||
-- ReadPropertyMultiple Initiate Execute
|
||||
-- SubscribeCOV Initiate Execute
|
||||
WriteProperty Initiate Execute
|
||||
-- WritePropertyMultiple Initiate Execute
|
||||
DeviceCommunicationControl Initiate Execute
|
||||
-- ConfirmedPrivateTransfer Initiate Execute
|
||||
-- UnconfirmedPrivateTransfer Initiate Execute
|
||||
TimeSynchronization Initiate Execute
|
||||
Who-Has Initiate Execute
|
||||
I-Have Initiate
|
||||
Who-Is Initiate Execute
|
||||
I-Am Initiate
|
||||
-- VT-Open Initiate Execute
|
||||
-- VT-Close Initiate Execute
|
||||
-- VT-Data Initiate Execute
|
||||
-- ConfirmedTextMessage Initiate Execute
|
||||
-- UnconfirmedTextMessage Initiate Execute
|
||||
ReinitializeDevice Initiate Execute
|
||||
-- RequestKey Initiate Execute
|
||||
-- Authenticate Initiate Execute
|
||||
UTCTimeSynchronization Initiate Execute
|
||||
-- ReadRange Initiate Execute
|
||||
-- GetEventInformation Initiate Execute
|
||||
-- LifeSafetyOperation Initiate Execute
|
||||
-- SubscribeCOVProperty Initiate Execute
|
||||
-- RequestKey Initiate Execute
|
||||
-- Authenticate Initiate Execute
|
||||
}
|
||||
|
||||
Standard Object-Types Supported:
|
||||
{
|
||||
Analog Input
|
||||
Analog Output
|
||||
Analog Value
|
||||
-- Averaging Createable Deleteable
|
||||
Binary Input
|
||||
Binary Output
|
||||
Binary Value
|
||||
-- Calendar Createable Deleteable
|
||||
-- Command Createable Deleteable
|
||||
Device
|
||||
-- Event Enrollment Createable Deleteable
|
||||
File
|
||||
-- Group Createable Deleteable
|
||||
-- Loop Createable Deleteable
|
||||
-- Multi-state Input Createable Deleteable
|
||||
Multi-state Output
|
||||
-- Multi-state Value Createable Deleteable
|
||||
-- Notification Class Createable Deleteable
|
||||
-- Program Createable Deleteable
|
||||
-- Schedule Createable Deleteable
|
||||
Life Safety Point
|
||||
-- Life Safety Zone Createable Deleteable
|
||||
-- Trend Log Createable Deleteable
|
||||
Load Control
|
||||
}
|
||||
|
||||
Data Link Layer Option:
|
||||
{
|
||||
-- ISO 8802-3, 10BASE5
|
||||
-- ISO 8802-3, 10BASE2
|
||||
-- ISO 8802-3, 10BASET
|
||||
-- ISO 8802-3, Fiber
|
||||
-- ARCNET, coax star
|
||||
-- ARCNET, coax bus
|
||||
-- ARCNET, twisted pair star
|
||||
-- ARCNET, twisted pair bus
|
||||
-- ARCNET, fiber star
|
||||
-- MS/TP master. Baud rate(s): 9600
|
||||
-- MS/TP slave. Baud rate(s): 9600
|
||||
-- Point-To-Point. Modem, Baud rate(s): 14.4k
|
||||
-- Point-To-Point. Modem, Autobaud range: 9600 to 28.8k
|
||||
BACnet/IP, 'DIX' Ethernet
|
||||
-- BACnet/IP, PPP
|
||||
-- Other
|
||||
}
|
||||
|
||||
Character Sets Supported:
|
||||
{
|
||||
ANSI X3.4
|
||||
-- Other Character Sets not supported
|
||||
-- IBM/Microsoft DBCS
|
||||
-- JIS C 6226
|
||||
-- ISO 10646 (ICS-4)
|
||||
-- ISO 10646 (UCS2)
|
||||
}
|
||||
|
||||
Special Functionality:
|
||||
{
|
||||
Maximum APDU size in octets: 480 -- Arcnet Maximum 501 less NL Header
|
||||
-- Maximum APDU size in octets: 480
|
||||
-- Segmented Requests Supported, window size: 1
|
||||
-- Segmented Responses Supported, window size: 1
|
||||
-- Router
|
||||
}
|
||||
|
||||
List of Objects in test device:
|
||||
{
|
||||
{
|
||||
object-identifier: (device,123)
|
||||
object-name: "SimpleServer"
|
||||
object-type: device
|
||||
system-status: operational
|
||||
vendor-name: "ASHRAE"
|
||||
vendor-identifier: 0
|
||||
model-name: "GNU"
|
||||
firmware-revision: "1.0"
|
||||
application-software-version: "1.0"
|
||||
protocol-version: 1
|
||||
protocol-revision: 5
|
||||
protocol-conformance-class: 1
|
||||
protocol-services-supported: (F,F,F,F,F,F,T,F,F,F,F,F,T,F,F,T,F,T,F,F,T,F,F,F,F,F,F,F,F,F,F,F,T,T,T,F,T,F,F,F)
|
||||
protocol-object-types-supported: (T,T,T,T,T,T,F,F,T,F,T,F,F,F,T,F,F,F,F,F,F,T,F,F,F)
|
||||
max-apdu-length-accepted: 480
|
||||
segmentation-supported: no-segmentation
|
||||
apdu-timeout: 3000
|
||||
number-of-apdu-retries: 3
|
||||
device-address-binding: ?
|
||||
local-time: ?
|
||||
local-date: ?
|
||||
utc-offset: ?
|
||||
daylight-savings-status: ?
|
||||
database-revision: ?
|
||||
object-list: {
|
||||
(device,123),(analog-input,0),(analog-input,1),
|
||||
(analog-input,2),(analog-input,3),(analog-input,4),
|
||||
(analog-input,5),(analog-input,6),(analog-output,0),
|
||||
(analog-output,1),(analog-output,2),(analog-output,3),
|
||||
(analog-value,0),(analog-value,1),(analog-value,2),
|
||||
(analog-value,3),(binary-input,0),(binary-input,1),
|
||||
(binary-input,2),(binary-input,3),(binary-input,4),
|
||||
(binary-output,0),(binary-output,1),(binary-output,2),
|
||||
(binary-output,3),(binary-output,4),(binary-output,5),
|
||||
(binary-value,0),(binary-value,1),(life-safety-point,0),
|
||||
(life-safety-point,1),(life-safety-point,2),(life-safety-point,3),
|
||||
(life-safety-point,4),(life-safety-point,5),(life-safety-point,6),
|
||||
(multi-state-output,0),(multi-state-output,1),(multi-state-output,2),
|
||||
(multi-state-output,3),(file,0),(file,1),
|
||||
(file,2)
|
||||
}
|
||||
},
|
||||
{
|
||||
object-identifier: (analog-input,0)
|
||||
object-name: "ANALOG INPUT 0"
|
||||
object-type: analog-input
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
units: percent
|
||||
description: "ANALOG INPUT 0"
|
||||
},
|
||||
{
|
||||
object-identifier: (analog-input,1)
|
||||
object-name: "ANALOG INPUT 1"
|
||||
object-type: analog-input
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
units: percent
|
||||
description: "ANALOG INPUT 1"
|
||||
},
|
||||
{
|
||||
object-identifier: (analog-input,2)
|
||||
object-name: "ANALOG INPUT 2"
|
||||
object-type: analog-input
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
units: percent
|
||||
description: "ANALOG INPUT 2"
|
||||
},
|
||||
{
|
||||
object-identifier: (analog-input,3)
|
||||
object-name: "ANALOG INPUT 3"
|
||||
object-type: analog-input
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
units: percent
|
||||
description: "ANALOG INPUT 3"
|
||||
},
|
||||
{
|
||||
object-identifier: (analog-input,4)
|
||||
object-name: "ANALOG INPUT 4"
|
||||
object-type: analog-input
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
units: percent
|
||||
description: "ANALOG INPUT 4"
|
||||
},
|
||||
{
|
||||
object-identifier: (analog-input,5)
|
||||
object-name: "ANALOG INPUT 5"
|
||||
object-type: analog-input
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
units: percent
|
||||
description: "ANALOG INPUT 5"
|
||||
},
|
||||
{
|
||||
object-identifier: (analog-input,6)
|
||||
object-name: "ANALOG INPUT 6"
|
||||
object-type: analog-input
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
units: percent
|
||||
description: "ANALOG INPUT 6"
|
||||
},
|
||||
{
|
||||
object-identifier: (analog-output,0)
|
||||
object-name: "ANALOG OUTPUT 0"
|
||||
object-type: analog-output
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
units: percent
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: 0.000000
|
||||
description: "ANALOG OUTPUT 0"
|
||||
},
|
||||
{
|
||||
object-identifier: (analog-output,1)
|
||||
object-name: "ANALOG OUTPUT 1"
|
||||
object-type: analog-output
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
units: percent
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: 0.000000
|
||||
description: "ANALOG OUTPUT 1"
|
||||
},
|
||||
{
|
||||
object-identifier: (analog-output,2)
|
||||
object-name: "ANALOG OUTPUT 2"
|
||||
object-type: analog-output
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
units: percent
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: 0.000000
|
||||
description: "ANALOG OUTPUT 2"
|
||||
},
|
||||
{
|
||||
object-identifier: (analog-output,3)
|
||||
object-name: "ANALOG OUTPUT 3"
|
||||
object-type: analog-output
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
units: percent
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: 0.000000
|
||||
description: "ANALOG OUTPUT 3"
|
||||
},
|
||||
{
|
||||
object-identifier: (analog-value,0)
|
||||
object-name: "ANALOG VALUE 0"
|
||||
object-type: analog-value
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
units: percent
|
||||
relinquish-default: 0.000000
|
||||
description: "ANALOG VALUE 0"
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: 0.000000
|
||||
},
|
||||
{
|
||||
object-identifier: (analog-value,1)
|
||||
object-name: "ANALOG VALUE 1"
|
||||
object-type: analog-value
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
units: percent
|
||||
relinquish-default: 0.000000
|
||||
description: "ANALOG VALUE 1"
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: 0.000000
|
||||
},
|
||||
{
|
||||
object-identifier: (analog-value,2)
|
||||
object-name: "ANALOG VALUE 2"
|
||||
object-type: analog-value
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
units: percent
|
||||
relinquish-default: 0.000000
|
||||
description: "ANALOG VALUE 2"
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: 0.000000
|
||||
},
|
||||
{
|
||||
object-identifier: (analog-value,3)
|
||||
object-name: "ANALOG VALUE 3"
|
||||
object-type: analog-value
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
units: percent
|
||||
relinquish-default: 0.000000
|
||||
description: "ANALOG VALUE 3"
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: 0.000000
|
||||
},
|
||||
{
|
||||
object-identifier: (binary-input,0)
|
||||
object-name: "BINARY INPUT 0"
|
||||
object-type: binary-input
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
polarity: normal
|
||||
description: "BINARY INPUT 0"
|
||||
},
|
||||
{
|
||||
object-identifier: (binary-input,1)
|
||||
object-name: "BINARY INPUT 1"
|
||||
object-type: binary-input
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
polarity: normal
|
||||
description: "BINARY INPUT 1"
|
||||
},
|
||||
{
|
||||
object-identifier: (binary-input,2)
|
||||
object-name: "BINARY INPUT 2"
|
||||
object-type: binary-input
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
polarity: normal
|
||||
description: "BINARY INPUT 2"
|
||||
},
|
||||
{
|
||||
object-identifier: (binary-input,3)
|
||||
object-name: "BINARY INPUT 3"
|
||||
object-type: binary-input
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
polarity: normal
|
||||
description: "BINARY INPUT 3"
|
||||
},
|
||||
{
|
||||
object-identifier: (binary-input,4)
|
||||
object-name: "BINARY INPUT 4"
|
||||
object-type: binary-input
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
polarity: normal
|
||||
description: "BINARY INPUT 4"
|
||||
},
|
||||
{
|
||||
object-identifier: (binary-output,0)
|
||||
object-name: "BINARY OUTPUT 0"
|
||||
object-type: binary-output
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
polarity: normal
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: inactive
|
||||
description: "BINARY OUTPUT 0"
|
||||
},
|
||||
{
|
||||
object-identifier: (binary-output,1)
|
||||
object-name: "BINARY OUTPUT 1"
|
||||
object-type: binary-output
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
polarity: normal
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: inactive
|
||||
description: "BINARY OUTPUT 1"
|
||||
},
|
||||
{
|
||||
object-identifier: (binary-output,2)
|
||||
object-name: "BINARY OUTPUT 2"
|
||||
object-type: binary-output
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
polarity: normal
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: inactive
|
||||
description: "BINARY OUTPUT 2"
|
||||
},
|
||||
{
|
||||
object-identifier: (binary-output,3)
|
||||
object-name: "BINARY OUTPUT 3"
|
||||
object-type: binary-output
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
polarity: normal
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: inactive
|
||||
description: "BINARY OUTPUT 3"
|
||||
},
|
||||
{
|
||||
object-identifier: (binary-output,4)
|
||||
object-name: "BINARY OUTPUT 4"
|
||||
object-type: binary-output
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
polarity: normal
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: inactive
|
||||
description: "BINARY OUTPUT 4"
|
||||
},
|
||||
{
|
||||
object-identifier: (binary-output,5)
|
||||
object-name: "BINARY OUTPUT 5"
|
||||
object-type: binary-output
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
polarity: normal
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: inactive
|
||||
description: "BINARY OUTPUT 5"
|
||||
},
|
||||
{
|
||||
object-identifier: (binary-value,0)
|
||||
object-name: "BINARY VALUE 0"
|
||||
object-type: binary-value
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
description: "BINARY VALUE 0"
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: inactive
|
||||
},
|
||||
{
|
||||
object-identifier: (binary-value,1)
|
||||
object-name: "BINARY VALUE 1"
|
||||
object-type: binary-value
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
description: "BINARY VALUE 1"
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: inactive
|
||||
},
|
||||
{
|
||||
object-identifier: (life-safety-point,0)
|
||||
object-name: "LS POINT 0"
|
||||
object-type: life-safety-point
|
||||
description: "LS POINT 0"
|
||||
present-value: ?
|
||||
device-type: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
reliability: ?
|
||||
out-of-service: F
|
||||
mode: ? W
|
||||
silenced: ?
|
||||
operation-expected: ?
|
||||
},
|
||||
{
|
||||
object-identifier: (life-safety-point,1)
|
||||
object-name: "LS POINT 1"
|
||||
object-type: life-safety-point
|
||||
description: "LS POINT 1"
|
||||
present-value: ?
|
||||
device-type: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
reliability: ?
|
||||
out-of-service: F
|
||||
mode: ? W
|
||||
silenced: ?
|
||||
operation-expected: ?
|
||||
},
|
||||
{
|
||||
object-identifier: (life-safety-point,2)
|
||||
object-name: "LS POINT 2"
|
||||
object-type: life-safety-point
|
||||
description: "LS POINT 2"
|
||||
present-value: ?
|
||||
device-type: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
reliability: ?
|
||||
out-of-service: F
|
||||
mode: ? W
|
||||
silenced: ?
|
||||
operation-expected: ?
|
||||
},
|
||||
{
|
||||
object-identifier: (life-safety-point,3)
|
||||
object-name: "LS POINT 3"
|
||||
object-type: life-safety-point
|
||||
description: "LS POINT 3"
|
||||
present-value: ?
|
||||
device-type: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
reliability: ?
|
||||
out-of-service: F
|
||||
mode: ? W
|
||||
silenced: ?
|
||||
operation-expected: ?
|
||||
},
|
||||
{
|
||||
object-identifier: (life-safety-point,4)
|
||||
object-name: "LS POINT 4"
|
||||
object-type: life-safety-point
|
||||
description: "LS POINT 4"
|
||||
present-value: ?
|
||||
device-type: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
reliability: ?
|
||||
out-of-service: F
|
||||
mode: ? W
|
||||
silenced: ?
|
||||
operation-expected: ?
|
||||
},
|
||||
{
|
||||
object-identifier: (life-safety-point,5)
|
||||
object-name: "LS POINT 5"
|
||||
object-type: life-safety-point
|
||||
description: "LS POINT 5"
|
||||
present-value: ?
|
||||
device-type: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
reliability: ?
|
||||
out-of-service: F
|
||||
mode: ? W
|
||||
silenced: ?
|
||||
operation-expected: ?
|
||||
},
|
||||
{
|
||||
object-identifier: (life-safety-point,6)
|
||||
object-name: "LS POINT 6"
|
||||
object-type: life-safety-point
|
||||
description: "LS POINT 6"
|
||||
present-value: ?
|
||||
device-type: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
reliability: ?
|
||||
out-of-service: F
|
||||
mode: ? W
|
||||
silenced: ?
|
||||
operation-expected: ?
|
||||
},
|
||||
{
|
||||
object-identifier: (multi-state-output,0)
|
||||
object-name: "MULTISTATE OUTPUT 0"
|
||||
object-type: multi-state-output
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: inactive
|
||||
number-of-states: 254
|
||||
description: "MULTISTATE OUTPUT 0"
|
||||
},
|
||||
{
|
||||
object-identifier: (multi-state-output,1)
|
||||
object-name: "MULTISTATE OUTPUT 1"
|
||||
object-type: multi-state-output
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: inactive
|
||||
number-of-states: 254
|
||||
description: "MULTISTATE OUTPUT 1"
|
||||
},
|
||||
{
|
||||
object-identifier: (multi-state-output,2)
|
||||
object-name: "MULTISTATE OUTPUT 2"
|
||||
object-type: multi-state-output
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: inactive
|
||||
number-of-states: 254
|
||||
description: "MULTISTATE OUTPUT 2"
|
||||
},
|
||||
{
|
||||
object-identifier: (multi-state-output,3)
|
||||
object-name: "MULTISTATE OUTPUT 3"
|
||||
object-type: multi-state-output
|
||||
present-value: ?
|
||||
status-flags: (F,F,F,F)
|
||||
event-state: normal
|
||||
out-of-service: F
|
||||
priority-array: {?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?}
|
||||
relinquish-default: inactive
|
||||
number-of-states: 254
|
||||
description: "MULTISTATE OUTPUT 3"
|
||||
},
|
||||
{
|
||||
object-identifier: (file,0)
|
||||
object-name: "FILE 0"
|
||||
object-type: file
|
||||
file-type: "TEXT"
|
||||
file-size: 0
|
||||
modification-date: ?
|
||||
archive: ? W
|
||||
read-only: T
|
||||
file-access-method: stream-access
|
||||
description: "test.log"
|
||||
},
|
||||
{
|
||||
object-identifier: (file,1)
|
||||
object-name: "FILE 1"
|
||||
object-type: file
|
||||
file-type: "TEXT"
|
||||
file-size: 0
|
||||
modification-date: ?
|
||||
archive: ? W
|
||||
read-only: T
|
||||
file-access-method: stream-access
|
||||
description: "script.txt"
|
||||
},
|
||||
{
|
||||
object-identifier: (file,2)
|
||||
object-name: "FILE 2"
|
||||
object-type: file
|
||||
file-type: "TEXT"
|
||||
file-size: 39582
|
||||
modification-date: ?
|
||||
archive: ? W
|
||||
read-only: T
|
||||
file-access-method: stream-access
|
||||
description: "bacenum.h"
|
||||
}
|
||||
}
|
||||
|
||||
End of BACnet Protocol Implementation Conformance Statement
|
||||
|
||||
|
||||
@@ -0,0 +1,322 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006 Steve Karg <skarg@users.sourceforge.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*********************************************************************/
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "server.h"
|
||||
#include "address.h"
|
||||
#include "bacdef.h"
|
||||
#include "handlers.h"
|
||||
#include "client.h"
|
||||
#include "dlenv.h"
|
||||
#include "bacdcode.h"
|
||||
#include "npdu.h"
|
||||
#include "apdu.h"
|
||||
#include "iam.h"
|
||||
#include "tsm.h"
|
||||
#include "device.h"
|
||||
#include "bacfile.h"
|
||||
#include "datalink.h"
|
||||
#include "dcc.h"
|
||||
#include "filename.h"
|
||||
#include "getevent.h"
|
||||
#include "net.h"
|
||||
#include "txbuf.h"
|
||||
#include "lc.h"
|
||||
#include "version.h"
|
||||
/* include the device object */
|
||||
#include "device.h"
|
||||
#include "trendlog.h"
|
||||
#if defined(INTRINSIC_REPORTING)
|
||||
#include "nc.h"
|
||||
#endif /* defined(INTRINSIC_REPORTING) */
|
||||
#if defined(BACFILE)
|
||||
#include "bacfile.h"
|
||||
#endif /* defined(BACFILE) */
|
||||
#if defined(BAC_UCI)
|
||||
#include "ucix.h"
|
||||
#endif /* defined(BAC_UCI) */
|
||||
|
||||
|
||||
/** @file server/main.c Example server application using the BACnet Stack. */
|
||||
|
||||
/* (Doxygen note: The next two lines pull all the following Javadoc
|
||||
* into the ServerDemo module.) */
|
||||
/** @addtogroup ServerDemo */
|
||||
/*@{*/
|
||||
|
||||
/** Buffer used for receiving */
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = { 0 };
|
||||
|
||||
/** Initialize the handlers we will utilize.
|
||||
* @see Device_Init, apdu_set_unconfirmed_handler, apdu_set_confirmed_handler
|
||||
*/
|
||||
static void Init_Service_Handlers(
|
||||
void)
|
||||
{
|
||||
Device_Init(NULL);
|
||||
/* we need to handle who-is to support dynamic device binding */
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is);
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_HAS, handler_who_has);
|
||||
|
||||
#if 0
|
||||
/* BACnet Testing Observed Incident oi00107
|
||||
Server only devices should not indicate that they EXECUTE I-Am
|
||||
Revealed by BACnet Test Client v1.8.16 ( www.bac-test.com/bacnet-test-client-download )
|
||||
BITS: BIT00040
|
||||
Any discussions can be directed to edward@bac-test.com
|
||||
Please feel free to remove this comment when my changes accepted after suitable time for
|
||||
review by all interested parties. Say 6 months -> September 2016 */
|
||||
/* In this demo, we are the server only ( BACnet "B" device ) so we do not indicate
|
||||
that we can execute the I-Am message */
|
||||
/* handle i-am to support binding to other devices */
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_bind);
|
||||
#endif
|
||||
|
||||
/* set the handler for all the services we don't implement */
|
||||
/* It is required to send the proper reject message... */
|
||||
apdu_set_unrecognized_service_handler_handler
|
||||
(handler_unrecognized_service);
|
||||
/* Set the handlers for any confirmed services that we support. */
|
||||
/* We must implement read property - it's required! */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
|
||||
handler_read_property);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
|
||||
handler_read_property_multiple);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
|
||||
handler_write_property);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROP_MULTIPLE,
|
||||
handler_write_property_multiple);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_RANGE,
|
||||
handler_read_range);
|
||||
#if defined(BACFILE)
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
|
||||
handler_atomic_read_file);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_WRITE_FILE,
|
||||
handler_atomic_write_file);
|
||||
#endif
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_REINITIALIZE_DEVICE,
|
||||
handler_reinitialize_device);
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_UTC_TIME_SYNCHRONIZATION,
|
||||
handler_timesync_utc);
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_TIME_SYNCHRONIZATION,
|
||||
handler_timesync);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_SUBSCRIBE_COV,
|
||||
handler_cov_subscribe);
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_COV_NOTIFICATION,
|
||||
handler_ucov_notification);
|
||||
/* handle communication so we can shutup when asked */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
|
||||
handler_device_communication_control);
|
||||
/* handle the data coming back from private requests */
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_PRIVATE_TRANSFER,
|
||||
handler_unconfirmed_private_transfer);
|
||||
#if defined(INTRINSIC_REPORTING)
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_ACKNOWLEDGE_ALARM,
|
||||
handler_alarm_ack);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_GET_EVENT_INFORMATION,
|
||||
handler_get_event_information);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_GET_ALARM_SUMMARY,
|
||||
handler_get_alarm_summary);
|
||||
#endif /* defined(INTRINSIC_REPORTING) */
|
||||
#if defined(BACNET_TIME_MASTER)
|
||||
handler_timesync_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void print_usage(const char *filename)
|
||||
{
|
||||
printf("Usage: %s [device-instance [device-name]]\n", filename);
|
||||
printf(" [--version][--help]\n");
|
||||
}
|
||||
|
||||
static void print_help(const char *filename)
|
||||
{
|
||||
printf("Simulate a BACnet server device\n"
|
||||
"device-instance:\n"
|
||||
"BACnet Device Object Instance number that you are\n"
|
||||
"trying simulate.\n"
|
||||
"device-name:\n"
|
||||
"The Device object-name is the text name for the device.\n"
|
||||
"\nExample:\n");
|
||||
printf("To simulate Device 123, use the following command:\n"
|
||||
"%s 123\n", filename);
|
||||
printf("To simulate Device 123 named Fred, use following command:\n"
|
||||
"%s 123 Fred\n", filename);
|
||||
}
|
||||
|
||||
/** Main function of server demo.
|
||||
*
|
||||
* @see Device_Set_Object_Instance_Number, dlenv_init, Send_I_Am,
|
||||
* datalink_receive, npdu_handler,
|
||||
* dcc_timer_seconds, bvlc_maintenance_timer,
|
||||
* Load_Control_State_Machine_Handler, handler_cov_task,
|
||||
* tsm_timer_milliseconds
|
||||
*
|
||||
* @param argc [in] Arg count.
|
||||
* @param argv [in] Takes one argument: the Device Instance #.
|
||||
* @return 0 on success.
|
||||
*/
|
||||
int main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = {
|
||||
0
|
||||
}; /* address where message came from */
|
||||
uint16_t pdu_len = 0;
|
||||
unsigned timeout = 1; /* milliseconds */
|
||||
time_t last_seconds = 0;
|
||||
time_t current_seconds = 0;
|
||||
uint32_t elapsed_seconds = 0;
|
||||
uint32_t elapsed_milliseconds = 0;
|
||||
uint32_t address_binding_tmr = 0;
|
||||
uint32_t recipient_scan_tmr = 0;
|
||||
#if defined(BACNET_TIME_MASTER)
|
||||
BACNET_DATE_TIME bdatetime;
|
||||
#endif
|
||||
#if defined(BAC_UCI)
|
||||
int uciId = 0;
|
||||
struct uci_context *ctx;
|
||||
#endif
|
||||
int argi = 0;
|
||||
const char *filename = NULL;
|
||||
|
||||
filename = filename_remove_path(argv[0]);
|
||||
for (argi = 1; argi < argc; argi++) {
|
||||
if (strcmp(argv[argi], "--help") == 0) {
|
||||
print_usage(filename);
|
||||
print_help(filename);
|
||||
return 0;
|
||||
}
|
||||
if (strcmp(argv[argi], "--version") == 0) {
|
||||
printf("%s %s\n", filename, BACNET_VERSION_TEXT);
|
||||
printf("Copyright (C) 2014 by Steve Karg and others.\n"
|
||||
"This is free software; see the source for copying conditions.\n"
|
||||
"There is NO warranty; not even for MERCHANTABILITY or\n"
|
||||
"FITNESS FOR A PARTICULAR PURPOSE.\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#if defined(BAC_UCI)
|
||||
ctx = ucix_init("bacnet_dev");
|
||||
if (!ctx)
|
||||
fprintf(stderr, "Failed to load config file bacnet_dev\n");
|
||||
uciId = ucix_get_option_int(ctx, "bacnet_dev", "0", "Id", 0);
|
||||
printf("ID: %i", uciId);
|
||||
if (uciId != 0) {
|
||||
Device_Set_Object_Instance_Number(uciId);
|
||||
} else {
|
||||
#endif /* defined(BAC_UCI) */
|
||||
/* allow the device ID to be set */
|
||||
if (argc > 1) {
|
||||
Device_Set_Object_Instance_Number(strtol(argv[1], NULL, 0));
|
||||
}
|
||||
if (argc > 2) {
|
||||
Device_Object_Name_ANSI_Init(argv[2]);
|
||||
}
|
||||
#if defined(BAC_UCI)
|
||||
}
|
||||
ucix_cleanup(ctx);
|
||||
#endif /* defined(BAC_UCI) */
|
||||
|
||||
printf("BACnet Server Demo\n" "BACnet Stack Version %s\n"
|
||||
"BACnet Device ID: %u\n" "Max APDU: %d\n", BACnet_Version,
|
||||
Device_Object_Instance_Number(), MAX_APDU);
|
||||
/* load any static address bindings to show up
|
||||
in our device bindings list */
|
||||
address_init();
|
||||
Init_Service_Handlers();
|
||||
dlenv_init();
|
||||
atexit(datalink_cleanup);
|
||||
/* configure the timeout values */
|
||||
last_seconds = time(NULL);
|
||||
/* broadcast an I-Am on startup */
|
||||
Send_I_Am(&Handler_Transmit_Buffer[0]);
|
||||
/* loop forever */
|
||||
for (;;) {
|
||||
/* input */
|
||||
current_seconds = time(NULL);
|
||||
|
||||
/* returns 0 bytes on timeout */
|
||||
pdu_len = datalink_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout);
|
||||
|
||||
/* process */
|
||||
if (pdu_len) {
|
||||
npdu_handler(&src, &Rx_Buf[0], pdu_len);
|
||||
}
|
||||
/* at least one second has passed */
|
||||
elapsed_seconds = (uint32_t) (current_seconds - last_seconds);
|
||||
if (elapsed_seconds) {
|
||||
last_seconds = current_seconds;
|
||||
dcc_timer_seconds(elapsed_seconds);
|
||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
||||
bvlc_maintenance_timer(elapsed_seconds);
|
||||
#endif
|
||||
dlenv_maintenance_timer(elapsed_seconds);
|
||||
Load_Control_State_Machine_Handler();
|
||||
elapsed_milliseconds = elapsed_seconds * 1000;
|
||||
handler_cov_timer_seconds(elapsed_seconds);
|
||||
tsm_timer_milliseconds(elapsed_milliseconds);
|
||||
trend_log_timer(elapsed_seconds);
|
||||
#if defined(INTRINSIC_REPORTING)
|
||||
Device_local_reporting();
|
||||
#endif
|
||||
#if defined(BACNET_TIME_MASTER)
|
||||
Device_getCurrentDateTime(&bdatetime);
|
||||
handler_timesync_task(&bdatetime);
|
||||
#endif
|
||||
}
|
||||
handler_cov_task();
|
||||
/* scan cache address */
|
||||
address_binding_tmr += elapsed_seconds;
|
||||
if (address_binding_tmr >= 60) {
|
||||
address_cache_timer(address_binding_tmr);
|
||||
address_binding_tmr = 0;
|
||||
}
|
||||
#if defined(INTRINSIC_REPORTING)
|
||||
/* try to find addresses of recipients */
|
||||
recipient_scan_tmr += elapsed_seconds;
|
||||
if (recipient_scan_tmr >= NC_RESCAN_RECIPIENTS_SECS) {
|
||||
Notification_Class_find_recipient();
|
||||
recipient_scan_tmr = 0;
|
||||
}
|
||||
#endif
|
||||
/* output */
|
||||
|
||||
/* blink LEDs, Turn on or off outputs, etc */
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* @} */
|
||||
|
||||
/* End group ServerDemo */
|
||||
@@ -0,0 +1,148 @@
|
||||
#
|
||||
# Simple makefile to build an executable for Win32
|
||||
#
|
||||
# This makefile assumes Borland bcc32 development environment
|
||||
# on Windows NT/9x/2000/XP
|
||||
#
|
||||
|
||||
!ifndef BORLAND_DIR
|
||||
BORLAND_DIR_Not_Defined:
|
||||
@echo .
|
||||
@echo You must define environment variable BORLAND_DIR to compile.
|
||||
!endif
|
||||
|
||||
# target
|
||||
PRODUCT = bacserv
|
||||
PRODUCT_EXE = $(PRODUCT).exe
|
||||
|
||||
# tools
|
||||
CC = $(BORLAND_DIR)\bin\bcc32
|
||||
MAKE=$(BORLAND_DIR)\bin\make.exe
|
||||
#LINK = $(BORLAND_DIR)\bin\tlink32
|
||||
LINK = $(BORLAND_DIR)\bin\ilink32
|
||||
|
||||
BACNET_LIB_DIR = ..\..\lib
|
||||
BACNET_LIB = $(BACNET_LIB_DIR)\bacnet.lib
|
||||
# getting back from the library
|
||||
BACNET_DEMO_DIR = ..\demo\server
|
||||
|
||||
# directories
|
||||
BACNET_PORT = ..\..\ports\win32
|
||||
BACNET_INCLUDE = ..\..\include
|
||||
BACNET_OBJECT = ..\object
|
||||
BACNET_HANDLER = ..\handler
|
||||
INCLUDES = \
|
||||
-I$(BACNET_INCLUDE) \
|
||||
-I$(BACNET_PORT) \
|
||||
-I$(BACNET_OBJECT) \
|
||||
-I$(BACNET_HANDLER) \
|
||||
-I$(BORLAND_DIR)\include
|
||||
|
||||
#
|
||||
BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACFILE -DBACAPP_ALL
|
||||
#BACDL_DEFINE=-DBACDL_MSTP -DCRC_USE_TABLE
|
||||
BACDL_DEFINE=-DBACDL_BIP=1 -DUSE_INADDR=1
|
||||
DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE)
|
||||
|
||||
SRCS = main.c
|
||||
|
||||
OBJS = $(SRCS:.c=.obj)
|
||||
|
||||
#
|
||||
# Compiler definitions
|
||||
#
|
||||
BCC_CFG = bcc32.cfg
|
||||
|
||||
#
|
||||
# Include directories
|
||||
#
|
||||
CFLAGS = $(INCLUDES) $(DEFINES)
|
||||
|
||||
#
|
||||
# Libraries
|
||||
#
|
||||
C_LIB_DIR = $(BORLAND_DIR)\lib
|
||||
|
||||
LIBS = $(BACNET_LIB) \
|
||||
$(C_LIB_DIR)\IMPORT32.lib \
|
||||
$(C_LIB_DIR)\CW32MT.lib \
|
||||
|
||||
#
|
||||
# Main target
|
||||
#
|
||||
# This should be the first one in the makefile
|
||||
|
||||
all : $(BACNET_LIB) $(BCC_CFG) $(OBJS) $(PRODUCT_EXE)
|
||||
del $(BCC_CFG)
|
||||
|
||||
install: $(PRODUCT_EXE)
|
||||
copy $(PRODUCT_EXE) ..\..\bin\$(PRODUCT_EXE)
|
||||
|
||||
$(BACNET_LIB):
|
||||
cd $(BACNET_LIB_DIR)
|
||||
$(MAKE) -i -f makefile.b32 clean
|
||||
$(MAKE) -f makefile.b32 all
|
||||
cd $(BACNET_DEMO_DIR)
|
||||
|
||||
# Linker specific: the link below is for BCC linker/compiler. If you link
|
||||
# with a different linker - please change accordingly.
|
||||
#
|
||||
|
||||
# need a temp response file (@&&| ... |) because command line is too long
|
||||
# $** lists each dependency
|
||||
# $< target name
|
||||
# $* target name without extension
|
||||
$(PRODUCT_EXE) : $(OBJS)
|
||||
@echo Running Linker for $(PRODUCT_EXE)
|
||||
$(LINK) -L$(C_LIB_DIR) -L$(BACNET_LIB_DIR) -m -c -s -v @&&|
|
||||
$(BORLAND_DIR)\lib\c0x32.obj $**
|
||||
$<
|
||||
$*.map
|
||||
$(LIBS)
|
||||
|
|
||||
|
||||
#
|
||||
# Utilities
|
||||
|
||||
clean :
|
||||
del $(OBJS)
|
||||
del $(PRODUCT_EXE)
|
||||
del $(PRODUCT).map
|
||||
del $(PRODUCT).ilc
|
||||
del $(PRODUCT).ild
|
||||
del $(PRODUCT).ilf
|
||||
del $(PRODUCT).ils
|
||||
del $(PRODUCT).tds
|
||||
del $(BCC_CFG)
|
||||
|
||||
#
|
||||
# Generic rules
|
||||
#
|
||||
.SUFFIXES: .cpp .c .sbr .obj
|
||||
|
||||
#
|
||||
# cc generic rule
|
||||
#
|
||||
.c.obj:
|
||||
$(CC) +$(BCC_CFG) -o$@ $<
|
||||
|
||||
# Compiler configuration file
|
||||
$(BCC_CFG) :
|
||||
Copy &&|
|
||||
$(CFLAGS)
|
||||
-c
|
||||
-y #include line numbers in OBJ's
|
||||
-v #include debug info
|
||||
-w+ #turn on all warnings
|
||||
#-Od #disable all optimizations
|
||||
-O2 #disable all optimizations
|
||||
-WM #multithread
|
||||
#-WM- #not multithread
|
||||
-w-aus # ignore warning assigned a value that is never used
|
||||
-w-sig # ignore warning conversion may lose sig digits
|
||||
#-a4 #32 bit data alignment
|
||||
#-M # generate link map
|
||||
#-ls # linker options
|
||||
| $@
|
||||
|
||||
# EOF: makefile
|
||||
@@ -0,0 +1,48 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006 Steve Karg <skarg@users.sourceforge.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef SERVER_H_
|
||||
#define SERVER_H_
|
||||
|
||||
/** @file server/server.h Header for example server (ie, BACnet Device)
|
||||
* using the BACnet Stack. */
|
||||
|
||||
/** @defgroup Demos Demos of Servers and Clients
|
||||
* Most of the folders under the /demo folder contain demonstration (ie, sample)
|
||||
* code that implements the name functionality.
|
||||
*
|
||||
* The exceptions to this general rule, /handler and /object folders, are
|
||||
* described in the various BIBBs and Object Framework modules.
|
||||
*/
|
||||
|
||||
/** @defgroup ServerDemo Demo of a BACnet Server (Device).
|
||||
* @ingroup Demos
|
||||
* This is a basic demonstration of a simple BACnet Device consisting of
|
||||
* the services and properties shown in its EPICS
|
||||
* (see file demo/server/epics_vts3.tpi)
|
||||
*/
|
||||
|
||||
|
||||
#endif /* SERVER_H_ */
|
||||
Reference in New Issue
Block a user