Default LuaLibraries in FW 1.2

luaLibraries.xml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <luaLibraries>
  3. <luaLibrary name="callforward">
  4. <code><![CDATA[
  5. local valid = false
  6. local active = config.get( pathPrefix .. "active" )
  7.  
  8. local function updateLed()
  9. if not valid then
  10. key:setLed( "red", true )
  11. elseif active == "true" then
  12. key:setLed( "green" )
  13. else
  14. key:setLed( "off" )
  15. end
  16. end
  17.  
  18. local function checkValid()
  19. local value = config.get( pathPrefix .. "target" )
  20. valid = value and value:len() > 0
  21. end
  22.  
  23. local function checkActive()
  24. active = config.get( pathPrefix .. "active" )
  25. end
  26.  
  27. local function configListener( path )
  28. checkValid()
  29. checkActive()
  30. updateLed()
  31. end
  32.  
  33. function onKeyUp()
  34. --[] check for validity []--
  35. if not valid then
  36. return
  37. end
  38.  
  39. local value = config.get( pathPrefix .. "active" )
  40. if value == "false" then
  41. config.set( pathPrefix .. "active", "true" )
  42. elseif value == "true" then
  43. config.set( pathPrefix .. "active", "false" )
  44. end
  45. end
  46.  
  47. config.register( pathPrefix, configListener )
  48. checkValid()
  49. updateLed()--]]></code>
  50. </luaLibrary>
  51. </luaLibraries>
  • en/products/comfortel-d-series/d-100-200/developer/provisioning/settings/lualibraries/default1.2.txt
  • Last modified: 03.03.2020 17:27
  • by neubauers