Line data Source code
1 : /*
2 : * Copyright (c) 2024 Project CHIP Authors
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 : #include "app/data-model-provider/ActionReturnStatus.h"
17 : #include <app/data-model-provider/StringBuilderAdapters.h>
18 :
19 : #include <lib/core/StringBuilderAdapters.h>
20 :
21 : namespace pw {
22 :
23 : template <>
24 0 : StatusWithSize ToString<chip::app::DataModel::ActionReturnStatus>(const chip::app::DataModel::ActionReturnStatus & status,
25 : pw::span<char> buffer)
26 : {
27 0 : chip::app::DataModel::ActionReturnStatus::StringStorage storage;
28 0 : return pw::string::Format(buffer, "ActionReturnStatus<%s>", status.c_str(storage));
29 : }
30 :
31 : template <>
32 0 : StatusWithSize ToString<chip::Protocols::InteractionModel::Status>(const chip::Protocols::InteractionModel::Status & status,
33 : pw::span<char> buffer)
34 : {
35 : #if CHIP_CONFIG_IM_STATUS_CODE_VERBOSE_FORMAT
36 0 : return pw::string::Format(buffer, "Status<%s/%d>", chip::Protocols::InteractionModel::StatusName(status),
37 0 : static_cast<int>(status));
38 : #else
39 : return pw::string::Format(buffer, "Status<%d>", static_cast<int>(status));
40 : #endif
41 : }
42 :
43 : } // namespace pw
44 :
45 : #if CHIP_CONFIG_TEST_GOOGLETEST
46 : namespace chip {
47 :
48 : void PrintTo(const chip::app::DataModel::ActionReturnStatus & status, std::ostream * os)
49 : {
50 : chip::app::DataModel::ActionReturnStatus::StringStorage storage;
51 : *os << "ActionReturnStatus<" << status.c_str(storage) << ">";
52 : }
53 :
54 : void PrintTo(const chip::Protocols::InteractionModel::Status & status, std::ostream * os)
55 : {
56 : *os << "Status<"
57 : #if CHIP_CONFIG_IM_STATUS_CODE_VERBOSE_FORMAT
58 : << chip::Protocols::InteractionModel::StatusName(status) << "/"
59 : #endif
60 : << static_cast<int>(status) << ">";
61 : }
62 :
63 : } // namespace chip
64 : #endif // CHIP_CONFIG_TEST_GOOGLETEST
|