Jump to content

login form and param


Pink-El

Recommended Posts

It depends on what the "barcode" means and what you want to do...is not clear from your question but you can also use a REST call and the UniGUIServerModuleHTTPCommand event of TUniServerModule....I use it for reports...see below.

procedure TUniServerModule.UniGUIServerModuleHTTPCommand(ARequestInfo: TIdHTTPRequestInfo;
  AResponseInfo: TIdHTTPResponseInfo; var Handled: Boolean);
var
  dm : TdmReportData;

begin
  if ARequestInfo.URI='/report/finsummary' then
  begin
    dm := TdmReportData.Create(nil);
    try
      dm.qryReport.Connection := dm.FDConnection;
      AResponseInfo.ContentText := dm.GenerateReportPDF(repFinSummary, '') + ' header [user] = ' + ARequestInfo.RawHeaders.Values['user'];
      AResponseInfo.ResponseNo := 200;
      AResponseInfo.WriteContent;
      Handled := True;
    finally
      dm.Free;
    end;
 end;
end;
Link to comment
Share on other sites

Idea is very simple.

I need check barcode in database with mobile device. I found QuickMark application. This application can recognize barcode by camera and open url with value after reading.

My application has login form. What I can do in this case?

1 use onShow event of the login form

2 use cookis and hide login form

3 httpcommand of the server module

 

Seems that second way is good solution

 

Thank you,

Dmytro Lendel

Link to comment
Share on other sites

I use a UnimHTMLFrame and below is the HTML for it:

<section id="container" class="container">
    <div class="controls">
        <fieldset class="input-group">
            <button class="start x-button" style="height: 32px; width: 150px; color: #fff;">START SCANNING</button>
        </fieldset>
        <div class="reader-config-group">
            <label>
                <span>Camera</span>
                <select name="input-stream_constraints" id="deviceSelection" style="height: 32px;"></select>
            </label>
        </div>
    </div>
    <div id="result_strip">
        <ul class="thumbnails"></ul>
    </div>
    <div class="video-center">
      <div id="interactive" class="viewport"><video autoplay="true" preload="auto" src=""></video><canvas class="drawingBuffer" width="320" height="240"></canvas><br clear="all"></div>
    </div>
</section>


<script src="files/quagga/js/live_w_locator.js" type="text/javascript"></script>

In the last line you can see it loads the script "live_w_locator.js". You can get that file from the website as well as the quagga.js file. See the examples. Those files go into your files folder of the server...

 

I have modified the "live_w_locator.js" to do a Ajax call to the UniGUI Server when a code has been scanned successfully. (Note that below is just a snipped from "live_w_locator.js".)  

 

ajaxRequest(frmBarcodeScan.UnimHTMLFrame, 'scansuccess', ["barcode="+code])...see below:

Quagga.onDetected(function(result) {
        var code = result.codeResult.code;
		App.scannedCount ++;
		
		if (App.scannedCount < 2) {
            var $node = null;
            $node = $('<li><div class="thumbnail"><div class="caption"><h4 class="code"></h4></div></li>');
            $node.find("h4.code").html(code);
            $("#result_strip ul.thumbnails").prepend($node);
        } 
		else {
			Quagga.stop();
			App.scannedCount = 0;
			ajaxRequest(frmBarcodeScan.UnimHTMLFrame, 'scansuccess', ["barcode="+code]);
		}
    });

scannedCount is a variable I introduced as to how many scans must be done before it stops and send the array of values back.

 

Just remember you have to use https as for the camera access to work.

 

Here is a few images:

 

 

post-4617-0-77416000-1496640907_thumb.png

post-4617-0-17261000-1496641013_thumb.png

post-4617-0-17326600-1496641015_thumb.png

  • Upvote 1
Link to comment
Share on other sites

There are many types of Barcodes, you would need to adjust the decoder property array under the state object to cater for the expected types in the live_w_locator.js file.

decoder: {
                readers : ['ean_reader', 'ean_5_reader', 'ean_2_reader', 'code_128_reader']

See the examples on the Quagga website...in which case they have a drop down to select the type but you can pass it in as above. Remember the more you define the longer it might take to recognize it as it has to try all of them.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...