General Discussion
  >> Fibre Broadband


Register (or login) on our website and you will not see this ad.


Pages in this thread: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | (show all)   Print Thread
Standard User Bald_Eagle1
(committed) Wed 26-Dec-12 10:05:27
Print Post

Huawei HG612 - Graphing - A cry for programming help


[link to this post]
 
I have occasionally mentioned that a new & enhanced version of the stats graphing system is to be released soon.

Programming this in 'C', Burakkucat has developed a Linux/Windows cross-platform stats harvesting program for the HG612 (a single version for use on ADSL & VDSL2 connections) & I have further developed it to munge the obtained data into a format that can be graphed (currently using a revised version of the graphpd.BAT graphing script for Windows users).

I have fully tested the .exe program resulting from compiling the C code with MingW over a couple of months & have found it to be very quick in operation & far more reliable than the scripted versions when coping with various flavours of virus checkers etc. hogging all the PC's resources & causing gaps in the harvested data.

Currently the program is controlled by a batch file called by a simple VBS script that is run every minute via Windows Task Scheduler (or via Cron for Linux users).

I would like to release at least the VDSL2 version very soon. However, I would firstly like it to use an .ini configuration file to make setting the defalut variables for different users' systems as easy as possible & avoid having to use a controlling batch file.

Unfortunately, as I am not a programmer and I have limited available time to research this, I have ground to a halt.

Initially, I imagine a basic ini file would look something like this:-

[login]
IPaddress=192.168.1.1
Username=admin
Password=admin
Shell=sh


[folder_locations]
Drive=C:
Main_folder=\HG612_Stats
Apps=\Apps
Program=\Program
Ongoing_Stats=\Ongoing_Stats
Current_Stats=\Current_Stats

The program would then read the ini file each time it is run from Task Scheduler/Cron & store the values as global variables.

The same ini file could then be used for obtaining & storing snapshot data and ongoing data, along with graphing programs already partially developed.

I/we would be happy to provide the C code "as is" if anyone was willing/able to add in the facility to use an ini configuration file for the default variables.

Initially I would be happy to manually edit the ini file, but at some stage, it would be nice to use a graphical front end where folder locations etc. could be chosen via a point & click method via a GUI rather than the "old fashioned" manual method.

Is anyone up for assisting with this?
It would have to be written in C, for inclusion into the currently developed program(s).

Intentionally, graphs will still only be generated on demand. However this is easily automated via Task Scheduler (if required).
Standard User BatBoy
(legend) Wed 26-Dec-12 10:13:58
Print Post

Re: Huawei HG612 - Graphing - A cry for programming help


[re: Bald_Eagle1] [link to this post]
 
inih (INI Not Invented Here) is a simple .INI file parser written in C. It's only a couple of pages of code, and it was designed to be small and simple, so it's good for embedded systems. It's also more or less compatible with Python's ConfigParser style of .INI files, including RFC 822-style multi-line syntax and name: value entries.
http://code.google.com/p/inih/


_____________________________________________________________________________________________ this is not usenet __________________

Edited by BatBoy (Wed 26-Dec-12 10:14:47)

Standard User RobertoS
(sensei) Wed 26-Dec-12 12:51:08
Print Post

Re: Huawei HG612 - Graphing - A cry for programming help


[re: Bald_Eagle1] [link to this post]
 
Sorry I'm not really in a position to help with the programming of this at the moment, but you should not use the ini file to store program data and results. (Although technically you could, as you suggest). It would be completely non-standard, confusing, and potentially disastrous.

It is what it says, a repository for configuration startup values such as you list. Keep it that way smile.

You imply that you are going to run the program every minute on the scheduler, as per your existing batch files. I suggest instead simply loading it at boot time, (which is easy), with an internal timer running the harvesting every 60 seconds.

Ideally under Windows it would be run as a service, but that's another question and not essential.

My broadband basic info/help site - www.robertos.me.uk | Domains,website and mail hosting - Tsohost.
Connection - Plusnet Extra Fibre (FTTC). Sync ~ 54.0/14.9Mbps @ 600m. - BQM

"Where talent is a dwarf, self-esteem is a giant." - Jean-Antoine Petit-Senn.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Allergy information: This post was manufactured in an environment where nuts are present. It may include traces of understatement, litotes and humour.


Register (or login) on our website and you will not see this ad.

Standard User jchamier
(knowledge is power) Wed 26-Dec-12 12:55:18
Print Post

Re: Huawei HG612 - Graphing - A cry for programming help


[re: Bald_Eagle1] [link to this post]
 
When I was coding (years ago) - we used WritePrivateProfileString and GetPrivateProfileString windows API calls to read and write the INI files. All the parsing is done for you by the OS.

Viz:

http://msdn.microsoft.com/en-gb/library/windows/desk...

http://msdn.microsoft.com/en-us/library/windows/desk...

See the comments from MS that they suggest now holding such data in the registry.

You could go all XML which a lot of .NET developers perfer. I don't know MingW.

James BT Infinity 2 19/09/2012 - Estimate 44.6/6.5 - Install 52/12 - Actual 46 / 8 Mbps
13 years of broadband - 1999 ntl:(512k/1M)/BTbusiness(2M)/Metronet(2M)/Bulldog(8M/16M)/BE(19M/16M)/BT FTTC(46M)
Standard User RobertoS
(sensei) Wed 26-Dec-12 13:41:11
Print Post

Re: Huawei HG612 - Graphing - A cry for programming help


[re: jchamier] [link to this post]
 
I reckon using the registry for this type of task is overkill. Also I think C has been wisely chosen for pure speed and portability. .NET would kill the Linux portability and bloat the whole thing for Windows.

