#include #include #include #include #include int main(int argc, char* argv[]) { std::string host = "127.0.0.1"; uint16_t port = 9000; std::string objectRef = "DemoSite/DemoSystem/DemoAsset/EdgeDevice_01/ValveOpening"; double value = 60.0; for (int i = 1; i < argc; ++i) { const std::string arg = argv[i]; if (arg == "--daemon" && i + 1 < argc) { const std::string endpoint = argv[++i]; const auto pos = endpoint.find(':'); if (pos != std::string::npos) { host = endpoint.substr(0, pos); port = static_cast(std::stoi(endpoint.substr(pos + 1))); } } else if (arg == "--object-ref" && i + 1 < argc) { objectRef = argv[++i]; } else if (arg == "--value" && i + 1 < argc) { value = std::stod(argv[++i]); } } softbus::api::ExecuteCommand cmd; cmd.requestId = "req-cli-" + softbus::core::DeviceIdentity::generateTraceId(); cmd.traceId = softbus::core::DeviceIdentity::generateTraceId(); cmd.objectRef = objectRef; cmd.command = "write"; cmd.params = {{"value", value}}; std::cout << cmd.toJson().dump() << std::endl; std::cout << "Use OPC UA ExecuteCommand or: softbus_daemon --self-test" << std::endl; std::cout << "Note: uplink port " << host << ":" << port << " is reserved for edge agent connection." << std::endl; (void)host; (void)port; return 0; }