Perspective Vibration / Notification

Say you have a system running vision clients at the production line and operators running perspective sessions on iPhones.

Say an alarm was to become active on the production line. How would one use system.perspective.VibrateDevice to the operator of that lines device.

The manual seems to indicate that it must be invoked from the device.

Is it possible for the vision client / gateway to communicate out to the perspective session to invoke this?

You can use system.util.sendMessage to send a message from the gateway to Perspective sessions and then use a message handler in Perspective to vibrate the device. On the other hand, you could probably do this without the message by having Perspective look at the alarm status.

One way to do this is to add a tag Event Script.

  • Select the tag you want to vibrate a device when the Tag’s configured alarm becomes active.
  • Right-click the tag and select Edit Tag.
  • Scroll down to Tag Events and select the pencil/edit icon.
  • Select Alarm Active under Alarm Events.
  • Provide a script along the lines of:
# note: system.util.sendMessage, NOT system.perspective.sendMessage
system.util.sendMessage('<project_name', messageHandler='ALARMACTIVE', payload={'tagName': tag.name},scope='S')
  • Commit the script and save changes to the alarm.
  • In the Designer Menu, select Project.
  • Select Session Events.
  • From the Session Event types, select Message.
  • Click the “+” icon and supply ALARMACTIVE for the Message Handler name
  • Supply a script here like:
system.perspective.vibrateDevice(sessionId=session.id)

Note that this will only work if the device is using the Perspective application to launch the session; mobile devices using a generic browser do not have access to this functionality.

1 Like

Hi cmallonee:
I have try your code but not success
Step1: in the perspective I have set the (Project Name:HTC_WareHouseScan)

Step2: Set the Tag:

system.util.sendMessage("HTC_WareHouseScan","ALARMACTIVE",scope='S')
system.tag.write('[HTC_MANTIS]HTCMES/NTScan/Status',1)

After the alarm active, I see the Status tag was write to 1 by the scriping

I have one ZEBRA TC21 andorid system, running the APP:(HTC_WareHouseScan)(not by IE)
The hardware not vibrate
Can you help to tell me , what I have made a mistake?

Ah, there was a typo in the “code” I provided. If you looked at your gateway logs you would see that session does not have a property id, and that you should instead have something like this:

system.perspective.vibrateDevice(sessionId=session.props.id)
2 Likes

it works , that’s just what I want
But one more question, when I open the mobile end point, it works


but when I lock the screen, it not works

it that possible make it works no matter the device is lock or not?

No, I’m pretty sure the session is more-or-less “disconnected” when you lock the screen. When you re-open, the session needs to re-connect to the Gateway. What you’re looking for at that point is actually more of a “push” notification, which Ignition/Perspective does not offer at this time.

1 Like

Before what I can’t understand is the SMS can send the message and also the perspective message handler also have similar function, after your explain , I understand, SMS can send message to client no need the mobile end point is open while the session need, thanks a lot