View Single Post
  #13   Spotlight this post!  
Unread 20-04-2011, 08:44
drakesword drakesword is offline
Registered User
AKA: Bryant
FRC #0346 (Robohawks)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: USA
Posts: 200
drakesword is on a distinguished road
Re: Comming soon: 2CAN Simple Analyzing Monitor

Well if its open source then here I go:

I pull data from ip/status.xml which contains xml with all of the individual jag data. I found it by stumbling through the index pages html for a couple of minutes.

The main XML container is a response tag

Each jag has the following tags
voltout#
current#
temp#
fault#
voltbus#
descript#
firmware#

Using the xpath library (java.xml.xpath.*) I can then retrieve the appropriate values via a simple path such as getting the voltout for jag number 7 like this
"response/voltout7" While that will work for jag number 7, i put in a loop to read all of the information from all of the jags so in reality its "response/voltout" + loop_counter but that is just logistics ...

To do it without xml and save memory you should think along this line
Open a stream over http to ip/status.xml read the response line for line looking for patterns. (eg <v* can only be 1 of 2 bits of information voltout or voltbus) find the first > character go 1 or 2 characters left to get the jag number then take the data from the right of the > character until you reach a < character

If you think it will help I will release source for 0.5 when I get it done.

BEFORE I FORGET the little problem I ran into was that the 2CAN doesn't log information unless the index page is loaded with POST data. Using the same http stream open ip/index.htm?enables=65535 and data should start rolling.
Reply With Quote