Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Managing PTZ cameras using Elixir and the Phoenix Framework

4.459 Aufrufe

Veröffentlicht am

Overview of the Elixir based Phoenix Framework highlighting what it makes it so productive, fast and different from the other web framework. Second part describse my experience using Phoenix as a contributor to some of the open source projects leaded by evercam.io http://evercam.io, an exciting new start-up based in Dublin that specialises in Apps and Developer tools to manage IP based cameras.

Veröffentlicht in: Software
  • Als Erste(r) kommentieren

Managing PTZ cameras using Elixir and the Phoenix Framework

  1. 1. Manage PTZ Cameras with Phoenix José C García-Sacristán @jgsacristan
  2. 2. “Phoenix is a framework for building HTML5 apps, API backends and distributed systems to take on the modern Web.” “Written in Elixir, you get beautiful syntax, productive tooling and a fast runtime”
  3. 3. 2 million connections per server 400 million users, 30 engineers
  4. 4. Erlang • Created in 1986 - Windows in 1985 - Linux in 1991 • Handles 50% of the worlds telecom traffic • Reported 99.9999999% availability (nine nines)
  5. 5. Elixir Elixir is a functional, concurrent, general- purpose programming language that runs on the Erlang virtual machine (BEAM). Elixir builds on top of Erlang to provide distributed, fault- tolerant, soft real-time, non-stop applications but also extends it to support metaprogramming with macros and polymorphism via protocols.
  6. 6. Productivity in Phoenix • Short term productivity - Documentation / Guides / Generators - Eliminates trivial choices • Long term productivity - Maintainability - Introspection
  7. 7. Easy installation • $mix local.hex • $ mix archive.install https://github.com/phoenixframework/phoen ix/releases/download/v1.0.2/phoenix_new- 1.0.2.ez • $mix phoenix.new my_app
  8. 8. Endpoints
  9. 9. Routers
  10. 10. Controllers
  11. 11. Generators $ mix phoenix.gen.html $ mix phoenix.gen.json $ mix phoenix.gen.channel
  12. 12. Views & Templates • Precompiled. Fast • Views render templates. • Views serve as a presentation layer • Beyond HTML
  13. 13. Performance
  14. 14. Robust Concurrency Model • “processes” – extreme lightweight units of concurrency • Garbage collection is per process - No global pauses • Load balances on IO and CPU
  15. 15. Channels Trivial realtime communication for connected devices
  16. 16. But there is more .. • Form builders • Static build tools with ES6 by default • Live reloading • First class test tools • Packages via hex.pm (+2MM downloads)
  17. 17. Applications • Package and run our code • Can be started and stopped as a unit • Provide unified configuration • Hold processes and state in the supervision tree
  18. 18. :observer.start
  19. 19. :observer.start
  20. 20. • The ONVIF specification defines a common protocol for the exchange of information between network video devices including automatic device discovery, video streaming and intelligence metadata.
  21. 21. Onvif Specification Based on relevant Web Services standards including security and IP configuration requirements. Areas covered: • IP configuration • Device discovery • Device management • Media configuration • Real time viewing • Event handling • PTZ camera control • Video analytics • Security
  22. 22. http://www.onvif.org/onvif/ver20/util/operationIndex.html
  23. 23. Integration with evercam-media Problems: • Poor SOAP support in Erlang/Elixir. • WS-Security not implemented. • SOAP operations return XML. • evercam-media needs JSON responses.
  24. 24. Integration with evercam-media Solution: • HTTPotion for HTTP requests
  25. 25. Integration with evercam-media Solution: • HTTPotion for HTTP requests • Own implementation of SOAP Envelope and WS-Security headers.
  26. 26. Integration with evercam-media Solution: • HTTPotion for HTTP requests • Own implementation of SOAP Envelope and WS-Security headers. • Own implementation of XML to Elixir Map transformations using Erlang xmerl library
  27. 27. Integration with evercam-media • Definition of needed operations using onvif_client methods.
  28. 28. Integration with evercam-media • Definition of needed operations using onvif_client methods. • Add REST routes to web/router.ex
  29. 29. Integration with evercam-media • Definition of needed operations using onvif_client methods. • Add REST routes to web/router.ex • Implement controllers that will invoke ONVIF operations and return the responses as Elixir Map structures.
  30. 30. Integration with evercam-media • Definition of needed operations using onvif_client methods. • Add REST routes to web/router.ex • Implement controllers that will invoke ONVIF operations and return the responses as Elixir Map structures. • Phoenix translate these Maps into JSON structures without the need of extra coding
  31. 31. Demo

×