Last modified on 30 May 2023, at 13:31

Optical code

Revision as of 13:31, 30 May 2023 by LGE (Talk | contribs) (Multiple codes on a single object {{Version/WinXSince|4.4}}{{Version/XamarinSince|4.4}})

In order for the users to find objects more efficiently, UBIK® objects can be marked with values for optical codes. Whenever a user scans an optical code, the resulting code value can be used to find all matching objects, namely objects that have the right property.

Types of optical codes

The following types are supported at the moment:

  • Barcode;
  • QR Code;
  • ID Marker.

Types of scanners

The following scanners are used for scanning:

  • ZXing Barcode Scanner (for barcodes and QR codes)
  • ID Marker Scanner - based on Metaio. (for ID Markers) This is now obsolete.
  • Getac Z710 integrated barcode/qr-code scanner (from version 2.4.4 on)


Searching for objects

UBIK® provides two mechanisms for searching objects: online and offline.

Searching offline

In any case (regardless of the network connection and sync mode), UBIK® always goes through all the objects currently available on the device and find the ones that match the scanned results.

Searching online

When the Internet is available and UBIK® is not running under offline mode, the search result is enhanced by online search. This means any objects that match the scanned results can be found even if they don't yet exist locally.

Presenting results of a search

Once the objects are found, they are displayed in a list. The users can then browse to any of the objects for more information by clicking on the objects.

Multiple codes on a single object

It's possible have multiple optical codes on a single object. This allows the same object to be found when you scan any of those codes. For such objects, the general scan and potentially the search behaviors are exactly the same as those with only a single code. For example, if an object with multiple codes is found when you scan one of the codes, it could also get unlocked.

Unlocking objects

In some scenarios where topics such as security, regulations etc. are of higher importance, some objects can often be locked by default until certain codes are scanned.

IC Attention.pngThe unlock codes are always compared case sensitive.

Unlock after a search

By default, a search is started for every scanned code. If an object is found, it is presented in the UI and unlocked. A group of objects sharing the same unlock code are unlocked as well.

Unlock mode

Unlock notification
Unlock notification

It's also possible to start a scan with an "unlock mode" (see XAML example below). In this mode, the app doesn't rely on the search mechanism to find the objects and, therefore, doesn't present anything in the UI. Instead, any objects having their unlock code matching the scanned one are unlocked in the background.

  • It doesn't matter whether objects having the unlock code are present at the time when that code is scanned or not. The scanned unlock code will be remembered for 15 minutes. If objects carrying that same unlock code show up on the client (locally created or downloaded from the server) within that time, they will have an unlocked status automatically;
  • It's possible (but optional) to specify an expected unlock code as well. In that case, nothing gets unlocked if the scanned code doesn't match the specified one.


Example XAML code to enable the unlock mode:

UWP

<Button
   ...
   xmlns:controls="using:UBIK.WinX.Controls"
   Command="{Binding NavigateToScanPageCommand}">
    <Button.CommandParameter>
        <controls:KeyValueList>
            <controls:KeyValueParameter Key="UnlockMode" Value="true" />
            <controls:KeyValueParameter Key="UnlockCode" Value="$LWP01" />
        </controls:KeyValueList>
    </Button.CommandParameter>
</Button>

Xamarin

<Button
   ...
   xmlns:classes="clr-namespace:UBIK.CPL.Classes;assembly=UBIK.CPL"
   Command="{Binding NavigateToScanPageCommand}">
    <Button.CommandParameter>
        <classes:KeyValueList>
            <classes:KeyValueParameter Key="UnlockMode" Value="true" />
            <classes:KeyValueParameter Key="UnlockCode" Value="$LWP01" />
        </classes:KeyValueList>
    </Button.CommandParameter>
</Button>

Technical background

In order for objects to be identifiable through optical codes, they have to carry the SYSCLS OBJECTWITHIDMARKER classification.

The data types of different optical codes are listed as follows:

  • Barcode - String;
  • QR Code - String;
  • ID Marker - Integer.

The service query used for online searching is IDMARKERSCANQUERY.

See also