Skip to content

Commit

Permalink
Implement camera device actions (wiper / preset)
Browse files Browse the repository at this point in the history
  • Loading branch information
DougLau committed Dec 12, 2024
1 parent 6e6dc78 commit f31ffea
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
9 changes: 6 additions & 3 deletions docs/action_plans.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,15 @@ the **Next Phase**. *Hold Time* must be a multiple of 30 seconds.
Device actions use [hashtag]s to associate devices with one phase of an action
plan. These devices can be:
- [DMS], displays the [message pattern] on the sign
- [beacon], activates flashing lights
- [ramp meter], enables metering operation
- [beacon], activates flashing lights
- [camera], recalls the specified camera [preset]
- [lane marking], activates in-pavement LEDs
- [camera], recalls the specified camera [preset] (experimental)

[Priority] determines the priority of messages created by the action.
[Priority] determines the priority of messages created by the action. For
camera actions, this value indicates:
* `0` activate wiper
* `1-12` a [preset] number to recall

<details>
<summary>API Resources 🕵️ </summary>
Expand Down
13 changes: 10 additions & 3 deletions src/us/mn/state/dot/tms/server/DeviceActionJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import us.mn.state.dot.tms.DMSHelper;
import us.mn.state.dot.tms.DeviceAction;
import us.mn.state.dot.tms.DeviceActionHelper;
import us.mn.state.dot.tms.DeviceRequest;
import us.mn.state.dot.tms.Hashtags;
import us.mn.state.dot.tms.LaneMarking;
import us.mn.state.dot.tms.LaneMarkingHelper;
Expand Down Expand Up @@ -196,9 +197,15 @@ private void performCameraAction(DeviceAction da, boolean deploy,
ActionTagMsg amsg = new ActionTagMsg(da, cam,
cam.getGeoLoc(), logger);
if (amsg.isPassing() && deploy) {
// FIXME: recall preset / save a snapshot
// after a moment
// cam.setRecallPreset(...);
int preset_num = da.getMsgPriority();
if (preset_num == 0) {
cam.setDeviceReq(DeviceRequest.
CAMERA_WIPER_ONESHOT);
} else if (preset_num > 0 && preset_num <= 12) {
cam.setRecallPreset(preset_num);
} else {
// FIXME: save snapshot?
}
}
}
}
Expand Down

0 comments on commit f31ffea

Please sign in to comment.