SNMP_GET_REQUEST (FB)

FUNCTION_BLOCK SNMP_GET_REQUEST

Function block to send a SNMP GET or GET_NEXT request.

InOut:

Scope

Name

Type

Initial

Comment

Input

xExecute

BOOL

Starts the request

sHost

STRING(100)

Hostname or IP address of the SNMP agent

sOwnIP

STRING(100)

Hostname or IP address of the SNMP master (the IP of the control)

asOIDs

REFERENCE TO ARRAY [0..(gc_uiMaxOIDs - 1)] OF STRING((gc_iMaxValueLength - 1))

Array of OIDs to request

iNumberOfOIDs

INT

Number of OIDs in asOIDs

uiPeerPort

UINT

161

Port of the sender (the control)

uiSendPort

UINT

161

Port of the agent (printer, router etc.)

eRequestType

RequestType

Type of the request

sCommunity

STRING

‚public‘

The community, default: ‚public‘

xClosePeer

BOOL

Rising edge closes the UDP peer.

uiTimeout

UINT

1000

Timeout in milliseconds, default: 1000 ms

bySNMPVersion

SNMPVersion

SNMPVersion.V1

SNMP Version, default: V1

sUserName

STRING

SNMP V3 only: Name of the registered user. Use the function CreateUser to register an user.

sContextName

STRING

‚‘

SNMP V3 only: Context name of the request.

xRequestReport

BOOL

TRUE

SNMP V3 only: TRUE: Requests a report to discover the engineId of the agent, Default: TRUE

Output

xBusy

BOOL

True while busy

xDone

BOOL

True if the call has finished

xError

BOOL

True if an error occured

aSNMPValues

ARRAY [0..gc_uiMaxSNMPValues] OF SNMPValue

The result of the get request

iSize

INT

Size of aSNMPValues

eError

ERROR

Error state of the function block

diErrorStatus

DINT

SNMP error status of the last request

diErrorIndex

DINT

SNMP error index of the last request (index of the object that caused the error)

diRequestId

DINT

SNMP request id of the last request

abResponse

ARRAY [0..(gc_uiMaxTelegramLength - 1)] OF BYTE

msgAuthoritativeEngineID

SNMPValue

SNMP V3 only: The authoritative engine Id. If xRequestReport = TRUE then this is the discovered engine id of the agent. If xRequestReport = FALSE then GVL.g_pEngineId is used.

Methods:

Structure: