Author Topic: Get status of "all" devices?  (Read 3044 times)

Frunple

  • Hero Member
  • *****
  • Posts: 774
    • View Profile
Get status of "all" devices?
« on: December 14, 2014, 11:26:08 am »
Now that the omni driver has lock status working, I'm trying to set up a rule to check the status of all locks at once.
So basically I want to do something like this:
Code: [Select]
if (omni.LockStatus[ALL]==0)
Is there a way to do this with one line or just list them all one at a time?

iostream212

  • Sr. Member
  • ****
  • Posts: 459
    • View Profile
Re: Get status of "all" devices?
« Reply #1 on: December 14, 2014, 04:33:12 pm »
Elk guy here,  but I'll take a stab.  Are locks treated like a zone? if so can you define a new area consisting of all your locks and then check if the area is secure?

Sent from my SCH-I545 using Tapatalk

I always wanted to be somebody. In retrospect, I think I should have been more specific.

Frunple

  • Hero Member
  • *****
  • Posts: 774
    • View Profile
Re: Get status of "all" devices?
« Reply #2 on: December 14, 2014, 06:17:02 pm »
Actually I'm just looking for the C# code. Just need to know if there's an equivalent for the word "ALL" in that example I wrote.

broconne

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Re: Get status of "all" devices?
« Reply #3 on: December 16, 2014, 01:01:45 pm »
There is no simple way to do all in the elve script language as far as I know.  C# itself could do it, but that isn't exposed into the scripting language..

I haven't tested it, but something like this:
Code: [Select]
boolean allLocked = true;
for(counter=0; counter<omni.LockStatus.Length; counter++){
  allLocked = allLocked && omni.LockStatus[counter] == 0;
}

Frunple

  • Hero Member
  • *****
  • Posts: 774
    • View Profile
Re: Get status of "all" devices?
« Reply #4 on: December 16, 2014, 01:41:23 pm »
Thanks! I'll give it a shot.