mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
实现MQTT协议消息订阅和消息解析流程
This commit is contained in:
@@ -55,12 +55,25 @@ std::shared_ptr<Device> Station::getDevice(int deviceId)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Station::getDeviceByType(int typeId, std::vector<std::shared_ptr<Device>>& res)
|
||||
std::shared_ptr<Device> Station::getDeviceByType(int deviceType, std::string code)
|
||||
{
|
||||
for (auto iter = mapDevice.begin(); iter!=mapDevice.end(); ++iter)
|
||||
{
|
||||
auto device = iter->second;
|
||||
if (device->type == typeId)
|
||||
if (device->type == deviceType && device->code == code)
|
||||
{
|
||||
return device;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Station::getDeviceByType(int deviceType, std::vector<std::shared_ptr<Device>>& res)
|
||||
{
|
||||
for (auto iter = mapDevice.begin(); iter!=mapDevice.end(); ++iter)
|
||||
{
|
||||
auto device = iter->second;
|
||||
if (device->type == deviceType)
|
||||
{
|
||||
res.push_back(device);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user