xref: /aosp_15_r20/external/openthread/src/posix/platform/power.hpp (revision cfb92d1480a9e65faed56933e9c12405f45898b4)
1*cfb92d14SAndroid Build Coastguard Worker /*
2*cfb92d14SAndroid Build Coastguard Worker  *  Copyright (c) 2022, The OpenThread Authors.
3*cfb92d14SAndroid Build Coastguard Worker  *  All rights reserved.
4*cfb92d14SAndroid Build Coastguard Worker  *
5*cfb92d14SAndroid Build Coastguard Worker  *  Redistribution and use in source and binary forms, with or without
6*cfb92d14SAndroid Build Coastguard Worker  *  modification, are permitted provided that the following conditions are met:
7*cfb92d14SAndroid Build Coastguard Worker  *  1. Redistributions of source code must strain the above copyright
8*cfb92d14SAndroid Build Coastguard Worker  *     notice, this list of conditions and the following disclaimer.
9*cfb92d14SAndroid Build Coastguard Worker  *  2. Redistributions in binary form must reproduce the above copyright
10*cfb92d14SAndroid Build Coastguard Worker  *     notice, this list of conditions and the following disclaimer in the
11*cfb92d14SAndroid Build Coastguard Worker  *     documentation and/or other materials provided with the distribution.
12*cfb92d14SAndroid Build Coastguard Worker  *  3. Neither the name of the copyright holder nor the
13*cfb92d14SAndroid Build Coastguard Worker  *     names of its contributors may be used to endorse or promote products
14*cfb92d14SAndroid Build Coastguard Worker  *     derived from this software without specific prior written permission.
15*cfb92d14SAndroid Build Coastguard Worker  *
16*cfb92d14SAndroid Build Coastguard Worker  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17*cfb92d14SAndroid Build Coastguard Worker  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*cfb92d14SAndroid Build Coastguard Worker  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*cfb92d14SAndroid Build Coastguard Worker  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20*cfb92d14SAndroid Build Coastguard Worker  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21*cfb92d14SAndroid Build Coastguard Worker  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22*cfb92d14SAndroid Build Coastguard Worker  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23*cfb92d14SAndroid Build Coastguard Worker  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24*cfb92d14SAndroid Build Coastguard Worker  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25*cfb92d14SAndroid Build Coastguard Worker  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26*cfb92d14SAndroid Build Coastguard Worker  *  POSSIBILITY OF SUCH DAMAGE.
27*cfb92d14SAndroid Build Coastguard Worker  */
28*cfb92d14SAndroid Build Coastguard Worker 
29*cfb92d14SAndroid Build Coastguard Worker #ifndef OT_POSIX_PLATFORM_POWER_HPP_
30*cfb92d14SAndroid Build Coastguard Worker #define OT_POSIX_PLATFORM_POWER_HPP_
31*cfb92d14SAndroid Build Coastguard Worker 
32*cfb92d14SAndroid Build Coastguard Worker #include <assert.h>
33*cfb92d14SAndroid Build Coastguard Worker #include <stdio.h>
34*cfb92d14SAndroid Build Coastguard Worker #include <string.h>
35*cfb92d14SAndroid Build Coastguard Worker 
36*cfb92d14SAndroid Build Coastguard Worker #include <openthread/error.h>
37*cfb92d14SAndroid Build Coastguard Worker #include <openthread/platform/radio.h>
38*cfb92d14SAndroid Build Coastguard Worker #include "common/string.hpp"
39*cfb92d14SAndroid Build Coastguard Worker 
40*cfb92d14SAndroid Build Coastguard Worker namespace ot {
41*cfb92d14SAndroid Build Coastguard Worker namespace Power {
42*cfb92d14SAndroid Build Coastguard Worker 
43*cfb92d14SAndroid Build Coastguard Worker class Domain
44*cfb92d14SAndroid Build Coastguard Worker {
45*cfb92d14SAndroid Build Coastguard Worker public:
Domain(void)46*cfb92d14SAndroid Build Coastguard Worker     Domain(void) { m8[0] = '\0'; }
47*cfb92d14SAndroid Build Coastguard Worker 
48*cfb92d14SAndroid Build Coastguard Worker     /**
49*cfb92d14SAndroid Build Coastguard Worker      * Sets the regulatory domain from a given null terminated C string.
50*cfb92d14SAndroid Build Coastguard Worker      *
51*cfb92d14SAndroid Build Coastguard Worker      * @param[in] aDomain   A regulatory domain name C string.
52*cfb92d14SAndroid Build Coastguard Worker      *
53*cfb92d14SAndroid Build Coastguard Worker      * @retval OT_ERROR_NONE           Successfully set the regulatory domain.
54*cfb92d14SAndroid Build Coastguard Worker      * @retval OT_ERROR_INVALID_ARGS   Given regulatory domain is too long.
55*cfb92d14SAndroid Build Coastguard Worker      *
56*cfb92d14SAndroid Build Coastguard Worker      */
57*cfb92d14SAndroid Build Coastguard Worker     otError Set(const char *aDomain);
58*cfb92d14SAndroid Build Coastguard Worker 
59*cfb92d14SAndroid Build Coastguard Worker     /**
60*cfb92d14SAndroid Build Coastguard Worker      * Overloads operator `==` to evaluate whether or not two `Domain` instances are equal.
61*cfb92d14SAndroid Build Coastguard Worker      *
62*cfb92d14SAndroid Build Coastguard Worker      * @param[in]  aOther  The other `Domain` instance to compare with.
63*cfb92d14SAndroid Build Coastguard Worker      *
64*cfb92d14SAndroid Build Coastguard Worker      * @retval TRUE   If the two `Domain` instances are equal.
65*cfb92d14SAndroid Build Coastguard Worker      * @retval FALSE  If the two `Domain` instances not equal.
66*cfb92d14SAndroid Build Coastguard Worker      *
67*cfb92d14SAndroid Build Coastguard Worker      */
operator ==(const Domain & aOther) const68*cfb92d14SAndroid Build Coastguard Worker     bool operator==(const Domain &aOther) const { return strcmp(m8, aOther.m8) == 0; }
69*cfb92d14SAndroid Build Coastguard Worker 
70*cfb92d14SAndroid Build Coastguard Worker     /**
71*cfb92d14SAndroid Build Coastguard Worker      * Overloads operator `!=` to evaluate whether or not the `Domain` is unequal to a given C string.
72*cfb92d14SAndroid Build Coastguard Worker      *
73*cfb92d14SAndroid Build Coastguard Worker      * @param[in]  aCString  A C string to compare with. Can be `nullptr` which then returns 'TRUE'.
74*cfb92d14SAndroid Build Coastguard Worker      *
75*cfb92d14SAndroid Build Coastguard Worker      * @retval TRUE   If the two regulatory domains are not equal.
76*cfb92d14SAndroid Build Coastguard Worker      * @retval FALSE  If the two regulatory domains are equal.
77*cfb92d14SAndroid Build Coastguard Worker      *
78*cfb92d14SAndroid Build Coastguard Worker      */
operator !=(const char * aCString) const79*cfb92d14SAndroid Build Coastguard Worker     bool operator!=(const char *aCString) const { return (aCString == nullptr) ? true : strcmp(m8, aCString) != 0; }
80*cfb92d14SAndroid Build Coastguard Worker 
81*cfb92d14SAndroid Build Coastguard Worker     /**
82*cfb92d14SAndroid Build Coastguard Worker      * Gets the regulatory domain as a null terminated C string.
83*cfb92d14SAndroid Build Coastguard Worker      *
84*cfb92d14SAndroid Build Coastguard Worker      * @returns The regulatory domain as a null terminated C string array.
85*cfb92d14SAndroid Build Coastguard Worker      *
86*cfb92d14SAndroid Build Coastguard Worker      */
AsCString(void) const87*cfb92d14SAndroid Build Coastguard Worker     const char *AsCString(void) const { return m8; }
88*cfb92d14SAndroid Build Coastguard Worker 
89*cfb92d14SAndroid Build Coastguard Worker private:
90*cfb92d14SAndroid Build Coastguard Worker     static constexpr uint8_t kDomainSize = 8;
91*cfb92d14SAndroid Build Coastguard Worker     char                     m8[kDomainSize + 1];
92*cfb92d14SAndroid Build Coastguard Worker };
93*cfb92d14SAndroid Build Coastguard Worker 
94*cfb92d14SAndroid Build Coastguard Worker class TargetPower
95*cfb92d14SAndroid Build Coastguard Worker {
96*cfb92d14SAndroid Build Coastguard Worker public:
97*cfb92d14SAndroid Build Coastguard Worker     static constexpr uint16_t       kInfoStringSize = 12; ///< Recommended buffer size to use with `ToString()`.
98*cfb92d14SAndroid Build Coastguard Worker     typedef String<kInfoStringSize> InfoString;
99*cfb92d14SAndroid Build Coastguard Worker 
100*cfb92d14SAndroid Build Coastguard Worker     /**
101*cfb92d14SAndroid Build Coastguard Worker      * Parses an target power string.
102*cfb92d14SAndroid Build Coastguard Worker      *
103*cfb92d14SAndroid Build Coastguard Worker      * The string MUST follow the format: "<channel_start>,<channel_end>,<target_power>".
104*cfb92d14SAndroid Build Coastguard Worker      * For example, "11,26,2000"
105*cfb92d14SAndroid Build Coastguard Worker      *
106*cfb92d14SAndroid Build Coastguard Worker      * @param[in]  aString   A pointer to the null-terminated string.
107*cfb92d14SAndroid Build Coastguard Worker      *
108*cfb92d14SAndroid Build Coastguard Worker      * @retval OT_ERROR_NONE   Successfully parsed the target power string.
109*cfb92d14SAndroid Build Coastguard Worker      * @retval OT_ERROR_PARSE  Failed to parse the target power string.
110*cfb92d14SAndroid Build Coastguard Worker      *
111*cfb92d14SAndroid Build Coastguard Worker      */
112*cfb92d14SAndroid Build Coastguard Worker     otError FromString(char *aString);
113*cfb92d14SAndroid Build Coastguard Worker 
114*cfb92d14SAndroid Build Coastguard Worker     /**
115*cfb92d14SAndroid Build Coastguard Worker      * Returns the start channel.
116*cfb92d14SAndroid Build Coastguard Worker      *
117*cfb92d14SAndroid Build Coastguard Worker      * @returns The channel.
118*cfb92d14SAndroid Build Coastguard Worker      *
119*cfb92d14SAndroid Build Coastguard Worker      */
GetChannelStart(void) const120*cfb92d14SAndroid Build Coastguard Worker     uint8_t GetChannelStart(void) const { return mChannelStart; }
121*cfb92d14SAndroid Build Coastguard Worker 
122*cfb92d14SAndroid Build Coastguard Worker     /**
123*cfb92d14SAndroid Build Coastguard Worker      * Returns the end channel.
124*cfb92d14SAndroid Build Coastguard Worker      *
125*cfb92d14SAndroid Build Coastguard Worker      * @returns The channel.
126*cfb92d14SAndroid Build Coastguard Worker      *
127*cfb92d14SAndroid Build Coastguard Worker      */
GetChannelEnd(void) const128*cfb92d14SAndroid Build Coastguard Worker     uint8_t GetChannelEnd(void) const { return mChannelEnd; }
129*cfb92d14SAndroid Build Coastguard Worker 
130*cfb92d14SAndroid Build Coastguard Worker     /**
131*cfb92d14SAndroid Build Coastguard Worker      * Returns the target power.
132*cfb92d14SAndroid Build Coastguard Worker      *
133*cfb92d14SAndroid Build Coastguard Worker      * @returns The target power, in 0.01 dBm.
134*cfb92d14SAndroid Build Coastguard Worker      *
135*cfb92d14SAndroid Build Coastguard Worker      */
GetTargetPower(void) const136*cfb92d14SAndroid Build Coastguard Worker     int16_t GetTargetPower(void) const { return mTargetPower; }
137*cfb92d14SAndroid Build Coastguard Worker 
138*cfb92d14SAndroid Build Coastguard Worker     /**
139*cfb92d14SAndroid Build Coastguard Worker      * Converts the target power into a human-readable string.
140*cfb92d14SAndroid Build Coastguard Worker      *
141*cfb92d14SAndroid Build Coastguard Worker      * @returns  An `InfoString` object representing the target power.
142*cfb92d14SAndroid Build Coastguard Worker      *
143*cfb92d14SAndroid Build Coastguard Worker      */
144*cfb92d14SAndroid Build Coastguard Worker     InfoString ToString(void) const;
145*cfb92d14SAndroid Build Coastguard Worker 
146*cfb92d14SAndroid Build Coastguard Worker private:
147*cfb92d14SAndroid Build Coastguard Worker     uint8_t mChannelStart;
148*cfb92d14SAndroid Build Coastguard Worker     uint8_t mChannelEnd;
149*cfb92d14SAndroid Build Coastguard Worker     int16_t mTargetPower;
150*cfb92d14SAndroid Build Coastguard Worker };
151*cfb92d14SAndroid Build Coastguard Worker 
152*cfb92d14SAndroid Build Coastguard Worker class RawPowerSetting
153*cfb92d14SAndroid Build Coastguard Worker {
154*cfb92d14SAndroid Build Coastguard Worker public:
155*cfb92d14SAndroid Build Coastguard Worker     // Recommended buffer size to use with `ToString()`.
156*cfb92d14SAndroid Build Coastguard Worker     static constexpr uint16_t kInfoStringSize = OPENTHREAD_CONFIG_POWER_CALIBRATION_RAW_POWER_SETTING_SIZE * 2 + 1;
157*cfb92d14SAndroid Build Coastguard Worker     typedef String<kInfoStringSize> InfoString;
158*cfb92d14SAndroid Build Coastguard Worker 
159*cfb92d14SAndroid Build Coastguard Worker     /**
160*cfb92d14SAndroid Build Coastguard Worker      * Sets the raw power setting from a given null terminated hex C string.
161*cfb92d14SAndroid Build Coastguard Worker      *
162*cfb92d14SAndroid Build Coastguard Worker      * @param[in] aRawPowerSetting  A raw power setting hex C string.
163*cfb92d14SAndroid Build Coastguard Worker      *
164*cfb92d14SAndroid Build Coastguard Worker      * @retval OT_ERROR_NONE           Successfully set the raw power setting.
165*cfb92d14SAndroid Build Coastguard Worker      * @retval OT_ERROR_INVALID_ARGS   The given raw power setting is too long.
166*cfb92d14SAndroid Build Coastguard Worker      *
167*cfb92d14SAndroid Build Coastguard Worker      */
168*cfb92d14SAndroid Build Coastguard Worker     otError Set(const char *aRawPowerSetting);
169*cfb92d14SAndroid Build Coastguard Worker 
170*cfb92d14SAndroid Build Coastguard Worker     /**
171*cfb92d14SAndroid Build Coastguard Worker      * Converts the raw power setting into a human-readable string.
172*cfb92d14SAndroid Build Coastguard Worker      *
173*cfb92d14SAndroid Build Coastguard Worker      * @returns  An `InfoString` object representing the calibrated power.
174*cfb92d14SAndroid Build Coastguard Worker      *
175*cfb92d14SAndroid Build Coastguard Worker      */
176*cfb92d14SAndroid Build Coastguard Worker     InfoString ToString(void) const;
177*cfb92d14SAndroid Build Coastguard Worker 
GetData(void) const178*cfb92d14SAndroid Build Coastguard Worker     const uint8_t *GetData(void) const { return mData; }
GetLength(void) const179*cfb92d14SAndroid Build Coastguard Worker     uint16_t       GetLength(void) const { return mLength; }
180*cfb92d14SAndroid Build Coastguard Worker 
181*cfb92d14SAndroid Build Coastguard Worker private:
182*cfb92d14SAndroid Build Coastguard Worker     static constexpr uint16_t kMaxRawPowerSettingSize = OPENTHREAD_CONFIG_POWER_CALIBRATION_RAW_POWER_SETTING_SIZE;
183*cfb92d14SAndroid Build Coastguard Worker 
184*cfb92d14SAndroid Build Coastguard Worker     uint8_t  mData[kMaxRawPowerSettingSize];
185*cfb92d14SAndroid Build Coastguard Worker     uint16_t mLength;
186*cfb92d14SAndroid Build Coastguard Worker };
187*cfb92d14SAndroid Build Coastguard Worker 
188*cfb92d14SAndroid Build Coastguard Worker class CalibratedPower
189*cfb92d14SAndroid Build Coastguard Worker {
190*cfb92d14SAndroid Build Coastguard Worker public:
191*cfb92d14SAndroid Build Coastguard Worker     // Recommended buffer size to use with `ToString()`.
192*cfb92d14SAndroid Build Coastguard Worker     static constexpr uint16_t       kInfoStringSize = 20 + RawPowerSetting::kInfoStringSize;
193*cfb92d14SAndroid Build Coastguard Worker     typedef String<kInfoStringSize> InfoString;
194*cfb92d14SAndroid Build Coastguard Worker 
195*cfb92d14SAndroid Build Coastguard Worker     /**
196*cfb92d14SAndroid Build Coastguard Worker      * Parses an calibrated power string.
197*cfb92d14SAndroid Build Coastguard Worker      *
198*cfb92d14SAndroid Build Coastguard Worker      * The string MUST follow the format: "<channel_start>,<channel_end>,<actual_power>,<raw_power_setting>".
199*cfb92d14SAndroid Build Coastguard Worker      * For example, "11,26,2000,1122aabb"
200*cfb92d14SAndroid Build Coastguard Worker      *
201*cfb92d14SAndroid Build Coastguard Worker      * @param[in]  aString   A pointer to the null-terminated string.
202*cfb92d14SAndroid Build Coastguard Worker      *
203*cfb92d14SAndroid Build Coastguard Worker      * @retval OT_ERROR_NONE   Successfully parsed the calibrated power string.
204*cfb92d14SAndroid Build Coastguard Worker      * @retval OT_ERROR_PARSE  Failed to parse the calibrated power string.
205*cfb92d14SAndroid Build Coastguard Worker      *
206*cfb92d14SAndroid Build Coastguard Worker      */
207*cfb92d14SAndroid Build Coastguard Worker     otError FromString(char *aString);
208*cfb92d14SAndroid Build Coastguard Worker 
209*cfb92d14SAndroid Build Coastguard Worker     /**
210*cfb92d14SAndroid Build Coastguard Worker      * Returns the start channel.
211*cfb92d14SAndroid Build Coastguard Worker      *
212*cfb92d14SAndroid Build Coastguard Worker      * @returns The channel.
213*cfb92d14SAndroid Build Coastguard Worker      *
214*cfb92d14SAndroid Build Coastguard Worker      */
GetChannelStart(void) const215*cfb92d14SAndroid Build Coastguard Worker     uint8_t GetChannelStart(void) const { return mChannelStart; }
216*cfb92d14SAndroid Build Coastguard Worker 
217*cfb92d14SAndroid Build Coastguard Worker     /**
218*cfb92d14SAndroid Build Coastguard Worker      * Sets the start channel.
219*cfb92d14SAndroid Build Coastguard Worker      *
220*cfb92d14SAndroid Build Coastguard Worker      * @param[in]  aChannelStart  The start channel.
221*cfb92d14SAndroid Build Coastguard Worker      *
222*cfb92d14SAndroid Build Coastguard Worker      */
SetChannelStart(uint8_t aChannelStart)223*cfb92d14SAndroid Build Coastguard Worker     void SetChannelStart(uint8_t aChannelStart) { mChannelStart = aChannelStart; }
224*cfb92d14SAndroid Build Coastguard Worker 
225*cfb92d14SAndroid Build Coastguard Worker     /**
226*cfb92d14SAndroid Build Coastguard Worker      * Returns the end channel.
227*cfb92d14SAndroid Build Coastguard Worker      *
228*cfb92d14SAndroid Build Coastguard Worker      * @returns The channel.
229*cfb92d14SAndroid Build Coastguard Worker      *
230*cfb92d14SAndroid Build Coastguard Worker      */
GetChannelEnd(void) const231*cfb92d14SAndroid Build Coastguard Worker     uint8_t GetChannelEnd(void) const { return mChannelEnd; }
232*cfb92d14SAndroid Build Coastguard Worker 
233*cfb92d14SAndroid Build Coastguard Worker     /**
234*cfb92d14SAndroid Build Coastguard Worker      * Sets the end channel.
235*cfb92d14SAndroid Build Coastguard Worker      *
236*cfb92d14SAndroid Build Coastguard Worker      * @param[in]  aChannelEnd  The end channel.
237*cfb92d14SAndroid Build Coastguard Worker      *
238*cfb92d14SAndroid Build Coastguard Worker      */
SetChannelEnd(uint8_t aChannelEnd)239*cfb92d14SAndroid Build Coastguard Worker     void SetChannelEnd(uint8_t aChannelEnd) { mChannelEnd = aChannelEnd; }
240*cfb92d14SAndroid Build Coastguard Worker 
241*cfb92d14SAndroid Build Coastguard Worker     /**
242*cfb92d14SAndroid Build Coastguard Worker      * Returns the actual power.
243*cfb92d14SAndroid Build Coastguard Worker      *
244*cfb92d14SAndroid Build Coastguard Worker      * @returns The actual measured power, in 0.01 dBm.
245*cfb92d14SAndroid Build Coastguard Worker      *
246*cfb92d14SAndroid Build Coastguard Worker      */
GetActualPower(void) const247*cfb92d14SAndroid Build Coastguard Worker     int16_t GetActualPower(void) const { return mActualPower; }
248*cfb92d14SAndroid Build Coastguard Worker 
249*cfb92d14SAndroid Build Coastguard Worker     /**
250*cfb92d14SAndroid Build Coastguard Worker      * Sets the actual channel.
251*cfb92d14SAndroid Build Coastguard Worker      *
252*cfb92d14SAndroid Build Coastguard Worker      * @param[in]  aActualPower  The actual power in 0.01 dBm.
253*cfb92d14SAndroid Build Coastguard Worker      *
254*cfb92d14SAndroid Build Coastguard Worker      */
SetActualPower(int16_t aActualPower)255*cfb92d14SAndroid Build Coastguard Worker     void SetActualPower(int16_t aActualPower) { mActualPower = aActualPower; }
256*cfb92d14SAndroid Build Coastguard Worker 
257*cfb92d14SAndroid Build Coastguard Worker     /**
258*cfb92d14SAndroid Build Coastguard Worker      * Returns the raw power setting.
259*cfb92d14SAndroid Build Coastguard Worker      *
260*cfb92d14SAndroid Build Coastguard Worker      * @returns A reference to the raw power setting.
261*cfb92d14SAndroid Build Coastguard Worker      *
262*cfb92d14SAndroid Build Coastguard Worker      */
GetRawPowerSetting(void) const263*cfb92d14SAndroid Build Coastguard Worker     const RawPowerSetting &GetRawPowerSetting(void) const { return mRawPowerSetting; }
264*cfb92d14SAndroid Build Coastguard Worker 
265*cfb92d14SAndroid Build Coastguard Worker     /**
266*cfb92d14SAndroid Build Coastguard Worker      * Sets the raw power setting.
267*cfb92d14SAndroid Build Coastguard Worker      *
268*cfb92d14SAndroid Build Coastguard Worker      * @param[in]  aRawPowerSetting  The raw power setting.
269*cfb92d14SAndroid Build Coastguard Worker      *
270*cfb92d14SAndroid Build Coastguard Worker      */
SetRawPowerSetting(const RawPowerSetting & aRawPowerSetting)271*cfb92d14SAndroid Build Coastguard Worker     void SetRawPowerSetting(const RawPowerSetting &aRawPowerSetting) { mRawPowerSetting = aRawPowerSetting; }
272*cfb92d14SAndroid Build Coastguard Worker 
273*cfb92d14SAndroid Build Coastguard Worker     /**
274*cfb92d14SAndroid Build Coastguard Worker      * Converts the calibrated power into a human-readable string.
275*cfb92d14SAndroid Build Coastguard Worker      *
276*cfb92d14SAndroid Build Coastguard Worker      * @returns  An `InfoString` object representing the calibrated power.
277*cfb92d14SAndroid Build Coastguard Worker      *
278*cfb92d14SAndroid Build Coastguard Worker      */
279*cfb92d14SAndroid Build Coastguard Worker     InfoString ToString(void) const;
280*cfb92d14SAndroid Build Coastguard Worker 
281*cfb92d14SAndroid Build Coastguard Worker private:
282*cfb92d14SAndroid Build Coastguard Worker     uint8_t         mChannelStart;
283*cfb92d14SAndroid Build Coastguard Worker     uint8_t         mChannelEnd;
284*cfb92d14SAndroid Build Coastguard Worker     int16_t         mActualPower;
285*cfb92d14SAndroid Build Coastguard Worker     RawPowerSetting mRawPowerSetting;
286*cfb92d14SAndroid Build Coastguard Worker };
287*cfb92d14SAndroid Build Coastguard Worker } // namespace Power
288*cfb92d14SAndroid Build Coastguard Worker } // namespace ot
289*cfb92d14SAndroid Build Coastguard Worker #endif // OT_POSIX_PLATFORM_POWER_HPP_
290