定值与内部定值修改完毕
This commit is contained in:
@@ -1081,6 +1081,176 @@ bool ClientManager::add_file_download_action_to_device(
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//获取指定装置指定测点下的定值数据
|
||||
bool ClientManager::get_fixedvalue_action_to_device(const std::string& identifier, ushort point_id) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
// 生成定值数据报文
|
||||
auto packet = generate_requestFixValue_message(point_id);
|
||||
|
||||
// 添加动作到队列 (状态: 读取文件目录)
|
||||
ctx->add_action(DeviceState::READING_FIXEDVALUE, packet);
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//获取指定装置的定值描述
|
||||
bool ClientManager::get_fixedvaluedes_action_to_device(const std::string& identifier) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
// 生成定值描述报文
|
||||
auto packet = generate_requestFixDes_message();
|
||||
|
||||
// 添加动作到队列 (状态: 读取文件目录)
|
||||
ctx->add_action(DeviceState::READING_FIXEDVALUEDES, packet);
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//设置指定测点定值配置
|
||||
bool ClientManager::set_fixedvalue_action_to_device(const std::string& identifier, ushort point_id, const std::vector<float>& value) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
// 生成定值描述报文
|
||||
auto packet = generate_requestSetFixValue_message(point_id, value);
|
||||
|
||||
// 添加动作到队列 (状态: 读取文件目录)
|
||||
ctx->add_action(DeviceState::SET_FIXEDVALUE, packet);
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//获取装置内部定值
|
||||
bool ClientManager::get_interfixedvalue_action_to_device(const std::string& identifier) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
// 生成定值描述报文
|
||||
auto packet = generate_requestinterfixvalue_message();
|
||||
|
||||
// 添加动作到队列 (状态: 读取文件目录)
|
||||
ctx->add_action(DeviceState::READING_INTERFIXEDVALUE, packet);
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//获取装置内部定值控制字描述or内部定值描述 1-内部定值描述,2-控制字位描述
|
||||
bool ClientManager::get_fixedvalucontrolword_action_to_device(const std::string& identifier, unsigned char nDesCW) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
// 生成定值描述报文
|
||||
auto packet = generate_requestinterfixdes_message(nDesCW);
|
||||
|
||||
if (nDesCW == 1) {
|
||||
// 添加内部定值描述
|
||||
ctx->add_action(DeviceState::READING_INTERFIXEDVALUEDES, packet);
|
||||
}
|
||||
else {
|
||||
// 添加控制字描述
|
||||
ctx->add_action(DeviceState::READING_CONTROLWORD, packet);
|
||||
}
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//设置装置内部定值配置
|
||||
bool ClientManager::set_interfixedvalue_action_to_device(const std::string& identifier, const std::vector<uint16_t>& values) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
|
||||
// 查找匹配的设备
|
||||
for (auto& pair : clients_) {
|
||||
auto& ctx = pair.second;
|
||||
if (ctx->device_info.device_id == identifier ||
|
||||
ctx->device_info.mac == identifier)
|
||||
{
|
||||
// 生成定值描述报文
|
||||
auto packet = generate_requestsetinterfixvalue_message(values);
|
||||
//auto packet = generate_requestsetinterfixvalue_message_new(values);
|
||||
|
||||
// 添加动作到队列 (状态: 读取文件目录)
|
||||
ctx->add_action(DeviceState::SET_INTERFIXEDVALUE, packet);
|
||||
|
||||
// 如果当前空闲则立即执行
|
||||
if (ctx->current_state_ == DeviceState::IDLE) {
|
||||
ctx->process_next_action();
|
||||
}
|
||||
|
||||
return true; // 成功添加
|
||||
}
|
||||
}
|
||||
return false; // 设备未找到
|
||||
}
|
||||
|
||||
//获取指定装置测点的电压等级与接线方式
|
||||
bool ClientManager::get_point_scale_and_pttype(const std::string& identifier,
|
||||
ushort nCpuNo,
|
||||
std::string& out_scale,
|
||||
|
||||
Reference in New Issue
Block a user