Announcement

Collapse
No announcement yet.

Script call to UltraGCIR3??

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Script call to UltraGCIR3??

    I am trying to convert the script function below from HS2 to HS3. This function is called from other functions within the same module to send IR commands from HSTouch.

    In HS2:
    Code:
        Public Function SendIR(ByVal pParm As String) As Boolean ' Send the IR Command (via UltraGCIR)
            Dim strSub As String = ":SendIR "               ' Define Subroutine name
            Dim hspi As Object = hs.Plugin("UltraGCIR")     ' Define the UltraGCIR object (& Set)
            Dim bSuccess As Boolean = hspi.SendIrCommand(strIRHcDv, UCase(pParm)) ' Issue the SendIR command & set return code
            Try                                             ' Start Try/Catch
                If bDebug Then hs.WriteLog(strPgm, strSub & "->pParm=" & pParm) ' Write to log
                If bDebug Or bSuccess <> True Then hs.WriteLog(strPgm, strSub & "->SendIR, " & String.Format("SendIrToDevice() returned {0}", bSuccess.ToString())) ' Write RC to log
                SendIR = True                               ' Set Exit RC
            Catch ex As Exception                           ' Exception Handling routine
                hs.WriteLog(strPgm, strSub & "->Execution Exception = " & ex.ToString) ' Log error Message
            End Try                                         ' End Try/Catch
        End Function
    I am confused as to the correct HS3 call to UltraGCIR3 that corresponds to these two HS2 commands:
    Code:
            Dim hspi As Object = hs.Plugin("UltraGCIR")     ' Define the UltraGCIR object (& Set)
            Dim bSuccess As Boolean = hspi.SendIrCommand(strIRHcDv, UCase(pParm)) ' Issue the SendIR command & set return code
    The best I could come up with was:
    Code:
    
     Dim bSuccess As Boolean = hs.PluginFunction("UltraGCIR3", "", "SendIR", {strIRHcDv, UCase(pParm)}) ' Issue the SendIR command & set return code
     
    While that replacement is clean in tenScripting3, I have no idea if the "SendIR" command is a HS3 replacement for the HS2 hspi.SendIrCommand. Can UltraJones or someone that has been there done that provide guidance?

    Thanks
    Gary

  • #2
    Hmm, I was supposed to follow-up with Rich on why simply controlling the device via HSTouch isn't working. I just sent Rich some more debug logs on this issue that will hopefully help him determine why controlling the IR Device using HSTouch isn't working.

    The easiest way to send an IR command is to simply find the device value of the button name from the status graphics tab of the device, then use it as the control Id.

    Code:
    Dim controlId as String = "1"
    Dim bSuccess as Boolean = hs.PluginFunction("UltraGCIR3", "", "SendIRById", New Object() {controlId})
    Note: The control Id is globally unique, so you don't have to worry about specifying the device name or button name. Will that work?

    Regards,
    Ultrajones
    Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

    Comment


    • #3
      Originally posted by Ultrajones View Post
      Code:
      Dim controlId as String = "1"
      Dim bSuccess as Boolean = hs.PluginFunction("UltraGCIR3", "", "SendIRById", New Object() {controlId})
      Note: The control Id is globally unique, so you don't have to worry about specifying the device name or button name. Will that work?
      Not sure about it working, but it is very different. I apologize for not explaining better what I do with this code in my Remote script. In this HS2 code, strIRHcDv is the House Code/Device Number (e.g. V40) of the IR Module (e.g. iTachIP2IR Blaster 1:3) and the pParm is the button name (e.g. POWEROFF), passed from HSTouch.
      Code:
              Dim hspi As Object = hs.Plugin("UltraGCIR")     ' Define the UltraGCIR object (& Set)
              Dim bSuccess As Boolean = hspi.SendIrCommand(strIRHcDv, UCase(pParm)) ' Issue the SendIR command & set return code
      Using tenScriptAid, I was able to get the following CAPI command:
      hs.CAPIControlHandler(hs.CAPIGetSingleControl(90,True,"ONKPO WEROFF",False,False))

      where 90 is the IR Module Reference ID and ONKPOWEROFF is the name of the Onkyo Power Off IR stream. That seem(ed) to work fine. So for now, it looks like the corresponding HS3 "SendIR" function would be:

      Code:
          Public Function SendIR(ByVal pParm As String) As Boolean ' Send the IR Command (via UltraGCIR3)
              Dim strSub As String = ":SendIR "               ' Define Subroutine name
              Dim intRef As Integer                           ' Device Reference Number
              Const strIRHcDv As String = "GC001:1:3"         ' UltraGCIR3 Address of the iTachIP2IR IR_Blaster Module 1:3
              Try                                             ' Start Try/Catch
                  If bDebug Then hs.WriteLog(strPgm, strSub & "->pParm=" & pParm) ' Write to log
                  intRef = hs.DeviceExistsAddress(strIRHcDv, True) ' Get the Device Reference number based on Device Address
                  If intRef <= 0 Then Throw New System.Exception("Device Reference to " & strIRHcDv & " was NOT Found!") ' Q. Valid Reference A. No, then throw exception
                  If bDebug Then hs.WriteLog(strPgm, strSub & "->IR Module Address = " & intRef) ' Write RC to log
                  hs.CAPIControlHandler(hs.CAPIGetSingleControl(intRef, True, pParm, False, False)) ' Use CAPI to send the IR stream for the corresponding HST Button
      
                  SendIR = True                               ' Set Exit RC
              Catch ex As Exception                           ' Exception Handling routine
                  hs.WriteLog(strPgm, strSub & "->Execution Exception = " & ex.ToString) ' Log error Message
                  SendIR = False                              ' Set Exit RC
              End Try                                         ' End Try/Catch
          End Function
      Where now, strIRHcDv is the Address (GC001:1:3) assigned to the iTach Blaster. In theory, I shouldn't have to change any of my HS2 HSTouch calls. Further, this may avoid the problems you are working with Rich on since the IR is being sent from a script instead of HSTouch.

      Do you see any flaws in any of this?

      Thanks
      Gary

      Comment


      • #4
        Another thing...

        UltraJones, after installing UltraGCIR3, my two GC devices were found just fine:

        Feb-25 02:50:44 PM Informational Ethernet connection established to 192.168.1.232:4998
        Feb-25 02:50:44 PM Informational DiscoveryBeacon: Global Cache unit GC-100-12 [192.168.1.232] discovered.
        Feb-25 02:50:18 PM Informational Ethernet connection established to 192.168.1.238:4998
        Feb-25 02:50:18 PM Informational DiscoveryBeacon: Global Cache unit iTachIP2IR [192.168.1.238] discovered.
        Feb-25 02:50:18 PM Plug-In Finished initializing plug-in UltraGCIR3
        Feb-25 02:50:17 PM Info Plugin UltraGCIR3 has connected. IP:127.0.0.1:54623

        Later however, I start getting this error message for my GC-100-12 every 3 minutes.
        Feb-25 04:40:46 PM Warning Watchdog Timer indicates TCP connection to Global Cache device [192.168.1.232] was lost.. Attempting to reconnect ...
        Feb-25 04:46:16 PM Informational Watchdog Timer reconnect attempt succeeded.
        Feb-25 04:46:16 PM Informational Ethernet connection established to 192.168.1.232:4998

        My GC-100 is pretty old, but is there a configuration fix (somewhere) that you know of for this error?

        Thanks again
        Gary

        Comment


        • #5
          Originally posted by Kbevo View Post
          UltraJones, after installing UltraGCIR3, my two GC devices were found just fine:

          Feb-25 02:50:44 PM Informational Ethernet connection established to 192.168.1.232:4998
          Feb-25 02:50:44 PM Informational DiscoveryBeacon: Global Cache unit GC-100-12 [192.168.1.232] discovered.
          Feb-25 02:50:18 PM Informational Ethernet connection established to 192.168.1.238:4998
          Feb-25 02:50:18 PM Informational DiscoveryBeacon: Global Cache unit iTachIP2IR [192.168.1.238] discovered.
          Feb-25 02:50:18 PM Plug-In Finished initializing plug-in UltraGCIR3
          Feb-25 02:50:17 PM Info Plugin UltraGCIR3 has connected. IP:127.0.0.1:54623

          Later however, I start getting this error message for my GC-100-12 every 3 minutes.
          Feb-25 04:40:46 PM Warning Watchdog Timer indicates TCP connection to Global Cache device [192.168.1.232] was lost.. Attempting to reconnect ...
          Feb-25 04:46:16 PM Informational Watchdog Timer reconnect attempt succeeded.
          Feb-25 04:46:16 PM Informational Ethernet connection established to 192.168.1.232:4998

          My GC-100 is pretty old, but is there a configuration fix (somewhere) that you know of for this error?

          Thanks again
          Gary
          The GC-100 only allows 1 TCP connection. If you're trying to run both the HS2 and HS3 version at the same time, then both plug-ins are fighting over the 1 and only TCP connection allowed by the GC-100.

          Regards,
          Ultrajones
          Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

          Comment


          • #6
            Originally posted by Ultrajones View Post
            The GC-100 only allows 1 TCP connection. If you're trying to run both the HS2 and HS3 version at the same time, then both plug-ins are fighting over the 1 and only TCP connection allowed by the GC-100.
            Yes, after looking at my HS2 log, that appears to be the case. Before testing the HS3 version I "disabled" the HS2 version. Apparently, that does not stop it from trying to connect to the GC-100 (once connected, I guess). Going the other way however, disabling the HS3 version does seem to stop it from trying to reconnect. Is this correct? To avoid this error, am I going to have to bring HS2 completely down?

            Thanks
            Gary

            Comment

            Working...
            X