Please login or register.

Login with username, password and session length

Author Topic: SDK Sample  (Read 10265 times)

marineau

  • Hero Member
  • *****
  • Helpful Post Rating: 2
  • Posts: 162
SDK Sample
« on: October 03, 2006, 06:26:51 PM »

I downloaded SDK for CM15A, I noticed thar all is include for VB6, but don't found sample to start easily...
Does anyone can say me where I can found sample for VB6 and module CM15A ?

Thanks
Logged

-Bill- (of wgjohns.com)

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 81
  • Posts: 1340
  • He's just this guy. You know?
    • wgjohns.com
Re: SDK Sample
« Reply #1 on: October 03, 2006, 10:30:46 PM »

First you'll need to add a reference to the ActiveHomeScriptLib.dll to your project.

Then you should be able to use the object browser to examine it's propeties and methods.
Logged
-Bill- (of wgjohns.com)
bill@wgjohns.com

In the real world, the only constant is change.

When I'm online you can find me in the Home Automation Chat Room!

hkactive

  • Full Member
  • ***
  • Helpful Post Rating: 1
  • Posts: 50
Re: SDK Sample
« Reply #2 on: October 19, 2006, 09:55:11 PM »

Here's some VB6 code for an example of how to use the queryplc and the sendplc with the CM15A
This was used with the CM15a and the AM14A two way appliance module.

You'll need the ahscript.dll component added to the project along with the Microsoft Windows Common Controls (SP6) for the status bar.

What's needed:
- 1 Form

- 1 Command Button
    cmdExecute

- 2 Option Buttons with Index values of 0 and 1
   optPLC(0)
   optPLC(1)

- 1 Status Bar
   stbX10

- 1 TextBox
  txtHouseCode

-1 Check Box
   chbOn

' ****************************************************
Option Explicit

Private Sub ActiveHome1_RecvAction(ByVal bszAction As Variant, _
    ByVal bszParm1 As Variant, ByVal bszParm2 As Variant, ByVal bszParm3 As Variant, _
    ByVal bszParm4 As Variant, ByVal bszParm5 As Variant, ByVal bszReserved As Variant)
Debug.Print bszAction, bszParm1, bszParm2
End Sub

Private Sub cmdExecute_Click()
Dim strX10command As String
Dim strOnOff As String
Dim lngReturn As Long
' What are we requesting? On or off?
If chbOn.Value = 1 Then
    strOnOff = " on"
Else
    strOnOff = " off"
End If
' Determine if sendplc or queryplc was sent and execute command
If optPLC(0).Value = True Then
    strX10command = "sendplc"
    ActiveHome1.SendAction strX10command, txtHouseCode.Text & strOnOff
Else
    strX10command = "queryplc"
    lngReturn = ActiveHome1.SendAction(strX10command, txtHouseCode.Text & " on")
End If
' Determine if queryplc was sent and return the status
' the queryplc returns 1 is the status is on, 0 if the status is off, and possibly -1 for other returns.
If optPLC(1).Value = True Then
    If lngReturn = 1 Then
        stbX10.Panels(1).Text = "Status " & txtHouseCode.Text & " is " & "ON"
    ElseIf lngReturn = 0 Then
        stbX10.Panels(1).Text = "Status " & txtHouseCode.Text & " is " & "OFF"
    Else
        stbX10.Panels(1).Text = "Status " & txtHouseCode.Text & " is " & lngReturn
    End If
End If
'
End Sub

'***************************************
This was run with the latest SDK.
Responses came back correct. Did have to reboot. As first try was getting incorrect responses.

regards,

Hank
« Last Edit: October 19, 2006, 10:00:54 PM by hkactive »
Logged

-Bill- (of wgjohns.com)

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 81
  • Posts: 1340
  • He's just this guy. You know?
    • wgjohns.com
Re: SDK Sample
« Reply #3 on: October 20, 2006, 10:06:30 PM »

Thanks Hank!   :)

That's the first VB6 example I can remember seeing posted on these forums.

I have a working VB 2005 Express project, but I wasn't sure how compatible the code would be when people were asking for VB6 (since I jumped from VB5 to Express and never really got into VB6).  It looks like VB6 and Express code are very similar.

Thanks again for taking the time to post this, as many people out there have been asking for VB6 example code!   8)
Logged
-Bill- (of wgjohns.com)
bill@wgjohns.com

In the real world, the only constant is change.

When I'm online you can find me in the Home Automation Chat Room!
 

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