Skip to content

Commit

Permalink
Add meter_algorithm / meter_type LUT resources
Browse files Browse the repository at this point in the history
  • Loading branch information
DougLau committed Jan 29, 2025
1 parent e139154 commit 5f9189c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/rest_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ These are static resources which may only change on IRIS updates:
- `lane_code` Lane codes
- `lane_use_indication` [LCS] lane use indications
- `lcs_lock` [LCS] lock codes
- `meter_algorithm` Ramp metering algorithms
- `meter_fault` Ramp meter faults
- `meter_lock` Ramp meter lock reasons
- `meter_queue_state` Ramp meter queue states
- `meter_type` Ramp meter types
- `r_node_transition` R_Node transitions
- `r_node_type` R_Node types
- `resource_type` [Resource types] available in `iris/api/`
Expand Down
12 changes: 12 additions & 0 deletions honeybee/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,12 @@ pub const LCS_LOCK_LUT: &str = "\
FROM iris.lcs_lock \
ORDER BY id";

/// SQL query for ramp meter algorithms (LUT)
pub const METER_ALGORITHM_LUT: &str = "\
SELECT id, description \
FROM iris.meter_algorithm \
ORDER BY id";

/// SQL query for ramp meter faults (LUT)
pub const METER_FAULT_LUT: &str = "\
SELECT id, description \
Expand All @@ -589,6 +595,12 @@ pub const METER_QUEUE_STATE_LUT: &str = "\
FROM iris.meter_queue_state \
ORDER BY id";

/// SQL query for ramp meter types (LUT)
pub const METER_TYPE_LUT: &str = "\
SELECT id, description, lanes \
FROM iris.meter_type \
ORDER BY id";

/// SQL query for all modems (primary)
pub const MODEM_ALL: &str = "\
SELECT name, enabled \
Expand Down
10 changes: 10 additions & 0 deletions honeybee/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ pub enum Resource {
LcsArray,
LcsIndication,
LcsLock,
MeterAlgorithm,
MeterFault,
MeterLock,
MeterQueueState,
MeterType,
Modem,
MonitorStyle,
MsgLine,
Expand Down Expand Up @@ -168,9 +170,11 @@ impl Resource {
LcsArray,
LcsIndication,
LcsLock,
MeterAlgorithm,
MeterFault,
MeterLock,
MeterQueueState,
MeterType,
Modem,
MonitorStyle,
MsgLine,
Expand Down Expand Up @@ -258,9 +262,11 @@ impl Resource {
LcsArray => Res::LcsArray,
LcsIndication => Res::LcsIndication,
LcsLock => Res::LcsLock,
MeterAlgorithm => Res::MeterAlgorithm,
MeterFault => Res::MeterFault,
MeterLock => Res::MeterLock,
MeterQueueState => Res::MeterQueueState,
MeterType => Res::MeterType,
Modem => Res::Modem,
MonitorStyle => Res::MonitorStyle,
MsgLine => Res::MsgLine,
Expand Down Expand Up @@ -347,9 +353,11 @@ impl Resource {
LcsArray => "api/lcs_array",
LcsIndication => "api/lcs_indication",
LcsLock => "lut/lcs_lock",
MeterAlgorithm => "lut/meter_algorithm",
MeterFault => "lut/meter_fault",
MeterLock => "lut/meter_lock",
MeterQueueState => "lut/meter_queue_state",
MeterType => "lut/meter_type",
Modem => "api/modem",
MonitorStyle => "api/monitor_style",
MsgLine => "api/msg_line",
Expand Down Expand Up @@ -449,9 +457,11 @@ impl Resource {
LcsArray => query::LCS_ARRAY_ALL,
LcsIndication => query::LCS_INDICATION_ALL,
LcsLock => query::LCS_LOCK_LUT,
MeterAlgorithm => query::METER_ALGORITHM_LUT,
MeterFault => query::METER_FAULT_LUT,
MeterLock => query::METER_LOCK_LUT,
MeterQueueState => query::METER_QUEUE_STATE_LUT,
MeterType => query::METER_TYPE_LUT,
Modem => query::MODEM_ALL,
MonitorStyle => query::MONITOR_STYLE_ALL,
MsgLine => query::MSG_LINE_ALL,
Expand Down
11 changes: 9 additions & 2 deletions resources/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ pub enum Res {
LcsArray,
LcsIndication,
LcsLock,
MeterAlgorithm,
MeterFault,
MeterLock,
MeterQueueState,
MeterType,
Modem,
MonitorStyle,
MsgLine,
Expand Down Expand Up @@ -164,9 +166,11 @@ impl Res {
LcsArray,
LcsIndication,
LcsLock,
MeterAlgorithm,
MeterFault,
MeterLock,
MeterQueueState,
MeterType,
Modem,
MonitorStyle,
MsgLine,
Expand Down Expand Up @@ -252,9 +256,11 @@ impl Res {
LcsArray => "lcs_array",
LcsIndication => "lcs_indication",
LcsLock => "lcs_lock",
MeterAlgorithm => "meter_algorithm",
MeterFault => "meter_fault",
MeterLock => "meter_lock",
MeterQueueState => "meter_queue_state",
MeterType => "meter_type",
Modem => "modem",
MonitorStyle => "monitor_style",
MsgLine => "msg_line",
Expand Down Expand Up @@ -349,8 +355,9 @@ impl Res {
BeaconState | CommProtocol | Condition | Direction | Encoding
| Font | GateArmInterlock | GateArmState | Graphic | IncImpact
| IncRange | LaneCode | LaneUseIndication | LcsLock
| MeterFault | MeterLock | MeterQueueState | ResourceType
| RnodeTransition | RnodeType | RoadClass | RoadModifier => true,
| MeterAlgorithm | MeterFault | MeterLock | MeterQueueState
| MeterType | ResourceType | RnodeTransition | RnodeType
| RoadClass | RoadModifier => true,
_ => false,
}
}
Expand Down

0 comments on commit 5f9189c

Please sign in to comment.