久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 4207|回復: 0
收起左側

wincc 冗余連接的代碼

[復制鏈接]
ID:140343 發表于 2016-9-24 20:18 | 顯示全部樓層 |閱讀模式
#include "apdefap.h"

int gscAction( void )
{

#pragma option(mbcs)

// WINCC:TAGNAME_SECTION_START
// syntax: #define TagNameInAction "DMTagName"
// next TagID : 1
#define TAG_0 "@S7-Programm(1)@AlternateConnectionAddress"
#define TAG_1 "@S7-Programm(1)@ConnectionEstablishMode"
#define TAG_2 "@S7-Programm(1)@ConnectionState"
#define TAG_3 "@S7-Programm(1)@ForceConnectionAddress"
// WINCC:TAGNAME_SECTION_END

// WINCC:PICNAME_SECTION_START
// syntax: #define PicNameInAction "PictureName"
// next PicID : 1
// WINCC:PICNAME_SECTION_END


#pragma code("msrtcli.dll")
#include "msrtapi.h"
#pragma code()

#pragma code( "kernel32.dll" )
VOID GetLocalTime(LPSYSTEMTIME lpSystemTime);
#pragma code()


static int Mld_Main = 0;
static int Mld_Res = 0;

DWORD ServiceID = 0;
static BOOL InitFirst = TRUE;

static MSG_RTCREATE_STRUCT  MsgCreate;
CMN_ERROR Error;



if ( InitFirst == TRUE )
{
    memset( &MsgCreate, 0, sizeof (MSG_RTCREATE_STRUCT) );
    MsgCreate.dwMsgState = MSG_STATE_COME;
    MsgCreate.wTextValueUsed = 1;
    sprintf( MsgCreate.mtTextValue[0].szText, "S7-Programm(1)" );
    SetTagChar( TAG_0, "MPI,3 0,,1,3,02" );
     InitFirst = FALSE;
}

if (  GetTagDWordWait( TAG_1 ) == 0  )
{
    Mld_Main = 0;
    Mld_Res = 0;
    return 0;
}
else
{
    GetLocalTime( &MsgCreate.stMsgTime );
    MSRTStartMsgService ( &ServiceID, NULL, NULL, MSG_NOTIFY_MASK_ARCHIV, NULL, &Error );

    if (  GetTagDWordWait( TAG_2 ) == 0  )
    {
             if (  GetTagDWordWait( TAG_3 ) == 0  )
        {
            if ( Mld_Main == 0 )
            {
                MsgCreate.dwMsgNr = 1012222;
                MSRTCreateMsg( ServiceID, &MsgCreate, &Error );
                Mld_Main = 1;
            }
         }
        else
        {
            if ( Mld_Res == 0 )
            {
                MsgCreate.dwMsgNr = 1012224;
                MSRTCreateMsg( ServiceID, &MsgCreate, &Error );
                Mld_Res = 1;
            }
        }

          if (  GetTagDWordWait( TAG_2 ) == 0  )
        {
            if (  GetTagDWordWait( TAG_3 ) == 0  )
            {
                  SetTagDWord( TAG_3, 1 );
            }
            else
            {
                SetTagDWord( TAG_3, 0 );
            }
        }
    }     
    else
    {
        if (  ( Mld_Main != 0 )  ||  ( Mld_Res != 0 )  )
        {
            Mld_Main = 0;
            Mld_Res = 0;

            if (  GetTagDWordWait( TAG_3 ) == 0  )
            {
                MsgCreate.dwMsgNr = 1012223;
                MSRTCreateMsg( ServiceID, &MsgCreate, &Error );
            }
            else
            {
                MsgCreate.dwMsgNr = 1012225;
                MSRTCreateMsg( ServiceID, &MsgCreate, &Error );
            }
        }
    }     
    if ( ServiceID != 0 )
    {
        MSRTStopMsgService ( ServiceID, &Error );
    }
     return 1;
}
}



回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 毛片a| 四虎在线观看 | 久久爱黑人激情av摘花 | 日韩欧美一区二区三区 | 色狠狠一区 | 中文字幕视频在线观看 | 国产成人免费视频 | 国产精品色综合 | 97色免费视频| www.日韩 | 欧美日韩在线成人 | 成人精品免费 | www亚洲免费国内精品 | 自拍视频网站 | 一区二区三区观看视频 | 国产精品日韩欧美一区二区三区 | av电影手机在线看 | 亚洲二区视频 | 久久久精品久久久 | 日韩欧美黄色 | 欧美激情视频一区二区三区免费 | 国内91在线| 国产成人亚洲精品自产在线 | 日本精品一区 | 久久久久国产一区二区三区 | a在线观看 | 久久久久无码国产精品一区 | 成人黄页在线观看 | 久精品久久 | 日韩精品一二三 | 超碰精品在线观看 | 欧美日韩视频在线播放 | 成人午夜毛片 | 国产传媒在线播放 | 国产精品区一区二区三区 | 欧美激情欧美激情在线五月 | 祝你幸福电影在线观看 | 国产色婷婷精品综合在线手机播放 | 国产成人精品一区二区三区在线 | 久久精品网| 成人精品一区二区三区 |