90c177b7ce
GEM300 layer: SEMI E40-0705 Process Job and E94-0705 Control Job state machines, plus the E30 §6.1 communication-state machine that sits between HSMS SELECT and full GEM communication. Data-driven via data/process_job_state.yaml and data/control_job_state.yaml, mirroring the existing control_state.yaml pattern. Wire coverage: S14F9/F10 CreateObject (CJ) host -> equipment S14F11/F12 DeleteObject (CJ) host -> equipment S16F5/F6 PRJobCommand host -> equipment S16F9 PRJobAlert equipment -> host S16F11/F12 PRJobCreate (simplified body) host -> equipment S16F13/F14 PRJobDequeue host -> equipment S16F27/F28 CJobCommand host -> equipment Process Job FSM exposes 8 states matching PRJOBSTATE bytes (E40 §10.3.2); HOQ is reorder-aware (move-to-head against an insertion-order vector); Stop/Abort on a Queued PJ routes through ABORTING so the host observes PRJOBSTATE=7 on the wire (§6.3); alert_enabled is settable per-PJ for PRALERT control; FSM dispatches through ProcessJobStore::on_change_ dynamically so a late set_state_change_handler() reaches existing PJs. Hardening: loader rejects NoState (sentinel) as initial/from/to and rejects `on: created` rows; static_asserts pin enum values to wire bytes; ProcessJobStore is non-movable to keep the per-PJ this-capture safe. Server simulator cascades the full CJ -> PJ lifecycle on CJSTART so the wire trace exercises every legal state. CEIDs 400/401 fire on CJ state changes via the existing event-report pipeline. Tests: 60+ new assertions across test_process_jobs, test_control_jobs, test_communication_state, test_hsms_connection, plus loader and messages round-trip coverage. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
64 lines
1.9 KiB
C++
64 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <stdexcept>
|
|
#include <string>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
#include "secsgem/gem/control_job_state.hpp"
|
|
#include "secsgem/gem/control_state.hpp"
|
|
#include "secsgem/gem/data_model.hpp"
|
|
#include "secsgem/gem/process_job_state.hpp"
|
|
|
|
// YAML-driven loaders for the E30 control-state transition table and the
|
|
// equipment data dictionary. Behaviour rules live in the YAML; this is the
|
|
// parser that wires them into the runtime structures.
|
|
namespace secsgem::config {
|
|
|
|
class ConfigError : public std::runtime_error {
|
|
public:
|
|
using std::runtime_error::runtime_error;
|
|
};
|
|
|
|
struct ControlStateConfig {
|
|
gem::ControlTransitionTable table;
|
|
gem::ControlState initial = gem::ControlState::HostOffline;
|
|
};
|
|
|
|
// Loads data/control_state.yaml.
|
|
ControlStateConfig load_control_state(const std::string& yaml_path);
|
|
|
|
struct EquipmentDescriptor {
|
|
uint16_t device_id = 0;
|
|
std::string model_name;
|
|
std::string software_rev;
|
|
std::string equipment_type; // S1F20 EQPTYP
|
|
std::vector<std::pair<uint8_t, std::string>> capabilities; // (CCODE, CDESC)
|
|
std::optional<uint32_t> emit_on_control_change;
|
|
};
|
|
|
|
// Loads data/equipment.yaml into the given data model and returns the
|
|
// equipment header (device id, MDLN, SOFTREV, optional auto-emit CEID).
|
|
EquipmentDescriptor load_equipment(const std::string& yaml_path,
|
|
gem::EquipmentDataModel& model);
|
|
|
|
struct ProcessJobStateConfig {
|
|
gem::ProcessJobTransitionTable table;
|
|
gem::ProcessJobState initial = gem::ProcessJobState::Queued;
|
|
};
|
|
|
|
// Loads data/process_job_state.yaml.
|
|
ProcessJobStateConfig load_process_job_state(const std::string& yaml_path);
|
|
|
|
struct ControlJobStateConfig {
|
|
gem::ControlJobTransitionTable table;
|
|
gem::ControlJobState initial = gem::ControlJobState::Queued;
|
|
};
|
|
|
|
// Loads data/control_job_state.yaml.
|
|
ControlJobStateConfig load_control_job_state(const std::string& yaml_path);
|
|
|
|
} // namespace secsgem::config
|