For the Search, I could define a device with VSPairs, I can create a device as below
SearchRef = hs.GetDeviceRef("Media Search")
If SearchRef <= 0 Then SearchRef = hs.NewDeviceRef("Media Search")
dv = hs.GetDeviceByRef(SearchRef)
dv.Address(hs) = "SqueezeBox-Search"
dv.Location(hs) = IFACE_NAME
dv.Last_Change(hs) = Now
dv.Device_Type_String(hs) = "Search Device"
dv.Interface(hs) = IFACE_NAME
dv.InterfaceInstance(hs) = instance
hs.DeviceVGP_ClearAll(dv.Ref(hs), True)
hs.DeviceVSP_ClearAll(dv.Ref(hs), True)
Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
Pair.PairType = VSVGPairType.SingleValue
Pair.Value = 1
Pair.Status = ""
Pair.Render = Enums.CAPIControlType.TextBox_String
hs.DeviceVSP_AddPair(dv.Ref(hs), Pair)
hs.SetDeviceValueByRef(dv.Ref(hs), 1, True)
dv.MISC_Set(hs, Enums.dvMISC.SHOW_VALUES)
When a search is submitted, my plugin SetIOMulti is called and I can determine what I need to do with this actio, how I want to represent the result (html in device string, content of a list in another device, etc) and which devices to update (including the NavBrowser). Of course instead of a Enums.CAPIControlType.TextBox_String I could use another like a select one in a list of predefined searches.
Note that from a plugin point if view I do not deal with the UI/Rendered which can be jQuery object, HSTouch UI, JSon, CAPI script call, etc From my point of view, I think we have all the (device & VSPair) constructs we need today.
SearchRef = hs.GetDeviceRef("Media Search")
If SearchRef <= 0 Then SearchRef = hs.NewDeviceRef("Media Search")
dv = hs.GetDeviceByRef(SearchRef)
dv.Address(hs) = "SqueezeBox-Search"
dv.Location(hs) = IFACE_NAME
dv.Last_Change(hs) = Now
dv.Device_Type_String(hs) = "Search Device"
dv.Interface(hs) = IFACE_NAME
dv.InterfaceInstance(hs) = instance
hs.DeviceVGP_ClearAll(dv.Ref(hs), True)
hs.DeviceVSP_ClearAll(dv.Ref(hs), True)
Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
Pair.PairType = VSVGPairType.SingleValue
Pair.Value = 1
Pair.Status = ""
Pair.Render = Enums.CAPIControlType.TextBox_String
hs.DeviceVSP_AddPair(dv.Ref(hs), Pair)
hs.SetDeviceValueByRef(dv.Ref(hs), 1, True)
dv.MISC_Set(hs, Enums.dvMISC.SHOW_VALUES)
When a search is submitted, my plugin SetIOMulti is called and I can determine what I need to do with this actio, how I want to represent the result (html in device string, content of a list in another device, etc) and which devices to update (including the NavBrowser). Of course instead of a Enums.CAPIControlType.TextBox_String I could use another like a select one in a list of predefined searches.
Note that from a plugin point if view I do not deal with the UI/Rendered which can be jQuery object, HSTouch UI, JSon, CAPI script call, etc From my point of view, I think we have all the (device & VSPair) constructs we need today.
Comment