2017-11-27 14:13:55 +01:00
|
|
|
/**
|
2022-07-05 17:08:35 +02:00
|
|
|
* (C) 2016 - 2021 KISTLER INSTRUMENTE AG, Winterthur, Switzerland
|
2024-04-16 22:48:34 +02:00
|
|
|
* (C) 2016 - 2024 Stanislav Angelovic <stanislav.angelovic@protonmail.com>
|
2017-11-27 14:13:55 +01:00
|
|
|
*
|
2020-07-18 20:16:57 +02:00
|
|
|
* @file Defs.h
|
2017-11-27 14:13:55 +01:00
|
|
|
*
|
|
|
|
|
* Created on: Jan 2, 2017
|
|
|
|
|
* Project: sdbus-c++
|
|
|
|
|
* Description: High-level D-Bus IPC C++ library based on sd-bus
|
|
|
|
|
*
|
|
|
|
|
* This file is part of sdbus-c++.
|
|
|
|
|
*
|
|
|
|
|
* sdbus-c++ is free software; you can redistribute it and/or modify it
|
|
|
|
|
* under the terms of the GNU Lesser General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 2.1 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* sdbus-c++ is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
|
* along with sdbus-c++. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef SDBUS_CPP_INTEGRATIONTESTS_DEFS_H_
|
|
|
|
|
#define SDBUS_CPP_INTEGRATIONTESTS_DEFS_H_
|
|
|
|
|
|
|
|
|
|
#include "sdbus-c++/Types.h"
|
2021-12-20 10:00:29 +01:00
|
|
|
#include <chrono>
|
|
|
|
|
#include <ostream>
|
2023-09-25 21:12:34 +03:00
|
|
|
#include <filesystem>
|
2017-11-27 14:13:55 +01:00
|
|
|
|
2020-07-18 20:16:57 +02:00
|
|
|
namespace sdbus { namespace test {
|
|
|
|
|
|
refactor: add strong types to public API (#414)
This introduces strong types for `std::string`-based D-Bus types. This facilitates safer, less error-prone and more expressive API.
What previously was `auto proxy = createProxy("org.sdbuscpp.concatenator", "/org/sdbuscpp/concatenator");` is now written like `auto proxy = createProxy(ServiceName{"org.sdbuscpp.concatenator"}, ObjectPath{"/org/sdbuscpp/concatenator"});`.
These types are:
* `ObjectPath` type for the object path (the type has been around already but now is also used consistently in sdbus-c++ API for object path strings),
* `InterfaceName` type for D-Bus interface names,
* `BusName` (and its aliases `ServiceName` and `ConnectionName`) type for bus/service/connection names,
* `MemberName` (and its aliases `MethodName`, `SignalName` and `PropertyName`) type for D-Bus method, signal and property names,
* `Signature` type for the D-Bus signature (the type has been around already but now is also used consistently in sdbus-c++ API for signature strings),
* `Error::Name` type for D-Bus error names.
2024-03-29 13:23:44 +01:00
|
|
|
const InterfaceName INTERFACE_NAME{"org.sdbuscpp.integrationtests"};
|
|
|
|
|
const ServiceName SERVICE_NAME{"org.sdbuscpp.integrationtests"};
|
|
|
|
|
const ServiceName EMPTY_DESTINATION;
|
|
|
|
|
const ObjectPath MANAGER_PATH {"/org/sdbuscpp/integrationtests"};
|
|
|
|
|
const ObjectPath OBJECT_PATH {"/org/sdbuscpp/integrationtests/ObjectA1"};
|
|
|
|
|
const ObjectPath OBJECT_PATH_2{"/org/sdbuscpp/integrationtests/ObjectB1"};
|
|
|
|
|
const PropertyName STATE_PROPERTY{"state"};
|
|
|
|
|
const PropertyName ACTION_PROPERTY{"action"};
|
2024-11-20 23:40:30 +01:00
|
|
|
const PropertyName ACTION_VARIANT_PROPERTY{"actionVariant"};
|
refactor: add strong types to public API (#414)
This introduces strong types for `std::string`-based D-Bus types. This facilitates safer, less error-prone and more expressive API.
What previously was `auto proxy = createProxy("org.sdbuscpp.concatenator", "/org/sdbuscpp/concatenator");` is now written like `auto proxy = createProxy(ServiceName{"org.sdbuscpp.concatenator"}, ObjectPath{"/org/sdbuscpp/concatenator"});`.
These types are:
* `ObjectPath` type for the object path (the type has been around already but now is also used consistently in sdbus-c++ API for object path strings),
* `InterfaceName` type for D-Bus interface names,
* `BusName` (and its aliases `ServiceName` and `ConnectionName`) type for bus/service/connection names,
* `MemberName` (and its aliases `MethodName`, `SignalName` and `PropertyName`) type for D-Bus method, signal and property names,
* `Signature` type for the D-Bus signature (the type has been around already but now is also used consistently in sdbus-c++ API for signature strings),
* `Error::Name` type for D-Bus error names.
2024-03-29 13:23:44 +01:00
|
|
|
const PropertyName BLOCKING_PROPERTY{"blocking"};
|
2023-09-25 21:12:34 +03:00
|
|
|
const std::string DIRECT_CONNECTION_SOCKET_PATH{std::filesystem::temp_directory_path() / "sdbus-cpp-direct-connection-test"};
|
2017-11-27 14:13:55 +01:00
|
|
|
|
|
|
|
|
constexpr const uint8_t UINT8_VALUE{1};
|
|
|
|
|
constexpr const int16_t INT16_VALUE{21};
|
|
|
|
|
constexpr const uint32_t UINT32_VALUE{42};
|
|
|
|
|
constexpr const int32_t INT32_VALUE{-42};
|
|
|
|
|
constexpr const int32_t INT64_VALUE{-1024};
|
|
|
|
|
|
|
|
|
|
const std::string STRING_VALUE{"sdbus-c++-testing"};
|
refactor: add strong types to public API (#414)
This introduces strong types for `std::string`-based D-Bus types. This facilitates safer, less error-prone and more expressive API.
What previously was `auto proxy = createProxy("org.sdbuscpp.concatenator", "/org/sdbuscpp/concatenator");` is now written like `auto proxy = createProxy(ServiceName{"org.sdbuscpp.concatenator"}, ObjectPath{"/org/sdbuscpp/concatenator"});`.
These types are:
* `ObjectPath` type for the object path (the type has been around already but now is also used consistently in sdbus-c++ API for object path strings),
* `InterfaceName` type for D-Bus interface names,
* `BusName` (and its aliases `ServiceName` and `ConnectionName`) type for bus/service/connection names,
* `MemberName` (and its aliases `MethodName`, `SignalName` and `PropertyName`) type for D-Bus method, signal and property names,
* `Signature` type for the D-Bus signature (the type has been around already but now is also used consistently in sdbus-c++ API for signature strings),
* `Error::Name` type for D-Bus error names.
2024-03-29 13:23:44 +01:00
|
|
|
const Signature SIGNATURE_VALUE{"a{is}"};
|
|
|
|
|
const ObjectPath OBJECT_PATH_VALUE{"/"};
|
2019-06-08 21:35:22 +02:00
|
|
|
const int UNIX_FD_VALUE = 0;
|
2017-11-27 14:13:55 +01:00
|
|
|
|
2019-05-29 22:28:15 +02:00
|
|
|
const std::string DEFAULT_STATE_VALUE{"default-state-value"};
|
|
|
|
|
const uint32_t DEFAULT_ACTION_VALUE{999};
|
2024-11-20 23:40:30 +01:00
|
|
|
const std::string DEFAULT_ACTION_VARIANT_VALUE{"ahoj"};
|
2019-05-29 22:28:15 +02:00
|
|
|
const bool DEFAULT_BLOCKING_VALUE{true};
|
|
|
|
|
|
2017-11-27 14:13:55 +01:00
|
|
|
constexpr const double DOUBLE_VALUE{3.24L};
|
|
|
|
|
|
2022-01-27 13:38:19 +01:00
|
|
|
}}
|
|
|
|
|
|
|
|
|
|
namespace testing::internal {
|
|
|
|
|
|
|
|
|
|
// Printer for std::chrono::duration types.
|
|
|
|
|
// This is a workaround, since it's not a good thing to add this to std namespace.
|
2021-12-20 10:00:29 +01:00
|
|
|
template< class Rep, class Period >
|
2022-01-27 13:38:19 +01:00
|
|
|
void PrintTo(const ::std::chrono::duration<Rep, Period>& d, ::std::ostream* os) {
|
2021-12-20 10:00:29 +01:00
|
|
|
auto seconds = std::chrono::duration_cast<std::chrono::duration<double>>(d);
|
2022-01-27 13:38:19 +01:00
|
|
|
*os << seconds.count() << "s";
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-20 10:00:29 +01:00
|
|
|
}
|
2020-07-18 20:16:57 +02:00
|
|
|
|
2017-11-27 14:13:55 +01:00
|
|
|
#endif /* SDBUS_CPP_INTEGRATIONTESTS_DEFS_H_ */
|