Intialization for BACnet MS/TP. #992
yughandharreddy
started this conversation in
General
Replies: 1 comment
-
|
The OS based apps initialize their datalink layers using dlenv.c module. For MS/TP datalink: dlenv.c also configures the initial values for the Network Port object in the device. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I’m currently working on a Proof of Concept (POC) project using C++ (Qt/QML) on Linux, and I would like to integrate the BACnet Stack with MS/TP support only.
Where do we need to configure Com port and buadrate and how to intialize MS/TP in POC project.
The ultimate goal is to send/receive BACnet services (e.g., Who-Is, I-Am, Who-Has, I-Have) from within a Qt-based application.
Build the BACnet Stack with only MS/TP support (no B/IP, no Ethernet).
Link the BACnet Stack binary (or its compiled object code) into my Qt/QML project.
currentl i have implemented for BACnet IP and Intialization. For reference please check below code :
#include "bacnetintegration.h"
#include <stdlib.h>
#include "QDebug"
static struct mstimer BACnet_Task_Timer;
static struct mstimer BACnet_TSM_Timer;
static struct mstimer BACnet_Address_Timer;
static uint8_t Rx_Buf[MAX_MPDU]; // Buffer for receiving data
bacnet_objects_manager *bac_obj_mgr = bacnet_objects_manager::getInstance();
BacnetIntegration::BacnetIntegration(QObject *parent)
: QObject{parent}
{
}
void BacnetIntegration::Init_Device()
{
uint32_t device_instance = 123; // The BACnet device instance number (can be configurable)
Device_Set_Object_Instance_Number(device_instance); // Set the device instance number
Device_Object_Name_ANSI_Init("DeluxeServer"); // Set the device name
}
void BacnetIntegration::Init_Service_Handlers()
{
BACNET_CREATE_OBJECT_DATA object_data = { 0 };
unsigned int i = 0;
}
void BacnetIntegration::Init_Communication()
{
dlenv_init(); // Initialize the data link environment
#ifdef BACDL_BIP
qDebug() <<"going to BACDL_BIP" ;
#endif
atexit(datalink_cleanup); // Clean up resources at exit
mstimer_set(&BACnet_Task_Timer, 1000UL); // Timer for periodic tasks
mstimer_set(&BACnet_TSM_Timer, 50UL); // Timer for TSM timeouts
mstimer_set(&BACnet_Address_Timer, 60000UL); // Timer for address binding timeouts
}
void BacnetIntegration::Start_Device()
{
BACNET_ADDRESS src = { 0 };
uint16_t pdu_len = 0;
unsigned timeout = 1; // Milliseconds for datalink receive timeout
uint32_t elapsed_milliseconds = 0;
}
void BacnetIntegration::Shutdown_Device()
{
datalink_cleanup();
}
Initialize and use MS/TP communication from my Qt/C++ codebase, invoking Who-Is / I-Am from within the app logic.
Any advice, references, or even simple examples would be very helpful!
Thanks for your amazing work on this stack – it’s been a great learning experience so far. Looking forward to contributing back once I have a working setup!
Beta Was this translation helpful? Give feedback.
All reactions