ZigbeeNet icon indicating copy to clipboard operation
ZigbeeNet copied to clipboard

Make the classes less private & more protected so we can extend some classes.

Open genesiscz opened this issue 2 years ago • 2 comments

So I am in process of writing an app for Xbee-Pro S1 802.15.4, which probably has several differences between yours Xbee implementation and I need to be able to override the Initialize function from ZigBeeDongleXBee class. There are several properties such as _serialPort, _frameHandler which are not overridable/accessable which makes it really hard to extend the class & just rewrite to my own means without replicating/changing a lot of code.

Is there a possibility you could make a lot of these properties public so we can feely extend them?

Side question: Have you ever connected by TCP/IP (ser2net) instead of SerialPort?

genesiscz avatar Sep 03 '21 16:09 genesiscz

Please describe a little bit more in detail which classes or fields do you need. In general this library should be very flexible, so that extending will be possible. But because each user will need someting else not everything is there from beginning.

No, I haven't used ser2net, yet. For me it seems that it could be an own implementation of IZigBeePort

See https://github.com/Mr-Markus/ZigbeeNet/blob/develop/libraries/ZigBeeNet.Transport.SerialPort/ZigBeeSerialPort.cs

Mr-Markus avatar Sep 03 '21 20:09 Mr-Markus

Yes, I did exactly that. Perfect.

I stepped into a different problem: I need to override the ZigBeeDongleXbee's Initialize method because I need to NOT send some packets (reset) & send more packets to set up it a little more. The _frameHandler could be public, so you can actually do some more low-level- stuff if you need to.

I literally copied the whole class because if I just extend the class & try to implement the Initialize method, it won't call the child method but the parent one (because it has no virtual keyword).

genesiscz avatar Sep 03 '21 22:09 genesiscz