Hello,
Is Gurux stack can manage connection to more than one clients at the same time? for example, meter has optical port and NIC mesh. both are could connected at the same time. Server has singular clientSAP. Do you have sample code?
Thanks and Best Regards!
Forums
Hi, It's possible to handle…
Hi,
It's possible to handle multiple clients at the same time. You need to create your own instance from the server intence for each interface, e.g. one for optical and one for NIC.
Server instances can share the same COSEM objects. This needs to be done because connections might use different communication interfaces, e.g. HDLC and WRAPPER.
BR,
Mikko
Hello, Thanks for kind…
Hello,
Thanks for kind support! Do you have sample ANSI server with several servers? Can you show short snippets, if do not have yet
BR,
Hi, You need to allocate own…
Hi,
You need to allocate own memory for both servers. Something like this:
//DLMS HDLC settings.
dlmsServerSettings hdlcSettings;
svr_init(&hdlcSettings, 1, DLMS_INTERFACE_TYPE_HDLC, HDLC_BUFFER_SIZE, PDU_BUFFER_SIZE, frameBuff, sizeof(frameBuff), pduBuff, sizeof(pduBuff));
//DLMS WRAPPER settings.
dlmsServerSettings srapperSettings;
svr_init(&srapperSettings, 1, DLMS_INTERFACE_TYPE_WRAPPER, WRAPPER_BUFFER_SIZE, PDU_BUFFER_SIZE, wrapperBuff, sizeof(wrapperBuff), wrapperPduBuff, sizeof(wrapperPduBuff));
BR,
Mikko
Hello, settings used in…
Hello,
settings used in server codes like " if ((ret = cosem_getValue(&uartSettings.base, &e)) != 0)" in lot of places. i have 2 different intiated server settings.
please, advice
BR,
Hi, You need to handle both…
Hi,
You need to handle both separately if you are using a different PDU size or all data can't fit into the one PDU.
Make sure that you don't make any changes to the server.c file. All the changes are made for the main.c file.
BR,
Mikko
Hello, Can add new Uart…
Hello,
Can add new Uart instance for NIC instead of server? Because NIC interface is uart too. Like bellow snippets?
while (true)
{
// Serial port connection.
if (uartBufferPosition != 0)
{
uart_irq_rx_disable(uart_dev);
if (svr_handleRequest2(&uartSettings, UART_BUFFER, uartBufferPosition, &uartReply) != 0)
{
bb_clear(&uartReply);
}
uartBufferPosition = 0;
uart_irq_rx_enable(uart_dev);
if (uartReply.size != 0)
{
// Send reply.
for (size_t i = 0; i < uartReply.size; i++)
{
uart_poll_out(uart_dev, uartReply.data[i]);
}
bb_clear(&uartReply);
}
}
// Serial port connection.
if (nicBufferPosition != 0)
{
uart_irq_rx_disable(uart_dev_nic);
if (svr_handleRequest2(&nicSettings, UART_BUFFER, nicBufferPosition, &nicReply) != 0)
{
bb_clear(&nicReply);
}
nicBufferPosition = 0;
uart_irq_rx_enable(uart_dev_nic);
if (nicReply.size != 0)
{
// Send reply.
for (size_t i = 0; i < nicReply.size; i++)
{
uart_poll_out(uart_dev_nic, nicReply.data[i]);
}
bb_clear(&nicReply);
}
}
k_msleep(100); // Adjust sleep duration as needed
}
Hi, You can add as many…
Hi,
You can add as many instances as you need if you have enough memory. You may have your own meter for each UART.
Just make own instance from settings like this:
dlmsServerSettings uart1Settings;
dlmsServerSettings uart2Settings;
while (true)
{
//Read data from UART1 and add it to the UART1 buffer.
if (svr_handleRequest2(&uart1Settings, UART1_BUFFER, uart1BufferPosition, &uart1Reply) != 0)
{
bb_clear(&uartReply);
}
...
//Read data from UART2 and add it to the UART2 buffer.
if (svr_handleRequest2(&uart2Settings, UART2_BUFFER, uart2BufferPosition, &uart2Reply) != 0)
{
bb_clear(&uartReply);
}
}
It's mandatory that you have your own buffer for both UARTs.
BR,
Mikko