Comet system forum

Discussion forum about Comet system products

Temperature, Humdity,

Pressure Transmitters

and Data Loggers

You are not logged in.

#1 21-10-2009 11:58:26

jeff
Member
Registered: 21-10-2009
Posts: 2

P8541 How to use VB.net get temperature

[P8541 ]
I need store temperature in Database
have any sample code?

Best regards.
Thank you.

Last edited by jeff (21-10-2009 11:59:14)

Offline

 

#2 21-10-2009 13:41:16

JindrichP
Administrator
Registered: 25-06-2007
Posts: 27

Re: P8541 How to use VB.net get temperature

Hello,

the best way to obtain values from ethernet P8541 sensor using VB.NET is to write Web Service which should capture SOAP messages sent from sensor.

Use program TSensor (Transimtters setup utility) to setup where and how often should sensor sends SOAP messages.

Furhter is C# code example of Web Service for obtaining SOAP messages from P85xx sensors, which stores obtained values into D:\temp\soap.log. I hope it won't be a big problem to convert C#.NET to VB.NET.

Best regards
Jindrich Pastorek

CODE EXAMPLE:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.IO;
using System.Text;
using System.Web.Services.Description;

namespace TransmittersWebService
{
    /// <summary>
    /// Example of web service for obtaining values from P85xx transmitters
    /// </summary>

    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]

    [WebService(Namespace = "http://cometsystem.cz/schemas/soapP85xx_v2.xsd")]

    public class TransmittersSoap : System.Web.Services.WebService
    {

        [WebMethod(Description = "Example of processing sample from P85xx sensor.")]
        public bool InsertP85xxSample(string passKey, string device, string temp1, string temp2, string temp3, string temp4, string alarms, string tempU, string timer)
        {
            string data =   "Time: " +  DateTime.Now.ToString()
                          + ", serial number: " + passKey
                          + ", Temp(1): " + temp1
                          + ", Unit: " + tempU
                          + ", alarms: " + alarms;

            FileStream fs = new FileStream("d:\\temp\\soap.log", FileMode.Append);
            StreamWriter w = new StreamWriter(fs, Encoding.ASCII);
            w.WriteLine(data);
            w.Flush();
            w.Close();
            fs.Close();

            return true;
        }

    }
}

Last edited by JindrichP (21-10-2009 13:42:49)

Offline

 

#3 22-10-2009 05:27:26

jeff
Member
Registered: 21-10-2009
Posts: 2

Re: P8541 How to use VB.net get temperature

Thank you for quick reply,
I have done my job

Best regards.
Thank you.

Offline

 

Board footer

Powered by PunBB | CZ / SK
© Copyright 2002–2005 Rickard Andersson