Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / setup_payload / ManualSetupPayloadGenerator.h
1 /**
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *
5  *    Licensed under the Apache License, Version 2.0 (the "License");
6  *    you may not use this file except in compliance with the License.
7  *    You may obtain a copy of the License at
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *    Unless required by applicable law or agreed to in writing, software
12  *    distributed under the License is distributed on an "AS IS" BASIS,
13  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *    See the License for the specific language governing permissions and
15  *    limitations under the License.
16  */
17
18 /**
19  *    @file
20  *      This file describes a Manual Entry Code Generator based on the
21  *      CHIP specification.
22  *
23  *      The encoding of the binary data to a decimal string is split
24  *      into 5 chunks <1-digit/3-bits><5 digits/16-bits><4-digits/13-bits><5-digits/16-bits><5-digits/16-bits>:
25  *      - <1 digit> Represents:
26  *          - <bits 1..0> Discriminator <bits 11.10>
27  *          - <bit 2> VID/PID present flag
28  *      - <5 digits> Represents:
29  *          - <bits 13..0> PIN Code <bits 13..0>
30  *          - <bits 15..14> Discriminator <bits 9..8>
31  *      - <4 digits> Represents:
32  *          - <bits 12..0> PIN Code <bits 26..14>
33  *      - <5 digits> Vendor ID
34  *      - <5 digits> Product ID
35  *
36  */
37
38 #pragma once
39
40 #include "SetupPayload.h"
41
42 #include <core/CHIPError.h>
43
44 #include <string>
45
46 namespace chip {
47
48 class ManualSetupPayloadGenerator
49 {
50 private:
51     SetupPayload mSetupPayload;
52
53 public:
54     ManualSetupPayloadGenerator(const SetupPayload & payload) : mSetupPayload(payload) {}
55
56     // Populates decimal string representation of the payload into outDecimalString
57     CHIP_ERROR payloadDecimalStringRepresentation(std::string & outDecimalString);
58 };
59
60 } // namespace chip