Here is the code to receive an event, just in case you didn't have it already:
C#:
using ActiveHomeScriptLib;
using System.Threading;
public class Form1
{
ActiveHomeScriptLib.ActiveHome ActiveHomeObj;
private void // ERROR: Handles clauses are not supported in C#
Form1_Load(object sender, EventArgs e)
{
ActiveHomeObj = new ActiveHome();
}
public void // ERROR: Handles clauses are not supported in C#
ActiveHome_RecvAction(object bszRecv, object vParm1, object vParm2, object vParm3, object vParm4, object vParm5, object vReserved)
{
TextBox1.Text = (bszRecv + " " + " " + vParm1 + " " + vParm2 + " " + vParm3 + " " + vParm4 + " " + vParm5) + Constants.vbCrLf;
TextBox2.AppendText(TextBox1.Text);
}
private void // ERROR: Handles clauses are not supported in C#
Button1_Click(object sender, EventArgs e)
{
ActiveHomeObj.SendAction("sendrawplc", "04 66");
// CM15A replies with 0x55 (always)
ActiveHomeObj.SendAction("sendrawplc", "06 62");
// turn A1 On
// CM15A replies with 0x55 (always)
}
private void // ERROR: Handles clauses are not supported in C#
Button2_Click(object sender, EventArgs e)
{
ActiveHomeObj.SendAction("sendrawplc", "04 66");
// CM15A replies with 0x55 (always)
ActiveHomeObj.SendAction("sendrawplc", "06 63");
// turn A1 Off
// CM15A replies with 0x55 (always)
}
}
VB:
Imports ActiveHomeScriptLib
Imports System.Threading
Public Class Form1
Dim WithEvents ActiveHomeObj As ActiveHomeScriptLib.ActiveHome
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ActiveHomeObj = New ActiveHome
End Sub
Sub ActiveHome_RecvAction(ByVal bszRecv As Object _
, ByVal vParm1 As Object _
, ByVal vParm2 As Object _
, ByVal vParm3 As Object _
, ByVal vParm4 As Object _
, ByVal vParm5 As Object _
, ByVal vReserved As Object) Handles ActiveHomeObj.RecvAction
TextBox1.Text = (bszRecv & " " & " " & vParm1 & " " & vParm2 & " " & vParm3 & " " & vParm4 & " " & vParm5) & vbCrLf
TextBox2.AppendText(TextBox1.Text)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
ActiveHomeObj.SendAction("sendrawplc", "04 66")
' CM15A replies with 0x55 (always)
ActiveHomeObj.SendAction("sendrawplc", "06 62") ' turn A1 On
' CM15A replies with 0x55 (always)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
ActiveHomeObj.SendAction("sendrawplc", "04 66")
' CM15A replies with 0x55 (always)
ActiveHomeObj.SendAction("sendrawplc", "06 63") ' turn A1 Off
' CM15A replies with 0x55 (always)
End Sub
End Class
The first portion of that protocol page contained the basic x10 protocol that you needed, but the rest was written for a CM11A interface. I don't want you and your buddies at stackoverflow.com to get off on a wild goose chase.