{"id":2317,"date":"2017-09-26T11:40:51","date_gmt":"2017-09-26T11:40:51","guid":{"rendered":"http:\/\/www.bardecode.com\/en1\/?p=2317"},"modified":"2017-09-26T11:40:51","modified_gmt":"2017-09-26T11:40:51","slug":"detect-scan-time-linux","status":"publish","type":"post","link":"https:\/\/www.bardecode.com\/en1\/detect-scan-time-linux\/","title":{"rendered":"How to detect a scan time out on Linux"},"content":{"rendered":"<p>The default time out for the scan of a page on Linux is 5000ms, but how can you detect if a time out has occurred?<\/p>\n<p>The following snippet of C code can be used in bardecode.c at the end of the main function&#8230;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint16 t;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 STGetParameter(hBarcode, ST_DID_TIMEOUT, &#038;t) ;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (t)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 printf (&#8220;Scan timed out\\n&#8221;) ;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 else<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 printf (&#8220;Scan completed without time out\\n&#8221;) ;<\/p>\n<p>This might mean that you would get the following outputs (depending on the speed of your system)&#8230;<\/p>\n<p>$ .\/bardecode ~\/tmp\/image.jpg &#8211;TimeOut 1000<br \/>\n123456<br \/>\nScan timed out<br \/>\n$ .\/bardecode ~\/tmp\/image.jpg &#8211;TimeOut 5000<br \/>\n123456<br \/>\nScan completed without time out<\/p>\n<p>The first call to bardecode used a 1 second time out where as the second used the default of 5s. Note that the fact a time out occurred doesn&#8217;t mean that the library wasn&#8217;t able to find a bar code, it just means that it didn&#8217;t complete a scan of the entire page.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The default time out for the scan of a page on Linux is 5000ms, but how can you detect if a time out has occurred? The following snippet of C code can be used in bardecode.c at the end of the main function&#8230; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint16 t; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 STGetParameter(hBarcode, ST_DID_TIMEOUT, &#038;t) ; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (t) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p><a href=\"https:\/\/www.bardecode.com\/en1\/detect-scan-time-linux\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":320,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[236,18,76,31],"tags":[],"class_list":["post-2317","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-documentation-for-our-toolkits-and-applications","category-knowledge-base","category-settings","category-software-development-kits"],"_links":{"self":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/2317"}],"collection":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/comments?post=2317"}],"version-history":[{"count":1,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/2317\/revisions"}],"predecessor-version":[{"id":2318,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/2317\/revisions\/2318"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/media\/320"}],"wp:attachment":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/media?parent=2317"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/categories?post=2317"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/tags?post=2317"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}