Strip tabs and trailing white spaces, and fix end of files (#748)
* format: Strip trailing whitespaces
We want to get rid of trailing whitespaces completly as they make just git
noice. Much better to start using automated tools to get rid of them once and
not getting them back again. This way git history will be cleaner and review
easier.
Commit was generated with:
pre-commit run --all-files trailing-whitespace
* format: Files should have exactly one new line end of them
It is good practice that every file has one new line. It is not now days so
mandatory but it also is not nice if file has lot of newlines end of it. We will
use pre-commit which takes automatically care about this so let's fix all.
Commit was generated with:
pre-commit run --all-files end-of-file-fixer
* format: Convert tabs to spaces
Project mostly use spaces over tabs. When mixing tabs and spaces this usually
makes formatting issues and also when changing those in commits it will make lot
of git noise. We will force spaces most of the time and use pre-commit to fix.
Commit was generated with:
pre-commit run --all-files remove-tabs
---------
Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
+1
-2
@@ -148,7 +148,7 @@ DEBUGGING ?=
|
||||
# enable all relevant warnings that find bugs
|
||||
WARNING_ALL := -Wall -Wextra -pedantic
|
||||
WARNING_ALL += -Wfloat-equal -Wconversion
|
||||
WARNING_ALL += -Wredundant-decls -Wswitch-default
|
||||
WARNING_ALL += -Wredundant-decls -Wswitch-default
|
||||
WARNING_ALL += -Wunused-variable
|
||||
# don't warn about conversion, sign, compares, long long and attributes
|
||||
# since they are common in embedded
|
||||
@@ -459,4 +459,3 @@ fuzz-afl: $(BACNET_LIB_TARGET)
|
||||
.PHONY: writepropm
|
||||
writepropm: $(BACNET_LIB_TARGET)
|
||||
$(MAKE) -B -C $@
|
||||
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that sends a BACnet service Abort message
|
||||
* @brief command line tool that sends a BACnet service Abort message
|
||||
* to the network
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2016
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -53,4 +53,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
+9
-10
@@ -5,7 +5,7 @@ for the eight RGB (red-green-blue) LEDs attached to the Blinkt! card.
|
||||
|
||||
## Installation
|
||||
|
||||
The demo uses pigpiod (Pi GPIO Daemon) and developer library. To install
|
||||
The demo uses pigpiod (Pi GPIO Daemon) and developer library. To install
|
||||
and run the daemon at powerup (and immediately):
|
||||
|
||||
$ sudo apt install libpigpio-dev libpigpiod-if-dev pigpiod
|
||||
@@ -14,12 +14,12 @@ and run the daemon at powerup (and immediately):
|
||||
|
||||
## WiFi Power
|
||||
|
||||
If you are using a Raspberry Pi with WiFi, you will likely want
|
||||
If you are using a Raspberry Pi with WiFi, you will likely want
|
||||
to disable WiFi Power saving. Under Raspberry Pi OS, so the following.
|
||||
|
||||
### Startup service in systemd
|
||||
|
||||
To manage to start programs you should use systemd Unit files.
|
||||
To manage to start programs you should use systemd Unit files.
|
||||
|
||||
File name: /etc/systemd/system/wlan0pwr.service
|
||||
|
||||
@@ -44,9 +44,9 @@ In the empty editor insert these statements, save them and quit the editor:
|
||||
Enable the new service with:
|
||||
|
||||
rpi ~$ sudo systemctl enable wlan0pwr.service
|
||||
|
||||
|
||||
## Building the Blinkt! BACnet Application
|
||||
|
||||
|
||||
Build from the root folder:
|
||||
|
||||
$ make blinkt
|
||||
@@ -59,8 +59,8 @@ Run from the bin/ folder:
|
||||
|
||||
## Blinkt! as a Startup service with systemd
|
||||
|
||||
To manage to start programs you should use systemd Unit files.
|
||||
Here is a very simple template you can use to start to solve your problem.
|
||||
To manage to start programs you should use systemd Unit files.
|
||||
Here is a very simple template you can use to start to solve your problem.
|
||||
Create a new service with:
|
||||
|
||||
rpi ~$ sudo systemctl --full --force edit bacnet.service
|
||||
@@ -81,13 +81,12 @@ Enable the new service after the next reboot with:
|
||||
|
||||
rpi ~$ sudo systemctl enable bacnet.service
|
||||
|
||||
Create your bacnet.sh shell script in your home folder (change from pi if
|
||||
Create your bacnet.sh shell script in your home folder (change from pi if
|
||||
that is not your home folder). Use the shell script to set any environment
|
||||
variables that you want, or configuration settings for the bin/bacblinkt
|
||||
variables that you want, or configuration settings for the bin/bacblinkt
|
||||
application such as a specific device ID.
|
||||
|
||||
A simplistic bacnet.sh script will look like this (with stdout/stderr to /dev/null):
|
||||
|
||||
#!/bin/bash
|
||||
/home/pi/bacnet-stack/bin/bacblinkt 9009 > /dev/null 2>&1
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file
|
||||
/**
|
||||
* @file
|
||||
* @brief Base "class" for handling all BACnet objects belonging
|
||||
* to a BACnet device, as well as Device-specific properties.
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Example application using the BACnet Stack on a Raspberry Pi
|
||||
/**
|
||||
* @file
|
||||
* @brief Example application using the BACnet Stack on a Raspberry Pi
|
||||
* with Blinkt! LEDs.
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2023
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
* Allows you to communicate with a localhost target.
|
||||
* -t: declare target's MAC instead of using Who-Is to bind to
|
||||
* device-instance. Format is "C0:A8:00:18:BA:C0" (as usual)
|
||||
*
|
||||
*
|
||||
* Examples:
|
||||
* ./bacepics -v 1234
|
||||
* ./bacepics -v 1234
|
||||
* where the device instance to be addressed is 1234
|
||||
* and the optional -v prints values out rather than the '?' that
|
||||
* the EPICS format for VTS3 wants.
|
||||
* ./bacepics -p 0xBAC1 -t "7F:0:0:1:BA:C0" 4194303
|
||||
* ./bacepics -p 0xBAC1 -t "7F:0:0:1:BA:C0" 4194303
|
||||
* communicates with the BACnet device on localhost (127.0.0.1), using
|
||||
* port 47809 as "my" source port so it doesn't conflict with
|
||||
* the device's port 47808.
|
||||
@@ -48,13 +48,13 @@
|
||||
* ALL again with array index of 0, which should result mostly in errors
|
||||
* but will provide the list of supported properties.
|
||||
* - If that succeeds, build the list of properties to be accessed. <br>
|
||||
* - If no RPM or failed to get ALL properties from the target device, then
|
||||
* fetch the coded Required and Optional properties from the demo/object
|
||||
* folder for this object type, and use this to build the list of
|
||||
* - If no RPM or failed to get ALL properties from the target device, then
|
||||
* fetch the coded Required and Optional properties from the demo/object
|
||||
* folder for this object type, and use this to build the list of
|
||||
* properties to be accessed.
|
||||
* - If the Fetch All succeeded, print the values for each property
|
||||
* - Otherwise, for each property in the list for this object,
|
||||
* - Request the single property value with ReadProperty (RP)
|
||||
* - Request the single property value with ReadProperty (RP)
|
||||
* - From the response, print the property's value
|
||||
* The Device Object will have fetched the Object List property and built a list
|
||||
* of objects from that; use it now to cycle through each other Object and
|
||||
|
||||
+2
-2
@@ -575,7 +575,7 @@ static void PrintReadPropertyData(BACNET_OBJECT_TYPE object_type,
|
||||
}
|
||||
} else if (rpm_property->propertyIdentifier ==
|
||||
PROP_SUBORDINATE_LIST) {
|
||||
if (value->tag !=
|
||||
if (value->tag !=
|
||||
BACNET_APPLICATION_TAG_DEVICE_OBJECT_REFERENCE) {
|
||||
break;
|
||||
}
|
||||
@@ -648,7 +648,7 @@ static void PrintReadPropertyData(BACNET_OBJECT_TYPE object_type,
|
||||
/* Closing brace for this multi-valued array */
|
||||
fprintf(stdout, " }");
|
||||
}
|
||||
if (property_list_writable_member(object_type,
|
||||
if (property_list_writable_member(object_type,
|
||||
rpm_property->propertyIdentifier)) {
|
||||
fprintf(stdout, " Writable");
|
||||
}
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that sends a BACnet service to the network:
|
||||
* BACnet Error message
|
||||
* BACnet Error message
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2016
|
||||
* @copyright SPDX-License-Identifier: MIT
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -15,10 +15,7 @@ afl-cc 2.57b by <lcamtuf@google.com>
|
||||
afl-fuzz -i </path/to/corpus/> -o </path/to/output_dir/> -m none ./apps/fuzz-afl/fuzz-afl
|
||||
```
|
||||
|
||||
Caveats:
|
||||
Caveats:
|
||||
|
||||
* This builds the target with ASAN (Address Sanitizer). This makes AFL require the `-m none` to not interpret ASAN's behavior as a crash
|
||||
* AFL uses a fork/exec model to launch the target. This is nice because each testcase is from a clean state. But this also brings in a lot of overhead. If you need something faster, check out ../fuzz-libfuzzer/
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "bacnet/datalink/bvlc.h"
|
||||
#include "bacnet/basic/bbmd/h_bbmd.h"
|
||||
|
||||
// Pull in all of this...
|
||||
// Pull in all of this...
|
||||
#include "../router-mstp/main.c"
|
||||
|
||||
static void Init_Service_Handlers()
|
||||
@@ -86,7 +86,7 @@ extern int Device_Reinitialize(void) {
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BACNET_ADDRESS src = { 0 };
|
||||
BACNET_ADDRESS src = { 0 };
|
||||
uint16_t pdu_len = 0;
|
||||
|
||||
Init_Service_Handlers();
|
||||
|
||||
@@ -17,12 +17,12 @@ INFO: seed corpus: files: 5790 min: 1b max: 483b total: 305068b rss: 40Mb
|
||||
NPDU: Decoding failed; Discarded!
|
||||
...
|
||||
NPDU: DNET=65280. Discarded!
|
||||
#5867 REDUCE cov: 208 ft: 249 corp: 66/1273b lim: 115 exec/s: 2933 rss: 106Mb L: 12/109 MS: 1 EraseBytes-
|
||||
#5867 REDUCE cov: 208 ft: 249 corp: 66/1273b lim: 115 exec/s: 2933 rss: 106Mb L: 12/109 MS: 1 EraseBytes-
|
||||
Received Reserved for Use by ASHRAE
|
||||
WP: Failed to send PDU (Success)!
|
||||
NEW_FUNC[1/3]: 0x55a0d533f98a in abort_encode_apdu /mnt/net/lab_share/Bacnet/bacnet-stack-fixes/src/bacnet/abort.c:149
|
||||
NEW_FUNC[2/3]: 0x55a0d538f29a in wp_decode_service_request /mnt/net/lab_share/Bacnet/bacnet-stack-fixes/src/bacnet/wp.c:113
|
||||
#5940 NEW cov: 216 ft: 257 corp: 68/1282b lim: 115 exec/s: 2970 rss: 106Mb L: 6/109 MS: 2 EraseBytes-ChangeBit-
|
||||
NEW_FUNC[1/3]: 0x55a0d533f98a in abort_encode_apdu /mnt/net/lab_share/Bacnet/bacnet-stack-fixes/src/bacnet/abort.c:149
|
||||
NEW_FUNC[2/3]: 0x55a0d538f29a in wp_decode_service_request /mnt/net/lab_share/Bacnet/bacnet-stack-fixes/src/bacnet/wp.c:113
|
||||
#5940 NEW cov: 216 ft: 257 corp: 68/1282b lim: 115 exec/s: 2970 rss: 106Mb L: 6/109 MS: 2 EraseBytes-ChangeBit-
|
||||
Received Reserved for Use by ASHRAE
|
||||
...
|
||||
=================================================================
|
||||
@@ -45,7 +45,6 @@ READ of size 1 at 0x60200003b656 thread T0
|
||||
...
|
||||
```
|
||||
|
||||
Caveat:
|
||||
Caveat:
|
||||
|
||||
* Libfuzzer does not reinitialize the target on each testcase. This means that it will be much quicker than ../fuzz-afl/, BUT it will also be a little less stable. It also will not continue to fuzz after a crash is found (since the libfuzzer runtime shares a process with the target that just crashed). There may be some command line options to adopt a fork model.
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "bacnet/datalink/bvlc.h"
|
||||
#include "bacnet/basic/bbmd/h_bbmd.h"
|
||||
|
||||
// Pull in all of this...
|
||||
// Pull in all of this...
|
||||
#include "../router-mstp/main.c"
|
||||
|
||||
static void Init_Service_Handlers(void) {
|
||||
@@ -83,7 +83,7 @@ extern int Device_Reinitialize(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern bool Device_COV(BACNET_OBJECT_TYPE object_type, uint32_t object_instance) {
|
||||
extern bool Device_COV(BACNET_OBJECT_TYPE object_type, uint32_t object_instance) {
|
||||
return false;
|
||||
}
|
||||
extern void Device_COV_Clear(BACNET_OBJECT_TYPE object_type, uint32_t object_instance) {
|
||||
@@ -98,11 +98,11 @@ extern bool Device_Encode_Value_List(BACNET_OBJECT_TYPE object_type,
|
||||
|
||||
}
|
||||
|
||||
extern int Device_Add_List_Element(BACNET_LIST_ELEMENT_DATA * list_element) {
|
||||
extern int Device_Add_List_Element(BACNET_LIST_ELEMENT_DATA * list_element) {
|
||||
return BACNET_STATUS_ERROR;
|
||||
}
|
||||
|
||||
extern int Device_Remove_List_Element(BACNET_LIST_ELEMENT_DATA * list_element) {
|
||||
extern int Device_Remove_List_Element(BACNET_LIST_ELEMENT_DATA * list_element) {
|
||||
return BACNET_STATUS_ERROR;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ extern bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data) {
|
||||
}
|
||||
|
||||
int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
|
||||
BACNET_ADDRESS src = { 0 };
|
||||
BACNET_ADDRESS src = { 0 };
|
||||
|
||||
Init_Service_Handlers();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Header for example gateway (ie, BACnet Router and Devices)
|
||||
* @brief Header for example gateway (ie, BACnet Router and Devices)
|
||||
* using the BACnet Stack.
|
||||
* @author Tom Brennan <tbrennan3@users.sourceforge.net>
|
||||
* @date 2010
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
/** @defgroup GatewayDemo Demo of a BACnet virtual gateway (multiple Device).
|
||||
* @ingroup Demos
|
||||
* This is a basic demonstration of a BACnet Router with child devices (ie,
|
||||
* This is a basic demonstration of a BACnet Router with child devices (ie,
|
||||
* gateway) appearing on a virtual BACnet network behind the Router.
|
||||
* This is an extension of the ServerDemo project.
|
||||
*/
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that sends a BACnet I-Am-Router-To-Network message
|
||||
* @brief command line tool that sends a BACnet I-Am-Router-To-Network message
|
||||
* for one or more networks.
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2008
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that sends a BACnet Initialize-Routing-Table
|
||||
* message to a network and waits for responses. Displays their network
|
||||
* @brief command line tool that sends a BACnet Initialize-Routing-Table
|
||||
* message to a network and waits for responses. Displays their network
|
||||
* information from the response. This is a router-to-router message.
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2008
|
||||
|
||||
@@ -60,7 +60,7 @@ ${TARGET_BIN}: ${OBJS} Makefile
|
||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
size $@
|
||||
cp $@ ../../bin
|
||||
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -16,68 +16,68 @@
|
||||
|
||||
<ul>
|
||||
|
||||
<li><a href="#name">NAME</a></li>
|
||||
<li><a href="#description">DESCRIPTION</a></li>
|
||||
<li><a href="#options">OPTIONS</a></li>
|
||||
<li><a href="#this_tool_s_api">This tool's API</a></li>
|
||||
<ul>
|
||||
<li><a href="#name">NAME</a></li>
|
||||
<li><a href="#description">DESCRIPTION</a></li>
|
||||
<li><a href="#options">OPTIONS</a></li>
|
||||
<li><a href="#this_tool_s_api">This tool's API</a></li>
|
||||
<ul>
|
||||
|
||||
<li><a href="#readproperty">ReadProperty</a></li>
|
||||
<ul>
|
||||
<li><a href="#readproperty">ReadProperty</a></li>
|
||||
<ul>
|
||||
|
||||
<li><a href="#inputs_to_readproperty">Inputs to ReadProperty</a></li>
|
||||
<li><a href="#outputs_from_readproperty">Outputs from ReadProperty</a></li>
|
||||
<li><a href="#example_of_readproperty">Example of ReadProperty</a></li>
|
||||
</ul>
|
||||
<li><a href="#inputs_to_readproperty">Inputs to ReadProperty</a></li>
|
||||
<li><a href="#outputs_from_readproperty">Outputs from ReadProperty</a></li>
|
||||
<li><a href="#example_of_readproperty">Example of ReadProperty</a></li>
|
||||
</ul>
|
||||
|
||||
<li><a href="#readpropertymultiple">ReadPropertyMultiple</a></li>
|
||||
<ul>
|
||||
<li><a href="#readpropertymultiple">ReadPropertyMultiple</a></li>
|
||||
<ul>
|
||||
|
||||
<li><a href="#inputs_to_readpropertymultiple">Inputs to ReadPropertyMultiple</a></li>
|
||||
<li><a href="#outputs_from_readpropertymultiple">Outputs from ReadPropertyMultiple</a></li>
|
||||
<li><a href="#example_of_readpropertymultiple">Example of ReadPropertyMultiple</a></li>
|
||||
</ul>
|
||||
<li><a href="#inputs_to_readpropertymultiple">Inputs to ReadPropertyMultiple</a></li>
|
||||
<li><a href="#outputs_from_readpropertymultiple">Outputs from ReadPropertyMultiple</a></li>
|
||||
<li><a href="#example_of_readpropertymultiple">Example of ReadPropertyMultiple</a></li>
|
||||
</ul>
|
||||
|
||||
<li><a href="#writeproperty">WriteProperty</a></li>
|
||||
<ul>
|
||||
<li><a href="#writeproperty">WriteProperty</a></li>
|
||||
<ul>
|
||||
|
||||
<li><a href="#inputs_to_writeproperty">Inputs to WriteProperty</a></li>
|
||||
<li><a href="#outputs_from_writeproperty">Outputs from WriteProperty</a></li>
|
||||
<li><a href="#example_of_writeproperty">Example of WriteProperty</a></li>
|
||||
</ul>
|
||||
<li><a href="#inputs_to_writeproperty">Inputs to WriteProperty</a></li>
|
||||
<li><a href="#outputs_from_writeproperty">Outputs from WriteProperty</a></li>
|
||||
<li><a href="#example_of_writeproperty">Example of WriteProperty</a></li>
|
||||
</ul>
|
||||
|
||||
<li><a href="#timesync">TimeSync</a></li>
|
||||
<ul>
|
||||
<li><a href="#timesync">TimeSync</a></li>
|
||||
<ul>
|
||||
|
||||
<li><a href="#inputs_to_timesync">Inputs to TimeSync</a></li>
|
||||
<li><a href="#outputs_from_timesync">Outputs from TimeSync</a></li>
|
||||
<li><a href="#example_of_timesync">Example of TimeSync</a></li>
|
||||
</ul>
|
||||
<li><a href="#inputs_to_timesync">Inputs to TimeSync</a></li>
|
||||
<li><a href="#outputs_from_timesync">Outputs from TimeSync</a></li>
|
||||
<li><a href="#example_of_timesync">Example of TimeSync</a></li>
|
||||
</ul>
|
||||
|
||||
<li><a href="#log">Log</a></li>
|
||||
<ul>
|
||||
<li><a href="#log">Log</a></li>
|
||||
<ul>
|
||||
|
||||
<li><a href="#inputs_to_log">Inputs to Log</a></li>
|
||||
<li><a href="#example_of_log">Example of Log</a></li>
|
||||
</ul>
|
||||
<li><a href="#inputs_to_log">Inputs to Log</a></li>
|
||||
<li><a href="#example_of_log">Example of Log</a></li>
|
||||
</ul>
|
||||
|
||||
<li><a href="#silencelog">SilenceLog</a></li>
|
||||
<ul>
|
||||
<li><a href="#silencelog">SilenceLog</a></li>
|
||||
<ul>
|
||||
|
||||
<li><a href="#inputs_to_silencelog">Inputs to SilenceLog</a></li>
|
||||
<li><a href="#outputs_from_silencelog">Outputs from SilenceLog</a></li>
|
||||
<li><a href="#example_of_silencelog">Example of SilenceLog</a></li>
|
||||
</ul>
|
||||
<li><a href="#inputs_to_silencelog">Inputs to SilenceLog</a></li>
|
||||
<li><a href="#outputs_from_silencelog">Outputs from SilenceLog</a></li>
|
||||
<li><a href="#example_of_silencelog">Example of SilenceLog</a></li>
|
||||
</ul>
|
||||
|
||||
<li><a href="#retry">Retry</a></li>
|
||||
<ul>
|
||||
<li><a href="#retry">Retry</a></li>
|
||||
<ul>
|
||||
|
||||
<li><a href="#inputs_to_retry">Inputs to Retry</a></li>
|
||||
<li><a href="#outputs_from_retry">Outputs from Retry</a></li>
|
||||
<li><a href="#example_of_retry">Example of Retry</a></li>
|
||||
</ul>
|
||||
<li><a href="#inputs_to_retry">Inputs to Retry</a></li>
|
||||
<li><a href="#outputs_from_retry">Outputs from Retry</a></li>
|
||||
<li><a href="#example_of_retry">Example of Retry</a></li>
|
||||
</ul>
|
||||
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
</ul>
|
||||
|
||||
@@ -257,7 +257,7 @@ mechanisms. NOTE: all enumerations are defined in <em class="file">bacenum.h</em
|
||||
<p>This function prints out to the desired method of logging (STDOUT or file).
|
||||
NewLine characters are not required when making calls to this function. If any
|
||||
NewLine characters are specified, they will be stripped out. To print an empty
|
||||
line, pass in a space as the message. NOTE: This function will honor previous
|
||||
line, pass in a space as the message. NOTE: This function will honor previous
|
||||
requests to silence the log (see SilcenseLog for details)</p>
|
||||
<p>
|
||||
</p>
|
||||
|
||||
@@ -39,37 +39,37 @@ ul {
|
||||
}
|
||||
.quotedString
|
||||
{
|
||||
color: #0000FF;
|
||||
color: #0000FF;
|
||||
}
|
||||
.comment
|
||||
{
|
||||
color: #999999;
|
||||
color: #999999;
|
||||
}
|
||||
.operator
|
||||
{
|
||||
color: #00CCCC;
|
||||
color: #00CCCC;
|
||||
}
|
||||
.builtinVariable
|
||||
{
|
||||
color: #CCCC00;
|
||||
color: #CCCC00;
|
||||
}
|
||||
.variableSpecifier
|
||||
{
|
||||
color: #FF0000;
|
||||
color: #FF0000;
|
||||
}
|
||||
.keyword
|
||||
{
|
||||
color: #AA0033;
|
||||
color: #AA0033;
|
||||
}
|
||||
.builtinFunction
|
||||
{
|
||||
color: #AA00AA;
|
||||
color: #AA00AA;
|
||||
}
|
||||
.identifier
|
||||
{
|
||||
color: #009900;
|
||||
color: #009900;
|
||||
}
|
||||
.number
|
||||
{
|
||||
color: #9999FF;
|
||||
color: #9999FF;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ function emulateHTMLModel()
|
||||
|
||||
// This function is used to generate a html string for the text properties/methods
|
||||
// It replaces '\n' with "<BR"> as well as fixes consecutive white spaces
|
||||
// It also repalaces some special characters
|
||||
// It also repalaces some special characters
|
||||
function convertTextToHTML(s) {
|
||||
s = s.replace(/\&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, "<BR>").replace(/\t/g, " "); //tachyon
|
||||
while (/\s\s/.test(s))
|
||||
@@ -17,7 +17,7 @@ function convertTextToHTML(s) {
|
||||
|
||||
HTMLElement.prototype.__defineSetter__("innerText", function (sText) {
|
||||
this.innerHTML = convertTextToHTML(sText);
|
||||
return sText;
|
||||
return sText;
|
||||
});
|
||||
|
||||
var tmpGet;
|
||||
@@ -29,7 +29,7 @@ HTMLElement.prototype.__defineGetter__("innerText", tmpGet = function () {
|
||||
|
||||
}
|
||||
|
||||
if (moz)
|
||||
if (moz)
|
||||
emulateHTMLModel();
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ RE[0] = new RegExp(re);
|
||||
// comment
|
||||
re = /\#.*?([\r\n]+|$)/; //tachyon
|
||||
RE[1] = new RegExp(re);
|
||||
|
||||
|
||||
// operator
|
||||
re = /xor|\.\.\.|and|not|\|\|\=|cmp|\>\>\=|\<\<\=|\<\=\>|\&\&\=|or|\=\>|\!\~|\^\=|\&\=|\|\=|\.\=|x\=|\%\=|\/\=|\*\=|\-\=|\+\=|\=\~|\*\*|\-\-|\.\.|\|\||\&\&|\+\+|\-\>|ne|eq|\!\=|\=\=|ge|le|gt|lt|\>\=|\<\=|\>\>|\<\<|\,|\=|\:|\?|\^|\||x|\%|\/|\*|\<|\&|\\|\~|\!|\>|\.|\-|\+ /;
|
||||
RE[2] = new RegExp(re);
|
||||
@@ -86,46 +86,46 @@ var classes = new Array("quotedString", "comment", "operator", "builtinVariable
|
||||
*/
|
||||
function HighlightCode(object)
|
||||
{
|
||||
codeText = object.innerText; //HTML.replace(/<.*?>/g, "");
|
||||
object.innerHTML = '';
|
||||
var left;
|
||||
var match;
|
||||
var right;
|
||||
while (codeText.length > 0)
|
||||
{
|
||||
var mode = -1 ;
|
||||
var index = 999999999;
|
||||
for (var i = 0; i < RE.length; i++)
|
||||
{
|
||||
if ((codeText.match(RE[i])) && (RegExp.leftContext.length < index))
|
||||
{
|
||||
left = RegExp.leftContext;
|
||||
match = RegExp.lastMatch;
|
||||
right = RegExp.rightContext;
|
||||
index = RegExp.leftContext.length;
|
||||
mode = i;
|
||||
}
|
||||
}
|
||||
if (mode == -1)
|
||||
{
|
||||
object.appendChild(document.createTextNode(codeText)); //.replace(/\r\n/g, "\r")));
|
||||
codeText = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
// append the plain text to the <code> block
|
||||
object.appendChild(document.createTextNode(left)); //.replace(/\r\n/g, "\r")));
|
||||
codeText = object.innerText; //HTML.replace(/<.*?>/g, "");
|
||||
object.innerHTML = '';
|
||||
var left;
|
||||
var match;
|
||||
var right;
|
||||
while (codeText.length > 0)
|
||||
{
|
||||
var mode = -1 ;
|
||||
var index = 999999999;
|
||||
for (var i = 0; i < RE.length; i++)
|
||||
{
|
||||
if ((codeText.match(RE[i])) && (RegExp.leftContext.length < index))
|
||||
{
|
||||
left = RegExp.leftContext;
|
||||
match = RegExp.lastMatch;
|
||||
right = RegExp.rightContext;
|
||||
index = RegExp.leftContext.length;
|
||||
mode = i;
|
||||
}
|
||||
}
|
||||
if (mode == -1)
|
||||
{
|
||||
object.appendChild(document.createTextNode(codeText)); //.replace(/\r\n/g, "\r")));
|
||||
codeText = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
// append the plain text to the <code> block
|
||||
object.appendChild(document.createTextNode(left)); //.replace(/\r\n/g, "\r")));
|
||||
|
||||
// create a new <span> with the current code
|
||||
var span = document.createElement("span");
|
||||
span.setAttribute("className", classes[mode]); // ie
|
||||
span.setAttribute("class", classes[mode]); //mozilla
|
||||
span.appendChild(document.createTextNode(match));
|
||||
object.appendChild(span);
|
||||
// create a new <span> with the current code
|
||||
var span = document.createElement("span");
|
||||
span.setAttribute("className", classes[mode]); // ie
|
||||
span.setAttribute("class", classes[mode]); //mozilla
|
||||
span.appendChild(document.createTextNode(match));
|
||||
object.appendChild(span);
|
||||
|
||||
codeText = right;
|
||||
}
|
||||
}
|
||||
codeText = right;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// little bit of JQuery to highlight code in all pre elements
|
||||
@@ -134,4 +134,3 @@ $(document).ready(function(){
|
||||
HighlightCode(this);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+15
-16
@@ -12,7 +12,7 @@ use Carp;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
bacnet.pl - Scriptable BACnet communications
|
||||
bacnet.pl - Scriptable BACnet communications
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@@ -33,7 +33,7 @@ Perl documentation, see http://perldoc.perl.org
|
||||
Usage: bacnet.pl [program_options] [-- script_args]
|
||||
|
||||
This program executes a script in perl syntax to perform BACnet/IP operations.
|
||||
|
||||
|
||||
Possible program options:
|
||||
--script=s The script to execute.
|
||||
--log=s The file to log all output.
|
||||
@@ -116,7 +116,7 @@ BEGIN {
|
||||
}
|
||||
|
||||
use Inline (
|
||||
C => Config =>
|
||||
C => Config =>
|
||||
LIBS => "-L$libDir -lbacnet -liphlpapi",
|
||||
INC => ["-I$incDir1", "-I$incDir2", "-I$incDir3"],
|
||||
DIRECTORY => $inlineBuildDir,
|
||||
@@ -141,7 +141,7 @@ my $answer = '';
|
||||
'help|?' => \$ask_help,
|
||||
'script=s' => \$script,
|
||||
'log=s' => \$log,
|
||||
);
|
||||
);
|
||||
|
||||
if (!defined($script) || !(-f $script))
|
||||
{
|
||||
@@ -150,7 +150,7 @@ if (!defined($script) || !(-f $script))
|
||||
}
|
||||
else
|
||||
{
|
||||
# Add the script's location to @INC so that they can include other scripts
|
||||
# Add the script's location to @INC so that they can include other scripts
|
||||
# using relative paths
|
||||
my $scriptdir = File::Spec->rel2abs(dirname($script));
|
||||
push @INC,$scriptdir;
|
||||
@@ -308,7 +308,7 @@ sub ReadProperty {
|
||||
=head2 ReadPropertyMultiple
|
||||
|
||||
This function implements the ReadPropertyMultiple service. There are no built in retry
|
||||
mechanisms. NOTE: all enumerations are defined in F<bacenum.h>
|
||||
mechanisms. NOTE: all enumerations are defined in F<bacenum.h>
|
||||
|
||||
=head3 Inputs to ReadPropertyMultiple
|
||||
|
||||
@@ -414,7 +414,7 @@ sub ReadPropertyMultiple
|
||||
=head2 WriteProperty
|
||||
|
||||
This function implements the WriteProperty service. There are no built in retry
|
||||
mechanisms. NOTE: all enumerations are defined in F<bacenum.h>
|
||||
mechanisms. NOTE: all enumerations are defined in F<bacenum.h>
|
||||
|
||||
=head3 Inputs to WriteProperty
|
||||
|
||||
@@ -494,7 +494,7 @@ sub WriteProperty {
|
||||
}
|
||||
else
|
||||
{
|
||||
# a priority of 0 means we are not writing to a priority array
|
||||
# a priority of 0 means we are not writing to a priority array
|
||||
$priority = 0;
|
||||
}
|
||||
$msg .= " in Device" . '[' . $deviceInstance . "] ==> ";
|
||||
@@ -553,7 +553,7 @@ This function implements the TimeSync and UTCTimeSync services
|
||||
|
||||
=cut
|
||||
|
||||
sub TimeSync
|
||||
sub TimeSync
|
||||
{
|
||||
my $deviceInstanceNumber = shift;
|
||||
my $year = shift;
|
||||
@@ -574,7 +574,7 @@ sub TimeSync
|
||||
|
||||
# be a pessimist. Assume things will fail
|
||||
$isFailure = 1;
|
||||
|
||||
|
||||
if (defined($utcOffset))
|
||||
{
|
||||
$isUTC = 1;
|
||||
@@ -586,7 +586,7 @@ sub TimeSync
|
||||
$utcOffset = 0;
|
||||
$isUTC = 0;
|
||||
}
|
||||
|
||||
|
||||
if ($year < 1900 || $year > 2099)
|
||||
{
|
||||
Log("Year '$year' is invalid.");
|
||||
@@ -610,7 +610,7 @@ sub TimeSync
|
||||
Log("Hour '$hour' is invalid.");
|
||||
last;
|
||||
}
|
||||
|
||||
|
||||
if ($minute < 0 || $minute > 59)
|
||||
{
|
||||
Log("Minute '$minute' is invalid.");
|
||||
@@ -629,7 +629,7 @@ sub TimeSync
|
||||
last;
|
||||
}
|
||||
|
||||
return $isFailure;
|
||||
return $isFailure;
|
||||
}
|
||||
|
||||
=head2 Log
|
||||
@@ -637,7 +637,7 @@ sub TimeSync
|
||||
This function prints out to the desired method of logging (STDOUT or file).
|
||||
NewLine characters are not required when making calls to this function. If any
|
||||
NewLine characters are specified, they will be stripped out. To print an empty
|
||||
line, pass in a space as the message. NOTE: This function will honor previous
|
||||
line, pass in a space as the message. NOTE: This function will honor previous
|
||||
requests to silence the log (see SilcenseLog for details)
|
||||
|
||||
=head3 Inputs to Log
|
||||
@@ -671,7 +671,7 @@ sub Log {
|
||||
|
||||
# if there is nothing to print, then don't do it
|
||||
return if (scalar(@last) == 0);
|
||||
|
||||
|
||||
# if there are newline-like characters, get rid of them.
|
||||
while ($msg =~/^(.*)[\r\n]+(.*)$/)
|
||||
{
|
||||
@@ -866,4 +866,3 @@ sub LogAnswer {
|
||||
$answer = '' unless $append;
|
||||
$answer .= $newAnswer;
|
||||
}
|
||||
|
||||
|
||||
@@ -884,7 +884,7 @@ int BacnetTimeSync(int deviceInstanceNumber,
|
||||
&Target_Address, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
|
||||
if (bytes_sent <= 0) {
|
||||
char msg[64];
|
||||
snprintf(msg, sizeof(msg),
|
||||
snprintf(msg, sizeof(msg),
|
||||
"Failed to Send Time-Synchronization Request (%s)!",
|
||||
strerror(errno));
|
||||
LogError(msg);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
The BACnet Scriptable (using Perl) Tool.
|
||||
|
||||
* Running this tool assumes that the library has been already built. The
|
||||
* Running this tool assumes that the library has been already built. The
|
||||
library should be built with a command similar to
|
||||
|
||||
|
||||
CC=/mingw/bin/gcc BACNET_DEFINES="-DPRINT_ENABLED -DBACAPP_ALL -DBACFILE
|
||||
-DINTRINSIC_REPORTING" BBMD_DEFINE=-DBBMD_ENABLED\=1 BACNET_PORT=win32 make
|
||||
clean library
|
||||
|
||||
* Currently, the tool assumes only win32 port, but should be easily modifiable
|
||||
for any port build.
|
||||
for any port build.
|
||||
* This tool has to be run from a path without any spaces. The presence of the
|
||||
.Inline directory is required.
|
||||
* Run the tool without any arguments to see usage instructions
|
||||
@@ -16,5 +16,3 @@ The BACnet Scriptable (using Perl) Tool.
|
||||
Value) for Device at instance 1234 run the following command
|
||||
|
||||
perl bacnet.pl --script example_readprop.pl -- 1234
|
||||
|
||||
|
||||
|
||||
@@ -56,4 +56,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -17,4 +17,3 @@ fi
|
||||
|
||||
make -C libmcp23s17
|
||||
make -C libpifacedigital
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file
|
||||
/**
|
||||
* @file
|
||||
* @brief Base "class" for handling all BACnet objects belonging
|
||||
* to a BACnet device, as well as Device-specific properties.
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
|
||||
@@ -6,5 +6,3 @@ To build, start with the configure script:
|
||||
|
||||
$ ./configure.sh
|
||||
$ make clean all
|
||||
|
||||
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that sends a BACnet BVLC message, and displays
|
||||
* @brief command line tool that sends a BACnet BVLC message, and displays
|
||||
* the reply, for a Read-Broadcast-Distribution-Table message to a peer BBMD.
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2012
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that sends a BACnet BVLC message, and displays
|
||||
* @brief command line tool that sends a BACnet BVLC message, and displays
|
||||
* the reply, for a Read-Foreign-Device-Table message to a peer BBMD.
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2012
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that uses BACnet ReadPropertyMultiple service
|
||||
* message to read object property values from another device on
|
||||
* @brief command line tool that uses BACnet ReadPropertyMultiple service
|
||||
* message to read object property values from another device on
|
||||
* the network and prints the values to the console.
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2008
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that uses BACnet ReadRange service
|
||||
* message to read device object BACnetList or BACnetARRAY property values
|
||||
* @brief command line tool that uses BACnet ReadRange service
|
||||
* message to read device object BACnetList or BACnetARRAY property values
|
||||
* from another device on the network and prints the values to the console.
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2006
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -565,7 +565,7 @@ static void send_who_is_router_to_network(uint16_t snet, uint16_t dnet)
|
||||
* @param src [in] The routing source information, if any.
|
||||
* If src->net and src->len are 0, there is no routing source information.
|
||||
* @param npdu_data [in] Contains a filled-out structure with information
|
||||
* decoded from the NCPI and other NPDU bytes.
|
||||
* decoded from the NCPI and other NPDU bytes.
|
||||
* @param npdu [in] Buffer containing the rest of the NPDU, following the
|
||||
* bytes that have already been decoded.
|
||||
* @param npdu_len [in] The length of the remaining NPDU message in npdu[].
|
||||
@@ -618,7 +618,7 @@ static void who_is_router_to_network_handler(uint16_t snet,
|
||||
* @param src [in] The routing source information, if any.
|
||||
* If src->net and src->len are 0, there is no routing source information.
|
||||
* @param npdu_data [in] Contains a filled-out structure with information
|
||||
* decoded from the NCPI and other NPDU bytes.
|
||||
* decoded from the NCPI and other NPDU bytes.
|
||||
* @param npdu [in] Buffer containing the rest of the NPDU, following the
|
||||
* bytes that have already been decoded.
|
||||
* @param npdu_len [in] The length of the remaining NPDU message in npdu[].
|
||||
@@ -899,7 +899,7 @@ static void routed_apdu_handler(uint16_t snet,
|
||||
while (port != NULL) {
|
||||
if (port->net != snet) {
|
||||
datalink_send_pdu(port->net, dest, npdu, &Tx_Buffer[0],
|
||||
npdu_len + apdu_len);
|
||||
npdu_len + apdu_len);
|
||||
}
|
||||
port = port->next;
|
||||
}
|
||||
@@ -979,7 +979,7 @@ static void my_routing_npdu_handler(
|
||||
}
|
||||
} else {
|
||||
fprintf(
|
||||
stderr, "NPDU: unsupported protocol version %u. Discarded!\n",
|
||||
stderr, "NPDU: unsupported protocol version %u. Discarded!\n",
|
||||
protocol_version);
|
||||
}
|
||||
|
||||
@@ -1118,7 +1118,7 @@ static void control_c_hooks(void)
|
||||
* @note This is a proxy function to satisfy the BACnet Stack IPv6 port layer
|
||||
* requirements since this application omits a Device object.
|
||||
*/
|
||||
uint32_t Device_Object_Instance_Number(void)
|
||||
uint32_t Device_Object_Instance_Number(void)
|
||||
{
|
||||
return Device_Instance_Number;
|
||||
}
|
||||
|
||||
@@ -586,7 +586,7 @@ static void send_who_is_router_to_network(uint16_t snet, uint16_t dnet)
|
||||
* @param src [in] The routing source information, if any.
|
||||
* If src->net and src->len are 0, there is no routing source information.
|
||||
* @param npdu_data [in] Contains a filled-out structure with information
|
||||
* decoded from the NCPI and other NPDU bytes.
|
||||
* decoded from the NCPI and other NPDU bytes.
|
||||
* @param npdu [in] Buffer containing the rest of the NPDU, following the
|
||||
* bytes that have already been decoded.
|
||||
* @param npdu_len [in] The length of the remaining NPDU message in npdu[].
|
||||
@@ -639,7 +639,7 @@ static void who_is_router_to_network_handler(uint16_t snet,
|
||||
* @param src [in] The routing source information, if any.
|
||||
* If src->net and src->len are 0, there is no routing source information.
|
||||
* @param npdu_data [in] Contains a filled-out structure with information
|
||||
* decoded from the NCPI and other NPDU bytes.
|
||||
* decoded from the NCPI and other NPDU bytes.
|
||||
* @param npdu [in] Buffer containing the rest of the NPDU, following the
|
||||
* bytes that have already been decoded.
|
||||
* @param npdu_len [in] The length of the remaining NPDU message in npdu[].
|
||||
@@ -922,7 +922,7 @@ static void routed_apdu_handler(uint16_t snet,
|
||||
while (port != NULL) {
|
||||
if (port->net != snet) {
|
||||
datalink_send_pdu(port->net, dest, npdu, &Tx_Buffer[0],
|
||||
npdu_len + apdu_len);
|
||||
npdu_len + apdu_len);
|
||||
}
|
||||
port = port->next;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ SRCS = main.c \
|
||||
msgqueue.c \
|
||||
network_layer.c
|
||||
|
||||
# note: router does not use common libbacnet.a library,
|
||||
# note: router does not use common libbacnet.a library,
|
||||
# so use CFLAGS without common app defines or includes
|
||||
CFLAGS = -I${SOURCE_DIR} -I${BACNET_PORT_DIR}
|
||||
CFLAGS += -DBACNET_STACK_DEPRECATED_DISABLE
|
||||
|
||||
+52
-52
@@ -2,67 +2,67 @@
|
||||
configuration file that stores values for router ports initialization
|
||||
|
||||
Common arguments:
|
||||
device_type - "bip" or "mstp" (with quotes)
|
||||
device - Connection device, for example "eth0" or "/dev/ttyS0"
|
||||
network - Network number [1..65534]. Do not use network number 65535, it is broadcast number
|
||||
device_type - "bip" or "mstp" (with quotes)
|
||||
device - Connection device, for example "eth0" or "/dev/ttyS0"
|
||||
network - Network number [1..65534]. Do not use network number 65535, it is broadcast number
|
||||
|
||||
bip arguments:
|
||||
port - bip UDP port, default 47808
|
||||
port - bip UDP port, default 47808
|
||||
|
||||
mstp arguments:
|
||||
mac - MSTP MAC
|
||||
max_master - MSTP max master
|
||||
max_frames - 1
|
||||
baud - one from the list: 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400
|
||||
parity - one from the list (with quotes): "None", "Even", "Odd"
|
||||
databits - one from the list: 5, 6, 7, 8
|
||||
stopbits - 1 or 2
|
||||
mac - MSTP MAC
|
||||
max_master - MSTP max master
|
||||
max_frames - 1
|
||||
baud - one from the list: 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400
|
||||
parity - one from the list (with quotes): "None", "Even", "Odd"
|
||||
databits - one from the list: 5, 6, 7, 8
|
||||
stopbits - 1 or 2
|
||||
|
||||
|
||||
Example:
|
||||
ports =
|
||||
(
|
||||
{
|
||||
device_type = "bip";
|
||||
device = "eth0";
|
||||
port = 47808;
|
||||
network = 1;
|
||||
},
|
||||
ports =
|
||||
(
|
||||
{
|
||||
device_type = "bip";
|
||||
device = "eth0";
|
||||
port = 47808;
|
||||
network = 1;
|
||||
},
|
||||
|
||||
{
|
||||
device_type = "mstp";
|
||||
device = "/dev/ttyS0";
|
||||
mac = 1;
|
||||
max_master = 127;
|
||||
max_frames = 1;
|
||||
baud = 38400;
|
||||
parity = "None";
|
||||
databits = 8;
|
||||
stopbits = 1;
|
||||
network = 2;
|
||||
}
|
||||
);
|
||||
{
|
||||
device_type = "mstp";
|
||||
device = "/dev/ttyS0";
|
||||
mac = 1;
|
||||
max_master = 127;
|
||||
max_frames = 1;
|
||||
baud = 38400;
|
||||
parity = "None";
|
||||
databits = 8;
|
||||
stopbits = 1;
|
||||
network = 2;
|
||||
}
|
||||
);
|
||||
*/
|
||||
|
||||
ports =
|
||||
(
|
||||
{
|
||||
device_type = "bip";
|
||||
device = "eth0";
|
||||
port = 47808;
|
||||
network = 1;
|
||||
},
|
||||
ports =
|
||||
(
|
||||
{
|
||||
device_type = "bip";
|
||||
device = "eth0";
|
||||
port = 47808;
|
||||
network = 1;
|
||||
},
|
||||
|
||||
{
|
||||
device_type = "mstp";
|
||||
device = "/dev/ttyS0";
|
||||
mac = 2;
|
||||
max_master = 127;
|
||||
max_frames = 1;
|
||||
baud = 38400;
|
||||
parity = "None";
|
||||
databits = 8;
|
||||
stopbits = 1;
|
||||
network = 2;
|
||||
}
|
||||
{
|
||||
device_type = "mstp";
|
||||
device = "/dev/ttyS0";
|
||||
mac = 2;
|
||||
max_master = 127;
|
||||
max_frames = 1;
|
||||
baud = 38400;
|
||||
parity = "None";
|
||||
databits = 8;
|
||||
stopbits = 1;
|
||||
network = 2;
|
||||
}
|
||||
);
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
#include "portthread.h"
|
||||
#include "bacnet/datalink/bip.h"
|
||||
|
||||
#define MAX_BIP_APDU 1476
|
||||
#define MAX_BIP_PDU (MAX_NPDU + MAX_BIP_APDU)
|
||||
#define MAX_BIP_MPDU (BIP_HEADER_MAX + MAX_BIP_PDU)
|
||||
#define MAX_BIP_APDU 1476
|
||||
#define MAX_BIP_PDU (MAX_NPDU + MAX_BIP_APDU)
|
||||
#define MAX_BIP_MPDU (BIP_HEADER_MAX + MAX_BIP_PDU)
|
||||
/* Yes, we know this is longer than an Ethernet Frame,
|
||||
a UDP payload and an IPv6 packet.
|
||||
Grandfathered in from BACnet Ethernet days,
|
||||
|
||||
+66
-69
@@ -17,7 +17,7 @@ SPDX-License-Identifier: MIT
|
||||
3. Build
|
||||
-----------------------
|
||||
|
||||
1. Download, build and install libconfig C/C++ Configuration File Library
|
||||
1. Download, build and install libconfig C/C++ Configuration File Library
|
||||
from http://www.hyperrealm.com/libconfig or use APT to install
|
||||
sudo apt-get install libconfig-dev
|
||||
2. Run "make clean all" from library root directory
|
||||
@@ -32,101 +32,98 @@ SPDX-License-Identifier: MIT
|
||||
//single line comment
|
||||
|
||||
/*
|
||||
multiline comment
|
||||
multiline comment
|
||||
*/
|
||||
|
||||
ports =
|
||||
(
|
||||
//route_1
|
||||
{
|
||||
device_type = "<value>";
|
||||
//route specific arguments, see below
|
||||
},
|
||||
//route_1
|
||||
{
|
||||
device_type = "<value>";
|
||||
//route specific arguments, see below
|
||||
},
|
||||
|
||||
//route_2
|
||||
{
|
||||
device_type = "<value>";
|
||||
//route specific arguments, see below
|
||||
},
|
||||
//route_2
|
||||
{
|
||||
device_type = "<value>";
|
||||
//route specific arguments, see below
|
||||
},
|
||||
|
||||
//.....
|
||||
//.....
|
||||
|
||||
//route_n
|
||||
{
|
||||
device_type = "<value>";
|
||||
//route specific arguments, see below
|
||||
}
|
||||
//route_n
|
||||
{
|
||||
device_type = "<value>";
|
||||
//route specific arguments, see below
|
||||
}
|
||||
);
|
||||
|
||||
Note: - arguments are separeted with ';'
|
||||
- routes are separeted with ','
|
||||
- no ',' after the last route
|
||||
Note: - arguments are separeted with ';'
|
||||
- routes are separeted with ','
|
||||
- no ',' after the last route
|
||||
|
||||
4.2. Configuration file arguments.
|
||||
|
||||
Common arguments:
|
||||
device_type - Describes a type of route, may be "bip" (Etherent) or "mstp" (Serial port). Use quotes.
|
||||
device - Connection device, for example "eth0" or "/dev/ttyS0"; default values: for BIP:"eth0", for MSTP: "/dev/ttyS0". Use quotes.
|
||||
network - Network number [1..65534]. Do not use network number 65535, it is broadcast number; default begins from 1 to routes count.
|
||||
device_type - Describes a type of route, may be "bip" (Etherent) or "mstp" (Serial port). Use quotes.
|
||||
device - Connection device, for example "eth0" or "/dev/ttyS0"; default values: for BIP:"eth0", for MSTP: "/dev/ttyS0". Use quotes.
|
||||
network - Network number [1..65534]. Do not use network number 65535, it is broadcast number; default begins from 1 to routes count.
|
||||
|
||||
bip arguments:
|
||||
port - bip UDP port; default port is 47808 (0xBAC0).
|
||||
port - bip UDP port; default port is 47808 (0xBAC0).
|
||||
|
||||
mstp arguments:
|
||||
mac - MSTP MAC; default value is 127.
|
||||
max_master - MSTP max master; default value is 127.
|
||||
max_frames - 1. Segmentation does not supported.
|
||||
baud - one from the list: 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400; default baud is 9600
|
||||
parity - one from the list (with quotes): "None", "Even", "Odd"; default parity "None". Use quotes.
|
||||
databits - one from the list: 5, 6, 7, 8; default 8.
|
||||
stopbits - 1 or 2; default 1.
|
||||
mac - MSTP MAC; default value is 127.
|
||||
max_master - MSTP max master; default value is 127.
|
||||
max_frames - 1. Segmentation does not supported.
|
||||
baud - one from the list: 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400; default baud is 9600
|
||||
parity - one from the list (with quotes): "None", "Even", "Odd"; default parity "None". Use quotes.
|
||||
databits - one from the list: 5, 6, 7, 8; default 8.
|
||||
stopbits - 1 or 2; default 1.
|
||||
|
||||
4.3. Example of configuration file.
|
||||
|
||||
ports =
|
||||
(
|
||||
{
|
||||
device_type = "bip";
|
||||
device = "eth0";
|
||||
port = 47808;
|
||||
network = 1;
|
||||
},
|
||||
{
|
||||
device_type = "bip";
|
||||
device = "eth1";
|
||||
port = 47808;
|
||||
network = 2;
|
||||
},
|
||||
{
|
||||
device_type = "bip";
|
||||
device = "eth1";
|
||||
port = 47809;
|
||||
network = 3;
|
||||
},
|
||||
{
|
||||
device_type = "mstp";
|
||||
device = "/dev/ttyS0";
|
||||
mac = 1;
|
||||
max_master = 127;
|
||||
max_frames = 1;
|
||||
baud = 38400;
|
||||
parity = "None";
|
||||
databits = 8;
|
||||
stopbits = 1;
|
||||
network = 4;
|
||||
}
|
||||
);
|
||||
ports =
|
||||
(
|
||||
{
|
||||
device_type = "bip";
|
||||
device = "eth0";
|
||||
port = 47808;
|
||||
network = 1;
|
||||
},
|
||||
{
|
||||
device_type = "bip";
|
||||
device = "eth1";
|
||||
port = 47808;
|
||||
network = 2;
|
||||
},
|
||||
{
|
||||
device_type = "bip";
|
||||
device = "eth1";
|
||||
port = 47809;
|
||||
network = 3;
|
||||
},
|
||||
{
|
||||
device_type = "mstp";
|
||||
device = "/dev/ttyS0";
|
||||
mac = 1;
|
||||
max_master = 127;
|
||||
max_frames = 1;
|
||||
baud = 38400;
|
||||
parity = "None";
|
||||
databits = 8;
|
||||
stopbits = 1;
|
||||
network = 4;
|
||||
}
|
||||
);
|
||||
|
||||
-----------------------
|
||||
5. Start
|
||||
-----------------------
|
||||
|
||||
5.1. With configuration file
|
||||
5.1. With configuration file
|
||||
1. Copy configuration file in the router executable directory
|
||||
2. Start the router with "sudo ./router -c init.cfg" command in terminal
|
||||
|
||||
5.2. Passing params in command line
|
||||
1. sudo ./router -D "mstp" "/dev/ttyS0" --mac 1 127 1 --baud 38400 --network 4 -D "bip" "eth0" --network 1
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that uses BACnet SubscribeCOV service
|
||||
* @brief command line tool that uses BACnet SubscribeCOV service
|
||||
* message to subscribe to a BACnet object for Change-of-Value notifications
|
||||
* in a BACnet device and print the Change-of-Value notifications values
|
||||
* in a BACnet device and print the Change-of-Value notifications values
|
||||
* to the console.
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2006
|
||||
|
||||
@@ -42,4 +42,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -42,4 +42,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -75,4 +75,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -36,19 +36,19 @@ BIBBs Supported:
|
||||
-- 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-A
|
||||
DM-DDB-B
|
||||
-- DM-DOB-A
|
||||
-- DM-DOB-A
|
||||
DM-DOB-B
|
||||
-- DM-DCC-A
|
||||
-- DM-DCC-A
|
||||
DM-DCC-B
|
||||
-- DM-PT-A DM-PT-B
|
||||
-- DM-TM-A DM-TM-B
|
||||
-- DM-TS-A
|
||||
-- DM-TS-A
|
||||
DM-TS-B
|
||||
-- DM-UTC-A
|
||||
-- DM-UTC-A
|
||||
DM-UTC-B
|
||||
-- DM-RD-A
|
||||
-- DM-RD-A
|
||||
DM-RD-B
|
||||
-- DM-BR-A DM-BR-B
|
||||
-- DM-R-A DM-R-B
|
||||
@@ -140,7 +140,7 @@ Data Link Layer Option:
|
||||
-- ISO 8802-3, 10BASET
|
||||
-- ISO 8802-3, Fiber
|
||||
-- ARCNET, coax star
|
||||
-- ARCNET, coax bus
|
||||
-- ARCNET, coax bus
|
||||
-- ARCNET, twisted pair star
|
||||
-- ARCNET, twisted pair bus
|
||||
-- ARCNET, fiber star
|
||||
@@ -755,5 +755,3 @@ List of Objects in test device:
|
||||
}
|
||||
|
||||
End of BACnet Protocol Implementation Conformance Statement
|
||||
|
||||
|
||||
|
||||
+10
-10
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that simulates a BACnet server device on the
|
||||
* @brief command line tool that simulates a BACnet server device on the
|
||||
* network using the BACnet Stack and all the example object types.
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2006
|
||||
@@ -179,15 +179,15 @@ static void Init_Service_Handlers(void)
|
||||
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 */
|
||||
/* 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
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that sends a BACnet TimeSynchronization service
|
||||
* message with the local or arbitrary time and date to sync another device
|
||||
* message with the local or arbitrary time and date to sync another device
|
||||
* on the network.
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2006
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that sends a BACnet Unconfirmed Change-of-Value
|
||||
* @brief command line tool that sends a BACnet Unconfirmed Change-of-Value
|
||||
* Notification to the network
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2006
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that sends a BACnet Who-Is-Router-To-Network
|
||||
* @brief command line tool that sends a BACnet Who-Is-Router-To-Network
|
||||
* message for one or more networks, and prints any I-Am-Router-To-Network
|
||||
* responses received. This is useful for finding routers on the network.
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that sends a BACnet BVLC message
|
||||
* @brief command line tool that sends a BACnet BVLC message
|
||||
* Write-Broadcast-Distribution-Table to a BBMD on the network,
|
||||
* and prints the result code received. This is useful for
|
||||
* configuring the BBMD on the network.
|
||||
|
||||
@@ -37,4 +37,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that uses BACnet AtomicWriteFile service
|
||||
* @brief command line tool that uses BACnet AtomicWriteFile service
|
||||
* to send a local file to a another device on the network.
|
||||
* This tool sends the file in chunks to the target device.
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
|
||||
@@ -40,4 +40,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that uses BACnet WriteProperty service
|
||||
* message to write object property values to another device on
|
||||
* @brief command line tool that uses BACnet WriteProperty service
|
||||
* message to write object property values to another device on
|
||||
* the network and prints an acknowledgment or error response of
|
||||
* this confirmed service request. This is useful for testing
|
||||
* the WriteProperty service.
|
||||
|
||||
@@ -40,4 +40,3 @@ clean:
|
||||
|
||||
.PHONY: include
|
||||
include: .depend
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief command line tool that uses BACnet WritePropertyMultiple service
|
||||
* message to write object property values to another device on
|
||||
* @brief command line tool that uses BACnet WritePropertyMultiple service
|
||||
* message to write object property values to another device on
|
||||
* the network and prints an acknowledgment or error response of
|
||||
* this confirmed service request. This is useful for testing
|
||||
* the WritePropertyMultiple service.
|
||||
|
||||
Reference in New Issue
Block a user