Please be sure to include at minimum the content and screenshots called out below. Be sure to read the complete Rules for each Tournament Round
First Round:
Summary:
Google documents offer great platform for creating and sharing documents. This application interacts with google documents and downloads the spreadsheet type of documents to local PC.
Function:
To get list of spreadsheet documents available in google documents. and download all spreadsheets in csv format.
Changes made for Round 2
Implemented the code into state machine modified for publisher subscriber framework.
My example needs downloading of .net library and creating google account for checking the example. In some compnies user can not install such libraries without IT permission. Also Just because of lengthy setup process some visitors may not actually try out code. To help them i have included “Simulation” mode for Task1 code. The process for enabling or disablling simulation mode is given below.
Created LVProj
Minor modification in subvis for compatibility with simulation mode
Enabling Disabling Simulation mode
open GoogleDocAPI.lvproj
Right click on “Project: GoogleDocAPI.lvproj” and select properties
go to conditional disable symobols
Set SIMULATE=TRUE for enabling simulation.(Set it to FALSE for disabling)
Install the Library (Not required for Simulation Mode execution)
If required google account for Google documents (Not required for Simulation Mode execution)
If required create some spreadsheet documents (Not required for Simulation Mode execution)
Open GoogleDocAPI.lvproj
Open the "GoogleDocSpreadsheetDownloader.vi" "GoogleDocSpreadsheetDownloader_2.0.vi"open block diagram and putup your gmail id and password in username and password string constants (Not required for Simulation Mode execution)
Run the vi
See Video attached below to see example at work
Screenshots:
Main Front Panel:
Main Block Diagram:
VI Snippet:
Second Round: Transfer data to other VI:
Communication Mechanism
Self Built Framework which implements publisher subscriber pattern or observer pattern.
Advantages
No need to pass any referance or configuration data between Vis for transfering data
Publisher and subscriber doesnt know about each other, the framework ensures the delivery. This gives following advantages
makes application extension very much powerful as well as easy
Attaching and removing debugging tools become easy
Totaly asynchronous operation without polling ensures optimum performance
Each parrallel VI executes “CALLBACK State” in state machine in response to the event(along with Event Data)
Has many adavantages over native Event driven porgramming
No development time check for event Name and event data type(much more flexible for future extension, ideal choice for plugins)
Events can be discarded(flushed)
Events can be given priority
with introduction of lossy queues framework can be modified to ensure max events to be queued(Not yet implemented in current framework)
multiple Vis can subscribe to same message in this case each VI gets a copy of event data
framework provides debugging tool to detect most common problems in async communication(such as continuously increasing backlog in case producer consistently send data faster than the consumer can consume)
ALL THIS IN JUST 7 very well encapsulated Vis(No complicated stuff outside so even new developer can use it without understanding complex logic inside)
Create
Destroy
Subscribe Event
Unsubscribe Event
Raize event
flush/discard events
Get Event
Highlights of new code (including changes in task 1 code)
Using diagram disable structure
Simulating data sources(Can be useful for simulating non ni hardwares/ Communication protocols etc as well)
understand publisher subscriber architecture
understand plugins
Function:
in publisher subscriber architecture VI can subscribe to perticular events. whenever event with that name is raized by any VI. subscribing VI goes to the state with the name of event. it receives the event data there and executes the callback code written
Task 1 Code(GoogleDocSpreadsheetDownloader_2.0.vi) subscribes following event:
GetDocList:
Raized by: SubscriberVI.vi when user presses refresh list button
What happens: GoogleDocSpreadsheetDownloader_2.0.vi goes to "GetDocList"case. fetches Names of all the spreadsheet document names from google docs and returns them in event "DocList Retrieved"(This event is subscribed by "SubscriberVI.vi" which then fills that list in All Spreadsheets combo box)
GetDocByName (Not used yet)
GetCacheDocByName
Raized by: SubscriberVI.vi when user presses Load Doc button (Document selected in All spreadsheets combo is passed as parameter)
What happens: GoogleDocSpreadsheetDownloader_2.0.vi goes to "GetCacheDocByName" case. Reads spreadsheet name present in event data. fetches perticular spreadsheet data from google docs cache and returns them in event "CacheDoc Retrieved"(This event is subscribed by "SubscriberVI.vi" which then fills that in table. It is also subscribed by sniffer)
LoadCache
Raized by: SubscriberVI.vi when user presses Reload Doc Cache button
What happens: GoogleDocSpreadsheetDownloader_2.0.vi goes to "LoadCache" case. Reads all the spreadsheet document names and their content. and stores it in memory cache.
Steps to execute code:
Open GoogleDocAPI.lvproj(Include both round 1 and round 2 code)
Open “GoogleDocSpreadsheetDownloader_2.0.vi” and “SubscriberVI.vi”
Run them. Order is NOT important. (Note: See that VIs communicate between them without knowing anything about other. I am not calling one VI dynamically from other to show this feature)
if you want to see doc sniffer at work then open “DocLoadSniffer.vi” and run it.