Utils.cpp (054aad8f80ca83b93123c495befe03dafaf63cc0) Utils.cpp (dabd48dd9ad9c05b1ad67e3540385bd69fe20239)
1/*
2// Copyright (c) 2017 Intel Corporation
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15*/
16
17#include "dbus-sensor_config.h"
18
1/*
2// Copyright (c) 2017 Intel Corporation
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15*/
16
17#include "dbus-sensor_config.h"
18
19#include <DeviceMgmt.hpp>
19#include <Utils.hpp>
20#include <boost/container/flat_map.hpp>
21#include <sdbusplus/asio/connection.hpp>
22#include <sdbusplus/asio/object_server.hpp>
23#include <sdbusplus/bus/match.hpp>
24
25#include <filesystem>
26#include <fstream>

--- 681 unchanged lines hidden (view full) ---

708 "type='signal',member='PropertiesChanged',path_namespace='" +
709 std::string(inventoryPath) + "',arg0namespace='" +
710 configInterfaceName(type) + "'",
711 handler);
712 matches.emplace_back(std::move(match));
713 }
714 return matches;
715}
20#include <Utils.hpp>
21#include <boost/container/flat_map.hpp>
22#include <sdbusplus/asio/connection.hpp>
23#include <sdbusplus/asio/object_server.hpp>
24#include <sdbusplus/bus/match.hpp>
25
26#include <filesystem>
27#include <fstream>

--- 681 unchanged lines hidden (view full) ---

709 "type='signal',member='PropertiesChanged',path_namespace='" +
710 std::string(inventoryPath) + "',arg0namespace='" +
711 configInterfaceName(type) + "'",
712 handler);
713 matches.emplace_back(std::move(match));
714 }
715 return matches;
716}
717
718std::vector<std::unique_ptr<sdbusplus::bus::match_t>>
719 setupPropertiesChangedMatches(
720 sdbusplus::asio::connection& bus, const I2CDeviceTypeMap& typeMap,
721 const std::function<void(sdbusplus::message_t&)>& handler)
722{
723 std::vector<const char*> types;
724 types.reserve(typeMap.size());
725 for (const auto& [type, dt] : typeMap)
726 {
727 types.push_back(type.data());
728 }
729 return setupPropertiesChangedMatches(bus, {types}, handler);
730}