Commit Graph

2617 Commits

Author SHA1 Message Date
skarg 00a3447ffd Merged revision(s) 3154 from branches/releases/bacnet-stack-0-8-0:
Fixed WriteProperty demo command line options when using more than one property value and a context tag.  Thank you James Gordon for reporting the problem.
........
2017-08-25 17:07:11 +00:00
skarg 85f3ea13b2 Merged revision(s) 3153 from branches/releases/bacnet-stack-0-8-0:
Fixed compile warnings due to BUILD=debug option
........
2017-08-25 17:06:27 +00:00
skarg f53035cde1 Add a Device object and application layer to router demo. 2017-08-25 17:05:40 +00:00
skarg 4599d725f6 Added some readme info about Wireshark, extcap, and DLTs. 2017-08-24 19:16:45 +00:00
skarg 0c39a8edaf Clean up compile for Atmel port example. 2017-08-24 17:57:30 +00:00
skarg ebcd9bc494 address_cache file was inadvertently disabled for command line demo tools. Fixed. Thank you, Martin Tremblay! Syncing with 0.8.x branch. 2017-08-24 17:55:46 +00:00
skarg 6560623fa6 Added property enumerations from BACnet 2016 standard. Thank you, Mario Sousa! 2017-08-24 17:09:57 +00:00
skarg 6b0134d6d4 added engineering units from 135-2012ag and 135-2012ar 2017-08-16 03:51:47 +00:00
skarg d39044261c Added some arduino_uno files that we missed during first import [WIP]. 2017-06-26 17:48:02 +00:00
skarg 7d1550362b Merged revision(s) 3136 from branches/releases/bacnet-stack-0-8-0:
Replace Receive_Packet_Flag conditional variable with a semaphore and update the related library functions accordingly.
Analysis of the problem determined that the issue lay in the transfer of APDU packets between the FSM and the APDU packet handler thread.
The mechanism previously used by the FSM to notify the APDU packet handler thread that a packet was available for processing used a pthread conditional variable which packet handler thread was supposed to wait on before being signalled by the FSM.
However the packet handler thread has other tasks to perform and sometimes was not waiting on the conditional variable which it was signalled.
Unlike other synchronisation mechanisms such as semaphores, if the waiting task (the consumer) is not blocked on the conditional variable when the producer signals, then that signal is lost and the consumer is never signalled again, leading to a continual sequence of timeouts on the conditional variable.
This in turn led to the packet handler thread never being notified of a packet waiting to be processed thus causing the interface hang.
The main problem is that a conditional variable is supposed to be used with a mutex to prevent this behaviour occurring, but this mutex was not present (and in fact had been removed from the code, most likely because it was causing other synchronisation issues)
Further inspection revealed that this code was copied from another file but modified to remove the mutex which is an essential part of using a conditional variable for synchronisation. This then prevents the producer task being blocked until the consumer task is waiting on the conditional variable, thus leading to a race condition which is causing the issues seen.
The fix is to replace the conditional variable with a semaphore as this provides the required mechanism in this case.
Thank you Ian Smith at Abelon Systems Ltd. for the patch!

........
2017-06-25 18:08:36 +00:00
skarg 0b5a514cf7 Adds two new functions to the ring buffer implementation, one to walk the ring by getting a pointer to the next element in the ring, and the other to Pop (remove) a specified element from somewhere in the ring and then move any elements up towards the head to fill the gap left. With these new functions in place, the Linux MS/TP datalink MSTP_Get_Reply() has been updated to walk the ring buffer to try to find the matching reply. If it is found then it is processed in the same way as usual, and then removed from the ring.
When a packet is received which expects a reply a copy is stored in the PDU ring buffer so it can be matched with the reply. Unfortunately when the reply is received it is only checked against the first entry in the ring buffer. This can cause a failure if a second packet expecting a reply has been received while waiting for the first reply to arrive.
This is a known issue in the bacnet-stack open source stack, and there is a outstanding FIXME in the latest version of the source code:

        /* The ANSWER_DATA_REQUEST state is entered when a  */
        /* BACnet Data Expecting Reply, a Test_Request, or  */
        /* a proprietary frame that expects a reply is received. */
        /* FIXME: MSTP_Get_Reply waits for a matching reply, but
           if the next queued message doesn't match, then we
           sit here for Treply_delay doing nothing */

