Comet system forum

Discussion forum about Comet system products

Temperature, Humdity,

Pressure Transmitters

and Data Loggers

You are not logged in.

#1 19-12-2007 19:07:00

Mike Higginbotham
Member
Registered: 19-12-2007
Posts: 1

Ethernet Sensor - SNMP - C# - FYI

I hope this information helps someone...

We got a T7510 sensor (temperature, humidity, computed value, pressure).   
It works great.  I was able to read the values by using the following: 
I configured the sensor for IP address 172.16.23.50  (that's my company's
intranet) I downloaded the MIB zip from this website (comet systems). 
I explored the MIB (T7511.mib) via the MibBrowser v1.04
( http://www.ks-soft.net/ip-tools.eng/downpage.htm )   
I went to Malcolme Crowe's website ( http://cis.paisley.ac.uk/crow-ci0/ )
and in the middle of the page is Snmp tools in C# 
( http://cis.paisley.ac.uk/crow-ci0/nmsnet.zip )   
I unzipped and copied BER.cs, bitset.cs and proto.cs to my working project (VS2005).

The first part of my class now looks like this:

using Snmp;   // Malcolm Crowe's stuff
using X690;    // Malcolm Crowe's stuff

// .iso.org.dod.internet.private.enterprises.comet.products
// .1.3.6.1.4.1.22626.1
namespace Comet.Products
{
   /// <summary>
   /// .iso.org.dod.internet.private.enterprises.comet.products.T7511
   /// .1.3.6.1.4.1.22626.1.2
   /// </summary>
   class T7511
   {
      string _ip_Address = "172.16.23.50";
     
      string _thingy = "public";

      ManagerSession _sess;

      public T7511( string IP_Address )
      {
         _ip_Address = IP_Address;
         
         _sess = new ManagerSession( _ip_Address, _thingy );
      }

      /// <summary>
      ///         .readings.temperature
      /// OID:    .1.3.6.1.4.1.22626.1.2.1.1.0
      /// Syntax: DisplayString (SIZE (0..8))
      /// Access: read-only
      /// Status: mandatory
      /// Text:   Temperature
      /// </summary>
      /// <returns>temperature in degrees centigrade</returns>
      public string Temperature()
      {
         uint[] oid = new uint[] { 1,3,6,1,4,1,22626,1,2,1,1,0 };
         ManagerItem mi = new ManagerItem( _sess, oid );

         return (mi.Value.ToString());
      }

      /// <summary>
      ///         .readings.humidity
      /// OID:    .1.3.6.1.4.1.22626.1.2.1.2.0
      /// Syntax: DisplayString (SIZE (0..8))
      /// Access: read-only
      /// Status: mandatory
      /// Text:   Humidity
      /// </summary>
      /// <returns>humidity</returns>
      public string Humidity()
      {
         uint[] oid = new uint[] { 1,3,6,1,4,1,22626,1,2,1,2,0 };
         ManagerItem mi = new ManagerItem( _sess, oid );

         return (mi.Value.ToString());
      }

Etc, etc.

Note that I am using a bit of hard coding of the OIDs.  I am not trying for a general solution.  I don't need to read the MIB programmatically.  I just want to read the current values using the known OIDs.   It works like a charm.  Also, 'thingy' is the password used to read the values.  I have not changed that yet.

I found the following sites interesting while learning this stuff :

   http://www.et.put.poznan.pl/snmp/intro/indexint.html
   http://codeidol.com/csharp/csharp-netwo … ndor-MIBs/

Prior to this I had done absolutely zero programming involving SNMP.  At least now I know how to spell MIB.  smile

- Mike

ps.  Did I mention I like the sensor?

Offline

 

Board footer

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