Please login or register.

Login with username, password and session length

Author Topic: Flags in SDK  (Read 9986 times)

jeff

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 2
Flags in SDK
« on: September 30, 2008, 12:12:14 PM »

How can I check flag status with SDK?

Does "queryplc", "flag1 on" work or is there something else?
Logged

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: Flags in SDK
« Reply #1 on: October 19, 2008, 07:15:05 AM »

Not unless the flag are some sort of extended code.

Have a look at the SDK docs and see if there's something in there.
Logged
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm

USdangerboy

  • Full Member
  • ***
  • Helpful Post Rating: 1
  • Posts: 32
Re: Flags in SDK
« Reply #2 on: December 28, 2008, 01:58:13 AM »

Why use flags at all, you don't need them anymore!  You have an unlimited amount of them by using arrays now!  Just create an 4x integer array with Col0 = HouseCode, col1 = UnitID, col2 = Status, col3 = LightLevel (of course this could be three, as LightLevel 0 could mean OFF, but I'm only 5 hours into the SDK so I'll streamline it later) then make a function in your code to do array management and you only need a few lines of code to write and read the array and get/put all the data you need!

I put all my units in an array and track everything in there, so no need for flags at all!!  YAHOO!!  I connected it to an SQL DB and can now control everyting with ASP.NET on my little XP box ... excellent!!

My only trouble now is filtering all the many, many commands that are transmitted on event triggers; a motion sensor ON command seems to sometimes trigger up to 7 different transmissions.  I'm still looking around, but if anyone knows in this thread, hit me up pls!!!  THANKS!
Logged
If at first you don't succeed, skydiving is not for you.

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: Flags in SDK
« Reply #3 on: January 24, 2009, 07:14:40 AM »

That's what I do also.

I have one array that just keeps track of on/off module status

if OnOff(a,10) = true then
'module is on
end if
Logged
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm

USdangerboy

  • Full Member
  • ***
  • Helpful Post Rating: 1
  • Posts: 32
Re: Flags in SDK
« Reply #4 on: January 29, 2009, 04:31:53 PM »

I actually setup two Arrays, one for units and one for comments/notes.

Code: [Select]
    Dim aryMyUnitStatus(31, 17) As Short
    Dim aryMyUnitNotes(31, 17) As String

This keeps the arrays small and I use the ASC function for the integer value of the housecode instead of using strings, considerably faster for large setups.

So basically, 65 is A, so i start with five and then use a 60 sub/add handler, so for example, if I want to add a note for unit C6, I use

Code: [Select]
aryMyUnitNotes(Asc("C") - 60), 6) = "EE facing SE on back pool deck"


So, of course, I have a function for processing data in and out of the arrays and everytime something fires, I see the note in the window (those notes are stored in the DB and I have an INIT procedure for that on startup that grabs a recordset and writes it to the array).  This way, I have unlimited If/Then potential in my logic.  Of course, I do ASSUME many of the units are actually in the state that was last set ... since I don't have all of my uints as two-way, so it's not flawless, I'm slowly replacing them, but time is not growing on trees at present :-)

Seems to work well so far, not totally perfected yet.  I really need to mark it against I/O on the database and see which is more stable/faster, but for now, it's doin the job ... more to come for sure!!


Logged
If at first you don't succeed, skydiving is not for you.
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.