(()=>{function t(t,i,r,c,a){return function(o,t,n){var e=this;e.units=n.getTimeUnits(),e.getSingle=function(){return n.execute({deviceId:o.id,description:a("Get single location"),c8y_MeasurementRequestOperation:{requestName:"location"}},e.getSingle)},e.setReportIntervalNoMotion=function(){return n.execute({deviceId:o.id,description:a("Position reporting interval if no motion detected"),c8y_Tracking:{interval:n.convertToSeconds(e.reportIntervalNoMotion,e.setReportIntervalNoMotion.unit)}},e.setReportIntervalNoMotion).then(function(t){t.completed.then(function(t){t.status===i.status.SUCCESSFUL&&(o.c8y_RequiredAvailability&&o.c8y_RequiredAvailability.responseInterval)!==(t=n.convertToUnits(e.reportIntervalNoMotion,_.find(e.units,{value:"minutes"}),e.setReportIntervalNoMotion.unit.multiplier))&&r.save({id:o.id,c8y_RequiredAvailability:{responseInterval:t}})})})},e.setReportIntervalOnMotion=function(){return n.execute({deviceId:o.id,description:a("Position reporting interval if motion detected"),c8y_MotionTracking:e.getMotionTracking()},e.setReportIntervalOnMotion)},e.getMotionTracking=function(){var t={};return o.c8y_MotionTracking&&!_.isUndefined(o.c8y_MotionTracking.active)&&(t.active=e.motionTracking),t.interval=n.convertToSeconds(e.reportIntervalOnMotion,e.setReportIntervalOnMotion.unit),t},e.setMotionTracking=function(){return n.execute({deviceId:o.id,description:a("Motion tracking"),c8y_MotionTracking:{active:e.motionTracking}},e.setMotionTracking)},e.blockReportIntervalOnMotionChange=function(){c.RTLU.block(e.setReportIntervalOnMotion,!0)},e.blockReportintervalNoMotionChange=function(){c.RTLU.block(e.setReportIntervalNoMotion,!0)},e.blockMotionTrackingChange=function(){c.RTLU.block(e.setMotionTracking.blocked,!0)},e.refreshReportIntervalOnMotion=function(){c.RTLU.clearLockup(e.setReportIntervalOnMotion),e.setReportIntervalOnMotion.unit=e.units[0],e.reportIntervalOnMotion=o.c8y_MotionTracking&&o.c8y_MotionTracking.interval},e.refreshReportIntervalNoMotion=function(){c.RTLU.clearLockup(e.setReportIntervalNoMotion),e.setReportIntervalNoMotion.unit=e.units[0],e.reportIntervalNoMotion=o.c8y_Tracking&&o.c8y_Tracking.interval},e.refreshMotionTracking=function(){c.RTLU.clearLockup(e.setMotionTracking),e.motionTracking=o.c8y_MotionTracking&&o.c8y_MotionTracking.active},e.getSingle.supported=t.supportedOperations.getSingleLocation,e.setReportIntervalNoMotion.supported=t.supportedOperations.reportIntervalNoMotion,e.setReportIntervalOnMotion.supported=t.supportedOperations.reportIntervalOnMotion,e.setMotionTracking.supported=t.supportedOperations.motionTracking,e.setReportIntervalOnMotion.supported&&n.scope.$watch("tracker.device.c8y_MotionTracking.interval",function(t){c.RTLU.getBlock(e.setReportIntervalOnMotion)?c.RTLU.infoChange(e.setReportIntervalOnMotion,!0):e.reportIntervalOnMotion=t}),e.setReportIntervalNoMotion.supported&&n.scope.$watch("tracker.device.c8y_Tracking.interval",function(t){c.RTLU.getBlock(e.setReportIntervalNoMotion)?c.RTLU.infoChange(e.setReportIntervalNoMotion,!0):e.reportIntervalNoMotion=t}),e.setMotionTracking.supported&&n.scope.$watch("tracker.device.c8y_MotionTracking.active",function(t){c.RTLU.getBlock(e.setMotionTracking)?c.RTLU.infoChange(e.setMotionTracking,!0):e.motionTracking=t}),e.setReportIntervalNoMotion.unit=e.units[0],e.setReportIntervalOnMotion.unit=e.setReportIntervalNoMotion.unit}}t.$inject=["c8yBase","c8yDeviceControl","c8yDevices","RealtimeLockupSvc","gettext"],angular.module("c8y.trackerConfiguration").factory("trackerLocationSvc",t)})();