From f31ffea160f51fef4a7bfdcbc50415030926c3bd Mon Sep 17 00:00:00 2001 From: Doug Lau Date: Thu, 12 Dec 2024 12:31:03 -0600 Subject: [PATCH] Implement camera device actions (wiper / preset) --- docs/action_plans.md | 9 ++++++--- src/us/mn/state/dot/tms/server/DeviceActionJob.java | 13 ++++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/action_plans.md b/docs/action_plans.md index bbbff9f04..21f2bb84e 100644 --- a/docs/action_plans.md +++ b/docs/action_plans.md @@ -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
API Resources 🕵️ diff --git a/src/us/mn/state/dot/tms/server/DeviceActionJob.java b/src/us/mn/state/dot/tms/server/DeviceActionJob.java index f002d4959..4ee112380 100644 --- a/src/us/mn/state/dot/tms/server/DeviceActionJob.java +++ b/src/us/mn/state/dot/tms/server/DeviceActionJob.java @@ -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; @@ -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? + } } } }