Announcement

Collapse
No announcement yet.

How do we extend UltraView2 for new device types?

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

  • How do we extend UltraView2 for new device types?

    I used to use the older (script) version of UltraView2 under IIS way back when, and extended it through the ultra_view2_xml.inc file to add different capabilities for new devices types. For example, for TEMP05 (weather), security, as well as Ninja Pan/Tilt camera base devices, I added a text-to-image function using the DynImage object, which created image files based on the device string in the device.

    This allowed me to use decimal numerical info, such as 65.6, instead of just using HS' integer data for device values. It wasn't easy to make the changes at first, but I got it down to a science and had many devices types where I did this.

    However, now that I'm running HS2 and UltraView2 as a plugin, I'm not sure where I would make this type of change, in order to use that DynImage object to create and pump icon image names into UV2.

    I think that along with the new Ultra Status2, this would be a great way to clean up any missing icons - have them built on the fly when the UV2 page is updated.

    Ultrajones, while I have not tested whether HS2's web server would recognize and use this ActiveX object, can you tell me how/where to extend the new UV2 to do this, or would you consider putting the capability into the package? I'll test the object to see if it will work under HS2 shortly and post my results. The object info is at http://www.oz.net/~cashton/dynimage.html .

    Here's an example section I had used from the older UV2 under IIS 5:


    Code:
     
       case "Weather"
    	if strDeviceString = "" then
    	 strDeviceString = "Unknown"
    	 strDeviceIcon = "unknown.gif"
    	else
    	 'Convert degree character to HTML degree
    	 strDeviceString = replace(strDeviceString, "", "°")
    	 select case strDeviceString
    	 case "." 
    	  strDeviceIcon = mid(strDeviceString,1,(Instr(strDeviceString,".")-1) )
    	 case "°"
    	  strDeviceIcon = mid(strDeviceString,1,(Instr(strDeviceString,"°")-1) )
    	 case else
    	  Set oDynImage = CreateObject("DynImage.DynImage") 
    	  oDynImage.Open 50, 20 
    	  oDynImage.Color = &h000000 
    	  oDynImage.Rectangle 0, 0, 50,20 
    	  'oDynImage.LoadImage 1, 1, 229, 250, "c:\Live.bmp"
    	  oDynImage.FontFace = "Tahoma Bold"
    	  oDynImage.FontWeight = 300
    	  oDynImage.FontSize = 12
    	  oDynImage.Color = &h000000
    	  oDynImage.TextOut 7,03, strDeviceString & ""
    	  oDynImage.FontFace = "Arial"
    	  oDynImage.FontWeight = 500
    	  oDynImage.FontSize = 14
    	  'sTemp = hs.DeviceString("v13")
    	  'iTemp = InStr(1,sTemp,">")
    	  'sTemp = Mid(sTemp, CInt(iTemp) + 1, (Len(sTemp) - CInt(iTemp)))
    	  'oDynImage.TextOut 7,105, Trim(sTemp)
    	  'Response.ContentType = "image/png" 
    	  'Response.BinaryWrite oDynImage.Image 
    	  image = "c:\program files\homeseer\html\temp\" & strDeviceString & ".png"
    	  oDynImage.SaveImage(image)
    	  oDynImage.Close 
    	  set oDynImage = nothing
    
    	  strDeviceIcon = "/temp/" & strDeviceString & ".png"
    	 end select
    	 strDeviceIcon = BuildIcon(strDeviceIcon)
    	end if
    |
    | - Gordon

    "I'm a Man, but I can change, if I have to, I guess." - Man's Prayer, Possum Lodge, The Red Green Show
    http://HiddenGemTech.com - http://MaineMusiciansExchange.org - http://www.WJZF.org


  • #2
    The DynImage ActiveX control works fine the HS2 web server, so all I need is where to put the code for modifying the UltraView2 plugin.
    |
    | - Gordon

    "I'm a Man, but I can change, if I have to, I guess." - Man's Prayer, Possum Lodge, The Red Green Show
    http://HiddenGemTech.com - http://MaineMusiciansExchange.org - http://www.WJZF.org

    Comment


    • #3
      Look at the PlaceImages() function in ultraview2.txt and the ProcessDevice() function in ultraview2_common.txt.
      Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

      Comment


      • #4
        Thanks Ultrajones, that'll help a lot. But I'm running into a problem. For some reason, the DynImage object works fine in the HS2 web server in an ASP file, but not in the UltraView2 ASPX file. Is there a limitation on using objects that write to disk in the ASPX files, or any idea why this would work one way and not the other?
        I'll look around the board for the solution, too. I'm real close to getting this to work now...
        |
        | - Gordon

        "I'm a Man, but I can change, if I have to, I guess." - Man's Prayer, Possum Lodge, The Red Green Show
        http://HiddenGemTech.com - http://MaineMusiciansExchange.org - http://www.WJZF.org

        Comment

        Working...
        X