Jump to content

emaxedon

c4Forums Member
  • Content count

    9
  • Joined

  • Last visited

  1. How to create Events from an Action?

    @TheWizard I'm writing a driver that receives HTTP requests from a web service. Depending on the request, an event is fired. There are 2 types of requests, for simplification, let's assume the requests are Turn On, and Turn Off. Each request also passes an ID, let's assume this ID is some device. I want to allow the programmer to dynamically create Events that will handle the two types of requests (Turn On, Turn Off) with an associated ID. So, the programmer knows there will be 3 IDs, 100, 101, and 102. He wants to create a Turn On, and Turn Off event for each of the IDs. Then, when a web request comes in, it will fire the appropriate event. I could create Events individually, say, C4:AddEvent(id, 'Turn On 100', description), C4:AddEvent(id, 'Turn Off 101', description), etc. etc., but I it would be more elegant to have only two Events, say "Turn On", and "Turn Off", where each event has parameters (100, 101, 102). Then when a request comes in that is say Turn On, it fires the Turn On event with parameter ID.
  2. How to create Events from an Action?

    Hey @TheWizard, 1. I've seen Events in the programming tab with a drop down select. Is it possible to use C4:AddEvent to create events that have drop downs? 2. I have to trigger Events using C4:FireEvent, or C4:FireEventByID. Is it possible to fire an Event that has a drop down and only trigger an element of the dropdown? For instance, Events: (event with a dropdown) - Command ['1', '2', '3', ... ] (normal events) - Pressed On Button - Pressed Off Button Let's say I want to trigger the Command event but only where it's number '2'? What's the XML configuration look like for an event that has more fields than just ID, name, and description?
  3. How to create Events from an Action?

    Hey @msgreenf, So I created an Action that pulls in Property values - and this works. I'm wondering if you've ever used the C4:AddEvent API. I'm calling C4:AddEvent, and creating events dynamically (not in the XML configuration), but I'm not seeing the events under the Programming/Events tab in Composer after they are allegedly being created. Does the AddEvent function create events that Composer programmers can then use in the Programming tab?
  4. How to get "action" parameters value

    Are there different kind of user input elements we can create under the "Actions" tab? For instance, something similar to a HTML form element, where there is a submit button with textfields we can pass as arguments. Or are Actions limited to only buttons?
  5. How to create Events from an Action?

    Can I pass arguments to the Update Properties command in the action tab? <action> <name>Update Properties</name> <command>update</command> ??? Any way to pass arguments that would show up as text fields in the action tab? </action> That way, when the "update" function is called, I can do stuff with user generated input... say: function LUA_ACTION.update(arg1, arg2) Dbg:Trace("Update properties") Dbg:Trace("Argument 1:" .. arg1) Dbg:Trace("Argument 2:" .. arg2) end Any ideas @msgreenf?
  6. My driver needs to be able to dynamically create Events. I want to create these Events from a LUA_ACTION. How would I complete the XML configuration to create an Action that would pass 3 parameters, eventId, eventName, and eventDescription? <actions> <action> ??? </action> </actions> When pressed, it would trigger the "ExecuteCommand", and subsequently create the Event using the C4:AddEvent API. function ExecuteCommand(strCommand, tParams) if (strCommand == 'LUA_ACTION') then if tParams ~= nil then for pName, pValue in pairs(tParams) do if pName == 'ACTION' then -- TODO: C4:AddEvent(eventId, eventName, eventDescription) end end end end end In Leyman's terms, I need to create a button under the Actions tab that would create an event by passing 3 parameters - the event ID, event name, and event description. Any help getting me moving in the right direction would be greatly appreciated. Thank you.
  7. How to get "action" parameters value

    How would we get the "second" parameter value from a LUA_ACTION?
  8. Help: Proxies and Connections

    Thank you @TheWizard, your answer was very helpful. I'll try it out now.
  9. I'm writing a driver that polls data using C4:urlGet, and depending on the resulting data an Event is fired. Is it possible to create a driver without using any device proxies or connections? I tried keeping proxies and connections empty: <proxies /> <connections /> But, Composer doesn't even find the driver when trying to add it. So I'm assuming it's not possible to keep proxies/connections empty. Any ideas on what type of proxy/connection XML configuration I should be using? And where specifically to look in the right direction for documentation? DriverWorks SDK 2.9.0 API Reference Guide doesn't document XML configurations very well at all...
×