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

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 4124|回復: 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;
}
}



分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復

使用道具 舉報

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

本版積分規則

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

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 国产视频一区在线 | 99久久精品免费看国产四区 | 毛片一区 | 精品久久久久一区二区国产 | 91免费在线视频 | 青青草在线播放 | 精品国产一区二区 | 欧美成人一区二区三区 | 在线视频成人 | 99riav国产一区二区三区 | 婷婷久| 美女天天干 | 国产成人久久精品一区二区三区 | 欧美视频在线播放 | 男女一区二区三区 | 祝你幸福电影在线观看 | 欧美日韩在线观看一区 | 日韩在线免费观看视频 | 成人免费视频网站在线看 | 国产乱码精品1区2区3区 | 超碰成人免费 | 国产69久久精品成人看动漫 | 国产最新网址 | 亚洲精品国产综合区久久久久久久 | 亚洲精品国产成人 | av免费观看在线 | 久久久久成人精品免费播放动漫 | 久久久久久国产精品免费免费狐狸 | 一区二区三区在线播放 | 日本一区二区影视 | 欧美一区二区三区在线 | 日韩在线精品视频 | 精品福利在线 | 国产精品电影在线观看 | 粉嫩av | 久久综合影院 | 日韩 国产 在线 | 国产日韩欧美中文 | 久久精品亚洲国产 | 亚洲精品一区二区三区中文字幕 | 情侣黄网站免费看 |