# Request for Multi-Device QR Code Scanning Solution

**URL:** <https://forum.inductiveautomation.com/t/request-for-multi-device-qr-code-scanning-solution/95569>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [September 5, 2024, 6:20am UTC](https://forum.inductiveautomation.com/t/request-for-multi-device-qr-code-scanning-solution/95569 "2024-09-05T06:20:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajashekar\_Reddy](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@Rajashekar\_Reddy](https://forum.inductiveautomation.com/u/Rajashekar_Reddy)\
**Post date:** [September 5, 2024, 6:20am UTC](https://forum.inductiveautomation.com/t/request-for-multi-device-qr-code-scanning-solution/95569/1 "2024-09-05T06:20:28Z")

</div>

Dear Team,

I am currently engaged in the Barcode System Project, which is operational for a single mobile client. Following the tutorial from Inductive University on barcode scanning,-  
[Barcode Scanned Video at Inductive University](https://inductiveuniversity.com/videos/barcode-scanned/8.1) - I encountered an issue where the camera fails to activate when accessed via a web browser. we understood that "Ignition Perspective" app is required for functionality, necessitating a intranet network connection for barcode scanning.

My concern lies in the limitation to one mobile client due to the **global tag connected** at "Session Events \> Barcode," as demonstrated in the video at the **01:33** mark. **I am seeking an efficient method to enable QR code reading from various devices such as tablets, mobiles for multiple clients.**

Your insights on this matter would be greatly appreciated. If you have any recommendations or alternative solutions, please share them with me.

Best regards,  
B.R.Reddy.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [September 5, 2024, 6:40am UTC](https://forum.inductiveautomation.com/t/request-for-multi-device-qr-code-scanning-solution/95569/2 "2024-09-05T06:40:41Z")

</div>

> [@Rajashekar\_Reddy](#):
>
> activate when accessed via a web browser

To give the browser permission to access a local camera via browser, you'll need to use SSL / HTTPS and then you'll get a permission prompt to allow access. For testing, you can just use a self-signed certificate that Ignition can generate for you.  
Browsers are not permitted to access a local camera without a secure connection.

---

<div class="post-metadata">

**Author:** ![Rajashekar\_Reddy](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@Rajashekar\_Reddy](https://forum.inductiveautomation.com/u/Rajashekar_Reddy)\
**Post date:** [September 5, 2024, 9:15am UTC](https://forum.inductiveautomation.com/t/request-for-multi-device-qr-code-scanning-solution/95569/3 "2024-09-05T09:15:21Z")

</div>

Hello @nminchin,

Thank you for your response.

Could you please provide guidance on generating a self-signed certificate in Ignition?

My concern lies in the limitation to one mobile client due to the **global tag connected** at "Session Events \> Barcode," as demonstrated in the video at the **01:33** mark. **I am seeking an efficient method to enable QR code reading from various devices such as tablets, mobiles for multiple clients in same application with different screens**

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [September 5, 2024, 9:52am UTC](https://forum.inductiveautomation.com/t/request-for-multi-device-qr-code-scanning-solution/95569/4 "2024-09-05T09:52:09Z")

</div>

A session event is attached to a single session only, so you can use this for as many sessions as you need to have on other devices, where a session is essentially an open perspective client.

Ah, I actually watched the video this time and see what youre talking about. If your barcode scanning should be limited to the session, then you wouldn't write the result into a tag. To might write it into a session custom prop instead, or even push it through to your view using a send Message (you could make it universal in this case). You would most likely want to use a uuid in that case however to know where the event came from and if it's for the component that has the msg event handler on it. You can generate a uuid with Java using:

```python
from Java.util import UUID
str(UUID.randomUUID())

```

I have a script library with a wrapper for that function. Generate a uuid in a custom prop on your bar code scan component and sentls that through with your barcode scan action.  
I can elaborate when I'm back at my laptop if you need

---

<div class="post-metadata">

**Author:** ![Rajashekar\_Reddy](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@Rajashekar\_Reddy](https://forum.inductiveautomation.com/u/Rajashekar_Reddy)\
**Post date:** [September 5, 2024, 11:47am UTC](https://forum.inductiveautomation.com/t/request-for-multi-device-qr-code-scanning-solution/95569/5 "2024-09-05T11:47:42Z")

</div>

Hello @nminchin,

Thank you for your response.

If you don't mind, could you share the script library and a wrapper for that function? Guidance would be much appreciated!

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [September 5, 2024, 11:57pm UTC](https://forum.inductiveautomation.com/t/request-for-multi-device-qr-code-scanning-solution/95569/6 "2024-09-05T23:57:39Z")

</div>

```python
# library: shared.util
from java.util import UUID
def getUUID():
   return str(UUID.randomUUID())

```

Session Event:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/5/054500ad71d73ab45cd946b5df8a7007227477e4.png)

Button on view (copy this and paste into a View):

```python
[
  {
    "type": "ia.input.button",
    "version": 0,
    "props": {
      "text": "Scan Barcode"
    },
    "meta": {
      "name": "Button"
    },
    "position": {
      "basis": "34px"
    },
    "custom": {},
    "propConfig": {
      "custom.uuid": {
        "binding": {
          "type": "expr",
          "config": {
            "expression": "1"
          },
          "transforms": [
            {
              "code": "\treturn shared.util.getUuid()",
              "type": "script"
            }
          ]
        }
      }
    },
    "events": {
      "component": {
        "onActionPerformed": {
          "type": "native/barcode",
          "scope": "C",
          "config": {
            "config": {
              "type": "ANY",
              "backgroundColor": "AUTO",
              "cameraPreference": "BACK",
              "uuid": "43a52965-b7b9-4834-b205-4ea7c7d75384"
            },
            "context": {
              "uuid": "{this.custom.uuid}"
            }
          }
        }
      }
    },
    "scripts": {
      "customMethods": [],
      "messageHandlers": [
        {
          "messageType": "barcode-scanned",
          "script": "\tthisUUID = self.custom.uuid\n\tscannedUUID = payload['uuid']\n\tif thisUUID == scannedUUID:\n\t\t#do something",
          "sessionScope": true,
          "pageScope": false,
          "viewScope": false
        }
      ],
      "extensionFunctions": null
    }
  }
]

```

\*\* Untested
