el evento que este dispositivo manda cuando se desconecta es
RECVRF A6 DEVICESTOP
y el evento cuando se conecta es
RECVRF A6 DEVICESTART
ahora en mi caso me interesa que el reciba cuando se conecta , para luego que me mande un comando a esta direccion
ActiveHomeObj.SendAction(sendplc, E7 off)
el codigo que me dieron seria este
Código: Seleccionar todo
Public Sub ActiveHome_Received(ByVal bszAction As Object, ByVal bszParam1 As Object, ByVal bszParam2 As Object, ByVal bszParam3 As Object, ByVal bszParam4 As Object, ByVal bszParam5 As Object, ByVal bszReserved As Object) Handles AHOBJ.RecvAction
' 'Since this is an ActiveX Object we should convert the objects to strings which is what they really are
Dim Reserved As String
Dim wrap As String
wrap = Chr(13) & Chr(10)
Try
action = CType(bszAction, String) 'recvplc, recvrf
Param1 = CType(bszParam1, String) 'housecode
Param2 = CType(bszParam2, String) 'power,on,off, dim bright
Param3 = CType(bszParam3, String) 'not needed here
Param4 = CType(bszParam4, String) 'not needed here
Param5 = CType(bszParam5, String) 'not needed here
Reserved = CType(bszReserved, String) 'not needed here
Catch ex As Exception
'Since we could get floods of x10 messages its best not to put any message boxes here
End Try
'we're only concerned about the interface reconnect
'so we only watch for the devicestart string
If Param2.ToUpperInvariant.ToString = "DEVICESTART" Then
' sends command to configured text boxes
AHOBJ.SendAction("SendPLC", ComboBox1.Text + ComboBox2.Text + " " + ComboBox3.Text)
End If
'writes received info to text box
TextBox1.Text = action + " " + Param1 + " " + Param2
End Sub