Welcome to the Barcode Scanner App codelab! In this tutorial, you will learn how to:

  1. Open the SmartPOS Store client app on your device (usually found in the terminal menu).
  2. Search for "Barcode Scanner" in the SmartPOS Store.

screenshot-step1-search-smartpos-store

  1. Install the application directly from the SmartPOS Store.

Note: The Barcode Scanner app is only available as an official release through the SmartPOS Store.

  1. Confirm installation on your device.
  1. After installation, check the status bar for the Barcode Scanner app service icon.

screenshot-step2-statusbar

  1. If the icon is not visible, open the app from the launcher menu.

screenshot-step2-launcher

  1. The main activity will display the service status and WebSocket connection info.

screenshot-step2-mainactivity

  1. Verify that the service icon (camera icon) is present in the status bar.

screenshot-step2-statusbar-camera

  1. If an external connection has been established, the notification center will display the connection status.

screenshot-step2-notification-center

  1. The service is now running.

Warning: The WebSocket server must be running for external connections to work.

  1. Open Postman on your computer.
  2. Create a new collection.

screenshot-step3-postman-new-collection 3. Create a new WebSocket request.

screenshot-step3-postman-new-websocket

  1. Enter the WebSocket URL in Postman:
  1. Click Connect to establish the WebSocket connection.

screenshot-step3-postman-connect

  1. You should see a successful connection message.

Note: Ensure your computer and device are on the same network.

screenshot-step3-postman-connected

  1. In Postman, send the following command as a simple string (not JSON):
    readScannerData
    
  1. Confirm the command has been sent successfully in Postman.

screenshot-step4-postman-command-sent

  1. The app will initiate a scan.

Note: Present a barcode or QR code at the bottom of the device so the reader can scan it.

  1. You should receive a response in Postman with the scanned data:
    {
      status: "success",
      data: "<scanned-barcode-data>"
    }
    
    screenshot-step4-postman-response-success
  1. In Postman, send the following command as a simple string (not JSON):
    readScannerData
    
  1. Confirm the command has been sent successfully in Postman.

screenshot-step5-postman-command-sent

  1. Before scanning a barcode, send the cancelRead command as a simple string (not JSON):
    cancelRead
    
  1. Confirm the cancel command has been sent successfully in Postman.

screenshot-step5-postman-cancel-command-sent

  1. The scan operation will be aborted. You should receive a response indicating the cancellation:
    {
      "status": "success",
      "data": "Read operation canceled"
    }
    
    screenshot-step5-postman-response-cancelled
  2. You should also receive a response to the initial readScannerData command:
    {
      "status": "error",
      "data": "No data read from scanner"
    }
    
    screenshot-step5-postman-response-aborted

Note: This demonstrates how to abort a scan operation from an external client.

You have learned how to: