*********************************************************************** eCars-Now! eGUI-module *********************************************************************** Copyright (C) 2008 Henry Palonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *********************************************************************** **************** REVISION HISTORY **************** 16th Nov 2008 eGUI application + raw documentation started / HeP 9th Feb 2009 eGUI documentation updates for different platforms / HeP 31st Mar 2009 eGUI merb version update, 1.0.10 5th Apr 2009 eGUI JSON feed updates and eGUI screen-feed definitions started. Merb update to 1.0.11 / HeP 13rd Apr 2009 Gem-system upgrade instructions added, corrected typos / HeP 12nd May 2009 Merb update to 1.0.11, forgot to send the config-file. Added install-script for Ubuntu 9.04 / HeP HeP = Henry Palonen ******************* GENERAL INFORMATION ******************* eCars-Now! project is founded in Finland as a common effort to convert existing internal combustion (ICE) cars to use electric-motors. eGUI module is responsible of GUI that user sees in the car. To establish that, eGUI needs to communicate with eECU. eECU is that tiny box full of electronics, that controls the motor-controller, battery-managment and all the car on-board electronics and sensors. Low-level communication with the eECU is done with scripts in 'public/utils/'-directory. These scripts inject the raw messages to the eGUI database as an XML-message. Raw messages are then converted to actual messages that can be consumed by actual eGUI. Actual GUI consists of bunch of Javascript and SVG-files. ************ REQUIREMENTS ************ Gems needed: sudo gem install merb sudo gem install httparty sudo gem install dm-core sudo gem install dm-serializer sudo gem install dm-timestamps sudo gem install merb-action-args sudo gem install ruby-serialport Ruby-Serialport: http://ruby-serialport.rubyforge.org/ ************ INSTALLATION ************ ****************************** FRESH UBUNTU 9.04 INSTALLATION ****************************** Installation to fresh Ubuntu 9.04 can be done with script "install_ubuntu_904.sh" that can be found from http://svn.assembla.com/svn/ecars_now/eGUI/trunk/egui/doc/install_to_ubuntu_904.sh Just download it to your home-directory and issue following commands; chmod a+rx install_to_ubuntu_904.sh ./install_to_ubuntu904.sh The script does the rest. It installs needed items and fetches the source from repository. The source is fetched to ~/src/ - directory. ************* OTHER SYSTEMS ************* 1. Install Ruby and Rubygems For Debian based linux this usually is done with "apt-get install rubygems" or similar. Also needed: ruby1.8-dev libsqlite3-dev For any recent (10.4+) Mac OS X, there usually is some version of Ruby installed already. For Windows, take a look at http://rubyinstaller.rubyforge.org/wiki/wiki.pl 2. Install all above gems; sudo gem install merb (IF after this you get error "Error installing merb: merb-core requires RubyGems version >= 1.3.0 see "UPDATING RUBYGEMS") sudo gem install httparty sudo gem install dm-core sudo gem install dm-serializer sudo gem install dm-timestamps sudo gem install merb-action-args IF httparty fails to install and complaints about missing jnumemaker-crack, please try this; sudo gem install jnunemaker-crack --source=http://gems.github.com/ 3. Create development database; If you want to use pre-configured database, you can simply copy "egui_development_sample.db" to the new name of "egui_development.db", eg. cp egui_development_sample.db egui_development.db Alternatively you can create database from scratch, with command rake db:automigrate 4. Lauch merb-server; merb 4. Point your browser to http://localhost:4000/messages and start adding messages and debugging the process. public/utils/eGUI-serial-monitor.rb is an small script to listen to eECU serial port data and insert it to the database. public/utils/xmlfeedtext.rb is an utility to test (for now, it returns error "'Moved temporarily'", but it still works, as it inserts the data to the database. ******** COMMANDS ******** Generating new resource (eg. model, view and controller) merb-gen resource Someresource Updating the database after modifications, saves all data: rake db:autoupgrade Creating the database from scratch, deletes all data in the database: rake db:automigrate ********* Key URL's ********* SVG UI, SCREEN #1; http://localhost:4000/egui_screen_1 Last messages for every messagetype; In XML http://localhost:4000/currentstatus.xml In JSON http://localhost:4000/currentstatus.js All messages in HTML-format; http://localhost:4000/messages All messages in XML-format; http://localhost:4000/messages.xml ***************** UPDATING RUBYGEMS ***************** If you try to install gems, and you get this error "Error installing merb: merb-core requires RubyGems version >= 1.3.0 then your Gem-system is a bit too old. You must issue these 2 commands to update them to more recent version: sudo gem install rubygems-update sudo update_rubygems It could be that "update_rubygems" is not in your path - then you must look for it, eg. find / -name "update_rubygems" 2>/dev/null and issue the command from found path. ******************* UPDATING IN GENERAL ******************* Every once in a while you should issue svn update in the "trunk"-directory of the sources. This fetches newest source-files from the eCars.Now!-software repository. If after that something fails, you can try to update your gems with sudo gem update ****************************** ?! "HELP, I NEED SOME HELP" ?! ****************************** Since Merb is quite young framework (about 2 years at the end of 2008), it still needs fair bit of work on documentation. First, for general introduction to Merb-framework, you should visit Merb homepage at http://www.merbivore.com/ And for installing & getting started, there is fairly good examples at the Merb Wiki Guides, at http://wiki.merbivore.com/documentation/guides After that, you can always read the on-going documentation effort as open-source book for Merb; http://book.merbist.com/