| .NET DotNet Forum Index » VB.NET Forum (Visual Basic .NET) » Where do I start?... |
|
Page 1 of 1 |
|
| Author |
Message |
| kevinp... |
Posted: Thu Oct 29, 2009 1:48 pm |
|
|
|
Guest
|
We have a building that we use to train firefighters. It has a lining
with temperature probes. These probes are connected to a computer
called a "Multitrend Plus V5" made by Honeywell which has a fixed IP
address on our network. I can open a browser with that IP address and
see a realtime display of the temperatures at each probe.
I want to be able to record those temperatures. I'm not sure how to
retrieve them into my VB2008 app. |
|
|
| Back to top |
|
|
|
| Scott M.... |
Posted: Thu Oct 29, 2009 2:24 pm |
|
|
|
Guest
|
"kevinp" <kevinp at (no spam) nospam.cfl.rr.com> wrote in message
news:7urje5teu1sg26bisneto2h3iactp9gm7c at (no spam) 4ax.com...
Quote: We have a building that we use to train firefighters. It has a lining
with temperature probes. These probes are connected to a computer
called a "Multitrend Plus V5" made by Honeywell which has a fixed IP
address on our network. I can open a browser with that IP address and
see a realtime display of the temperatures at each probe.
I want to be able to record those temperatures. I'm not sure how to
retrieve them into my VB2008 app.
If the structure of the page's DOM (Document Object Model) stays consistent,
but it's only the data that changes, you can load that page up and parse it
for the values you need using JavaScript or ASP .NET (screen-scraping).
-Scott |
|
|
| Back to top |
|
|
|
| Al Reid... |
Posted: Thu Oct 29, 2009 2:38 pm |
|
|
|
Guest
|
"kevinp" <kevinp at (no spam) nospam.cfl.rr.com> wrote in message
news:7urje5teu1sg26bisneto2h3iactp9gm7c at (no spam) 4ax.com...
Quote: We have a building that we use to train firefighters. It has a lining
with temperature probes. These probes are connected to a computer
called a "Multitrend Plus V5" made by Honeywell which has a fixed IP
address on our network. I can open a browser with that IP address and
see a realtime display of the temperatures at each probe.
I want to be able to record those temperatures. I'm not sure how to
retrieve them into my VB2008 app.
Does the device have the Modbus communications option? If so, you should be
able to communicate with the device using the Modbus protocol over the
Ethernet.
--
Al Reid |
|
|
| Back to top |
|
|
|
| kevinp... |
Posted: Thu Oct 29, 2009 5:24 pm |
|
|
|
Guest
|
On Thu, 29 Oct 2009 16:38:36 -0400, "Al Reid"
<areidjr at (no spam) reidDASHhome.com> wrote:
Quote: "kevinp" <kevinp at (no spam) nospam.cfl.rr.com> wrote in message
news:7urje5teu1sg26bisneto2h3iactp9gm7c at (no spam) 4ax.com...
We have a building that we use to train firefighters. It has a lining
with temperature probes. These probes are connected to a computer
called a "Multitrend Plus V5" made by Honeywell which has a fixed IP
address on our network. I can open a browser with that IP address and
see a realtime display of the temperatures at each probe.
I want to be able to record those temperatures. I'm not sure how to
retrieve them into my VB2008 app.
Does the device have the Modbus communications option? If so, you should be
able to communicate with the device using the Modbus protocol over the
Ethernet.
Yes, it does. But I'm not sure how to communicate with it. I was
trying to save myself lots of reading... |
|
|
| Back to top |
|
|
|
| kevinp... |
Posted: Thu Oct 29, 2009 5:25 pm |
|
|
|
Guest
|
On Thu, 29 Oct 2009 16:24:08 -0400, "Scott M." <s-mar at (no spam) nospam.nospam>
wrote:
Quote:
"kevinp" <kevinp at (no spam) nospam.cfl.rr.com> wrote in message
news:7urje5teu1sg26bisneto2h3iactp9gm7c at (no spam) 4ax.com...
We have a building that we use to train firefighters. It has a lining
with temperature probes. These probes are connected to a computer
called a "Multitrend Plus V5" made by Honeywell which has a fixed IP
address on our network. I can open a browser with that IP address and
see a realtime display of the temperatures at each probe.
I want to be able to record those temperatures. I'm not sure how to
retrieve them into my VB2008 app.
If the structure of the page's DOM (Document Object Model) stays consistent,
but it's only the data that changes, you can load that page up and parse it
for the values you need using JavaScript or ASP .NET (screen-scraping).
-Scott
I was hoping not to do it that way, but it's always an option if I can
figure out how to do it cleanly. |
|
|
| Back to top |
|
|
|
| Nobody... |
Posted: Thu Oct 29, 2009 6:56 pm |
|
|
|
Guest
|
For scraping web pages, it's better to look for XML version. If not
available, using WebBrowser and HtmlDocument classes is preferable because
it parses the HTML for you. Basically you use
GetElementsByTagName(). This gives you a collection of all elements in the
page that has that tag name, such as "A" for Anchor(links), or "IMG" for
images, and so on. Then you can loop through the collection and use
GetAttribute(). This function gives you the attribute inside the element,
such as "HREF". There are other useful functions such as:
- GetElementById(): This returns the element that matches the given ID. HTML
authors can specify it to make the page easier to scrape, but not everyone
uses it. This appear in HTML like ID="abc".
- GetElementsByName(): This returns a collection of elements matching the
given name. If the HTML author used it, you can jump to these elements
directly. This appear in HTML like NAME="xyz".
Some HTML reference pages:
http://www.htmlhelp.com/reference/html40/structure.html
http://www.htmlhelp.com/
The sample below shows how to retrieve all links and the "blue" text that
refer to them. To try this sample, start a new project, and add a button to
Form1, then use the following code(VB 2008):
Option Explicit On
Option Strict On
Public Class Form1
Private WithEvents ie As WebBrowser
Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
ie = Nothing
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ie = New WebBrowser
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ie.Navigate("http://www.google.com/")
End Sub
Private Sub ie_DocumentCompleted(ByVal sender As Object, ByVal e As
System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles
ie.DocumentCompleted
Console.WriteLine("ie_DocumentCompleted called")
PrintHTMLElements("A", "HREF")
End Sub
Private Sub PrintHTMLElements(ByVal sTagName As String, ByVal
sAttributeName As String)
Dim oHTML As HtmlDocument
Dim oElementCollection As HtmlElementCollection
Dim oElement As HtmlElement
Console.WriteLine("PrintHTMLElements called")
oHTML = ie.Document
If oHTML Is Nothing Then
Console.WriteLine("oHTML Is Nothing")
Exit Sub
End If
oElementCollection = oHTML.GetElementsByTagName(sTagName)
If oElementCollection Is Nothing Then
Console.WriteLine("oElementCollection Is Nothing")
Exit Sub
End If
For Each oElement In oElementCollection
Console.WriteLine(oElement.InnerText)
Console.WriteLine(oElement.GetAttribute(sAttributeName))
Next
End Sub
End Class |
|
|
| Back to top |
|
|
|
| Nobody... |
Posted: Thu Oct 29, 2009 7:45 pm |
|
|
|
Guest
|
"kevinp" <kevinp at (no spam) nospam.cfl.rr.com> wrote in message
news:809ke5101fgd4tdt52i689je9jonldqja4 at (no spam) 4ax.com...
Quote: On Thu, 29 Oct 2009 16:38:36 -0400, "Al Reid"
areidjr at (no spam) reidDASHhome.com> wrote:
Does the device have the Modbus communications option? If so, you should
be
able to communicate with the device using the Modbus protocol over the
Ethernet.
Yes, it does. But I'm not sure how to communicate with it. I was
trying to save myself lots of reading...
http://en.wikipedia.org/wiki/Modbus |
|
|
| Back to top |
|
|
|
| Al Reid... |
Posted: Fri Oct 30, 2009 5:05 am |
|
|
|
Guest
|
"kevinp" <kevinp at (no spam) nospam.cfl.rr.com> wrote in message
news:809ke5101fgd4tdt52i689je9jonldqja4 at (no spam) 4ax.com...
Quote: On Thu, 29 Oct 2009 16:38:36 -0400, "Al Reid"
areidjr at (no spam) reidDASHhome.com> wrote:
"kevinp" <kevinp at (no spam) nospam.cfl.rr.com> wrote in message
news:7urje5teu1sg26bisneto2h3iactp9gm7c at (no spam) 4ax.com...
We have a building that we use to train firefighters. It has a lining
with temperature probes. These probes are connected to a computer
called a "Multitrend Plus V5" made by Honeywell which has a fixed IP
address on our network. I can open a browser with that IP address and
see a realtime display of the temperatures at each probe.
I want to be able to record those temperatures. I'm not sure how to
retrieve them into my VB2008 app.
Does the device have the Modbus communications option? If so, you should
be
able to communicate with the device using the Modbus protocol over the
Ethernet.
Yes, it does. But I'm not sure how to communicate with it. I was
trying to save myself lots of reading...
You could go with a commercial modbus driver. This is one example and is
not very expensive: http://www.ingeardrivers.com/mblink/mblink.htm
Otherwise, the protocols are not hard to find if you want to program it
yourself.
--
Al Reid |
|
|
| Back to top |
|
|
|
| DickGrier... |
Posted: Fri Oct 30, 2009 10:21 am |
|
|
|
Guest
|
Here is a screen-scraping example that is pretty complete:
http://www.codetoad.com/asp_http_cache.asp
I like Al's suggestion the best, if the temp monitoring devices allow it.
IMO, your time will be more valuable than the cost of the add-on. You still
need to know something about the embedded data, of course.
Dick
--
Richard Grier, Consultant, Hard & Software 12962 West Louisiana Avenue
Lakewood, CO 80228 303-986-2179 (voice) Homepage: www.hardandsoftware.net
Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004, Revised July
2006. |
|
|
| Back to top |
|
|
|
| kevinp... |
Posted: Fri Oct 30, 2009 7:10 pm |
|
|
|
Guest
|
On Fri, 30 Oct 2009 10:21:11 -0600, "DickGrier"
<dick_grierNOSPAM at (no spam) msn.com> wrote:
Quote: Here is a screen-scraping example that is pretty complete:
http://www.codetoad.com/asp_http_cache.asp
I like Al's suggestion the best, if the temp monitoring devices allow it.
IMO, your time will be more valuable than the cost of the add-on. You still
need to know something about the embedded data, of course.
Dick
Thanks to everyone for their suggestions. I'll be checking them out in
the next few days. |
|
|
| Back to top |
|
|
|
| kevinp... |
Posted: Fri Nov 06, 2009 6:18 pm |
|
|
|
Guest
|
I ended up doing the screen-scrape method. Everything's working fine,
just have to finish the app.
On Fri, 30 Oct 2009 10:21:11 -0600, "DickGrier"
<dick_grierNOSPAM at (no spam) msn.com> wrote:
Quote: Here is a screen-scraping example that is pretty complete:
http://www.codetoad.com/asp_http_cache.asp
I like Al's suggestion the best, if the temp monitoring devices allow it.
IMO, your time will be more valuable than the cost of the add-on. You still
need to know something about the embedded data, of course.
Dick |
|
|
| Back to top |
|
|
|
|