Check out our OOP Code Repository Files or visit the LabVIEW Wiki OOP Portal.
Tags |
(This content has not been tagged yet)
|
![]() |
Jul 18 2008, 09:40 PM
Post
#1
|
|||
|
Very Active Member Posts: 115 Joined: 26-January 07 From: Seattle, WA Member No.: 7603 Using LabVIEW Since:2006 LV:8.20 ,. ,.
|
Earlier I had a question regarding class design that MikaelH kindly answered. Now I have a related, but more complex problem. I have four "toasters" I need to test: Toast Magic, Super Toast 2k, Super Toast 3k, and Toast All. Three of the toasters communicate to the host computer via an I2C interface while one, the Toast All, communicates via a USB/serial UART. That creates an issue in that the TA toaster has a very different communication process. The I2C toasters continually check the state of the toast and update their internal registers to reflect the current state. The TA toaster continually checks the toast state and sends it out to the serial port. If the UART has been initialized each toast state is stored in a buffer that will be dumped all at once at my next read, which may not be for quite some time. Furthermore, there are potentially three different devices we will use for I2C communication. All can do basic read and writes, but each has it's own unique feature set. The 8451 can operate only in master mode, the Aardvark can do master or slave as well monitor the bus (in case the blender wants to talk to the food processor), and the Corelis do everything the Aardvark can as well as fiddle with low level bit timing. Here's a UML diagram of what I'm thinking of doing. (I don't really know UML, so some of the notation might be incorrect.) I've also attached a copy of the Visio diagram if anyone wants to modify it. Explanation: Each I2C interface class inherits from an abstract I2C Interface Base class. Each toaster class inherits from an abstract Toaster Base class, which inherits from an abstract I2C Slave Base class. The I2C Slave Base class contains the I2C Interface Base class as part of its private data. Whew! Enough with the problem description. On to the questions...
Any and all comments are welcome!
Attached File(s)
|
||
|
|
|||
| Ad |
Jul 18 2008, 09:40 PM
Post
#
|
||
|
|
|
||
|
|
|||
Jul 21 2008, 04:57 AM
Post
#2
|
||||
![]() Very Active Premium Member ![]() Posts: 150 Joined: 1-November 04 From: Sydney Member No.: 941 Using LabVIEW Since:1995 LV:8.5.1 ,8.6 ,.
|
Hi
I've made a quick UML diagram of how I would have solved the design. When I get more time I'll try to give you more feed back. Remember that all base class methods should makes sense to the child classes. Cheers, Mikael --------------------
|
|||
|
|
||||
Jul 21 2008, 12:58 PM
Post
#3
|
|||
|
Certified Kool-Aid Kid Premium Member ![]() Posts: 1156 Joined: 6-December 02 From: Pittsburgh PA USA Member No.: 29 Using LabVIEW Since:1998 LV:7.1 ,. ,.
|
Thanks for that reply Mikael! For self-taught (ah-hem, cough cough) OO types like myself, snippets like this are "Golden Nuggets". Thank you! Ben
|
||
|
|
|||
Jul 21 2008, 02:43 PM
Post
#4
|
||||
|
Very Active Member Posts: 115 Joined: 26-January 07 From: Seattle, WA Member No.: 7603 Using LabVIEW Since:2006 LV:8.20 ,. ,.
|
Hi I've made a quick UML diagram of how I would have solved the design. When I get more time I'll try to give you more feed back. Remember that all base class methods should makes sense to the child classes. Cheers, Mikael Thanks for the response Mikael. I ended up implementing most of the structure over the weekend and did almost exactly what you suggested. The only difference is that I didn't create a Toaster I2C and Toaster Serial class. Instead I just made the I2C Slave class a member of the Toaster classes that use I2C and I'll implement the serial protocol directly in the Toast All class. I think this will work okay. The only problem I can see right now is how to configure the I2C interfaces and Toasters. You suggested a pop-up configure dialog box in the other thread so I'll probably go that route.
|
|||
|
|
||||
![]() ![]() |
| Time is now: 2nd December 2008 - 04:11 AM |