B2: HostHandler status + subscription senders
Adds the five GEM event-subscription primitives the host needs to drive
the equipment's data-collection lifecycle (E30 §6.11):
S1F3/F4 selected status data
S1F11/F12 status variable namelist
S2F33/F34 define reports
S2F35/F36 link event reports
S2F37/F38 enable/disable events
Each is a one-line wrapper over the codegen builders + Connection's
send_request, surfacing the codegen-generated DefineReportEntry /
LinkEventEntry structs to callers behind a {id, [vids]} pair API.
This is the minimum surface a host needs to walk a fresh equipment
through "define report -> link CEID -> enable" and start receiving
S6F11 event reports — the same pattern the existing demo client does
inline. B3 lands the RCMD / recipe / job / terminal senders that
build on top.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -71,6 +71,31 @@ class HostHandler : public std::enable_shared_from_this<HostHandler> {
|
|||||||
// S1F15/F16 Request Offline. Counterpart to go_remote().
|
// S1F15/F16 Request Offline. Counterpart to go_remote().
|
||||||
void go_offline(ReplyHandler cb);
|
void go_offline(ReplyHandler cb);
|
||||||
|
|
||||||
|
// ---- Status + subscription senders (B2) -------------------------------
|
||||||
|
|
||||||
|
// S1F3/F4 Selected Status Data: empty `svids` requests every SVID.
|
||||||
|
void send_selected_status(const std::vector<uint32_t>& svids, ReplyHandler cb);
|
||||||
|
|
||||||
|
// S1F11/F12 Status Variable Namelist: empty `svids` requests every name.
|
||||||
|
void send_status_namelist(const std::vector<uint32_t>& svids, ReplyHandler cb);
|
||||||
|
|
||||||
|
// S2F33/F34 Define Report. `reports[i] = {rptid, [vids]}`; an empty
|
||||||
|
// rptid list per request resets that report (per E30 §6.11).
|
||||||
|
void send_define_reports(
|
||||||
|
uint32_t dataid,
|
||||||
|
const std::vector<std::pair<uint32_t, std::vector<uint32_t>>>& reports,
|
||||||
|
ReplyHandler cb);
|
||||||
|
|
||||||
|
// S2F35/F36 Link Event Reports. `links[i] = {ceid, [rptids]}`.
|
||||||
|
void send_link_event_reports(
|
||||||
|
uint32_t dataid,
|
||||||
|
const std::vector<std::pair<uint32_t, std::vector<uint32_t>>>& links,
|
||||||
|
ReplyHandler cb);
|
||||||
|
|
||||||
|
// S2F37/F38 Enable/Disable Events. Empty `ceids` = all.
|
||||||
|
void send_enable_events(bool enable, const std::vector<uint32_t>& ceids,
|
||||||
|
ReplyHandler cb);
|
||||||
|
|
||||||
// ---- Low-level: forward a primary verbatim ----------------------------
|
// ---- Low-level: forward a primary verbatim ----------------------------
|
||||||
void send_request(secs2::Message msg, ReplyHandler cb);
|
void send_request(secs2::Message msg, ReplyHandler cb);
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,42 @@ void HostHandler::go_offline(ReplyHandler cb) {
|
|||||||
send_request(s1f15_request_offline(), std::move(cb));
|
send_request(s1f15_request_offline(), std::move(cb));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HostHandler::send_selected_status(const std::vector<uint32_t>& svids,
|
||||||
|
ReplyHandler cb) {
|
||||||
|
send_request(s1f3_selected_status_request(svids), std::move(cb));
|
||||||
|
}
|
||||||
|
|
||||||
|
void HostHandler::send_status_namelist(const std::vector<uint32_t>& svids,
|
||||||
|
ReplyHandler cb) {
|
||||||
|
send_request(s1f11_status_namelist_request(svids), std::move(cb));
|
||||||
|
}
|
||||||
|
|
||||||
|
void HostHandler::send_define_reports(
|
||||||
|
uint32_t dataid,
|
||||||
|
const std::vector<std::pair<uint32_t, std::vector<uint32_t>>>& reports,
|
||||||
|
ReplyHandler cb) {
|
||||||
|
std::vector<DefineReportEntry> entries;
|
||||||
|
entries.reserve(reports.size());
|
||||||
|
for (const auto& [rptid, vids] : reports) entries.push_back({rptid, vids});
|
||||||
|
send_request(s2f33_define_report(dataid, entries), std::move(cb));
|
||||||
|
}
|
||||||
|
|
||||||
|
void HostHandler::send_link_event_reports(
|
||||||
|
uint32_t dataid,
|
||||||
|
const std::vector<std::pair<uint32_t, std::vector<uint32_t>>>& links,
|
||||||
|
ReplyHandler cb) {
|
||||||
|
std::vector<LinkEventEntry> entries;
|
||||||
|
entries.reserve(links.size());
|
||||||
|
for (const auto& [ceid, rptids] : links) entries.push_back({ceid, rptids});
|
||||||
|
send_request(s2f35_link_event_report(dataid, entries), std::move(cb));
|
||||||
|
}
|
||||||
|
|
||||||
|
void HostHandler::send_enable_events(bool enable,
|
||||||
|
const std::vector<uint32_t>& ceids,
|
||||||
|
ReplyHandler cb) {
|
||||||
|
send_request(s2f37_enable_event(enable, ceids), std::move(cb));
|
||||||
|
}
|
||||||
|
|
||||||
void HostHandler::send_request(s2::Message msg, ReplyHandler cb) {
|
void HostHandler::send_request(s2::Message msg, ReplyHandler cb) {
|
||||||
conn_->send_request(std::move(msg), std::move(cb));
|
conn_->send_request(std::move(msg), std::move(cb));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user