microCoAPy icon indicating copy to clipboard operation
microCoAPy copied to clipboard

OOP

Open big-vl opened this issue 2 years ago • 4 comments

I saw a method sendPacket in the code, I wanted to use it, but I had to look at the code further, it turns out this method has privacy. Do you think this is a bad method to use? :thinking:

big-vl avatar Sep 09 '22 22:09 big-vl

Hello @big-vl

it is not wrong to use it as long as you provide a properly initialized CoapPacket instance as "send" and "sendEx" functions do. Also manually set the coap state:

self.state = self.TRANSMISSION_STATE.STATE_IDLE

May I ask why do you need to use the low level function directly?

ftylitak avatar Sep 10 '22 10:09 ftylitak

Hello @big-vl

it is not wrong to use it as long as you provide a properly initialized CoapPacket instance as "send" and "sendEx" functions do. Also manually set the coap state:

self.state = self.TRANSMISSION_STATE.STATE_IDLE

May I ask why do you need to use the low level function directly?

so I wrote that it would be better to make methods more usable, for example _sendPacket I would know that I can use it but with some limitation. So there are no problems with the code, there is also a question about subscription, as I understand it, according to the specification, such an opportunity exists but is not implemented. For now, I'll have to use sockets without a specification.

big-vl avatar Sep 12 '22 00:09 big-vl

@ftylitak You have made a very stable and good library, I am delighted.

big-vl avatar Sep 12 '22 00:09 big-vl

Thank you for your kind words.

Indeed, the function should be named _sendPacket. Right now I am a bit hesitant to change it to avoid breaking compatibility with applictions that already use it...though I believe there are none to few of them.

It might be done soon.

Fo the subscription, in case you make it work, we are open for contributions :)

ftylitak avatar Sep 12 '22 09:09 ftylitak