/**
* Change log
* 2.3
* - Packaging change in order to separate the Linux CM160 device driver from
* the ElectricOWL release. The linux_cm160_driver.tgz file now contains the
* CM160 device drivers. This allows the drivers to be updated without a
* new electricowl release.
* - Added installation script for a pre built cp210x (CM160 device) driver
* onto a raspberry pi 3.6.11 kernel so that users may use the cm160server
* without having to rebuild the raspberrypi kernel.
* - Updated the details of how to rebuild the driver on the raspberry pi for
* the raspberry pi 3.6 kernel.
* - Updated the Makefile for Ubuntu machines to make and install the cp210x
* kernel module.
* - In the electricowl GUI don't report the error ~//.eowl.view.SetupPlotDialogConfig.cfg (No such file or directory)
* as config file will not be present initially.
* CM160Server.py changes
* v1.16
* - Ignore errors seting the locale as some platforms may not support it. Previously this
* caused a crash.
* - When down loading history, output data every second rather than showing every record
* added which slowed down the data download. Data is only committed to the db on display
* to improve performance on slower (E.G raspberrypi platforms).
*
* 2.2
* fix problem in cm160Server. cm160Server moves to version v1.15
* Correctly set the locale in the python code to fix exceptions E.G
*
* Unhandled exception in thread started by <bound method Server.handle_socket of <
* Server(Thread-2, started daemon 2940)>>
* Traceback (most recent call last):
* File "cm160Server.py", line 878, in handle_socket
* File "cm160Server.py", line 911, in __handleClientCmd
* File "cm160Server.py", line 945, in __getLogData
* File "_strptime.pyc", line 325, in _strptime
* ValueError: time data '2012-dic-11 00:00:00' does not match format '%Y-%b-%d %H:%M:%S'
*
* 2.1
* - Fix bug in CM160Server. It is possible for the CM160 device to initially
* not be detected because of a protocol error in the data from the CM160
* device. The CM160Server could then get into a state where it would
* repeatedly attempt to find a CM160 device but fail. This has been
* fixed.
* - Fix bug in CM160Server. In the event of a read error or user pressing
* Ctrl C, restart the queuereader and server to allow the ElectricOWL
* GUI to connect to CM160server.
*
* 2.0
* - Fix bug in CM160Server that caused the server to crash somtimes with an
* invalid month error.
*
* 1.99
* - Added check in the linbux cm160Server.py installation script that pyserial
* is installed on the Linux platform.
*
* 1.98
* - ElectricOWL GUI change. The socket read timeout has been extended from 10
* seconds to 30 seconds as problems have been seen when connecting to remote
* servers wit hread timeouts.
* - ElectricOWL GUI change. If unable to connect to an OWLServer or CM160Server
* client then attempt to reconnect after a 1 second delay is made.
*
* 1.97
* - CM160 Server changes
* - The CM160Server will now run on Linux as well as Windows. Many Thanks to
* Barry McMullin for his valuable work in this regard. See the cm160Server.py
* file for details of changes made.
* - The CM160Server now stores data in an sqlite database file by default in order
* to overcome an inherent problem with the previous version where the CM160
* device did not return data in date/time order. This caused data to be lost
* which has now been fixed.
* - Added a feature to forward data from the sqlite database file to a text file
* so that users who have scripts which operate on text file data can still use
* their scripts.
* - ELectricOWL changes
* - The sensor drop down box in the history dialog would not always be populated
* with the sensor list. Fixed.
* - Added history dialog warning users if the entered start date is before or
* equal to the stop date.
* - Fixed bug which caused data to spread from the history plot to the realtime
* data plot in the ElectricOWL GUI.
* - Added a new package (tgz) file to be used to install the CM160Server and
* ElectricOWL software onto Linux platforms. This includes a driver for the
* CM160 device and some details of how to install this. Again Many thanks to
* Barry McMullin for his work in generating this driver code.
* - Updated the manual to detail software installation and use on Linux platforms.
*
* 1.96
* Bug in cm160Server code, that stopped the TCPIP server startup. This meant
* that the ElecticOWL java GUI could not connect to it. Fixed.
*
* 1.95
* - When the CM160Server is started with the --no_compat option.
* - The log file ends year_month_day.txt. The date is the date on which the
* CM160 device recorded the energy usage data.
* - The TCP file server is not started as this allows the ELectric OWL client
* to connect which it can only do when this argument is not used.
*
* 1.94
* - The CM160Server.py, -s (serial port) option does not work. Fixed.
*
* 1.93
* - Add support for the CM160Server, in order to read and plot data from the OWL CM160 (OWL+USB) device.
*
* 1.92
* - Added the ability to save the contents of a history plot to a log file. The log
* file is in the same format as the OWLServer log file. Updated manual to reflect
* this change.
* - Another attempt to fix the Italian localisation issue. This time reproduced the
* symptom and tested the fix.
*
* V1.91
* Patch release to fix Italian localisation issue. Should have replaced . characters in data with : characters.
*
* V1.9
* Changes to the client software.
*
* - Work around for Italian localisation issue where C# time is formatted HH,MM,SS,
* and Java expects time as HH:MM:SS.
* - Added an electricowl_debug.bat file that prints some debug info to stdout. This
* will hopefully provide some debug data for localisation issues.
*
* Changes to the server software
*
* 1.0.987
* Handle UnauthorizedAccessException on Windows 7 when the C:\\owl_server_log.txt path is not writable.
* In this case the temp path is used (same file name) as the store for the sensor data.
*
* 1.01986
* Change the default delay (between device init and availability check) from 0.1 second to 1 second to
* improve the reliability of the availability check.
* Add the ability to change (command line option) the default delay between initialising the USB Connect
* device and checking if the device is available. This allows the delay to be extended if the USB connect
* device is not detected.
*
* 1.01985
* Fix startup bug when the log file does not exist.
*
* 1.01984
* Add some extra text to stdout to indicate when the USB connect device is detected and initialised.
*
* V1.8
* - Problem introduced in V1.7. OWLServer.exe, .net target changed to 3.5 due to corruption of the SharpDevelop project.
* Rebuilt SharpDevelop OWLServer project (set target as 32 bit, .net 2.0) and recompiled.
* - Take more care of the error handling when converting old log file formats to new log file formats in the
* OWLServer code to handle situations where the log file does not exist and where the log file is empty.
* - On the Electric OWL client side if Double values are passed with comma's in convert them to . separated
* work around localisation differences between dotnet and Java.
*
* V1.7
* - Change the format of OWLServer log files to be semicolon separated rather than
* comma separated. This is because in France localisation may cause number to
* have comma's in them, E.G
*
* SENSOR_DATA=383,2,59,19,79248740,27,2010-06-19 07:01:41
* instead of this
* SENSOR_DATA=383,2.59,19,79248740.27,2010-06-19 07:01:41
*
* This change involved
* - Changing the format the file was saved (use semicolons to separated the data rather than commas) by the OWLServer.
* - Adding code to convert existing log files from comma separated to semicolon separated text when the OWLServer starts up.
* - Changing the Java client code to expect semicolon separated data rather than comma separated data from the OWLServer.
*
* Therefore the first time the new OWLServer starts up it will convert the log file (C:\owl_server_log.txt) from the
* old format to the new format. The old file will be renamed to C:\owl_server_log.txt.original in this process.
* The time taken to perform this conversion will vary based on the spec of the machine that it's running on but
* should take around 20 seconds pre 100 MB of log file.
*
* Thanks to kalemena for testing this.
*
* - Getting historical data could be error prone when large log files are present.
* The OWLServer and Electric OWL code to get historical data has been restructured
* and the design changed in order to make the progress bar update more
* accurate (the progress bar now represents how far the search through
* the log data has progressed). Also the cancel button on the progress
* bar will stop the log being sent to the client (Electric OWL) from
* the server (OWLServer) as soon as the cancel button is selected.
* Previously the user had to wait for the entire log to be sent
* before the OWLServer would continue to log data.
*
* V1.6
* - Bump to next general release version number.
*
* V1.54
* - Add a feature where the user can set a max power limit (in KW) in the
* configuration dialog. When the power detected is greater than this
* value and external command (user configurable) can be executed.
* Also when the power is over the configured maximum they are highlighted
* on the plots in red to indicate the period of time the power usage was
* over the configured maximum.
* - Add tool tips for each setup/config dialog menu item.
* - Allow the user to adjust the max plot time for the main plot up to a
* max of 1 hour.
* - Modify windows installer to provide the option of running the OWLServer
* on startup.
* - Fix problem with installer: When requested to install a desktop icon, no
* desktop icon was installed.
* - Updated the manual document to include the changes to the GUI.
*
* V1.53
* - Removed init sensors option from config dialog and added to the File menu.
*
* V1.52
* - Recompiled the OWLServer so that it runs on 64 Bit platforms.
*
* V1.51
* - Added an init option to the main menu to init the USB connect device attached
* to the server in order to see if this will recover the situation when the
* USB connect device appears to lock up and stop detecting sensors.
*
* V1.5
* - Change Y axis label on cost graph to Cost(�) rather than 'Cost (�) per kWh'
* - When GUI made visible of hidden the plot updates can be delayed as the CPU
* spends it's time displaying the window. If this delay is long enough to span
* the gap between polls then an exception is thrown because the plot occur
* in the same time period. Fixed by using addOrUpdate rather than add which
* will not throw an exception in the event of a overlapping time period.
* - Provide definition of the max digit count of numbers shown in the log file
* to limit them to sensible resolutions.
* - When starting up, the status log now details the location of the OWLServer
* logfile.
* - Added an exception stack trace to the status log to aid debugging of any
* problems reported.
* - When a sensor is detected present a default name for the sensor (Mains
* followed by the sensor address) and auto select this sensor name if the
* user does not enter a different name within 20 seconds.
* Previously if a sensor was found and the user did not enter a name when
* the dialog was presented it would block the update of other sensors which
* caused the stream buffers on the server connection to fill up.
*
* V1.4
* The history plot is now in a useful state.
*
* V1.3
* Fixed misc bugs in the V1.2.
*
* v1.2
* Change so that OwlServer logs data and GUI retrives data from history held at Owl server
*
* v1.11
* Started log file impl
*
* v1.1
* Fix negative period value when Electric OWL just installed
* Set default cost to 0.01
*
* * v1.0
* Initial release.
*
*/