Outro dia, o Guilherme me questionou como avaliar o status de uma conexão do WinCC, aqui vai a minha resposta:
Prezado Guilherme,Você pode avaliar o status da conexão, bem como outras informações de cada TAG, através das função GetTagXXXState().
Exemplo:
GetTagBitState(Tag_Name,lp_dwstate) onde:
lp_dwstate é um pointer para uma DWORD aonde será retornado o status do TAG, podendo ser:
Value (decimal) Value (hexdecimal) Significance
0 0×0000 No error
1 0×0001 No connection to partner established
2 0×0002 Protocol error
4 0×0004 Network component defect
8 0×0008 Exceeded configured upper limit
16 0×0010 Below configured lower limit
32 0×0020 Exceeded format limit
64 0×0040 Below format limit
128 0×0080 Conversion error
256 0×0100 Initialization value of tag
512 0×0200 Replacement value of tag
1024 0×0400 Addressing error in channel
2048 0×0800 Tag not found or non-existent
4096 0×1000 Access to tag rejected
8192 0×2000 Timeout, no response from channel
16384 0×4000 Server not available.Ou você usa o Wizard “Create Redundant Connection” para criar os tags de status de canal conexão que você tem, aí você vai ter diversos tags pra avaliar o status da conexão.
Abraços e bom uso.
Márcio Roberto