[Bacnet-developers] Timing Considerations and Message Handling Architecture
Brought to you by:
skarg
|
From: Christoph Z. <cz...@rs...> - 2013-10-22 09:12:32
|
Hi Everybody,
first of all thanks for helping me out on my previous request. Currently I Am designing
a higher-level C++ layer for better abstracting the access to the BACNet network, from
a client's perspective. The goal is to e.g. let the BACNet stacks' 'receive and handle'
block run assynchronously within a separate thread. All requests and responses will
be stored in two FIFOs.
Concerning this architecture I would like to ask the following questions:
1) What was the reason for designing the BACNet stack with a callback mechanism
for handling responses? E.g. why wasn't the npdu_handler(...) designed to 'just' decode
the BACNet protocol and then update some receive message buffers, which can
be simply read directly after npdu_handler(...) had been called successfully?
2) Are there any real-time constraints for the client, server and/or both sides of the
communication?
3) Are there any other not-considered BACNet-related properties which might
render the intended higher-level architecture 'useless'?
To better understand the architecture here is a fictive sample of a user-application:
//Init: Sets up all handlers, data link, address cache etc.
bacnetStackBase::BACNetConnection connection(...)
//Let the connection run asynchronously as a thread.
connection.run()
//Begin the main routine
//E.g. Here a user-application can handle RPCs from another system, GUI, etc.
//NB: The keepRunning flag is a variable, which can be set to false via the
// appropriate CTRL-C, etc handlers.
while( keepRunning )
{
//Issue a read property request
connection.send( ReadPropertyRequest( ... ), ... )
//Check the length of the currently enqueued active responses.
if( connection.activeResponses() )
{
//If the invoke IDs match and the response type is the same as
//the request type the ReadPropertyRequest(...) has been answered.
//NB: In case of an error an appropriate state flag will be set in the response.
...
}
//Now here the user-application can interact with a GUI, etc.
}
//After the above loop has been quit the application should be gracefully
//closed.
connection.close()
---------------------------------- END OF PSEUDO-CODE
Thank You in advance for Your help.
Mit freundlichen Grüßen,
Christoph Zach
-----------------------------------------------------------------------------
RST Industrie Automation GmbH * Carl-Zeiss-Str. 51, D-85521 Ottobrunn
Tel. +49-89-9616018-00 * Fax +49-89-9616018-10 * http://www.rst-automation.de
Geschäftsführer: Dipl.-Ing.(FH) Robert Schachner
Amtsgericht München: HRB 103 626 * ID-Nr. DE 811 466 035
-----------------------------------------------------------------------------
|