vitalidze / traccar-web

Traccar Web UI mod
http://traccar.litvak.su/
151 stars 145 forks source link

Notification on Idle and on Movement #95

Open Abyss777 opened 9 years ago

Abyss777 commented 9 years ago

It would be nice to have notifications on this events:

Examples:

vitalidze commented 9 years ago

This intersects with #25 (have no idea on how to implement it correctly yet), #60 and #88

Right now my next goal is to implement geofences.

Abyss777 commented 9 years ago

How frequently is updating position.IdleSince ? (it happends in MapController.update()) Is it possible to do the work in NotificationServiceImpl.NotificationSender ?

vitalidze commented 9 years ago

It is updated with ApplicationSettings.updateInterval frequency (15 seconds by default). For the first time there is also a map of latest non-idle positions by device loaded from server (see DataServiceImpl.getLatestNonIdlePositions). This is used to calculate how much time device/vehicle is not moving (or when it stopped).

Well, it can be done in NotificationSender, but my approach is to split notification sending and notification events posting. So something posts events and then NotificationSender sends them to the users that expect to receive it (i.e. have access to the device, set up email and checked notifications box in his profile).

Abyss777 commented 9 years ago

Yes, sure, my mistake. Best way is creating new class in EventServiceImpl like MovingDetector and IdleDetector to rise new types of Events.

A lot of work :( May be after geofences.