The fix for this is to check all the messages in the PDU queue to see if any of them match, and if one does then handle it in the normal way. Thank you to Ian Smith of Abelon Systems Ltd. for the patch!
2017-06-25 18:06:27 +00:00
skarg 7df0b9c5ed Fixed Initialize-Routing-Table demo handling of ACK. 2017-05-30 21:43:48 +00:00
skarg 8af8043d49 Fixed MS/TP ANSWER_DATA_REQUEST state in some of the ports to be compliant to the standard by emitting Reply-Postponed rather than nothing when the data request times out. 2017-05-02 20:17:39 +00:00
skarg c9742a594c Fixed VMAC for routed address match on compare. Thank you, Arne Nickel! 2017-04-10 14:43:31 +00:00
skarg 9b2d696dda Per 135-2016bl-2 and test BTL 9.20.1.8 Reading OPTIONAL Properties, if no optional properties are supported then an empty 'List of Results' shall be returned for the specified property. 2017-03-20 15:15:30 +00:00
koby3101 b51bd6bc5e To process the last object in the object list 2017-03-02 10:39:10 +00:00
koby3101 60fdfcd04e NC added/corrected validation and also parse Priority as array 2017-03-01 11:51:46 +00:00
skarg fa445a1251 Fixed warnings detected by splint 2017-02-15 21:50:06 +00:00
skarg dba03d47bd Fixed warnings found via splint. 2017-02-14 18:14:58 +00:00
skarg e0d302cf31 Fixed warnings found via splint. 2017-02-14 17:59:26 +00:00
skarg eec96e8f5d Merge splint warning fixes. 2017-02-14 17:35:54 +00:00
skarg bd5ec637a6 Changes to clean up compile warnings 2017-02-14 15:21:39 +00:00
skarg daf346e6b2 Add makefile for BACnet/IPv6 unit test. 2017-02-14 14:44:37 +00:00
koby3101 ee973cb906 Typo semicolons removed 2017-02-06 12:22:14 +00:00
skarg d4469212d0 Updated Atmega8 project to compile under IAR EWARM 6.40.3 2017-01-28 18:43:57 +00:00
skarg 8414ed64e5 Added some text into EPICS demo that BTL wants to see in their testing tool. 2017-01-28 18:42:45 +00:00
skarg 957bb9fb99 Added COV example to Analog Value object. 2017-01-11 23:51:24 +00:00
skarg d48ac6bc26 Fixed COV examples to Notify upon subscribe. 2017-01-11 23:51:02 +00:00
koby3101 5e5c2d616a Return value from snprintf is type int 2017-01-09 13:35:45 +00:00
skarg 79af8b60df Merged revision(s) 3102 from branches/releases/bacnet-stack-0-8-0:
Changed info prints to go to stdout rather than stderr to clean up Wireshark extcap usage.
........
2017-01-04 18:55:24 +00:00
skarg 18c7020659 Fixed [bug#40] - problems if pdu_len exceeds the size of a single pbuf block. Thank you, Jörg Hofmann!
Added statistics to track packets sent, received, and errors.
Added proper reply when BVLC functions are requested and not supported.
Fixed Forwarded NPDU.
2017-01-02 23:03:10 +00:00
skarg 349c01920f Added MS/TP slave node to BDK DLMSTP module. 2017-01-02 15:47:29 +00:00
skarg 134c628041 Fixed compilation of unit tests. 2017-01-01 05:42:55 +00:00
skarg e317b253f4 Fixed compiler warnings and error. 2017-01-01 05:27:03 +00:00
skarg 13c85c5aea Fixed the BITMASK_CHECK macro to actually compare to the mask. 2017-01-01 05:23:51 +00:00
skarg 2bb0045028 Added function to BIP to detect when the UDP port number changed. 2017-01-01 05:23:01 +00:00
skarg 2f393c13c2 Added cast to fix compiler warning. 2017-01-01 05:22:17 +00:00
skarg 53d4ab31d7 Fixed spelling of variable deviceIdentifier. 2017-01-01 05:21:33 +00:00
skarg a2cd7c478c Added structure name. 2017-01-01 05:20:39 +00:00
skarg f2b754336d Updated ringbuffer library to remove alloc and include data-peek and data-put. 2017-01-01 05:20:13 +00:00
skarg 55e77695c8 Changed order of checking in MS/TP LostToken transition to handle case of OS that is really late. 2017-01-01 05:19:28 +00:00
skarg 98d919546c Refactored memcopy range check. 2017-01-01 05:18:13 +00:00
skarg 5e5dc533af Fixed JavaDoc comments. 2017-01-01 05:17:31 +00:00
skarg aad3c42b82 Added wildcard date comparison functions. 2017-01-01 05:15:28 +00:00
skarg 66013584fa Added buffer size to COV handler function parameters. 2017-01-01 05:14:33 +00:00
skarg 93834e7c45 Added DCC enum text names. 2017-01-01 05:13:55 +00:00
skarg f0c727ff29 Added functions to encode/decode unsigned64 values. 2017-01-01 05:12:59 +00:00
skarg 8afd5669f7 Added encode/decode for BACnet address. 2017-01-01 05:12:06 +00:00
skarg 1f3fd7e933 Added functions for Reliability property Get/Set for demo objects. 2017-01-01 05:10:48 +00:00
skarg d416303844 Added function to get the DCC password from demo handler. 2017-01-01 05:08:40 +00:00