Coder Social home page Coder Social logo

Comments (5)

ftylitak avatar ftylitak commented on June 17, 2024 1

@dmartauz I am very happy it worked as expected.

A proper example code for ESP32 was within our plans, so this change that you suggested is a good opportunity to proceed on doing.

My estimation is that within this week we will have a first version. We will keep you updated.

from microcoapy.

ftylitak avatar ftylitak commented on June 17, 2024

Hello @dmartauz

to my understanding you suggest to decouple the CoAP logic from the socket operations. Correct?

Indeed it is a good idea and future-proof. The initial version was implemented as is because on Pycom devices, the sockets are already encapsulated by the micropython API. So in case of WiFi, it is a typical UDP socket, whereas on NBIoT it is AT commands sent to the modem to handle the UDP socket on the modem.

Do you have any specific example of a user case where the network interface is not mapped to the internal IP stack? If yes, it would be a good input for us to use it as test scenario.

Eitherway, during next week we will proceed to the decoupling and we will keep you updated.

from microcoapy.

dmartauz avatar dmartauz commented on June 17, 2024

@ftylitak yes your understanding is correct.

My setup is ESP32 (WROVER module) with Quectel BC66 NB-IoT modem on a custom board. I already performed some testing of your lib against Thingsboard. First time without any modifications over WiFi connection, second time I passed content of "buffer" bytearray from sendPacket method to the NB-IoT modem via AT command. Worked as expected in both cases.

from microcoapy.

ftylitak avatar ftylitak commented on June 17, 2024

@dmartauz,

in branch IN-209-esp32-example there is a proposed solution to your suggestion through Pull Request #2 .

The branch also contains an example for ESP32 that show how to use a custom socket.

The custom dummy socket that has been used is:

################################################################################
## Custom socket implementation
class CustomSocket:
def __init__(self):
print("CustomSocket: init")
def sendto(self, bytes, address):
print("CustomSocket: Sending bytes to: " + str(address))
return len(bytes)
def recvfrom(self, bufsize):
print("CustomSocket: receiving max bytes: " + bufsize)
return b"test data"
def setblocking(self, flag):
print(".", end="")
################################################################################

and is set in microCoAPy instance as:

# Initialize custom socket
customSocket = CustomSocket()
# Use custom socket to all operations of CoAP
client.setCustomSocket(customSocket)

Could you give this branch a try?
Does this fullfil your requirements?

from microcoapy.

ftylitak avatar ftylitak commented on June 17, 2024

Closing the issue due to inactivity.

If there is any suggestion of a different approach on this subject, please open an new issue.

from microcoapy.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.