Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

sensors.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * Created by robin on 11/21/15.
  3. */
  4. (function () {
  5. 'use strict';
  6. angular.module('camotionAdmin')
  7. .factory('SensorsService', ['luticateRequest', function (luticateRequest) {
  8. var SensorsService = {};
  9. SensorsService.add = function(data, promise)
  10. {
  11. return luticateRequest.post("/api/sensors/add", {sensor: JSON.stringify(data)}, null, promise);
  12. };
  13. SensorsService.getAll = function(data, promise)
  14. {
  15. return luticateRequest.get("/api/sensors", data, promise);
  16. };
  17. SensorsService.getAllTypes = function(promise)
  18. {
  19. return luticateRequest.get("/api/sensors/types", null, promise);
  20. };
  21. SensorsService.get = function(data, promise)
  22. {
  23. return luticateRequest.get("/api/sensors/" + data.sensor_id , null, promise);
  24. };
  25. SensorsService.edit = function(data, promise)
  26. {
  27. return luticateRequest.post("/api/sensors/" + data.sensor_id + "/edit", {sensor: JSON.stringify(data)}, null, promise);
  28. };
  29. SensorsService.del = function(data, promise)
  30. {
  31. return luticateRequest.post("/api/sensors/" + data.sensor_id + "/del", null, null, promise);
  32. };
  33. return SensorsService;
  34. }]);
  35. })();