Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KNXnetIP implementation in C#

Tags:

c#

knx

I'm developing an application in C# to control my KNX home system. So, i've used the software ETS3Demo, and using the software wireshark could "see" the IP datagrams sent by the ETS3 to the KNX/IP Interface.

I've alredy succeed with the "Connection_Request", "ConnectionState_Request" and "Disconnect_Request", i.e. I send the requests datagram and the KNX/IP Interface responds.

The only request that is giving me headaches is the "Tunnelling_Request". I send the information exactly the same way as I send the previous datagrams, but this one seems not to work.

I send the datagram "byte by byte", as you can see in the following code:

byte[] byteToSend1 = { 06, 16, 04, 32, 00, 21, 04 };

string communicationChannel = ComunicationChannelNum.Text;
byte bytesnew = Convert.ToByte(communicationChannel);

byte[] byteToSend2 = { 00, 00, 17, 00, 188, 224, 00, 00, 09, 01, 01, 00, 129 };

writer.WriteBytes(byteToSend1);
writer.WriteByte(bytesnew);
writer.WriteBytes(byteToSend2);

I've alredy changed the byte that corresponds to the source address and the group address to a "int" variable, and still doesn't work.

Can someone give me a suggestion or something that I might be doing wrong.

Thanks

like image 355
Canha Avatar asked Oct 22 '22 08:10

Canha


1 Answers

For anyone coming here looking up the thread:

You can always use the KNX association Falcon Library that can be downloaded for free and allows to preform all the operations (run-time and management). It requires you to understand KNX protocol though and isn't the prettiest and cleaner library ever, but works.

here: https://my.knx.org/en/downloads/falcon

Note: May need you to register, but that is for free. [I can't share it here because it would violate the License Agreement. Thanks Mr. Bummi!]

like image 58
João Portela Avatar answered Nov 17 '22 10:11

João Portela