8 years, 10 months ago.

Same class name in mbed library

Hi all!

I want to implement two network interface library as below. /media/uploads/SteveKim/dual-nic-3.jpg

But, it failed to compile it.

And I found that this problem is because of same class name(header file name) of two library. In other words, there are same name classes in both ESP8266Interface and EthernetInterface. (Endpoint, Socket, TCPSocketConnection, .......)

What is the best way to solve this problem?

  • Change class-name in a library(Endpoint -> ESP8266Endpoint, Socket -> ESP8266Socket, ......)
  • Use "namespace" keyword in a library
  • Or any other way?

Please let me know the best way to solve the problem.

Steve.

Question relating to:

Team for developers working on the ESP8266 WiFi SOC.

Silly question probably: Are the two versions the same? They look like they are implementing the same standard network functionality. If so can't you just remove one from the project?

posted by Andy A 01 Jul 2015

No, I can't remove it. (I need both libraries.) Because I want to implement multi NIC (Network Interface Card). Some data need to be sent via ethernet(wired) and some data need to be sent via WiFi.

posted by Steve Kim 01 Jul 2015

That functionality should be the same for both and so there should be no need to include it twice. Both libraries are implementing TCP/UTP sockets, that has nothing to to with whether the data is on 100Base T or WiFi, it's a different layer of the network stack.

posted by Andy A 01 Jul 2015

As I said above, I solved the problem using namespace. I couldn't find another good way.

Please, refer to the below code. https://developer.mbed.org/teams/WIZnet/code/DualNetworkInterface-Basic/wiki/Homepage

posted by Steve Kim 15 Jul 2015

1 Answer

8 years, 9 months ago.

This is not an answer, but the answer was provided by Steve, in the comment above - the link he shared: https://developer.mbed.org/teams/WIZnet/code/DualNetworkInterface-Basic/wiki/Homepage

Thank for sharing the link and your solution, mgiht help others as I saw this questions asked here before.