I am curious if there are any examples in making an embedded application that need not be modified if the underlying networking layers are changed say CANOpen or Ethernet.
Is it possible to do something like this?
Probably a layer between the application and the networking layer that decides in what format the message should be sent based on the size, or transaction type like ack on receipt for that particular protocol(CANopen,Ethernet).
Any reference of something similar to this will be of great help.
Thanks
You are not comparing like for like; CANopen addresses layer 3 (Network) and above on the OSI Model, whereas Ethernet defines only physical and data link layers (layers 1 and 2). To compare like-for-like you would need to compare say CAN with Ethernet, or CANopen with TCP/IP.
In principle, at any layer if you implement a common API and semantics, you could replace all underlying layers with some other technology. However the OSI model is conceptual, and not all technologies necessarily make such clear distinctions between the layers, or use the same layer boundaries, or nomenclature. So finding an appropriate level for an abstraction suitable for a number of protocols and technologies might be difficult.
Moreover the two technologies address very different needs CAN is a field-bus technology designed for communication of real-time sensor/actuator information between “intelligent” controllers, while Ethernet is a high-bandwidth and general purpose computer networking technology.
The usual solution for network interoperability is to use some sort of bridging or tunnelling technology (i.e. conversion between networks, or transport of messages of one protocol encapsulated within the messages of another). There are any number of CAN/Ethernet bridge devices, and even a few CAN-over-Ethernet devices.