LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Device independent application protocol; is there an equivalent to an abstract base class?

Labview application experts:

I would like to create a .VI to handle an application level protocol (let's call it AppProt.VI).  I would like AppProt.VI to use either a serial, TCP/IP, or UDP port.  Is it possible to pass a .VI reference to AppProt.VI so it can use the low level communication device without knowing what it is?  In C++, I would derive SERIAL, TCP/IP, and UDP objects from an abstract base class... say COMMDEV.  AppProt would then be passed a pointer to a COMMDEV object.  What is the equivalent in LabView?

Thanks much,
Terry

0 Kudos
Message 1 of 3
(2,624 Views)
Hi Terry,

Other people are going to have to help me out on this one.  I think data sockets are close to what you want.  You start by declaring what protocol you want to use (like, tcp or udp).  Then it send the message out on the default communication bus. 

For something more specific, you might need to make your own LabVIEW object oriented class LVOOP.  Maybe someone has done something close to this?
"If you want to succeed... Architect" - The Specialist
0 Kudos
Message 2 of 3
(2,611 Views)

As mentioned, if you use 8.2 or above, LVOOP is what you want. You should note, however, that LVOOP is not identical to the OOP of C++. You should read that paper and the ones it links to before starting.

In your specific case, you would create and inherit the relevant classes and then create a constructor (although it's not really a constructor, as you will see) for each one. Once you do that, you can carry a wire of any of the child classes on the same wire and when you call a method VI from one of those classes LabVIEW will choose the correct one.

Incidentally, you can do it  another way if the protocol really doesn't need to know anything about the implementation by using any number of other methods. Which one to use and how depends on your exact architecture.


___________________
Try to take over the world!
0 Kudos
Message 3 of 3
(2,600 Views)