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 - 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.
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.
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
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:
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
1 Like
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!
# library: shared.util
from java.util import UUID
def getUUID():
return str(UUID.randomUUID())
Session Event:
Button on view (copy this and paste into a View):
[
{
"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
2 Likes