myems/admin/app/services/settings/sensor/sensorpoint.service.js

31 lines
1.0 KiB
Python

'use strict';
app.factory('SensorPointService', function($http) {
return {
addPair: function(sensorID,pointID, headers, callback) {
$http.post(getAPI()+'sensors/'+sensorID+'/points',{data:{'point_id':pointID}}, {headers})
.then(function (response) {
callback(response);
}, function (response) {
callback(response);
});
},
deletePair: function(sensorID,pointID, headers, callback) {
$http.delete(getAPI()+'sensors/'+sensorID+'/points/'+pointID, {headers})
.then(function (response) {
callback(response);
}, function (response) {
callback(response);
});
},
getPointsBySensorID: function(id, callback) {
$http.get(getAPI()+'sensors/'+id+'/points')
.then(function (response) {
callback(response);
}, function (response) {
callback(response);
});
}
};
});