Click or drag to resize

SNMP Class

Class to support the Simpl Network Management Protocol on the controllers. This is a static class and is always registered. Please use the AddSig(eSigType, UInt32, String, eSigIoMask) method to define the cues. The SigChange will fire to indicate a change in the value of the corresponding sig. The AddTrap(UInt32, String) method can be used to add the traps. We support adding traps/sigs dynamically.
Inheritance Hierarchy
SystemObject
  Crestron.SimplSharpProSNMP

Namespace: Crestron.SimplSharpPro
Assembly: SimplSharpPro (in SimplSharpPro.dll) Version: 2.21.121
Syntax
C#
public static class SNMP

The SNMP type exposes the following members.

Properties
 NameDescription
Public propertyStatic memberUserDefinedBooleanSigDetailsBooleanSigData collection for storing the BooleanSigData for User Configurable Bool Sig details.

The SigChange event will trigger for User defined Bool Output Sig state changes.

Public propertyStatic memberUserDefinedStringSigDetailsStringSigData collection for storing the StringSigData for User Configurable String Sig details.

The SigChange event will trigger for User defined String Output Sig value changes.

Public propertyStatic memberUserDefinedTrapDetailsStringSigData collection for storing the TrapData for User Configurable trap details.
Public propertyStatic memberUserDefinedUShortSigDetailsUShortSigData collection for storing the UShortSigData for User Configurable UShort Sig details.

The SigChange event will trigger for User defined UShort Output Sig value changes.

Top
Methods
 NameDescription
Public methodStatic memberAddSig Method to add user configurable sig to the corresponding collection. The valid sig numbers are from 1 and 4000.
Public methodStatic memberAddTrap Method to add user configurable trap to the corresponding collection. The valid trap numbers are from 1 and 4000.
Top
Events
 NameDescription
Public eventStatic memberSigChange Event triggered when cue information is received from a device. When processing this event, it will hold off other cues from being received from the device. If one desires to continue processing the data and receive more information, launch a new thread and allow this event to exit.
Top
Example
C#
public override void InitializeSystem()
         public override void InitializeSystem()
         {
             // This should always return   

            SNMP.AddSig(eSigType.Bool, 1, "Digital", eSigIoMask.InputOutputSig);
            SNMP.AddSig(eSigType.Bool, 100, "Digital100", eSigIoMask.InputSigOnly);
            SNMP.AddSig(eSigType.Bool, 1000, "Digital1000", eSigIoMask.OutputSigOnly);

            SNMP.AddSig(eSigType.UShort, 2, "Analog", eSigIoMask.InputOutputSig);
            SNMP.AddSig(eSigType.UShort, 200, "Analog200", eSigIoMask.InputSigOnly);
            SNMP.AddSig(eSigType.UShort, 2000, "Analog2000", eSigIoMask.OutputSigOnly);

            SNMP.AddSig(eSigType.String, 3, "Serial", eSigIoMask.InputOutputSig);
            SNMP.AddSig(eSigType.String, 300, "Serial300", eSigIoMask.InputSigOnly);
            SNMP.AddSig(eSigType.String, 3000, "Serial3000", eSigIoMask.OutputSigOnly);

            SNMP.AddTrap(1, "This is trap number 1");
            SNMP.AddTrap(2, "This is trap number 2");
            SNMP.SigChange += new SNMP.SigEventHandler(SNMP_SigChange);

         } 

         void SNMP_SigChange(SigEventArgs sigEvent)
         {
            CrestronConsole.PrintLine(" Sig change fired for {0} \r\n", sigEvent.Event);
            switch (sigEvent.Event)
            {
                case eSigEvent.BoolChange:
                    CrestronConsole.PrintLine(" bool fired for args {0}. Sig \r\n", sigEvent.Sig.ToString());
                    break;
                case eSigEvent.UShortChange:
                    CrestronConsole.PrintLine(" Ushort fired for args {0} \r\n", sigEvent.Sig.ToString());
                    break;
                case eSigEvent.StringChange:
                    CrestronConsole.PrintLine(" String fired for args {0} \r\n", sigEvent.Sig.ToString());
                    break;
            }
         }

         void SendSNMPSigsAndTraps()
         {
            if (SNMP.UserDefinedUShortSigDetails.Contains(sigNumber))
            {
                SNMP.UserDefinedUShortSigDetails[sigNumber].InputSig.UShortValue = ValueToSend;
            }
            if (SNMP.UserDefinedStringSigDetails.Contains(sigNumber))
            {
                SNMP.UserDefinedStringSigDetails[sigNumber].InputSig.StringValue = ValueToSend;
            }
            if (SNMP.UserDefinedBooleanSigDetails.Contains(sigNumber))
            {
                SNMP.UserDefinedBooleanSigDetails[sigNumber].InputSig.BoolValue = ValueToSend;
            }
            // Now send out some traps
            SNMP.UserDefinedTrapDetails[trapNumber].SendTrap(ValueToSend);
            SNMP.UserDefinedTrapDetails[trapNumber].SendTrap();
         }

Version Information

.NET

Supported in: 6.0

.NET Compact Framework

Supported in: 3.5
See Also