LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic User Lockout

I'm trying to create functionality such that a LV app I've built is only accessible to certain users who have unlock privileges. The idea is that a user will have an RFID fog type device which when presented to a reader will notify the LV app that they are a trusted user and thus unlock the app, enabling the user to access it. The user will then be automatically locked out of the app again after a certain period of inactivity, say 5s (for now the RFID aspect of the functionality can be ignored, and is instead just replaced with a login Boolean in my VI).

I've made an initial attempt at the functionality using a crude event-based approach based, however whilst the functionality of this is essentially as required, I'm not happy with the programming style and thus efficiency. The VI has the 'Pane: Mouse Move' event registered at all times, even when the user isn't logged in thus the event is fired continuously. Additionally the handling of the inactivity count is crude at best, with a SR operating within the timeout case, something I don't like to employ in general.

So, I'm basically posting to ask for any advice on how the functionality could perhaps be better implemented? I have considered using dynamic event registration, however I have no experience using it and am also unsure as to how it would operate within this context exactly? Cheers in advance!

OG
Research Engineer



0 Kudos
Message 1 of 5
(2,689 Views)

I know this is old, but I just recently saw it and so...I added a custom user-event for when the application needs to calculate the time (rather than using the timeout case) which reduces some of the load.  As far as the 'Pane: Mouse Move' event, I couldn't figure out an easy way to do this without poling frequently (which is basically what is happening now) so I set up the event queue to limit the total number of 'Pane: Mouse Move' events it will allow on the queue at one time to two.  It seems to work okay, without having to waste as much time checking itself but I suspect there is still a better way to go about this.  See the attached...

0 Kudos
Message 2 of 5
(2,473 Views)

An event structure loop isn't a polling loop.  It just sits there waiting for an event.

 

You have a timeout event, but you haven't set a timeout.  I would set the timeout event for the length of time you want inactivity to lock the screen.  Use the mouse event, which will execute the event structure and essentially do nothing, other than reset the timeout.  So if y ou do nothing for let's say 5 minutes, the timeoue event runs.  If you occasionally do a mouse move, that event executes and the timeout value will reset.

 

I think the whole user event thing you are doing is complicating thing unnecessarily, and possibly even reversing the logic of what you really want to do.

Message 3 of 5
(2,463 Views)

Thanks for reviving the post guys, nice to finally get some input! I'll have a play around with it and get back to you.

OG
Research Engineer



0 Kudos
Message 4 of 5
(2,438 Views)

@cycleguy I ran the VI you provided however it doesn't provide the required functionality. It unlocks as required and relocks once the lockout time is reached however the lockout count is not reset if the user interacts with the mouse.

 

@RavensFan I like your idea and have implemented it into a simple Vi - it seems to work well (see attached). The only issue I could see with this approach is integrating it into a larger application where one would likely have multiple events registered, the triggering of which would impact on the triggering of the timeout case. One option would be to seperate the lockout function into a different event structure however this would result in there being more than one event structure within a single VI which is frowned upon! Having said that I don' see why in that case it would cause an issue as long as only the appropriate events were registered in each and not duplicated. 

OG
Research Engineer



0 Kudos
Message 5 of 5
(2,402 Views)