System erweitert
Pushovernotifications eingefügt
This commit is contained in:
@@ -108,10 +108,9 @@ PROGRAM _CYCLIC
|
||||
brsitoa (diTempFrac[4], ADR (strTempFrac[4]));
|
||||
// bei Mehreren Nachkommastellen Fuehrende Nullen generieren !!
|
||||
brsstrcat (ADR (strLine), ADR (strTempFrac[4]) + 1);
|
||||
//brsstrcat (ADR (strLine), ADR (';'));
|
||||
brsstrcat (ADR (strLine), ADR (';'));
|
||||
|
||||
//Partikel OberhalbM26
|
||||
brsstrcat (ADR (strLine), ADR (';'));
|
||||
brsitoa (gLogValue.iParticle25c, ADR (strTempNum[44]));
|
||||
brsstrcat (ADR (strLine), ADR (strTempNum[44]));
|
||||
brsstrcat (ADR (strLine), ADR (';'));
|
||||
@@ -125,8 +124,30 @@ PROGRAM _CYCLIC
|
||||
brsstrcat (ADR (strLine), ADR (';'));
|
||||
brsitoa (gLogValue.iParticle10d, ADR (strTempNum[47]));
|
||||
brsstrcat (ADR (strLine), ADR (strTempNum[47]));
|
||||
//brsstrcat (ADR (strLine), ADR (';'));
|
||||
brsstrcat (ADR (strLine), ADR (';'));
|
||||
|
||||
//Luftdruck
|
||||
rTempFrac[5] := brmmodf (gLogValue.rAirPreasure, ADR (rTempNum[5]));
|
||||
brsitoa (REAL_TO_DINT (rTempNum[5]), ADR (strTempNum[5]));
|
||||
brsstrcat (ADR (strLine), ADR (strTempNum[5]));
|
||||
brsstrcat (ADR (strLine), ADR (','));
|
||||
diTempFrac[5] := REAL_TO_DINT (gLogValue.rAirPreasure * 10000.0) MOD 10000 + 10000;
|
||||
brsitoa (diTempFrac[5], ADR (strTempFrac[5]));
|
||||
// bei Mehreren Nachkommastellen Fuehrende Nullen generieren !!
|
||||
brsstrcat (ADR (strLine), ADR (strTempFrac[5]) + 1);
|
||||
brsstrcat (ADR (strLine), ADR (';'));
|
||||
|
||||
//Differenzdruck
|
||||
rTempFrac[6] := brmmodf (gLogValue.rDiffPreassure, ADR (rTempNum[6]));
|
||||
brsitoa (REAL_TO_DINT (rTempNum[6]), ADR (strTempNum[6]));
|
||||
brsstrcat (ADR (strLine), ADR (strTempNum[6]));
|
||||
brsstrcat (ADR (strLine), ADR (','));
|
||||
diTempFrac[6] := REAL_TO_DINT (gLogValue.rDiffPreassure * 100.0) MOD 100 + 100;
|
||||
brsitoa (diTempFrac[6], ADR (strTempFrac[6]));
|
||||
// bei Mehreren Nachkommastellen Fuehrende Nullen generieren !!
|
||||
brsstrcat (ADR (strLine), ADR (strTempFrac[6]) + 1);
|
||||
//brsstrcat (ADR (strLine), ADR (';'));
|
||||
|
||||
enLogfile := enLogCREATE;
|
||||
END_IF
|
||||
|
||||
@@ -181,7 +202,7 @@ PROGRAM _CYCLIC
|
||||
//==========================================
|
||||
enLogWRITEHEADER:
|
||||
FUBs.FileWrite.ident := udLogfileIdent;
|
||||
strHeader := 'TS;Part25Tisch;Part10Tisch;Part25Lim;Part10Lim;Part25ObM38;Part10ObM38;TempOb38;HumOb38;Part25M38;Part10M38;TempM38;HumM38;Part25ObM26;Part10ObM26;Part25M26;Part10M26';
|
||||
strHeader := 'TS;Part25Tisch;Part10Tisch;Part25Lim;Part10Lim;Part25ObM38;Part10ObM38;TempOb38;HumOb38;Part25M38;Part10M38;TempM38;HumM38;Part25ObM26;Part10ObM26;Part25M26;Part10M26;AtmPress;DiffPress';
|
||||
usLastParamset := 250;
|
||||
FUBs.FileWrite.len := brsstrlen (ADR (strHeader));
|
||||
FUBs.FileWrite.offset := udLogfileOffset;
|
||||
|
||||
350
Logical/Libraries/AsHttp/AsHttp.fun
Normal file
350
Logical/Libraries/AsHttp/AsHttp.fun
Normal file
@@ -0,0 +1,350 @@
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpService (*offers a webservice ; asynchronous execution*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution, registers webservice; asynchronous execution*)
|
||||
send : BOOL; (*on positive edge response will be sent*)
|
||||
abort : BOOL; (*request handling aborts on positive edge*)
|
||||
option : UDINT; (*options such as service type, protocol version (HTTP/1.0 , HTTP/1.1), see httpOPTIONS_XXX*)
|
||||
pServiceName : UDINT; (*ressource name of webservice, see httpOPTION_SERVICE_TYPE_XXX*)
|
||||
pUri : UDINT; (*URI buffer string given as a pointer, an URI may look like "hello.cgi?name=myName"*)
|
||||
uriSize : UDINT; (*size of uri data puffer*)
|
||||
pRequestHeader : UDINT; (*pointer to httpRequestHeader_t, optional*)
|
||||
pRequestData : UDINT; (*request data puffer string given as a pointer*)
|
||||
requestDataSize : UDINT; (*size of request data buffer*)
|
||||
pResponseHeader : UDINT; (*pointer to httpResponseHeader_t, optional*)
|
||||
pResponseData : UDINT; (*response data string given as a pointer*)
|
||||
responseDataLen : UDINT; (*length of response data*)
|
||||
pStatistics : UDINT; (*pointer to httpStatistics_t, optional*)
|
||||
pStruct : UDINT; (*reserve*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY,0xXXXX = see help*)
|
||||
method : UINT; (*method of incoming request, see httpMETHOD_XXX*)
|
||||
requestDataLen : UDINT; (*length of request data*)
|
||||
phase : UINT; (*current phase of request response handling of the webservice, see httpPHASE_XXX*)
|
||||
END_VAR
|
||||
VAR
|
||||
_i_state : UDINT; (*internal variable*)
|
||||
_i_result : UINT; (*internal variable*)
|
||||
_ident : UDINT; (*internal variable*)
|
||||
_oldEnable : UDINT; (*internal variable*)
|
||||
_oldAbort : UDINT; (*internal variable*)
|
||||
_oldSend : UDINT; (*internal variable*)
|
||||
_state : UDINT; (*internal variable*)
|
||||
_internal : UDINT; (*internal variable*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpClient (*sends and recieves HTTP messages (web requests); asynchronous execution*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution; asynchronous execution*)
|
||||
send : BOOL; (*sends request data on positive edge*)
|
||||
abort : BOOL; (*disconnects and resets client state on positive edge*)
|
||||
option : UDINT; (*options, e.g protocol version (HTTP1.0 / 1.1)*)
|
||||
pHost : UDINT; (*host name or ip of server to connect to given as a pointer*)
|
||||
hostPort : UINT; (*port number of server to connect to*)
|
||||
method : UDINT; (*request method see httpMETHOD_XXX*)
|
||||
pUri : UDINT; (*request uri given as a pointer, e.g. "/index.html" or "/hello.cgi?name=myName"*)
|
||||
pRequestHeader : UDINT; (*pointer to httpRequestHeader_t, optional*)
|
||||
pRequestData : UDINT; (*pointer to request data, typically string data*)
|
||||
requestDataLen : UDINT; (*length of request data*)
|
||||
pResponseHeader : UDINT; (*pointer to httpResponseHeader_t, optional*)
|
||||
pResponseData : UDINT; (*pointer to response data buffer, typically string data*)
|
||||
responseDataSize : UDINT; (*size of response data buffer*)
|
||||
pStatistics : UDINT; (*pointer to httpStatistics_t, optional*)
|
||||
pStruct : UDINT; (*reserve*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY,
|
||||
0xXXXX = see help*)
|
||||
tcpStatus : UINT; (*status of the tcp connection*)
|
||||
httpStatus : UINT; (*status code of response, e.g. 200 for "OK", 404 for "Not Found"*)
|
||||
responseDataLen : UDINT; (*length of response (bytes)*)
|
||||
phase : UINT; (*current phase of request response handling of the webservice, see httpPHASE_XXX*)
|
||||
END_VAR
|
||||
VAR
|
||||
_i_state : UDINT; (*internal variable*)
|
||||
_i_result : UINT; (*internal variable*)
|
||||
_ident : UDINT; (*internal variable*)
|
||||
_oldEnable : UDINT; (*internal variable*)
|
||||
_oldAbort : UDINT; (*internal variable*)
|
||||
_oldSend : UDINT; (*internal variable*)
|
||||
_state : UDINT; (*internal variable*)
|
||||
_internal : UDINT; (*internal variable*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpsService (*offers a webservice over HTTPs; asynchronous execution*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution, registers webservice; asynchronous execution*)
|
||||
send : BOOL; (*on positive edge response will be sent*)
|
||||
abort : BOOL; (*request handling aborts on positive edge*)
|
||||
option : UDINT; (*options such as service type, protocol version (HTTP/1.0 , HTTP/1.1), see httpOPTIONS_XXX*)
|
||||
pServiceName : UDINT; (*ressource name of webservice, see httpOPTION_SERVICE_TYPE_XXX*)
|
||||
pUri : UDINT; (*URI buffer string given as a pointer, an URI may look like "hello.cgi?name=myName"*)
|
||||
uriSize : UDINT; (*size of uri data puffer*)
|
||||
pRequestHeader : UDINT; (*pointer to httpRequestHeader_t, optional*)
|
||||
pRequestData : UDINT; (*request data puffer string given as a pointer*)
|
||||
requestDataSize : UDINT; (*size of request data buffer*)
|
||||
pResponseHeader : UDINT; (*pointer to httpResponseHeader_t, optional*)
|
||||
pResponseData : UDINT; (*response data string given as a pointer*)
|
||||
responseDataLen : UDINT; (*length of response data*)
|
||||
pStatistics : UDINT; (*pointer to httpStatistics_t, optional*)
|
||||
pStruct : UDINT; (*reserve*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY,0xXXXX = see help*)
|
||||
method : UINT; (*method of incoming request, see httpMETHOD_XXX*)
|
||||
requestDataLen : UDINT; (*length of request data*)
|
||||
phase : UINT; (*current phase of request response handling of the webservice, see httpPHASE_XXX*)
|
||||
END_VAR
|
||||
VAR
|
||||
_i_state : UDINT; (*internal variable*)
|
||||
_i_result : UINT; (*internal variable*)
|
||||
_ident : UDINT; (*internal variable*)
|
||||
_oldEnable : UDINT; (*internal variable*)
|
||||
_oldAbort : UDINT; (*internal variable*)
|
||||
_oldSend : UDINT; (*internal variable*)
|
||||
_state : UDINT; (*internal variable*)
|
||||
_internal : UDINT; (*internal variable*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpsClient (*sends and recieves HTTPs messages (web requests); asynchronous execution*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution; asynchronous execution*)
|
||||
send : BOOL; (*sends request data on positive edge*)
|
||||
abort : BOOL; (*disconnects and resets client state on positive edge*)
|
||||
option : UDINT; (*options, e.g protocol version (HTTP1.0 / 1.1)*)
|
||||
sslCfgIdent : UDINT; (*identifier of the SSL configuration*)
|
||||
pHost : UDINT; (*host name or ip of server to connect to given as a pointer*)
|
||||
hostPort : UINT; (*port number of server to connect to*)
|
||||
method : UDINT; (*request method see httpMETHOD_XXX*)
|
||||
pUri : UDINT; (*request uri given as a pointer, e.g. "/index.html" or "/hello.cgi?name=myName"*)
|
||||
pRequestHeader : UDINT; (*pointer to httpRequestHeader_t, optional*)
|
||||
pRequestData : UDINT; (*pointer to request data, typically string data*)
|
||||
requestDataLen : UDINT; (*length of request data*)
|
||||
pResponseHeader : UDINT; (*pointer to httpResponseHeader_t, optional*)
|
||||
pResponseData : UDINT; (*pointer to response data buffer, typically string data*)
|
||||
responseDataSize : UDINT; (*size of response data buffer*)
|
||||
pStatistics : UDINT; (*pointer to httpStatistics_t, optional*)
|
||||
pStruct : UDINT; (*reserve*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY,
|
||||
0xXXXX = see help*)
|
||||
tcpStatus : UINT; (*status of the ssl connection (tcp and ssl)*)
|
||||
httpStatus : UINT; (*status code of response, e.g. 200 for "OK", 404 for "Not Found"*)
|
||||
responseDataLen : UDINT; (*length of response (bytes)*)
|
||||
phase : UINT; (*current phase of request response handling of the webservice, see httpPHASE_XXX*)
|
||||
END_VAR
|
||||
VAR
|
||||
_i_state : UDINT; (*internal variable*)
|
||||
_i_result : UINT; (*internal variable*)
|
||||
_ident : UDINT; (*internal variable*)
|
||||
_oldEnable : UDINT; (*internal variable*)
|
||||
_oldAbort : UDINT; (*internal variable*)
|
||||
_oldSend : UDINT; (*internal variable*)
|
||||
_state : UDINT; (*internal variable*)
|
||||
_internal : UDINT; (*internal variable*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpUtf8ToString (*converts a UTF8 string in string with respect to given code page mapping*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution*)
|
||||
pSrc : UDINT; (*input string (UTF8 encoded), given as a pointer*)
|
||||
pDest : UDINT; (*destination buffer*)
|
||||
destSize : UDINT; (*size of destination buffer*)
|
||||
pMappingTable : UDINT; (*pointer to WSTRING[255], mapping table for code page, see help*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
|
||||
destLen : UDINT; (*string length of the string*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpStringToUtf8 (*converts a string in UTF8 string with respect to given code page mapping*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution*)
|
||||
pSrc : UDINT; (*input string, given as a pointer*)
|
||||
pDest : UDINT; (*destination buffer*)
|
||||
destSize : UDINT; (*size of destination buffer*)
|
||||
pMappingTable : UDINT; (*pointer to WSTRING[255], mapping table for code page, see help*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
|
||||
destLen : UDINT; (*string length of the UTF8 string*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpUtf8ToWString (*converts a UTF8 encoded string in wide character string*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution*)
|
||||
pSrc : UDINT; (*input string, given as a pointer*)
|
||||
pDest : UDINT; (*destination buffer*)
|
||||
destSize : UDINT; (*size of destination buffer*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
|
||||
destLen : UDINT; (*wide character string length*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpWStringToUtf8 (*converts a wide character string in UTF8 string*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution*)
|
||||
pSrc : UDINT; (*input string, given as a pointer*)
|
||||
pDest : UDINT; (*destination buffer*)
|
||||
destSize : UDINT; (*size of destination buffer*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
|
||||
destLen : UDINT; (*string length of the UTF8 encoded string*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpDecodeBase64 (*decodes base64 encoded string in binary data or string*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution*)
|
||||
pSrc : UDINT; (*encoded string, given as a pointer*)
|
||||
srcLen : UDINT; (*length of encoded string*)
|
||||
pDest : UDINT; (*destination buffer, given as a pointer*)
|
||||
destSize : UDINT; (*size of destination buffer*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
|
||||
destLen : UDINT; (*length of decoded data*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpEncodeBase64 (*encodes binary data or a string in a base64 encoded string*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution*)
|
||||
pSrc : UDINT; (*input data, given as a pointer*)
|
||||
srcLen : UDINT; (*length of input data*)
|
||||
pDest : UDINT; (*destination buffer, given as a pointer*)
|
||||
destSize : UDINT; (*size of destination buffer*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
|
||||
destLen : UDINT; (*length of encoded string*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpEncodeUrl (*encodes special chars in the given string according the URL encoding*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution*)
|
||||
pSrc : UDINT; (*input string, given as a pointer*)
|
||||
pDest : UDINT; (*destination buffer, given as a pointer*)
|
||||
destSize : UDINT; (*size of destination buffer*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
|
||||
destLen : UDINT; (*length of encoded string*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpDecodeUrl (*decodes an URL encoded string*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution*)
|
||||
pSrc : UDINT; (*input string, given as a pointer*)
|
||||
pDest : UDINT; (*destination buffer, given as a pointer*)
|
||||
destSize : UDINT; (*size of destination buffer*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
|
||||
destLen : UDINT; (*length of decoded string*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpGetParamUrl (*retrieves the string value of the given parameter.*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution*)
|
||||
pSrc : UDINT; (*input string, given as a pointer*)
|
||||
pParam : UDINT; (*search string given as a pointer*)
|
||||
pValue : UDINT; (*value string buffer given as a pointer*)
|
||||
valueSize : UDINT; (*size of value buffer*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
|
||||
valueLen : UDINT; (*length of value string*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpSetParamUrl (*adds a parameter and its value with respect to URL encoding*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution*)
|
||||
pParam : UDINT; (*name string given as a pointer*)
|
||||
pValue : UDINT; (*value string buffer given as a pointer*)
|
||||
pDest : UDINT; (*resulting string buffer given as pointer*)
|
||||
destSize : UDINT; (*size of destination buffer*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
|
||||
destLen : UDINT; (*length of resulted string*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpSetBoundary (*adds the boundary information to the HTTP message header*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution*)
|
||||
pStruct : UDINT; (*pointer to the header structure (httpRequestHeader_t or httpResponseHeader_t)*)
|
||||
pBoundary : UDINT; (*boundary string given as a pointer. A boundary has no more than 70 chars and is unambiguous*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpGetBoundary (*retrieves the boundary value of the given header structure*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution*)
|
||||
pStruct : UDINT; (*pointer to the header structure (httpRequestHeader_t or httpResponseHeader_t)*)
|
||||
pBoundary : UDINT; (*boundary string buffer given as a pointer*)
|
||||
boundarySize : UDINT; (*size of boundary buffer, preferrably slighly more than 70 bytes*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
|
||||
boundaryLen : UDINT; (*length of the retrieved boundary if any*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpSetMultipartMessage (*sets respectivly appends a multipart message*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution*)
|
||||
pDest : UDINT; (*destination buffer string given as a pointer*)
|
||||
destSize : UDINT; (*size of destination buffer*)
|
||||
pBoundary : UDINT; (*boundary string to seperate multipart message given as a pointer*)
|
||||
pMessageHeader : UDINT; (*header string given as a pointer, contains header for multipart message, if any*)
|
||||
pMessageData : UDINT; (*message body given as a pointer, contains data for multipart message*)
|
||||
messageDataLen : UDINT; (*length of message data*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
|
||||
END_VAR
|
||||
VAR
|
||||
_messageLen : UDINT; (*internal variable*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
{REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK httpGetMultipartMessage (*gets next multipart message information on each call*)
|
||||
VAR_INPUT
|
||||
enable : BOOL; (*enables execution*)
|
||||
pSrc : UDINT; (*source string given as a pointer, contains one or more multipart messages*)
|
||||
pBoundary : UDINT; (*boundary string given as a pointer, seperator of the multipart messages*)
|
||||
pMessageHeader : UDINT; (*string buffer for a optional message header given as a pointer*)
|
||||
messageHeaderSize : UDINT; (*size of message header buffer*)
|
||||
pMessageData : UDINT; (*string buffer for message data given as a pointer*)
|
||||
messageDataSize : UDINT; (*size of message data buffer*)
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
status : UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
|
||||
messageHeaderLen : UDINT; (*length of current header, if any*)
|
||||
messageDataLen : UDINT; (*length of current data*)
|
||||
messageLen : UDINT; (*offset to current message ending*)
|
||||
END_VAR
|
||||
VAR
|
||||
_internal : UDINT; (*internal variable*)
|
||||
END_VAR
|
||||
END_FUNCTION_BLOCK
|
||||
40
Logical/Libraries/AsHttp/AsHttp.typ
Normal file
40
Logical/Libraries/AsHttp/AsHttp.typ
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
TYPE
|
||||
httpResponseHeader_t : STRUCT (*response header structure*)
|
||||
protocol : STRING[20]; (*HTTP/1.0 or HTTP/1.1*)
|
||||
status : STRING[280]; (*HTTP status line e.g. "200 OK" , "404 Not Found"*)
|
||||
contentType : STRING[100]; (*MIME type specifying message body, e.g. "text/html"*)
|
||||
contentLength : UDINT; (*length of message data, should be equal to responseDataLen, optional input*)
|
||||
connection : STRING[80]; (*valid tokens are "Close" or "Keep-Alive", default is "Close"*)
|
||||
keepAlive : STRING[80]; (*e.g. "timeout=5, max=100", optional*)
|
||||
userLine : ARRAY[0..7]OF httpHeaderLine_t; (*userspecific headerlines, optional*)
|
||||
rawHeader : httpRawHeader_t; (*interface to add / get formatted headers, optional*)
|
||||
END_STRUCT;
|
||||
httpRequestHeader_t : STRUCT (*request header structure*)
|
||||
protocol : STRING[20]; (*protocol version e.g. "HTTP/1.0" or "HTTP/1.1", optional input*)
|
||||
host : STRING[280]; (*host name or ip address of the server and port number if <> 80, optional input*)
|
||||
contentType : STRING[100]; (*MIME type specifying message body, e.g. "text/html", optional input*)
|
||||
contentLength : UDINT; (*length of message data, should be equal to requestDataLen, optional input*)
|
||||
connection : STRING[80]; (*valid tokens are "Close" or "Keep-Alive", default is "Close", optional input*)
|
||||
keepAlive : STRING[80]; (*e.g. "timeout=5, max=100", optional input*)
|
||||
userLine : ARRAY[0..7]OF httpHeaderLine_t; (*userspecific headerlines, optional*)
|
||||
rawHeader : httpRawHeader_t; (*interface to add / get formatted headers, optional*)
|
||||
END_STRUCT;
|
||||
httpHeaderLine_t : STRUCT (*structure containing information of one header line*)
|
||||
name : STRING[50]; (*header field name, e.g. "User-Agent" to get / set the user-agent header entry*)
|
||||
value : STRING[80]; (*header field value, e.g. "B&R Client"*)
|
||||
END_STRUCT;
|
||||
httpRawHeader_t : STRUCT (*buffer handling structure for raw (formatted) headers*)
|
||||
pData : UDINT; (*pointer to data buffer, where the header is copied*)
|
||||
dataSize : UDINT; (*max. length of data buffer in bytes*)
|
||||
dataLen : UDINT; (*length of the header bytes copied out*)
|
||||
END_STRUCT;
|
||||
httpStatistics_t : STRUCT (*informational structure*)
|
||||
requestCounter : UDINT; (*counts requests*)
|
||||
timeOfLastRequest : DATE_AND_TIME; (*timestamp of last request*)
|
||||
responseCounter : UDINT; (*counts responses*)
|
||||
timeOfLastResponse : DATE_AND_TIME; (*timestamp of last response*)
|
||||
errorCounter : UDINT; (*counts errors, e.g. connection errors, aborts *)
|
||||
lastError : UDINT; (*error number, if any*)
|
||||
END_STRUCT;
|
||||
END_TYPE
|
||||
37
Logical/Libraries/AsHttp/AsHttp.var
Normal file
37
Logical/Libraries/AsHttp/AsHttp.var
Normal file
@@ -0,0 +1,37 @@
|
||||
VAR CONSTANT
|
||||
httpERR_BUFFER_SIZE : UINT := 35550; (*buffer is too small*)
|
||||
httpERR_DATA_SIZE : UINT := 35551; (*data buffer is too small*)
|
||||
httpERR_HEADER_SIZE_RAW : UINT := 35552; (*raw header size buffer is too small or raw header is too long*)
|
||||
httpERR_HEADER_SIZE_USERLINE : UINT := 35553; (*any of requested user line is too long for the structure*)
|
||||
httpERR_INVALID_PARAM : UINT := 35554; (*check parameters. At least one of needed ones is zero*)
|
||||
httpERR_NO_DATA : UINT := 35555; (*no data retrieved*)
|
||||
httpERR_METHOD_UNSUPPORTED : UINT := 35556; (*method not supported, supported methods are PUT, POST, GET, DELETE*)
|
||||
httpERR_SERVICE_NO_WEBSERVER : UINT := 35557; (*webserver is disabled or not installed, webservice will not be available*)
|
||||
httpERR_SERVICE_LINK_FAILED : UINT := 35558; (*webservice could not be registered, check registration*)
|
||||
httpERR_CLIENT_ERR_SOCKET_CREATE : UINT := 35559; (*could not create a new socket. Try again later*)
|
||||
httpERR_CLIENT_NO_MORE_IDENTS : UINT := 35560; (*too many httpClients enabled, disable unused instances*)
|
||||
httpERR_CLIENT_TCP_CONN_CLOSED : UINT := 35561; (*informational, no error: Connection closed. Possible reasons: HTTP/1.0, use of "Connection: close" header, Keep-Alive timeout*)
|
||||
httpERR_CLIENT_TCP_CONN_FAILED : UINT := 35562; (*could not connect to given server. Check network parameters and server aviability*)
|
||||
httpERR_CLIENT_TCP_INVALID_HOST : UINT := 35563; (*could not resolve name or IP-address of server, check pHost*)
|
||||
httpERR_CLIENT_TCP_DISCONNECTED : UINT := 35564; (*lost connection unexpectedly*)
|
||||
httpERR_NOT_FOUND : UINT := 35565; (*source string didn't contain parameter*)
|
||||
httpERR_ILLEGAL_CHARACTERS : UINT := 35566; (*source contains characters, that couldn't be transformd*)
|
||||
httpERR_SSL_HANDSHAKE_FAILED : UINT := 35567; (*client handshake failed*)
|
||||
httpERR_INVALID_SSL_CONFIG : UINT := 35568; (*Could not open ssl configuration*)
|
||||
httpERR_SYSTEM : UINT := 35579; (*general error, see help*)
|
||||
httpMETHOD_GET : UINT := 1; (*request method GET, additional request parameters are part of the URL*)
|
||||
httpMETHOD_POST : UINT := 2; (*request method POST, request contains a message body*)
|
||||
httpMETHOD_PUT : UINT := 3; (*request method PUT, request contains a message body*)
|
||||
httpMETHOD_DELETE : UINT := 4; (*request method DELETE, additional request parameters are part of the URL*)
|
||||
httpOPTION_HTTP_10 : UINT := 0; (*use HTTP/1.0 as protocol type*)
|
||||
httpOPTION_HTTP_11 : UINT := 1; (*use HTTP/1.1 as protocol type*)
|
||||
httpOPTION_SERVICE_TYPE_ROOT : UINT := 4; (*Type of service: root path, e.g. "/basePath", handles requests inside this virtual folder*)
|
||||
httpOPTION_SERVICE_TYPE_NAME : UINT := 2; (*Type of service: name, e.g. "hello.cgi", handles requests ending with this name*)
|
||||
httpOPTION_SERVICE_TYPE_EXT : UINT := 6; (*Type of service: file extension, e.g. "*.abc" handles requests with file extension ".abc"*)
|
||||
httpOPTION_SERVICE_TYPE_LEAF : UINT := 8; (*Type of service: relative path, e.g. "cgi-bin" handles requests in virtual subfolders called "cgi-bin"*)
|
||||
httpPHASE_NOT_CONNECTED : UINT := 0; (*not connected*)
|
||||
httpPHASE_SENDING : UINT := 1; (*sending a HTTP message*)
|
||||
httpPHASE_RECEIVING : UINT := 2; (*receiving a HTTP message*)
|
||||
httpPHASE_RECEIVED : UINT := 3; (*HTTP message received *)
|
||||
httpPHASE_WAITING : UINT := 4; (*idle state*)
|
||||
END_VAR
|
||||
511
Logical/Libraries/AsHttp/SG4/AsHttp.h
Normal file
511
Logical/Libraries/AsHttp/SG4/AsHttp.h
Normal file
@@ -0,0 +1,511 @@
|
||||
/* Automation Studio generated header file */
|
||||
/* Do not edit ! */
|
||||
|
||||
#ifndef _ASHTTP_
|
||||
#define _ASHTTP_
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <bur/plctypes.h>
|
||||
|
||||
#include <runtime.h>
|
||||
|
||||
#ifndef _BUR_PUBLIC
|
||||
#define _BUR_PUBLIC
|
||||
#endif
|
||||
/* Constants */
|
||||
#ifdef _REPLACE_CONST
|
||||
#define httpPHASE_WAITING 4U
|
||||
#define httpPHASE_RECEIVED 3U
|
||||
#define httpPHASE_RECEIVING 2U
|
||||
#define httpPHASE_SENDING 1U
|
||||
#define httpPHASE_NOT_CONNECTED 0U
|
||||
#define httpOPTION_SERVICE_TYPE_LEAF 8U
|
||||
#define httpOPTION_SERVICE_TYPE_EXT 6U
|
||||
#define httpOPTION_SERVICE_TYPE_NAME 2U
|
||||
#define httpOPTION_SERVICE_TYPE_ROOT 4U
|
||||
#define httpOPTION_HTTP_11 1U
|
||||
#define httpOPTION_HTTP_10 0U
|
||||
#define httpMETHOD_DELETE 4U
|
||||
#define httpMETHOD_PUT 3U
|
||||
#define httpMETHOD_POST 2U
|
||||
#define httpMETHOD_GET 1U
|
||||
#define httpERR_SYSTEM 35579U
|
||||
#define httpERR_INVALID_SSL_CONFIG 35568U
|
||||
#define httpERR_SSL_HANDSHAKE_FAILED 35567U
|
||||
#define httpERR_ILLEGAL_CHARACTERS 35566U
|
||||
#define httpERR_NOT_FOUND 35565U
|
||||
#define httpERR_CLIENT_TCP_DISCONNECTED 35564U
|
||||
#define httpERR_CLIENT_TCP_INVALID_HOST 35563U
|
||||
#define httpERR_CLIENT_TCP_CONN_FAILED 35562U
|
||||
#define httpERR_CLIENT_TCP_CONN_CLOSED 35561U
|
||||
#define httpERR_CLIENT_NO_MORE_IDENTS 35560U
|
||||
#define httpERR_CLIENT_ERR_SOCKET_CREATE 35559U
|
||||
#define httpERR_SERVICE_LINK_FAILED 35558U
|
||||
#define httpERR_SERVICE_NO_WEBSERVER 35557U
|
||||
#define httpERR_METHOD_UNSUPPORTED 35556U
|
||||
#define httpERR_NO_DATA 35555U
|
||||
#define httpERR_INVALID_PARAM 35554U
|
||||
#define httpERR_HEADER_SIZE_USERLINE 35553U
|
||||
#define httpERR_HEADER_SIZE_RAW 35552U
|
||||
#define httpERR_DATA_SIZE 35551U
|
||||
#define httpERR_BUFFER_SIZE 35550U
|
||||
#else
|
||||
#ifndef _GLOBAL_CONST
|
||||
#define _GLOBAL_CONST _WEAK const
|
||||
#endif
|
||||
_GLOBAL_CONST unsigned short httpPHASE_WAITING;
|
||||
_GLOBAL_CONST unsigned short httpPHASE_RECEIVED;
|
||||
_GLOBAL_CONST unsigned short httpPHASE_RECEIVING;
|
||||
_GLOBAL_CONST unsigned short httpPHASE_SENDING;
|
||||
_GLOBAL_CONST unsigned short httpPHASE_NOT_CONNECTED;
|
||||
_GLOBAL_CONST unsigned short httpOPTION_SERVICE_TYPE_LEAF;
|
||||
_GLOBAL_CONST unsigned short httpOPTION_SERVICE_TYPE_EXT;
|
||||
_GLOBAL_CONST unsigned short httpOPTION_SERVICE_TYPE_NAME;
|
||||
_GLOBAL_CONST unsigned short httpOPTION_SERVICE_TYPE_ROOT;
|
||||
_GLOBAL_CONST unsigned short httpOPTION_HTTP_11;
|
||||
_GLOBAL_CONST unsigned short httpOPTION_HTTP_10;
|
||||
_GLOBAL_CONST unsigned short httpMETHOD_DELETE;
|
||||
_GLOBAL_CONST unsigned short httpMETHOD_PUT;
|
||||
_GLOBAL_CONST unsigned short httpMETHOD_POST;
|
||||
_GLOBAL_CONST unsigned short httpMETHOD_GET;
|
||||
_GLOBAL_CONST unsigned short httpERR_SYSTEM;
|
||||
_GLOBAL_CONST unsigned short httpERR_INVALID_SSL_CONFIG;
|
||||
_GLOBAL_CONST unsigned short httpERR_SSL_HANDSHAKE_FAILED;
|
||||
_GLOBAL_CONST unsigned short httpERR_ILLEGAL_CHARACTERS;
|
||||
_GLOBAL_CONST unsigned short httpERR_NOT_FOUND;
|
||||
_GLOBAL_CONST unsigned short httpERR_CLIENT_TCP_DISCONNECTED;
|
||||
_GLOBAL_CONST unsigned short httpERR_CLIENT_TCP_INVALID_HOST;
|
||||
_GLOBAL_CONST unsigned short httpERR_CLIENT_TCP_CONN_FAILED;
|
||||
_GLOBAL_CONST unsigned short httpERR_CLIENT_TCP_CONN_CLOSED;
|
||||
_GLOBAL_CONST unsigned short httpERR_CLIENT_NO_MORE_IDENTS;
|
||||
_GLOBAL_CONST unsigned short httpERR_CLIENT_ERR_SOCKET_CREATE;
|
||||
_GLOBAL_CONST unsigned short httpERR_SERVICE_LINK_FAILED;
|
||||
_GLOBAL_CONST unsigned short httpERR_SERVICE_NO_WEBSERVER;
|
||||
_GLOBAL_CONST unsigned short httpERR_METHOD_UNSUPPORTED;
|
||||
_GLOBAL_CONST unsigned short httpERR_NO_DATA;
|
||||
_GLOBAL_CONST unsigned short httpERR_INVALID_PARAM;
|
||||
_GLOBAL_CONST unsigned short httpERR_HEADER_SIZE_USERLINE;
|
||||
_GLOBAL_CONST unsigned short httpERR_HEADER_SIZE_RAW;
|
||||
_GLOBAL_CONST unsigned short httpERR_DATA_SIZE;
|
||||
_GLOBAL_CONST unsigned short httpERR_BUFFER_SIZE;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* Datatypes and datatypes of function blocks */
|
||||
typedef struct httpHeaderLine_t
|
||||
{ plcstring name[51];
|
||||
plcstring value[81];
|
||||
} httpHeaderLine_t;
|
||||
|
||||
typedef struct httpRawHeader_t
|
||||
{ unsigned long pData;
|
||||
unsigned long dataSize;
|
||||
unsigned long dataLen;
|
||||
} httpRawHeader_t;
|
||||
|
||||
typedef struct httpResponseHeader_t
|
||||
{ plcstring protocol[21];
|
||||
plcstring status[281];
|
||||
plcstring contentType[101];
|
||||
unsigned long contentLength;
|
||||
plcstring connection[81];
|
||||
plcstring keepAlive[81];
|
||||
struct httpHeaderLine_t userLine[8];
|
||||
struct httpRawHeader_t rawHeader;
|
||||
} httpResponseHeader_t;
|
||||
|
||||
typedef struct httpRequestHeader_t
|
||||
{ plcstring protocol[21];
|
||||
plcstring host[281];
|
||||
plcstring contentType[101];
|
||||
unsigned long contentLength;
|
||||
plcstring connection[81];
|
||||
plcstring keepAlive[81];
|
||||
struct httpHeaderLine_t userLine[8];
|
||||
struct httpRawHeader_t rawHeader;
|
||||
} httpRequestHeader_t;
|
||||
|
||||
typedef struct httpStatistics_t
|
||||
{ unsigned long requestCounter;
|
||||
plcdt timeOfLastRequest;
|
||||
unsigned long responseCounter;
|
||||
plcdt timeOfLastResponse;
|
||||
unsigned long errorCounter;
|
||||
unsigned long lastError;
|
||||
} httpStatistics_t;
|
||||
|
||||
typedef struct httpService
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long option;
|
||||
unsigned long pServiceName;
|
||||
unsigned long pUri;
|
||||
unsigned long uriSize;
|
||||
unsigned long pRequestHeader;
|
||||
unsigned long pRequestData;
|
||||
unsigned long requestDataSize;
|
||||
unsigned long pResponseHeader;
|
||||
unsigned long pResponseData;
|
||||
unsigned long responseDataLen;
|
||||
unsigned long pStatistics;
|
||||
unsigned long pStruct;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
unsigned short method;
|
||||
unsigned long requestDataLen;
|
||||
unsigned short phase;
|
||||
/* VAR (analog) */
|
||||
unsigned long _i_state;
|
||||
unsigned short _i_result;
|
||||
unsigned long _ident;
|
||||
unsigned long _oldEnable;
|
||||
unsigned long _oldAbort;
|
||||
unsigned long _oldSend;
|
||||
unsigned long _state;
|
||||
unsigned long _internal;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
plcbit send;
|
||||
plcbit abort;
|
||||
} httpService_typ;
|
||||
|
||||
typedef struct httpClient
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long option;
|
||||
unsigned long pHost;
|
||||
unsigned short hostPort;
|
||||
unsigned long method;
|
||||
unsigned long pUri;
|
||||
unsigned long pRequestHeader;
|
||||
unsigned long pRequestData;
|
||||
unsigned long requestDataLen;
|
||||
unsigned long pResponseHeader;
|
||||
unsigned long pResponseData;
|
||||
unsigned long responseDataSize;
|
||||
unsigned long pStatistics;
|
||||
unsigned long pStruct;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
unsigned short tcpStatus;
|
||||
unsigned short httpStatus;
|
||||
unsigned long responseDataLen;
|
||||
unsigned short phase;
|
||||
/* VAR (analog) */
|
||||
unsigned long _i_state;
|
||||
unsigned short _i_result;
|
||||
unsigned long _ident;
|
||||
unsigned long _oldEnable;
|
||||
unsigned long _oldAbort;
|
||||
unsigned long _oldSend;
|
||||
unsigned long _state;
|
||||
unsigned long _internal;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
plcbit send;
|
||||
plcbit abort;
|
||||
} httpClient_typ;
|
||||
|
||||
typedef struct httpsService
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long option;
|
||||
unsigned long pServiceName;
|
||||
unsigned long pUri;
|
||||
unsigned long uriSize;
|
||||
unsigned long pRequestHeader;
|
||||
unsigned long pRequestData;
|
||||
unsigned long requestDataSize;
|
||||
unsigned long pResponseHeader;
|
||||
unsigned long pResponseData;
|
||||
unsigned long responseDataLen;
|
||||
unsigned long pStatistics;
|
||||
unsigned long pStruct;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
unsigned short method;
|
||||
unsigned long requestDataLen;
|
||||
unsigned short phase;
|
||||
/* VAR (analog) */
|
||||
unsigned long _i_state;
|
||||
unsigned short _i_result;
|
||||
unsigned long _ident;
|
||||
unsigned long _oldEnable;
|
||||
unsigned long _oldAbort;
|
||||
unsigned long _oldSend;
|
||||
unsigned long _state;
|
||||
unsigned long _internal;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
plcbit send;
|
||||
plcbit abort;
|
||||
} httpsService_typ;
|
||||
|
||||
typedef struct httpsClient
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long option;
|
||||
unsigned long sslCfgIdent;
|
||||
unsigned long pHost;
|
||||
unsigned short hostPort;
|
||||
unsigned long method;
|
||||
unsigned long pUri;
|
||||
unsigned long pRequestHeader;
|
||||
unsigned long pRequestData;
|
||||
unsigned long requestDataLen;
|
||||
unsigned long pResponseHeader;
|
||||
unsigned long pResponseData;
|
||||
unsigned long responseDataSize;
|
||||
unsigned long pStatistics;
|
||||
unsigned long pStruct;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
unsigned short tcpStatus;
|
||||
unsigned short httpStatus;
|
||||
unsigned long responseDataLen;
|
||||
unsigned short phase;
|
||||
/* VAR (analog) */
|
||||
unsigned long _i_state;
|
||||
unsigned short _i_result;
|
||||
unsigned long _ident;
|
||||
unsigned long _oldEnable;
|
||||
unsigned long _oldAbort;
|
||||
unsigned long _oldSend;
|
||||
unsigned long _state;
|
||||
unsigned long _internal;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
plcbit send;
|
||||
plcbit abort;
|
||||
} httpsClient_typ;
|
||||
|
||||
typedef struct httpUtf8ToString
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long pSrc;
|
||||
unsigned long pDest;
|
||||
unsigned long destSize;
|
||||
unsigned long pMappingTable;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
unsigned long destLen;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
} httpUtf8ToString_typ;
|
||||
|
||||
typedef struct httpStringToUtf8
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long pSrc;
|
||||
unsigned long pDest;
|
||||
unsigned long destSize;
|
||||
unsigned long pMappingTable;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
unsigned long destLen;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
} httpStringToUtf8_typ;
|
||||
|
||||
typedef struct httpUtf8ToWString
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long pSrc;
|
||||
unsigned long pDest;
|
||||
unsigned long destSize;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
unsigned long destLen;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
} httpUtf8ToWString_typ;
|
||||
|
||||
typedef struct httpWStringToUtf8
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long pSrc;
|
||||
unsigned long pDest;
|
||||
unsigned long destSize;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
unsigned long destLen;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
} httpWStringToUtf8_typ;
|
||||
|
||||
typedef struct httpDecodeBase64
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long pSrc;
|
||||
unsigned long srcLen;
|
||||
unsigned long pDest;
|
||||
unsigned long destSize;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
unsigned long destLen;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
} httpDecodeBase64_typ;
|
||||
|
||||
typedef struct httpEncodeBase64
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long pSrc;
|
||||
unsigned long srcLen;
|
||||
unsigned long pDest;
|
||||
unsigned long destSize;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
unsigned long destLen;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
} httpEncodeBase64_typ;
|
||||
|
||||
typedef struct httpEncodeUrl
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long pSrc;
|
||||
unsigned long pDest;
|
||||
unsigned long destSize;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
unsigned long destLen;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
} httpEncodeUrl_typ;
|
||||
|
||||
typedef struct httpDecodeUrl
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long pSrc;
|
||||
unsigned long pDest;
|
||||
unsigned long destSize;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
unsigned long destLen;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
} httpDecodeUrl_typ;
|
||||
|
||||
typedef struct httpGetParamUrl
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long pSrc;
|
||||
unsigned long pParam;
|
||||
unsigned long pValue;
|
||||
unsigned long valueSize;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
unsigned long valueLen;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
} httpGetParamUrl_typ;
|
||||
|
||||
typedef struct httpSetParamUrl
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long pParam;
|
||||
unsigned long pValue;
|
||||
unsigned long pDest;
|
||||
unsigned long destSize;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
unsigned long destLen;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
} httpSetParamUrl_typ;
|
||||
|
||||
typedef struct httpSetBoundary
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long pStruct;
|
||||
unsigned long pBoundary;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
} httpSetBoundary_typ;
|
||||
|
||||
typedef struct httpGetBoundary
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long pStruct;
|
||||
unsigned long pBoundary;
|
||||
unsigned long boundarySize;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
unsigned long boundaryLen;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
} httpGetBoundary_typ;
|
||||
|
||||
typedef struct httpSetMultipartMessage
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long pDest;
|
||||
unsigned long destSize;
|
||||
unsigned long pBoundary;
|
||||
unsigned long pMessageHeader;
|
||||
unsigned long pMessageData;
|
||||
unsigned long messageDataLen;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
/* VAR (analog) */
|
||||
unsigned long _messageLen;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
} httpSetMultipartMessage_typ;
|
||||
|
||||
typedef struct httpGetMultipartMessage
|
||||
{
|
||||
/* VAR_INPUT (analog) */
|
||||
unsigned long pSrc;
|
||||
unsigned long pBoundary;
|
||||
unsigned long pMessageHeader;
|
||||
unsigned long messageHeaderSize;
|
||||
unsigned long pMessageData;
|
||||
unsigned long messageDataSize;
|
||||
/* VAR_OUTPUT (analog) */
|
||||
unsigned short status;
|
||||
unsigned long messageHeaderLen;
|
||||
unsigned long messageDataLen;
|
||||
unsigned long messageLen;
|
||||
/* VAR (analog) */
|
||||
unsigned long _internal;
|
||||
/* VAR_INPUT (digital) */
|
||||
plcbit enable;
|
||||
} httpGetMultipartMessage_typ;
|
||||
|
||||
|
||||
|
||||
/* Prototyping of functions and function blocks */
|
||||
_BUR_PUBLIC void httpService(struct httpService* inst);
|
||||
_BUR_PUBLIC void httpClient(struct httpClient* inst);
|
||||
_BUR_PUBLIC void httpsService(struct httpsService* inst);
|
||||
_BUR_PUBLIC void httpsClient(struct httpsClient* inst);
|
||||
_BUR_PUBLIC void httpUtf8ToString(struct httpUtf8ToString* inst);
|
||||
_BUR_PUBLIC void httpStringToUtf8(struct httpStringToUtf8* inst);
|
||||
_BUR_PUBLIC void httpUtf8ToWString(struct httpUtf8ToWString* inst);
|
||||
_BUR_PUBLIC void httpWStringToUtf8(struct httpWStringToUtf8* inst);
|
||||
_BUR_PUBLIC void httpDecodeBase64(struct httpDecodeBase64* inst);
|
||||
_BUR_PUBLIC void httpEncodeBase64(struct httpEncodeBase64* inst);
|
||||
_BUR_PUBLIC void httpEncodeUrl(struct httpEncodeUrl* inst);
|
||||
_BUR_PUBLIC void httpDecodeUrl(struct httpDecodeUrl* inst);
|
||||
_BUR_PUBLIC void httpGetParamUrl(struct httpGetParamUrl* inst);
|
||||
_BUR_PUBLIC void httpSetParamUrl(struct httpSetParamUrl* inst);
|
||||
_BUR_PUBLIC void httpSetBoundary(struct httpSetBoundary* inst);
|
||||
_BUR_PUBLIC void httpGetBoundary(struct httpGetBoundary* inst);
|
||||
_BUR_PUBLIC void httpSetMultipartMessage(struct httpSetMultipartMessage* inst);
|
||||
_BUR_PUBLIC void httpGetMultipartMessage(struct httpGetMultipartMessage* inst);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
#endif /* _ASHTTP_ */
|
||||
|
||||
12
Logical/Libraries/AsHttp/binary.lby
Normal file
12
Logical/Libraries/AsHttp/binary.lby
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?AutomationStudio FileVersion="4.9"?>
|
||||
<Library SubType="binary" Description="This library contains FBKs for exchanging and formatting data (message based) via HTTP (TCP)." xmlns="http://br-automation.co.at/AS/Library">
|
||||
<Files>
|
||||
<File>AsHttp.fun</File>
|
||||
<File>AsHttp.typ</File>
|
||||
<File>AsHttp.var</File>
|
||||
</Files>
|
||||
<Dependencies>
|
||||
<Dependency ObjectName="runtime" />
|
||||
</Dependencies>
|
||||
</Library>
|
||||
@@ -16,5 +16,6 @@
|
||||
<Object Type="Library" Language="binary" Description="This library contains FBKs for sending email over an SMTP (Simple Mail Transfer Protocol) server.">AsSMTP</Object>
|
||||
<Object Type="Library" Language="binary" Description="The AsString Library contains FBKs for memory and character string handling.">asstring</Object>
|
||||
<Object Type="Library" Language="binary" Description="This library integrates mathematical functions such as angle functions, rounding off, etc. into the program.">AsBrMath</Object>
|
||||
<Object Type="Library" Language="binary" Description="This library contains FBKs for exchanging and formatting data (message based) via HTTP (TCP).">AsHttp</Object>
|
||||
</Objects>
|
||||
</Package>
|
||||
@@ -23,6 +23,7 @@
|
||||
;"", 4, 7, "ConMon:AirValues.iTemperature3", 0002, 0001
|
||||
;"", 4, 7, "ConMon:AirValues.iHumidity3", 0001, 0001
|
||||
"", 4, 8, "ConMon:AirValues.iAirPreassure", 0020, 0001
|
||||
"", 4, 8, "ConMon:AirValues.iBaroPreassure", 0021, 0001
|
||||
"", 4, 8, "ConMon:AirValues.iDiffPreassure", 0022, 0001
|
||||
;In M26
|
||||
"", 4, 9, "ConMon:AirValues.iParticle25d", 0016, 0001
|
||||
|
||||
@@ -53,15 +53,17 @@ PROGRAM _CYCLIC
|
||||
Environment.rTemperature2 := INT_TO_REAL (AirValues.iTemperature2) * 0.1;
|
||||
Environment.rHumidity1 := INT_TO_REAL (AirValues.iHumidity1) * 0.1;
|
||||
Environment.rHumidity2 := INT_TO_REAL (AirValues.iHumidity2) * 0.1;
|
||||
Environment.rAirPreasure := INT_TO_REAL (AirValues.iAirPreassure);
|
||||
Environment.rAirPreasure := INT_TO_REAL (AirValues.iBaroPreassure); //Barometrischen Luftdruck verwenden
|
||||
Environment.rDiffPreassure := - INT_TO_REAL (AirValues.iDiffPreassure) * 0.1;
|
||||
gLogValue := Environment;
|
||||
END_IF
|
||||
END_CASE;
|
||||
|
||||
|
||||
//===================================
|
||||
IF (Environment.iParticle25 > gLimits.iParticle25) OR
|
||||
//===================================
|
||||
//Werte nicht Ok
|
||||
//Partikelanzahl <EFBFBD>berschritten
|
||||
blTempNOk := (Environment.iParticle25 > gLimits.iParticle25) OR
|
||||
(Environment.iParticle10 > gLimits.iParticle10) OR
|
||||
(Environment.iParticle25a > gLimits.iParticle25) OR
|
||||
(Environment.iParticle10a > gLimits.iParticle10) OR
|
||||
@@ -70,36 +72,73 @@ PROGRAM _CYCLIC
|
||||
(Environment.iParticle25c > gLimits.iParticle25) OR
|
||||
(Environment.iParticle10c > gLimits.iParticle10) OR
|
||||
(Environment.iParticle25d > gLimits.iParticle25) OR
|
||||
(Environment.iParticle10d > gLimits.iParticle10) OR
|
||||
(Environment.rDiffPreassure < gLimits.rDiffPreassure) THEN
|
||||
|
||||
(Environment.iParticle10d > gLimits.iParticle10);
|
||||
FUBs.TOFParticleNOk.PT := t#2s; //Kurze verbesserung ignorieren
|
||||
FUBs.TOFParticleNOk.IN := blTempNOk;
|
||||
FUBs.TOFParticleNOk ();
|
||||
FUBs.TONParticleNOK.PT := t#60s;
|
||||
FUBs.TONParticleNOK.IN := FUBs.TOFParticleNOk.Q;
|
||||
FUBs.TONParticleNOK ();
|
||||
|
||||
//Luftdruck zu gering
|
||||
FUBs.TOFPreassureNOK.PT := t#3s;
|
||||
FUBs.TOFPreassureNOK.IN := (Environment.rDiffPreassure < gLimits.rDiffPreassure);
|
||||
FUBs.TOFPreassureNOK ();
|
||||
FUBs.TONPreassureNOK.IN := FUBs.TOFPreassureNOK.Q;
|
||||
FUBs.TONPreassureNOK.PT := t#90s;
|
||||
FUBs.TONPreassureNOK ();
|
||||
|
||||
IF FUBs.TONParticleNOK.Q OR FUBs.TONPreassureNOK.Q THEN
|
||||
Status.bAirNOk := TRUE;
|
||||
END_IF
|
||||
//Meldungen Senden
|
||||
IF EDGEPOS (Status.bAirNOk) THEN
|
||||
gMailCmd.bSendAirNok := TRUE;
|
||||
gTweetCmd.bSendAirNok := TRUE;
|
||||
END_IF
|
||||
|
||||
VC_Ctrl.usDisablesVCs.0 := FALSE; //Hide disabled VCs
|
||||
|
||||
//Werte Ok
|
||||
FUBs.TOFParticleOk.PT := t#1s;
|
||||
FUBs.TOFParticleOk.IN := (Environment.iParticle25 < gLimits.iParticle25) AND
|
||||
(Environment.iParticle10 < gLimits.iParticle10) AND
|
||||
(Environment.iParticle25a < gLimits.iParticle25) AND
|
||||
(Environment.iParticle10a < gLimits.iParticle10) AND
|
||||
(Environment.iParticle25b < gLimits.iParticle25) AND
|
||||
(Environment.iParticle10b < gLimits.iParticle10) AND
|
||||
(Environment.iParticle25c < gLimits.iParticle25) AND
|
||||
(Environment.iParticle10c < gLimits.iParticle10) AND
|
||||
(Environment.iParticle25d < gLimits.iParticle25) AND
|
||||
(Environment.iParticle10d < gLimits.iParticle10);
|
||||
FUBs.TOFParticleOk ();
|
||||
|
||||
FUBs.TONParticleOK.PT := t#10s;
|
||||
FUBs.TONParticleOK.IN := FUBs.TOFParticleOk.Q;
|
||||
FUBs.TONParticleOK ();
|
||||
|
||||
FUBs.TOFPreassureOK.PT := t#4s;
|
||||
FUBs.TOFPreassureOK.IN := (Environment.rDiffPreassure > gLimits.rDiffPreassure);
|
||||
FUBs.TOFPreassureOK ();
|
||||
FUBs.TONPreassureOK.PT := t#10s;
|
||||
FUBs.TONPreassureOK.IN := FUBs.TOFPreassureOK.Q;
|
||||
FUBs.TONPreassureOK ();
|
||||
|
||||
VC_Ctrl.ResetError.usStatus.0 := NOT Status.bAirNOk;
|
||||
VC_Ctrl.ResetError.usStatus.1 := (Environment.iParticle25 >= gLimits.iParticle25) OR
|
||||
(Environment.iParticle10 >= gLimits.iParticle10) OR
|
||||
(Environment.iParticle25a >= gLimits.iParticle25) OR
|
||||
(Environment.iParticle10a >= gLimits.iParticle10) OR
|
||||
(Environment.iParticle25b >= gLimits.iParticle25) OR
|
||||
(Environment.iParticle10b >= gLimits.iParticle10) OR
|
||||
(Environment.iParticle25c >= gLimits.iParticle25) OR
|
||||
(Environment.iParticle10c >= gLimits.iParticle10) OR
|
||||
(Environment.iParticle25d >= gLimits.iParticle25) OR
|
||||
(Environment.iParticle10d >= gLimits.iParticle10) OR
|
||||
(Environment.rDiffPreassure <= gLimits.rDiffPreassure);
|
||||
|
||||
IF EDGEPOS (VC_Ctrl.ResetError.usStatus.1) THEN
|
||||
//Bedienen sperren wenn nicht alles Ok
|
||||
VC_Ctrl.ResetError.usStatus.1 := NOT FUBs.TONParticleOK.Q OR NOT FUBs.TONPreassureOK.Q;
|
||||
|
||||
//Werte wieder Ok Meldung senden
|
||||
IF EDGEPOS (VC_Ctrl.ResetError.usStatus.1) AND Status.bAirNOk THEN
|
||||
gMailCmd.bSendAirOk := TRUE;
|
||||
gTweetCmd.bSendAirOk := TRUE;
|
||||
END_IF
|
||||
|
||||
|
||||
IF EDGEPOS (VC_Ctrl.ResetError.bCommand) THEN
|
||||
Status.bAirNOk := FALSE;
|
||||
gMailCmd.bSendAirOkAck := TRUE;
|
||||
gTweetCmd.bSendAirOkAck := TRUE;
|
||||
END_IF
|
||||
|
||||
//Ausg<EFBFBD>nge
|
||||
|
||||
@@ -8,6 +8,14 @@ TYPE
|
||||
MBMOpen : MBMOpen; (*Modbusschnittstelle <20>ffnen*)
|
||||
MBMMaster : MBMaster; (*Modbusschnittstelle Master*)
|
||||
MBMClose : MBMClose; (*Modbusschnittstelle Schlie<69>en*)
|
||||
TONPreassureNOK : TON;
|
||||
TOFPreassureNOK : TON;
|
||||
TOFPreassureOK : TOF;
|
||||
TONPreassureOK : TON;
|
||||
TONParticleNOK : TON;
|
||||
TOFParticleNOk : TOF;
|
||||
TONParticleOK : TON;
|
||||
TOFParticleOk : TOF;
|
||||
END_STRUCT;
|
||||
typ_enAirComm :
|
||||
( (*Schrittkette*)
|
||||
@@ -36,10 +44,12 @@ TYPE
|
||||
iHumidity3 : INT; (*Luftfeuchter 0.1 % (Ueber M26)*)
|
||||
iHumidity4 : INT; (*Luftfeuchter 0.1 % (In M26)*)
|
||||
iAirPreassure : INT; (*Differenzdruck mbar (Generell)*)
|
||||
iBaroPreassure : INT; (*Differenzdruck mbar (Generell)*)
|
||||
iDiffPreassure : INT; (*Differenzdruck 0.1 Pa (Generell)*)
|
||||
END_STRUCT;
|
||||
typ_VCCtrl : STRUCT
|
||||
ResetError : gtyp_VCButton;
|
||||
usDisablesVCs : USINT;
|
||||
END_STRUCT;
|
||||
END_TYPE
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
VAR
|
||||
blTempOk : BOOL;
|
||||
blTempNOk : BOOL;
|
||||
Status : typ_Status; (*Status*)
|
||||
Environment : gtyp_Environment; (*Umgebungsvariablen*)
|
||||
AirValues : typ_AirValues; (*Werte von Klimaanlage*)
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
|
||||
TYPE
|
||||
gtyp_TweetCmd : STRUCT
|
||||
bSendAirNok : BOOL;
|
||||
bSendAirOk : BOOL;
|
||||
bSendAirOkAck : BOOL;
|
||||
END_STRUCT;
|
||||
gtyp_MailCmd : STRUCT
|
||||
bSendLogfile : BOOL;
|
||||
bSendAirNok : BOOL;
|
||||
|
||||
@@ -4,4 +4,5 @@ END_VAR
|
||||
VAR
|
||||
gLogValue : gtyp_Environment; (*Logwerte*)
|
||||
gMailCmd : gtyp_MailCmd;
|
||||
gTweetCmd : gtyp_TweetCmd;
|
||||
END_VAR
|
||||
|
||||
@@ -7,5 +7,6 @@
|
||||
<Object Type="Program" Language="IEC" Description="Anlagenzustand">ConMon</Object>
|
||||
<Object Type="DataObject" Language="Simple" Description="Modbusdaten CDE Klimaanlage">AIRConf</Object>
|
||||
<Object Type="Program" Language="IEC" Description="Mail verschicken">SendMail</Object>
|
||||
<Object Type="Program" Language="IEC">PushNot</Object>
|
||||
</Objects>
|
||||
</Package>
|
||||
52
Logical/Machine/PushNot/Cyclic.st
Normal file
52
Logical/Machine/PushNot/Cyclic.st
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
PROGRAM _CYCLIC
|
||||
|
||||
//Nachricht vorbereiten
|
||||
IF NOT FUBs.HttpsClient.send THEN
|
||||
brsmemset (ADR (sJSON), 0, SIZEOF (sJSON));
|
||||
sJSON := CONCAT('token=', sAPIKEY);
|
||||
sJSON := CONCAT(sJSON, '&user=');
|
||||
sJSON := CONCAT(sJSON, sUSERKEY);
|
||||
sJSON := CONCAT(sJSON, '&html=1');
|
||||
sJSON := CONCAT(sJSON, '&message=');
|
||||
|
||||
IF gTweetCmd.bSendAirNok THEN
|
||||
sJSON := CONCAT(sJSON, '<font color="#ff0000">Max. Anzahl Partikel ueberschritten oder Druck zu gering - Produktion gestoppt</font>');
|
||||
sJSON := CONCAT(sJSON, '&title=Pliessnig-Sauberraum Luft NOK');
|
||||
FUBs.HttpsClient.send := TRUE;
|
||||
gTweetCmd.bSendAirNok := FALSE;
|
||||
ELSIF gTweetCmd.bSendAirOk THEN
|
||||
sJSON := CONCAT(sJSON, '<font color="#ffff00">Max. Anzahl Partikel wieder unterschritten und Druck Ok</font>');
|
||||
sJSON := CONCAT(sJSON, '&title=Pliessnig-Sauberraum Luft OK');
|
||||
FUBs.HttpsClient.send := TRUE;
|
||||
gTweetCmd.bSendAirOk := FALSE;
|
||||
ELSIF gTweetCmd.bSendAirOkAck THEN
|
||||
sJSON := CONCAT(sJSON, '<font color="#00ff00">Max. Anzahl Partikel und Druck Ok und quitiert (Produktion freigegeben)</font>');
|
||||
sJSON := CONCAT(sJSON, '&title=Pliessnig-Sauberraum Produktion Freigabe');
|
||||
FUBs.HttpsClient.send := TRUE;
|
||||
gTweetCmd.bSendAirOkAck := FALSE;
|
||||
END_IF
|
||||
END_IF
|
||||
|
||||
//HTTPS Client einrichten
|
||||
FUBs.HttpsClient.enable := TRUE;
|
||||
FUBs.HttpsClient.option := httpOPTION_HTTP_11;
|
||||
FUBs.HttpsClient.pHost := ADR (sHOST);
|
||||
FUBs.HttpsClient.pUri := ADR (sURi);
|
||||
FUBs.HttpsClient.method := httpMETHOD_POST;
|
||||
FUBs.HttpsClient.pRequestData := ADR (sJSON);
|
||||
FUBs.HttpsClient.requestDataLen := LEN (sJSON);
|
||||
FUBs.HttpsClient.pResponseData := ADR (sRESPONSE);
|
||||
FUBs.HttpsClient.responseDataSize := SIZEOF (sRESPONSE);
|
||||
FUBs.HttpsClient.pRequestHeader := ADR (RequestHeader);
|
||||
|
||||
|
||||
|
||||
FUBs.HttpsClient ();
|
||||
IF (FUBs.HttpsClient.status = ERR_OK) THEN
|
||||
FUBs.HttpsClient.send := FALSE;
|
||||
ELSIF (FUBs.HttpsClient.status < ERR_FUB_BUSY) AND
|
||||
(FUBs.HttpsClient.status > ERR_OK) THEN
|
||||
FUBs.HttpsClient.send := FALSE;
|
||||
END_IF
|
||||
END_PROGRAM
|
||||
6
Logical/Machine/PushNot/Exit.st
Normal file
6
Logical/Machine/PushNot/Exit.st
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
PROGRAM _EXIT
|
||||
(* Insert code here *)
|
||||
|
||||
END_PROGRAM
|
||||
11
Logical/Machine/PushNot/IEC.prg
Normal file
11
Logical/Machine/PushNot/IEC.prg
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?AutomationStudio FileVersion="4.9"?>
|
||||
<Program SubType="IEC" xmlns="http://br-automation.co.at/AS/Program">
|
||||
<Files>
|
||||
<File Description="Cyclic code">Cyclic.st</File>
|
||||
<File Description="Init code">Init.st</File>
|
||||
<File Description="Exit code">Exit.st</File>
|
||||
<File Description="Local data types" Private="true">Types.typ</File>
|
||||
<File Description="Local variables" Private="true">Variables.var</File>
|
||||
</Files>
|
||||
</Program>
|
||||
18
Logical/Machine/PushNot/Init.st
Normal file
18
Logical/Machine/PushNot/Init.st
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
PROGRAM _INIT
|
||||
sHOST := '104.20.9.236'; //api.pushover.net
|
||||
sURi := '/1/messages.json';
|
||||
sUSERKEY := 'gdtd1yk2g7pjozvuxkk9jwkejbtnr7'; //Gruppe Pliessnigg
|
||||
sAPIKEY := 'au2jy41if349o5q6q4k9ehjjgg79e2'; // Application Pliessnigg
|
||||
|
||||
//Webhook Test
|
||||
//sHOST := '178.63.67.153';
|
||||
//sURi := '/772bde39-be80-491b-9682-4ce396830399';
|
||||
|
||||
RequestHeader.contentType := 'application/x-www-form-urlencoded';
|
||||
RequestHeader.protocol := 'HTTP/1.1';
|
||||
RequestHeader.host := 'api.pushover.net';
|
||||
|
||||
|
||||
END_PROGRAM
|
||||
6
Logical/Machine/PushNot/Types.typ
Normal file
6
Logical/Machine/PushNot/Types.typ
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
TYPE
|
||||
typ_FUBs : STRUCT
|
||||
HttpsClient : httpsClient;
|
||||
END_STRUCT;
|
||||
END_TYPE
|
||||
10
Logical/Machine/PushNot/Variables.var
Normal file
10
Logical/Machine/PushNot/Variables.var
Normal file
@@ -0,0 +1,10 @@
|
||||
VAR
|
||||
FUBs : typ_FUBs;
|
||||
sHOST : STRING[80] := 'api.pushover.net'; (*URL Pushover*)
|
||||
sURi : STRING[80] := '/1/messages.json'; (*URL Pushover*)
|
||||
sUSERKEY : STRING[80] := 'gdtd1yk2g7pjozvuxkk9jwkejbtnr7'; (*User / Gruppen Key*)
|
||||
sAPIKEY : STRING[80] := 'au2jy41if349o5q6q4k9ehjjgg79e2'; (*API Key*)
|
||||
sJSON : STRING[254];
|
||||
sRESPONSE : STRING[250];
|
||||
RequestHeader : {REDUND_UNREPLICABLE} httpRequestHeader_t;
|
||||
END_VAR
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
PROGRAM _INIT
|
||||
|
||||
//SmptData smtp-relay.sendinblue.com
|
||||
SmtpData.sSmtpServer := '185.107.232.248';//'52.98.175.2'; //'smtp.office365.com';
|
||||
//SmptData smtp-relay.brevo.com
|
||||
SmtpData.sSmtpServer := '1.179.115.1';//'52.98.175.2'; //'smtp.office365.com';
|
||||
SmtpData.sUser := 'mr@kerschdorfer-maschinenbau.de';
|
||||
SmtpData.sPassword := '8yt32gs1khBTPI0D';
|
||||
SmtpData.sSendername := 'pliessnig@kerschdorfer-maschinenbau.de';
|
||||
|
||||
@@ -250,8 +250,8 @@
|
||||
<Property Name="DPLimit" Value="Default"/>
|
||||
<Property Name="Description" Value=""/>
|
||||
<Property Name="PLCType" Value="REAL"/>
|
||||
<Property Name="PLCUnit" Value="Source[relative:UnitGroup].Unit[Pascal]"/>
|
||||
<Property Name="UnitGroup" Value="Source[global].UnitGroup[Pressure]"/>
|
||||
<Property Name="PLCUnit" Value="Default"/>
|
||||
<Property Name="UnitGroup" Value="Source[global].UnitGroup[PressureMBar]"/>
|
||||
<Property Name="UpdateTime" Value="Default"/>
|
||||
<Property Name="UserID" Value="None"/>
|
||||
<Property Name="VCType" Value="SCALED"/>
|
||||
@@ -282,6 +282,15 @@
|
||||
<Property Name="VCType" Value="BOOL"/>
|
||||
</DataPoint>
|
||||
</Folder>
|
||||
<DataPoint Name="usDisablesVCs">
|
||||
<Property Name="ConnectedBySharedResource" Value="False"/>
|
||||
<Property Name="ConnectingVisus" Value="Visu"/>
|
||||
<Property Name="Description" Value=""/>
|
||||
<Property Name="PLCType" Value="USINT"/>
|
||||
<Property Name="UpdateTime" Value="Default"/>
|
||||
<Property Name="UserID" Value="None"/>
|
||||
<Property Name="VCType" Value="INTEGER"/>
|
||||
</DataPoint>
|
||||
</Folder>
|
||||
</Folder>
|
||||
<Folder Name="gLimits">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<Project xmlns="http://br-automation.co.at/AS/VC/Project">
|
||||
<Property Name="EnableEvents" Value="False"/>
|
||||
<Property Name="SharedTargetResourceRoot" Value=""/>
|
||||
<Property Name="TextIDMax" Value="95353"/>
|
||||
<Property Name="TextIDMax" Value="95553"/>
|
||||
<SourceFiles>
|
||||
<Source File="Languages.vcr"/>
|
||||
<Source File="TextGroups\AlarmAcknowledgeState.txtgrp"/>
|
||||
@@ -21,6 +21,7 @@
|
||||
<Source File="UnitGroups\Temperatures.vcug"/>
|
||||
<Source File="UnitGroups\Particle.vcug"/>
|
||||
<Source File="UnitGroups\Humidity.vcug"/>
|
||||
<Source File="UnitGroups\PressureMBar.vcug"/>
|
||||
<Source File="AlarmGroups\AlarmSystem.alcfg"/>
|
||||
<Source File="AlarmGroups\SystemAlarms.algrp"/>
|
||||
<Source File="DataSources\Internal.dso"/>
|
||||
|
||||
146
Logical/VCShared/UnitGroups/PressureMBar.vcug
Normal file
146
Logical/VCShared/UnitGroups/PressureMBar.vcug
Normal file
@@ -0,0 +1,146 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?AutomationStudio Version="4.11.4.55 SP"?>
|
||||
<UnitGroup xmlns="http://br-automation.co.at/AS/VC/Project" Name="PressureMBar">
|
||||
<Property Name="DefaultDisplayUnit" Value="Source[embedded].Unit[Millibar]"/>
|
||||
<Property Name="DefaultLimit" Value="None"/>
|
||||
<Property Name="DefaultPLCUnit" Value="Source[embedded].Unit[Millibar]"/>
|
||||
<Property Name="Description" Value="Unit group for pressure"/>
|
||||
<Property Name="InternalUnitTextIndex" Value="0"/>
|
||||
<Property Name="RuntimeUnitChange" Value="None"/>
|
||||
<Property Name="RuntimeUnitCurrentDatapoint" Value="None"/>
|
||||
<TextGroup Name="TextGroup_1">
|
||||
<Property Name="Description" Value=""/>
|
||||
<Property Name="Index" Value="65536"/>
|
||||
<TextSnippets/>
|
||||
<TextLayer LanguageId="de">
|
||||
<Text ID="95539" Value="Bar"/>
|
||||
<Text ID="95540" Value="bar"/>
|
||||
<Text ID="95541" Value=""/>
|
||||
<Text ID="95542" Value=""/>
|
||||
<Text ID="95543" Value="Millibar"/>
|
||||
<Text ID="95544" Value="mbar"/>
|
||||
<Text ID="95545" Value="Mikrobar"/>
|
||||
<Text ID="95546" Value="µbar"/>
|
||||
<Text ID="95547" Value="Pascal"/>
|
||||
<Text ID="95548" Value="Pa"/>
|
||||
<Text ID="95549" Value="Kilopascal"/>
|
||||
<Text ID="95550" Value="kPa"/>
|
||||
<Text ID="95551" Value="Megapascal"/>
|
||||
<Text ID="95552" Value="MPa"/>
|
||||
<Text ID="95553" Value="Pascal"/>
|
||||
</TextLayer>
|
||||
<IndexMap>
|
||||
<Index ID="95539" Value="1"/>
|
||||
<Index ID="95540" Value="2"/>
|
||||
<Index ID="95541" Value="3"/>
|
||||
<Index ID="95542" Value="4"/>
|
||||
<Index ID="95543" Value="5"/>
|
||||
<Index ID="95544" Value="6"/>
|
||||
<Index ID="95545" Value="7"/>
|
||||
<Index ID="95546" Value="8"/>
|
||||
<Index ID="95547" Value="9"/>
|
||||
<Index ID="95548" Value="10"/>
|
||||
<Index ID="95549" Value="11"/>
|
||||
<Index ID="95550" Value="12"/>
|
||||
<Index ID="95551" Value="13"/>
|
||||
<Index ID="95552" Value="14"/>
|
||||
<Index ID="95553" Value="0"/>
|
||||
</IndexMap>
|
||||
</TextGroup>
|
||||
<Units>
|
||||
<Unit ClassId="0x00000602" Name="Bar">
|
||||
<Property Name="DefaultPrecisionDatapoint" Value="None"/>
|
||||
<Property Name="Description" Value=""/>
|
||||
<Property Name="Factor" Value="0.00001"/>
|
||||
<Property Name="Index" Value="4"/>
|
||||
<Property Name="Offset" Value="0"/>
|
||||
<Property Name="Text_Abbreviation_TextGroup" Value="None"/>
|
||||
<Property Name="Text_Abbreviation_TextIndex" Value="2"/>
|
||||
<Property Name="Text_Description_TextGroup" Value="None"/>
|
||||
<Property Name="Text_Description_TextIndex" Value="1"/>
|
||||
<Property Name="UnitFraction" Value="False"/>
|
||||
<Property Name="Unit_DefaultPrecision" Value="6"/>
|
||||
</Unit>
|
||||
<Unit ClassId="0x00000603" Name="PLCUnit">
|
||||
<Property Name="DefaultPrecisionDatapoint" Value="None"/>
|
||||
<Property Name="Description" Value=""/>
|
||||
<Property Name="Index" Value="0"/>
|
||||
<Property Name="Text_Abbreviation_TextGroup" Value="None"/>
|
||||
<Property Name="Text_Abbreviation_TextIndex" Value="4"/>
|
||||
<Property Name="Text_Description_TextGroup" Value="None"/>
|
||||
<Property Name="Text_Description_TextIndex" Value="3"/>
|
||||
<Property Name="UnitFraction" Value="False"/>
|
||||
<Property Name="Unit_DefaultPrecision" Value="2"/>
|
||||
<Property Name="Value[0].Internal" Value="0"/>
|
||||
<Property Name="Value[0].Scaled" Value="0"/>
|
||||
<Property Name="Value[1].Internal" Value="1"/>
|
||||
<Property Name="Value[1].Scaled" Value="1"/>
|
||||
</Unit>
|
||||
<Unit ClassId="0x00000602" Name="Millibar">
|
||||
<Property Name="DefaultPrecisionDatapoint" Value="None"/>
|
||||
<Property Name="Description" Value=""/>
|
||||
<Property Name="Factor" Value="0.01"/>
|
||||
<Property Name="Index" Value="5"/>
|
||||
<Property Name="Offset" Value="0"/>
|
||||
<Property Name="Text_Abbreviation_TextGroup" Value="None"/>
|
||||
<Property Name="Text_Abbreviation_TextIndex" Value="6"/>
|
||||
<Property Name="Text_Description_TextGroup" Value="None"/>
|
||||
<Property Name="Text_Description_TextIndex" Value="5"/>
|
||||
<Property Name="UnitFraction" Value="False"/>
|
||||
<Property Name="Unit_DefaultPrecision" Value="4"/>
|
||||
</Unit>
|
||||
<Unit ClassId="0x00000602" Name="Microbar">
|
||||
<Property Name="DefaultPrecisionDatapoint" Value="None"/>
|
||||
<Property Name="Description" Value=""/>
|
||||
<Property Name="Factor" Value="10"/>
|
||||
<Property Name="Index" Value="6"/>
|
||||
<Property Name="Offset" Value="0"/>
|
||||
<Property Name="Text_Abbreviation_TextGroup" Value="None"/>
|
||||
<Property Name="Text_Abbreviation_TextIndex" Value="8"/>
|
||||
<Property Name="Text_Description_TextGroup" Value="None"/>
|
||||
<Property Name="Text_Description_TextIndex" Value="7"/>
|
||||
<Property Name="UnitFraction" Value="False"/>
|
||||
<Property Name="Unit_DefaultPrecision" Value="2"/>
|
||||
</Unit>
|
||||
<Unit ClassId="0x00000602" Name="Pascal">
|
||||
<Property Name="DefaultPrecisionDatapoint" Value="None"/>
|
||||
<Property Name="Description" Value=""/>
|
||||
<Property Name="Factor" Value="1"/>
|
||||
<Property Name="Index" Value="1"/>
|
||||
<Property Name="Offset" Value="0"/>
|
||||
<Property Name="Text_Abbreviation_TextGroup" Value="None"/>
|
||||
<Property Name="Text_Abbreviation_TextIndex" Value="10"/>
|
||||
<Property Name="Text_Description_TextGroup" Value="None"/>
|
||||
<Property Name="Text_Description_TextIndex" Value="9"/>
|
||||
<Property Name="UnitFraction" Value="False"/>
|
||||
<Property Name="Unit_DefaultPrecision" Value="2"/>
|
||||
</Unit>
|
||||
<Unit ClassId="0x00000602" Name="KiloPascal">
|
||||
<Property Name="DefaultPrecisionDatapoint" Value="None"/>
|
||||
<Property Name="Description" Value=""/>
|
||||
<Property Name="Factor" Value="0.001"/>
|
||||
<Property Name="Index" Value="2"/>
|
||||
<Property Name="Offset" Value="0"/>
|
||||
<Property Name="Text_Abbreviation_TextGroup" Value="None"/>
|
||||
<Property Name="Text_Abbreviation_TextIndex" Value="12"/>
|
||||
<Property Name="Text_Description_TextGroup" Value="None"/>
|
||||
<Property Name="Text_Description_TextIndex" Value="11"/>
|
||||
<Property Name="UnitFraction" Value="False"/>
|
||||
<Property Name="Unit_DefaultPrecision" Value="5"/>
|
||||
</Unit>
|
||||
<Unit ClassId="0x00000602" Name="MegaPascal">
|
||||
<Property Name="DefaultPrecisionDatapoint" Value="None"/>
|
||||
<Property Name="Description" Value=""/>
|
||||
<Property Name="Factor" Value="0.000001"/>
|
||||
<Property Name="Index" Value="3"/>
|
||||
<Property Name="Offset" Value="0"/>
|
||||
<Property Name="Text_Abbreviation_TextGroup" Value="None"/>
|
||||
<Property Name="Text_Abbreviation_TextIndex" Value="14"/>
|
||||
<Property Name="Text_Description_TextGroup" Value="None"/>
|
||||
<Property Name="Text_Description_TextIndex" Value="13"/>
|
||||
<Property Name="UnitFraction" Value="False"/>
|
||||
<Property Name="Unit_DefaultPrecision" Value="7"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
<Limits/>
|
||||
</UnitGroup>
|
||||
@@ -675,8 +675,9 @@
|
||||
<Property Name="MaxDatapoint" Value="None"/>
|
||||
<Property Name="MaxValue" Value="500"/>
|
||||
<Property Name="MinDatapoint" Value="None"/>
|
||||
<Property Name="MinValue" Value="0.5"/>
|
||||
<Property Name="MinValue" Value="0"/>
|
||||
<Property Name="SimulationValue" Value="0"/>
|
||||
<Property Name="StatusDatapoint" Value="Source[global].Variable[DataSource.Machine.ConMon.VC_Ctrl.usDisablesVCs]"/>
|
||||
<Property Name="StyleClass" Value="Source[relative:StyleGroup].StyleClass[Output]"/>
|
||||
<Property Name="TeachDatapoint" Value="None"/>
|
||||
<Property Name="Top" Value="120"/>
|
||||
@@ -698,6 +699,7 @@
|
||||
<Property Name="Left" Value="1420"/>
|
||||
<Property Name="SimulationIndex" Value="0"/>
|
||||
<Property Name="SimulationValue" Value=""/>
|
||||
<Property Name="StatusDatapoint" Value="Source[global].Variable[DataSource.Machine.ConMon.VC_Ctrl.usDisablesVCs]"/>
|
||||
<Property Name="StyleClass" Value="Source[relative:StyleGroup].StyleClass[Text]"/>
|
||||
<Property Name="TextGroup" Value="Source[embedded].TextGroup"/>
|
||||
<Property Name="TextIndexOffset" Value="12"/>
|
||||
@@ -746,6 +748,7 @@
|
||||
<Property Name="Width" Value="150"/>
|
||||
</Control>
|
||||
<Control ClassId="0x00001007" Name="numPart20cAct2">
|
||||
<Property Name="AddFractionDigits" Value="-4"/>
|
||||
<Property Name="ControlID" Value="0"/>
|
||||
<Property Name="Description" Value=""/>
|
||||
<Property Name="Font" Value="Source[local].Font[Aria20pxBold]"/>
|
||||
@@ -755,8 +758,9 @@
|
||||
<Property Name="MaxDatapoint" Value="None"/>
|
||||
<Property Name="MaxValue" Value="None"/>
|
||||
<Property Name="MinDatapoint" Value="None"/>
|
||||
<Property Name="MinIntegerDigits" Value="0"/>
|
||||
<Property Name="MinValue" Value="None"/>
|
||||
<Property Name="SimulationValue" Value="0"/>
|
||||
<Property Name="SimulationValue" Value="100000"/>
|
||||
<Property Name="StyleClass" Value="Source[relative:StyleGroup].StyleClass[Output]"/>
|
||||
<Property Name="TeachDatapoint" Value="None"/>
|
||||
<Property Name="Top" Value="180"/>
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
</TaskClass>
|
||||
<TaskClass Name="Cyclic#2" />
|
||||
<TaskClass Name="Cyclic#3" />
|
||||
<TaskClass Name="Cyclic#4" />
|
||||
<TaskClass Name="Cyclic#4">
|
||||
<Task Name="PushNot" Source="Machine.PushNot.prg" Memory="UserROM" Language="IEC" Debugging="true" />
|
||||
</TaskClass>
|
||||
<TaskClass Name="Cyclic#5" />
|
||||
<TaskClass Name="Cyclic#6" />
|
||||
<TaskClass Name="Cyclic#7" />
|
||||
@@ -74,5 +76,6 @@
|
||||
<LibraryObject Name="vcresman" Source="" Memory="UserROM" Language="Binary" Debugging="true" />
|
||||
<LibraryObject Name="asstring" Source="Libraries.asstring.lby" Memory="UserROM" Language="binary" Debugging="true" />
|
||||
<LibraryObject Name="AsBrMath" Source="Libraries.AsBrMath.lby" Memory="UserROM" Language="binary" Debugging="true" />
|
||||
<LibraryObject Name="AsHttp" Source="Libraries.AsHttp.lby" Memory="UserROM" Language="binary" Debugging="true" />
|
||||
</Libraries>
|
||||
</SwConfiguration>
|
||||
Reference in New Issue
Block a user