Xy - S7 - SR - System - Yx Setsr (, ,) SRMD - Set (, ,) SRMD - Request (, ) Call - Ina ( )
Xy - S7 - SR - System - Yx Setsr (, ,) SRMD - Set (, ,) SRMD - Request (, ) Call - Ina ( )
/*****************************************************************************************
*** Prototypen
*****************************************************************************************/
#ifndef _XY_S7_SR_SYSTEM_YX
__declspec(dllimport) int WINAPI SetSR(LPSTR SRLogDev,HWND SRwnd,UINT SRmsg);
__declspec(dllimport) int WINAPI SRMD_Set(LPSTR SRLogDev,HWND SRwnd,UINT SRmsg);
__declspec(dllimport) int WINAPI SRMD_Request (int hSRAAccessPoint, void *RB);
__declspec(dllimport) int WINAPI Call_Ina (char *anw);
#endif
/*****************************************************************************************
*** Konstanten
*****************************************************************************************/
#define WM_SINEC (WM_USER+1)
#ifndef UBYTE
#define UBYTE unsigned char
#endif
#ifndef UWORD
#define UWORD unsigned short int
#endif
/*****************************************************************************************
*** Auftragsarten
*****************************************************************************************/
#define OPEN_REQ 0x00
#define SEND_CONN_REQ 0x01
#define AWAIT_CONN_REQ_TRAN 0x02
#define SEND_DATA 0x05
#define SEND_EOM_DATA 0x06
#define SEND_EXP_DATA 0x09
#define RECEIVE_DATA 0x07
#define RECEIVE_EXP_DATA 0x0A
#define AWAIT_CLOSE 0x0D
#define CLOSE_REQ 0x0C
#define IASETUP 0x89
/*****************************************************************************************
*** Subsysteme
*****************************************************************************************/
#define SUBSYS_DL 0x20
#define SUBSYS_TCL 0x40
/*****************************************************************************************
*** Fehlercodierungen
*****************************************************************************************/
#define REQ_WAITING 0xFF
#define OK_RESP 1
#define OK_EOM_RESP 3
#define OK_DECIDE_REQ_RESP 5
#define OK_CLOSED_RESP 7
#define OK_REJECT_CONN_RESP 11
#define INVALID_REQ 2
#define NO_RESOURCES 4
#define UNKNOWN_REFERENCE 6
#define BUFFER_TOO_SHORT 8
#define BUFFER_TOO_LONG 10
#define ILLEGAL_REQ 12
#define REM_ABORT 14
#define LOC_TIMEOUT 16
#define UNKNOWN_CONN_CLASS 18
#define DUP_REQ 20
#define CONN_REJECT 22
#define NEGOT_FAILED 24
#define ILLEGAL_ADDRESS 26
#define NETWORK_ERROR 28
#define PROTOCOL_ERR 30
#define ILLEGAL_RB_LENGTH 32
#define SR_ERROR 1000
#define SR_BUFFER_TOO_LONG SR_ERROR+1
#define SR_ERR_ATTACH SR_ERROR+2
#define SR_ERR_PARAM SR_ERROR+3
#define SR_ERR_SINEC SR_ERROR+4
#define SR_INVALID_BUF SR_ERROR+5
#define SR_INVALID_OPCODE SR_ERROR+6
#define SR_NO_RESOURCE SR_ERROR+7
#define SR_NO_SCP_HANDLE SR_ERROR+8
#define SR_NO_THREAD SR_ERROR+9
#define SR_NO_WINDOW SR_ERROR+10
#define SR_SCP_HANDLE SR_ERROR+11
#define SR_TIMEOUT SR_ERROR+12
#define SR_ERR_ACCESSPOINT SR_ERROR+13
/* defines for result */
#define S7_RESULT_OK 0x00ff
#define S7_RESULT_HW_ERROR 0x0001
#define S7_RESULT_OBJ_ACCESS_DENIED 0x0003
#define S7_RESULT_OBJ_ADDRESS_INVALID 0x0005
#define S7_RESULT_OBJ_TYPE_NOT_SUPPORTED 0x0006
#define S7_RESULT_OBJ_TYPE_INCONSISTENT 0x0007
#define S7_RESULT_OBJ_NOT_EXISTS 0x000a
/*****************************************************************************************
*** Requestblockstrukturen
*****************************************************************************************/
#pragma pack(1)
typedef struct
{
SR_RB rbh; /* Header */
UBYTE conn_iso_reason_code;
UBYTE conn_rfu[4];
WORD conn_ack_delay_estimate;
DWORD *conn_ta;
WORD conn_persistence_count;
WORD conn_abort_timeout;
WORD conn_reference;
UBYTE conn_class;
WORD conn_negot_options;
DWORD *conn_buffer_ptr;
WORD conn_buffer_length;
} SR_VAR_ARRAY_1;
typedef struct
{
SR_RB rbh; /* Header */
UBYTE vc_iso_reason_code;
UBYTE vc_rfu[15];
WORD vc_reference;
UBYTE vc_conn_class;
WORD vc_buf_len;
UBYTE vc_num_blks;
WORD *vc_buf0_ptr;
WORD vc_buf0_length;
WORD *vc_buf1_ptr;
WORD vc_buf1_length;
} SR_VAR_ARRAY_2;
typedef struct
{
UBYTE loc_nsap_id_len;
UBYTE loc_tsap_id_len;
UBYTE loc_tsap_id[8];
UBYTE rem_net_addr_len;
UBYTE afi;
WORD subnet;
UBYTE host_id[6];
UBYTE lsap_id;
UBYTE rem_net_nsap;
UBYTE rem_tsap_id_len;
UBYTE rem_tsap_id[8];
} SR_TA;
typedef struct
{
SR_RB rbh; /* Header */
WORD count;
UBYTE address[6];
UBYTE usertext[24];
} SR_IA;
#pragma pack ()
/****************************************************************************/
/* Copyright (C) Siemens AG 1997 All Rights Reserved. */
/****************************************************************************/