[spinel-decoder] fix comments (#3661)

This commit is contained in:
Abtin Keshavarzian
2019-03-11 09:40:32 -07:00
committed by Jonathan Hui
parent f695ccae22
commit dd69fabd2d
+22 -22
View File
@@ -51,16 +51,21 @@ namespace Ncp {
class SpinelDecoder
{
public:
enum
{
kMaxNestedStructs = 4, ///< Maximum number of nested structs.
};
/**
* This constructor initializes a `SpinelDecoder` object
* This constructor initializes a `SpinelDecoder` object.
*
*/
SpinelDecoder(void);
/**
* This method initializes the decoder to start decoding a new given spinel encoded frame.
* This method initializes the decoder to start decoding a new frame.
*
* It sets the read position to beginning of the frame and also erases/voids any saved positions (see
* It sets the read position to the start of the frame and also erases/voids any saved positions (see
* `SavePosition()` and `ResetToSaved()` methods).
*
* @param[in] aFrame Pointer to the buffer containing the frame to be decoded.
@@ -70,7 +75,7 @@ public:
void Init(const uint8_t *aFrame, uint16_t aLength);
/**
* This method returns a pointer to the frame.
* This method returns the pointer to the start of the frame.
*
* @returns A pointer to buffer containing current frame being decoded.
*
@@ -302,7 +307,7 @@ public:
*
* On success, the read position gets updated and the IP address is copied into the given output variable.
*
* @param[out] aIp6Addr Reference to IPv6 address variable to output the value (as spinel_ipv6addr_t).
* @param[out] aIp6Addr Reference to IPv6 address variable to output the value (as `spinel_ipv6addr_t`).
* On success, the address is copied into the output variable.
*
* @retval OT_ERROR_NONE Successfully read the value.
@@ -316,7 +321,7 @@ public:
*
* On success, the read position gets updated and the IP address is copied into the given output variable.
*
* @param[out] aIp6Addr Reference to IPv6 address variable to output the value (as otIp6Address).
* @param[out] aIp6Addr Reference to IPv6 address variable to output the value (as `otIp6Address`).
* On success, the address is copied into the output variable.
*
* @retval OT_ERROR_NONE Successfully read the value.
@@ -378,7 +383,7 @@ public:
*
* On success, the read position gets updated and the EUI64 value is copied into the given output variable.
*
* @param[out] aEui64 Reference to EUI64 variable to output the value (as spinel_eui64_t).
* @param[out] aEui64 Reference to EUI64 variable to output the value (as `spinel_eui64_t`).
* On success, the address is copied into the output variable.
*
* @retval OT_ERROR_NONE Successfully read the value.
@@ -392,7 +397,7 @@ public:
*
* On success, the read position gets updated and the EUI64 value is copied into the given output variable.
*
* @param[out] aEui64 Reference to EUI64 variable to output the value (as otExtAddress).
* @param[out] aEui64 Reference to EUI64 variable to output the value (as `otExtAddress`).
* On success, the address is copied into the output variable.
*
* @retval OT_ERROR_NONE Successfully read the value.
@@ -437,7 +442,7 @@ public:
*
* On success, the read position gets updated and the EUI48 value is copied into the given output variable.
*
* @param[out] aEui48 Reference to EUI48 variable to output the value (as spinel_eui48_t).
* @param[out] aEui48 Reference to EUI48 variable to output the value (as `spinel_eui48_t`).
* On success, value is copied into the output variable.
*
* @retval OT_ERROR_NONE Successfully read the value.
@@ -467,7 +472,7 @@ public:
*
* @param[out] aData Reference to pointer variable to output the data.
* On success, the pointer variable is updated.
* @param[out] aDataLength Reference to variable to out the data length (number of bytes).
* @param[out] aDataLength Reference to variable to output the data length (number of bytes).
*
* @retval OT_ERROR_NONE Successfully read the value.
* @retval OT_ERROR_PARSE Failed to parse/decode the value.
@@ -478,8 +483,8 @@ public:
/**
* This method decodes and reads a data blob (sequence of bytes) with data length.
*
* The data length is assumed to be prepended before the data content (encoded as a `uint16_t`). The size of the
* length field should not be included in the length value. This method corresponds to `SPINEL_DATATYPE_DATA_WLEN`
* The data length is assumed to be prepended before the data content (encoded as a `uint16_t`). The size of the
* length field should not be included in the length value. This method corresponds to `SPINEL_DATATYPE_DATA_WLEN`
* type.
*
* @param[out] aData Reference to pointer variable to output the data.
@@ -495,7 +500,7 @@ public:
/**
* This method opens a struct in the frame.
*
* After a successful call to this method, all the subsequent `Read<SomeType>()` methods decode and read the
* After a successful call to this method, all the subsequent `Read{SomeType}()` methods decode and read the
* field/value from the current open struct until the struct is closed using `CloseStruct()` method. Structures can
* be nested. Up to `kMaxNestedStructs` nested structs can be opened at the same time.
*
@@ -539,9 +544,9 @@ public:
/**
* This method saves the current read position in the frame.
*
* A subsequent call to `SavePosition()` will overwrite the previously saved position. The saved position can be
* used to to move the read position back (using `ResetToSaved()`) and re-read the same content.
* used to move the read position back (using `ResetToSaved()`) and re-read the same content.
*
* Saved position can be within an open struct, and it remembers its enclosing struct. When the enclosing struct is
* closed, the saved position will be voided and can no longer be used. This ensures that we cannot jump back to
@@ -568,13 +573,8 @@ private:
void ClearSavedPosition(void) { mSavedIndex = mLength; }
bool IsSavedPositionValid(void) const { return (mSavedIndex < mLength); }
enum
{
kMaxNestedStructs = 4, ///< Maximum number of nested structs.
};
const uint8_t *mFrame; // Frame buffer
uint16_t mLength; // Total length of the buffer.
const uint8_t *mFrame; // Frame buffer.
uint16_t mLength; // Frame length (number of bytes).
uint16_t mIndex; // Current read index.
uint16_t mEnd; // Current end index (end of struct if in a struct, or end of buffer otherwise).
uint8_t mNumOpenStructs; // Number of open structs.