E40 Process Jobs + E94 Control Jobs + E30 communication state
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>
This commit is contained in:
@@ -16,6 +16,8 @@ enum class Format : uint8_t {
|
||||
Binary = 010, // 8
|
||||
Boolean = 011, // 9
|
||||
ASCII = 020, // 16
|
||||
JIS8 = 021, // 17 — 8-bit JIS (single-byte Japanese text)
|
||||
C2 = 022, // 18 — 2-byte Unicode code points (big-endian)
|
||||
I8 = 030, // 24
|
||||
I1 = 031, // 25
|
||||
I2 = 032, // 26
|
||||
@@ -34,6 +36,8 @@ inline const char* format_name(Format f) {
|
||||
case Format::Binary: return "B";
|
||||
case Format::Boolean: return "BOOLEAN";
|
||||
case Format::ASCII: return "A";
|
||||
case Format::JIS8: return "J";
|
||||
case Format::C2: return "C";
|
||||
case Format::I8: return "I8";
|
||||
case Format::I1: return "I1";
|
||||
case Format::I2: return "I2";
|
||||
@@ -55,10 +59,12 @@ inline std::size_t element_size(Format f) {
|
||||
switch (f) {
|
||||
case Format::List: return 0;
|
||||
case Format::ASCII:
|
||||
case Format::JIS8:
|
||||
case Format::Binary:
|
||||
case Format::Boolean:
|
||||
case Format::U1:
|
||||
case Format::I1: return 1;
|
||||
case Format::C2:
|
||||
case Format::U2:
|
||||
case Format::I2: return 2;
|
||||
case Format::U4:
|
||||
@@ -81,13 +87,13 @@ class Item {
|
||||
using List = std::vector<Item>;
|
||||
using Storage = std::variant<
|
||||
List, // List
|
||||
std::string, // ASCII
|
||||
std::string, // ASCII, JIS-8
|
||||
std::vector<uint8_t>, // Binary, Boolean, U1
|
||||
std::vector<int8_t>, // I1
|
||||
std::vector<int16_t>, // I2
|
||||
std::vector<int32_t>, // I4
|
||||
std::vector<int64_t>, // I8
|
||||
std::vector<uint16_t>, // U2
|
||||
std::vector<uint16_t>, // U2, C2 (Unicode code points)
|
||||
std::vector<uint32_t>, // U4
|
||||
std::vector<uint64_t>, // U8
|
||||
std::vector<float>, // F4
|
||||
@@ -107,6 +113,8 @@ class Item {
|
||||
// --- Factory functions -------------------------------------------------
|
||||
static Item list(List items) { return Item(Format::List, std::move(items)); }
|
||||
static Item ascii(std::string s) { return Item(Format::ASCII, std::move(s)); }
|
||||
static Item jis8(std::string s) { return Item(Format::JIS8, std::move(s)); }
|
||||
static Item c2(std::vector<uint16_t> code_points) { return Item(Format::C2, std::move(code_points)); }
|
||||
static Item binary(std::vector<uint8_t> b) { return Item(Format::Binary, std::move(b)); }
|
||||
static Item boolean(std::vector<uint8_t> b) { return Item(Format::Boolean, std::move(b)); }
|
||||
static Item boolean(bool b) { return Item(Format::Boolean, std::vector<uint8_t>{static_cast<uint8_t>(b ? 1 : 0)}); }
|
||||
@@ -141,6 +149,11 @@ class Item {
|
||||
const List& as_list() const { return std::get<List>(data_); }
|
||||
List& as_list() { return std::get<List>(data_); }
|
||||
const std::string& as_ascii() const { return std::get<std::string>(data_); }
|
||||
// JIS-8 shares the std::string storage slot (it's a single-byte
|
||||
// encoding like ASCII); callers disambiguate via `format()`.
|
||||
const std::string& as_jis8() const { return std::get<std::string>(data_); }
|
||||
// C2 (Unicode) shares the std::vector<uint16_t> storage with U2.
|
||||
const std::vector<uint16_t>& as_c2() const { return std::get<std::vector<uint16_t>>(data_); }
|
||||
const std::vector<uint8_t>& as_bytes() const { return std::get<std::vector<uint8_t>>(data_); }
|
||||
|
||||
const Storage& storage() const { return data_; }
|
||||
|
||||
Reference in New Issue
Block a user