My broadband basic info/help site - www.robertos.me.uk | Domains,website and mail hosting - Tsohost.
Connection - Plusnet Extra Fibre (FTTC). Sync ~ 54.0/14.9Mbps @ 600m. - BQM

"Where talent is a dwarf, self-esteem is a giant." - Jean-Antoine Petit-Senn.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Allergy information: This post was manufactured in an environment where nuts are present. It may include traces of understatement, litotes and humour.
Standard User Bald_Eagle1
(committed) Wed 26-Dec-12 13:41:42
Print Post

Re: Huawei HG612 - Graphing - A cry for programming help


[re: BatBoy] [link to this post]
 
Thanks for that link Batboy.

I have downoladed a couple of versions & a quick glance suggests it is exactly what I have previously tried to find.

As soon as I can find some time, I'll have a dabble with it.

Edited by Bald_Eagle1 (Wed 26-Dec-12 14:02:23)

Standard User jchamier
(knowledge is power) Wed 26-Dec-12 13:52:38
Print Post

Re: Huawei HG612 - Graphing - A cry for programming help


[re: RobertoS] [link to this post]
 
In reply to a post by RobertoS:
I reckon using the registry for this type of task is overkill. Also I think C has been wisely chosen for pure speed and portability. .NET would kill the Linux portability and bloat the whole thing for Windows.


I happen to agree, but to write/read parameter files using the layout given previously is done for you in the Windows OS, but you have to write code (or use free libraries) for other OSes.

James BT Infinity 2 19/09/2012 - Estimate 44.6/6.5 - Install 52/12 - Actual 46 / 8 Mbps
13 years of broadband - 1999 ntl:(512k/1M)/BTbusiness(2M)/Metronet(2M)/Bulldog(8M/16M)/BE(19M/16M)/BT FTTC(46M)
Standard User Bald_Eagle1
(committed) Wed 26-Dec-12 14:00:35
Print Post

Re: Huawei HG612 - Graphing - A cry for programming help


[re: RobertoS] [link to this post]
 
In reply to a post by RobertoS:
Sorry I'm not really in a position to help with the programming of this at the moment, but you should not use the ini file to store program data and results. (Although technically you could, as you suggest). It would be completely non-standard, confusing, and potentially disastrous.

It is what it says, a repository for configuration startup values such as you list. Keep it that way smile.


I may have mislead you about my intentions in my original post.
The ini file will indeed only store very basic details, similar to those I mentioned.
At some stage it may also store details of which graphs to include on a yes or no or a true or false basis

The global variables will only be stored in memory for the duration of the harvesting (now usually taking less than 2 seconds every minute due to the more efficient/reliable logging in method).

All the harvested data is stored in modem_stats.log (or Plink.log for snapshot data), as per the ecripted version.
This ensures a level of compatibility with previously harvested data from the scripted versions for continuity of graphing.

The issue of incorrect error count data (CRC/FEC) being stored/plotted has also been resolved.
The exe version now ONLY obtains its data from xcdslcmd info --stats & no longer bothers to obtain any data from the code that provides the modem's GUI data.



You imply that you are going to run the program every minute on the scheduler, as per your existing batch files. I suggest instead simply loading it at boot time, (which is easy), with an internal timer running the harvesting every 60 seconds.

I did toy with a similar idea when I first put the scripted versions together, but I chose to use Windows Task Scheduler instead, mainly to avoid accidentally closing a running program, thus removeing the potential risk of losing continuity of data.



Ideally under Windows it would be run as a service, but that's another question and not essential.

Maybe an idea for a later date.
My current aim is to try to maintain one set of code that can simply be compiled for Windows or Linux, simply by using different compilers.
Standard User Bald_Eagle1
(committed) Wed 26-Dec-12 14:10:45
Print Post

Re: Huawei HG612 - Graphing - A cry for programming help


[re: jchamier] [link to this post]
 
In reply to a post by jchamier:
In reply to a post by RobertoS:
I reckon using the registry for this type of task is overkill. Also I think C has been wisely chosen for pure speed and portability. .NET would kill the Linux portability and bloat the whole thing for Windows.


I happen to agree, but to write/read parameter files using the layout given previously is done for you in the Windows OS, but you have to write code (or use free libraries) for other OSes.


For me, with an openly admitted very limited understanding of programming, simplicity is key.

I had/have no desire to write anything to the registry etc. as I have no intention of formally "installing" anything or writing uninstall programs & the like.
Simply ceasing to use the program or deleting the relevant folders and their contents is sufficient (in my mind) to restore a computer to its original state.

Edited by Bald_Eagle1 (Wed 26-Dec-12 14:11:29)

Standard User jchamier
(knowledge is power) Wed 26-Dec-12 14:18:10
Print Post

Re: Huawei HG612 - Graphing - A cry for programming help


[re: Bald_Eagle1] [link to this post]
 
In reply to a post by Bald_Eagle1:
For me, with an openly admitted very limited understanding of programming, simplicity is key.

I had/have no desire to write anything to the registry etc. as I have no intention of formally "installing" anything or writing uninstall programs & the like.
Simply ceasing to use the program or deleting the relevant folders and their contents is sufficient (in my mind) to restore a computer to its original state.


Exactly why my colleagues programs still use the INI files and PrivateProfileString APIs. However those won't work on any other OS - so you'll have to either write your own file handling code and parse the attributes or investigate BatBoy's suggestion.

James BT Infinity 2 19/09/2012 - Estimate 44.6/6.5 - Install 52/12 - Actual 46 / 8 Mbps
13 years of broadband - 1999 ntl:(512k/1M)/BTbusiness(2M)/Metronet(2M)/Bulldog(8M/16M)/BE(19M/16M)/BT FTTC(46M)
Pages in this thread: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | (show all)   Print Thread

Jump to