{"id":964,"date":"2020-05-19T16:22:37","date_gmt":"2020-05-19T14:22:37","guid":{"rendered":"https:\/\/www.rocworks.at\/wordpress\/?p=964"},"modified":"2020-05-20T06:40:04","modified_gmt":"2020-05-20T04:40:04","slug":"generate-qr-code-image-in-wincc-oa","status":"publish","type":"post","link":"https:\/\/www.rocworks.at\/wordpress\/?p=964","title":{"rendered":"Generate QR Code Image in WinCC OA &#8230;"},"content":{"rendered":"\n<p>Add a label object into your screen and add some lines of code to get a QR image. In this example a mobile phone app will scan the QR code and send username and password via a GraphQL server to WinCC OA and set it on datapoints (username and password should additionally be encrypted).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#uses \"CtrlQRCode\"\n\nstring g_code;\n\nmain()\n{\n  g_code = createUuid();\n  strreplace(g_code,\"{\", \"\");\n  strreplace(g_code,\"}\", \"\");\n  DebugTN(g_code);\n\n  string fpath = PROJ_PATH+\"\/pictures\/\";\n  string fname = \"login_qr_code_\"+myUiNumber();\n  int ret = createQRCodeFile(g_code, fpath+fname);\n  this.image=fname+\".png\";\n\n  dpConnect(\"work\", false, \"QRLogin.code\", \"QRLogin.usr\", \"QRLogin.pwd\");\n}\n\nvoid work(string dp, string code, string dp1, string usr, string dp2, string pwd)\n{\n  if (code == g_code)\n  {\n    setInputFocus(myModuleName(), myPanelName(), txt_username.name());\n    txt_username.text = usr;\n    setInputFocus(myModuleName(), myPanelName(), txt_password.name());\n    txt_password.text = pwd;\n    m_loginFrameworkController.doContinue();\n  }\n}<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"807\" src=\"https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2020\/05\/OA-Logon-QR-Code-1024x807.png\" alt=\"\" class=\"wp-image-965\" srcset=\"https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2020\/05\/OA-Logon-QR-Code-1024x807.png 1024w, https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2020\/05\/OA-Logon-QR-Code-300x237.png 300w, https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2020\/05\/OA-Logon-QR-Code-768x605.png 768w, https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2020\/05\/OA-Logon-QR-Code.png 1035w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Add a label object into your screen and add some lines of code to get a QR image. In this example a mobile phone app will scan the QR code and send username and password via a GraphQL server to WinCC OA and set it on datapoints (username and password should additionally be encrypted).<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[26],"class_list":["post-964","post","type-post","status-publish","format-standard","hentry","category-wincc-oa","tag-wincc-oa"],"_links":{"self":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/964","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=964"}],"version-history":[{"count":2,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/964\/revisions"}],"predecessor-version":[{"id":967,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/964\/revisions\/967"}],"wp:attachment":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=964"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=964"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}