|
|
Exercise 4 Acquisition of control page including CSV format data and upload to FTP server | ||||||
| ■ Exercise 4 2. Addition of CSV data lines to HTML data on web control screen 3. About the installation of each command 4. Example of acquisition of pages, filtering and editing 5. How to schedule regular command execution 6. Upload of CSV file to ftp server
→Click here if you have some questions and comments. ←Back to the table of contents
Updated May 30, 2005 18:33
|
●Goal of Exercise 4As Exercise 4, submit the exercise of "Acquisition of control page including CSV format data and upload to FTP server". →Click here for the submission of exercise. Utilize actually some of items you mastered in IT graduate school curriculum: (A) Acquisition of a minimum of knowledge and skills to become an IT engineer. There are two objectives in this exercise. (1) Creation of CSV format data (PICNIC side) (2) Upload of acquisition data to FTP server (PC side) ・wget: acquisition program of HTML pages Because of highly versatile data format, it can be used for many purposes such as database as logs and understanding of recent state of each PICNIC node. ●Addition of CSV data lines to HTML data on web control screenTo make editing work after acquisition of HTML data easy, add various data lines which begin with "CSV," to HTML data on web control screen. It's desirable to add after beginning a new line (\n) in the last line of the footer. (1) CSV data format Sequence of comma-separated data of CSV lines is as follows: <CSV data format (actually one line)> <Output example> CSV,02TA699X, 1.2.0.9, 00:02:CB:01:2E:75, 0, 0, 0, 0, 27, High , Low , High , High , High , Low , Low , Low , 0 →Click here to see the actual web page (HTML).
Add the following codes to the footer of message bank #4 on the web control screen. <Additional codes to the footer of message bank #4 on the web control screen>
●About the installation of each command(1) In the case of Unix machine Shells such as sh and bash, various commands such as grep, sed and date and wget are already installed as a standard installation in recent Linux-OS and so on.
There are the following two methods. [A] Installation of Cygwin environment. [A] Cygwin environment Execute Cygwin environment setup from the Cygwin homepage. grep, sed, date: default installation of the Base category These are operated on the bash command shell. [B] Win32-Unix compatible command environment (2005.3.25 revised again) Install Unix compatible commands with GNU utilities for Win32. After downloading from this local copy (12.6MB), execute unxutils.exe to setup. Each compatible command is used on the sh shell called from the DOS command prompt. In the case of WinXP: Then, the sh shell compatible environment will be available by executing c:\windows\system32\sh. ※Note In WinXp and so on, execute setup by administrator user whose name is composed of alphanumeric characters and who has administrative right. ●Example of acquisition of pages, filtering and editing (2005.3.25 revised)
|
open ysserve.cs.shinshu-u.ac.jp |
<Execution example> Execute "ftp -s:ftplogin.txt"
THINKPAD2# ftp -s:ftplogin.txt |
(2) Preparing a file in which FTP commands are enumerated to redirect (using the -n option)
<File in which FTP commands are enumerated, ftpupload.txt>
open ysserve.cs.shinshu-u.ac.jp |
<Execution example> Execute "ftp -v -n < ftpupload.txt"
THINKPAD2# ftp -v -n < ftpupload.txt |
Access the following URL with your browser to confirm the upload.
ftp://ysserve.cs.shinshu-u.ac.jp/incoming/picnic/
CSV files stored in the above URL can be opened from InternetExplorer on a Windows machine where MS-Excel is installed.
# Do not delete other students' files!
|
【Exercise 4】(Integral experiment) 【A】Creation of CSV format data (PICNIC side) 【B】Upload of acquisition data to FTP server (PC side) |
【A】Creation of CSV format data (PICNIC side) and report submission
(1) Update firmware to display CSV format data on the web control screen.
(2) Using the state of door sensor, the changes of counter values and the web control screen, confirm working as required.
(3) Change the version number of the assembled source file to
ver1.2.0.9
And change arbitrarily the footer of the web control screen to your student ID number and so on.
(4) Save the assembled source file under the name of v1209e4.asm. (English one byte characters/ Lower-case alphabets/ Do not use one-byte katakana and double-byte characters as file name.)
(5) From the following report submission system, upload v1209e4.asm. We will mark your report after receiving it.
<How to submit>
For the program you created, submit the assembled source file (the extension is not *.hex but *.asm) by using the following report system (with the file upload function).
We will judge resubmission or completion after checking the operation of the file you submitted. You have to resubmit if there are any defects in the operation. You can "finish【A】" if the operation is OK.
Click here to submit the report of Exercise 4【A】(Exercise number: picnic-exp04).
(6) You have to "wait our judgement". Send an e-mail to here if you do not receive the result of judgement for a long time.
(7) If you received the judgement of resubmission, correct the defects indicated, change the filename to the name of v1209e4a.asm and so on and submit it.
(8) Without (7) (that is, the judgement of completion), your report Exercise 4【A】was accepted once. (But you have to go on Exercise 4【B】.)
【B】Upload of acquisition data to FTP server (PC side)
(9) Set shells such as sh and bash, various commands such as grep, sed and date, and wget as enabled with a PC which can be directly connected to PICNIC.
(10) After implementing the shell script of acquisition of pages, filtering and editing according to individual OS environment, confirm acquisition of the output of CSV implemented in the above【A】from PICNIC, addition and storage of CSV file. For date and time, acquire 3 to 4 times at intervals of about ten seconds.(11) You don't have to configure the schedule of regular command execution at this moment. (Take your time to try at a later date.)
(12) A CSV file named student-ID-number.csv should be created in the current directory. Upload it by ftp to the incoming/picnic directory of the ftp server (ysserve.cs.shinshu-u.ac.jp) using anonymous user.
(13) Access the following URL to confirm that your CSV file was uploaded.
ftp://ysserve.cs.shinshu-u.ac.jp/incoming/picnic/
(14) After confirming uploading, input a comment including the URL of CSV file you uploaded to teacher comment field
<How to submit>
We will judge resubmission or completion after checking the URL of CSV file described in the comment field. You have to resubmit if there are any defects. You can finish【B】and the whole Exercise 4 in the case of OK.
Click here to submit the report of Exercise 4【B】(Exercise number: picnic-exp04).
(15) You have to "wait our judgement". Send an e-mail to here if you do not receive the result of judgement for a long time.
(16) If you received the judgement of resubmission, correct the defects indicated and resubmit it.
(17) Without (16) (that is, the judgement of completion), your report Exercise 4【B】and the whole Exercise 4 was accepted.
Students who finished the above (17), good work! That's the end of required exercises of "IT Technology exercise". We hope you will study and research aggressively in Shinshu University Graduate School on the Internet, join in the remote education project. Thank you for your cooperation. m(_o_)m
Point of consideration on this time's specification and implementation is as follows. You do not have to answer it as a report, but make sure to arrange your thoughts before you finish the program and submit your report.
[1] About this time's CSV output format, the version of firmware of PICNIC to be acquired and the data processing (which column means what) after acquisition have to be mutually collaborated and corresponded. On the other hand, from the data collection PC side, the "node" for getting HTML does not have to be an actually "existing" PICNIC microcomputer board. What this means is that there is a possibility for the number of I/O ports to change as a result of a version change in the PICNIC microcomputer board and that could change the assignments of each column. In the CSV data format used here, we simply put data in rows and do not have a title line for expressing the port assignment or meaning of each column. Therefore, it would be a good idea in the finalized *.csv file to include in the first line the appropriate "CSV file format version" (not the PICNIC firmware version) and the assignments for each column. Discuss the important points of consideration and implementation for this approach.
[2]
For the data collection from
the PICNIC->server upload, what would
be the appropriate collection period and
timing? This will depend greatly on
the application to be used. For example,
if you are going to use it for a
"temperature recording device",
it will probably be sufficient
to take measurements every 10
minutes -> upload a few hours worth
all at once. On the other hand,
if you are going to implement a
door security system and speed is
of the importance in alerting users
of door alarms during out modes, there
will probably be cases where
measurement -> alarm responses should
be less than one minute.
Consider
carefully the timing for data
measurements and delivery for
each application.
[3] By setting CGI parameters (such as ?RB6=H) with the wget command, the PICNIC port output control can be done instantly from a shell script. Consider some application examples that can use this feature.
UNIX Tools for Win32
http://crocus.sci.kumamoto-u.ac.jp/physics/astro/fujimoto/home/junixwin32.htm
Cygwin
http://www.cygwin.com/
GNU utilities for Win32
http://unxutils.sourceforge.net/
GNU FSF/UNESCO Free Software Directory
http://www.gnu.org/directory/
![]()
wasaki@cs.shinshu-u.ac.jp
Copyright(c) 2005 Katsumi Wasaki. All rights reserved.