diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2738417ae..52f6068c4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -104,7 +104,7 @@ Now, it may be desirable to squash some of your smaller commits down into a smal ```bash # Rebase all commits on your development branch -git checkout +git checkout git rebase -i master ``` @@ -112,7 +112,7 @@ This will open up a text editor where you can specify which commits to squash. #### Coding Conventions and Style -OpenThread uses and enforces the [OpenThread Coding Conventions and Style](STYLE_GUIDE.md) on all code, except for code located in [third_party](third_party). Use the `make pretty` and `make pretty-check` targets to automatically reformat code and check for code-style compilance, respectively. OpenThread currently requires [clang-format v5.0.1](http://releases.llvm.org/download.html#5.0.1) for `make pretty` and `make pretty-check`. +OpenThread uses and enforces the [OpenThread Coding Conventions and Style](STYLE_GUIDE.md) on all code, except for code located in [third_party](third_party). Use the `make pretty` and `make pretty-check` targets to automatically reformat code and check for code-style compliance, respectively. OpenThread currently requires [clang-format v5.0.1](http://releases.llvm.org/download.html#5.0.1) for `make pretty` and `make pretty-check`. As part of the cleanup process, you should also run `make pretty-check` to ensure that your code passes the baseline code style checks. diff --git a/include/openthread/coap.h b/include/openthread/coap.h index 040460b8c..ba77634bc 100644 --- a/include/openthread/coap.h +++ b/include/openthread/coap.h @@ -149,6 +149,7 @@ typedef struct otCoapOption /** * CoAP Content Format codes. The full list is documented at * https://tools.ietf.org/html/rfc7252#page-92 + * */ typedef enum otCoapOptionContentFormat { OT_COAP_OPTION_CONTENT_FORMAT_TEXT_PLAIN = 0, ///< text/plain @@ -181,7 +182,7 @@ typedef struct otCoapHeader uint16_t mOptionLast; ///< The last CoAP Option Number value uint16_t mFirstOptionOffset; ///< The byte offset for the first CoAP Option uint16_t mNextOptionOffset; ///< The byte offset for the next CoAP Option - otCoapOption mOption; ///< A structure representing the current CoAP Option. + otCoapOption mOption; ///< A structure representing the current CoAP Option } otCoapHeader; /** @@ -276,6 +277,7 @@ void otCoapHeaderGenerateToken(otCoapHeader *aHeader, uint8_t aTokenLength); * @retval OT_ERROR_NONE Successfully appended the option. * @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type. * @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size. + * */ otError otCoapHeaderAppendContentFormatOption(otCoapHeader *aHeader, otCoapOptionContentFormat aContentFormat); @@ -316,6 +318,7 @@ otError otCoapHeaderAppendUintOption(otCoapHeader *aHeader, uint16_t aNumber, ui * @retval OT_ERROR_NONE Successfully appended the option. * @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type. * @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size. + * */ otError otCoapHeaderAppendObserveOption(otCoapHeader *aHeader, uint32_t aObserve); @@ -341,6 +344,7 @@ otError otCoapHeaderAppendUriPathOptions(otCoapHeader *aHeader, const char *aUri * @retval OT_ERROR_NONE Successfully appended the option. * @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type. * @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size. + * */ otError otCoapHeaderAppendMaxAgeOption(otCoapHeader *aHeader, uint32_t aMaxAge); @@ -527,6 +531,7 @@ void otCoapRemoveResource(otInstance *aInstance, otCoapResource *aResource); * @param[in] aInstance A pointer to an OpenThread instance. * @param[in] aHandler A function pointer that shall be called when an unhandled request arrives. * @param[in] aContext A pointer to arbitrary context information. May be NULL if not used. + * */ void otCoapSetDefaultHandler(otInstance *aInstance, otCoapRequestHandler aHandler, void *aContext); diff --git a/include/openthread/dataset_ftd.h b/include/openthread/dataset_ftd.h index d5b35c432..5a1a71643 100644 --- a/include/openthread/dataset_ftd.h +++ b/include/openthread/dataset_ftd.h @@ -55,7 +55,7 @@ extern "C" { * @param[in] aDataset A pointer to the Active Operational Dataset. * * @retval OT_ERROR_NONE Successfully set the Active Operational Dataset. - * @retval OT_ERROR_NO_BUFS Insufficient buffer space to set the Active Operational Datset. + * @retval OT_ERROR_NO_BUFS Insufficient buffer space to set the Active Operational Dataset. * @retval OT_ERROR_INVALID_ARGS @p aDataset was NULL. * */ diff --git a/include/openthread/instance.h b/include/openthread/instance.h index 4dd0f397a..2798edd0e 100644 --- a/include/openthread/instance.h +++ b/include/openthread/instance.h @@ -163,7 +163,7 @@ OTAPI uint32_t OTCALL otGetCompartmentId(otInstance *aInstance); /** * This function initializes the OpenThread library. * - * This function initializes OpenThread and prepares it for subsequent OpenThread API calls. This function must be + * This function initializes OpenThread and prepares it for subsequent OpenThread API calls. This function must be * called before any other calls to OpenThread. * * This function is available and can only be used when support for multiple OpenThread instances is enabled. @@ -182,7 +182,7 @@ otInstance *otInstanceInit(void *aInstanceBuffer, size_t *aInstanceBufferSize); /** * This function initializes the static single instance of the OpenThread library. * - * This function initializes OpenThread and prepares it for subsequent OpenThread API calls. This function must be + * This function initializes OpenThread and prepares it for subsequent OpenThread API calls. This function must be * called before any other calls to OpenThread. * * This function is available and can only be used when support for multiple OpenThread instances is disabled. diff --git a/include/openthread/jam_detection.h b/include/openthread/jam_detection.h index 96c7f7f74..6c9bbb7d0 100644 --- a/include/openthread/jam_detection.h +++ b/include/openthread/jam_detection.h @@ -101,6 +101,7 @@ otError otJamDetectionSetWindow(otInstance *aInstance, uint8_t aWindow); * @param[in] aInstance A pointer to an OpenThread instance. * * @returns The Jam Detection Window. + * */ uint8_t otJamDetectionGetWindow(otInstance *aInstance); @@ -125,7 +126,8 @@ otError otJamDetectionSetBusyPeriod(otInstance *aInstance, uint8_t aBusyPeriod); * * @param[in] aInstance A pointer to an OpenThread instance. * - * @returns The Jam Detection Busy Period + * @returns The Jam Detection Busy Period. + * */ uint8_t otJamDetectionGetBusyPeriod(otInstance *aInstance); @@ -159,6 +161,7 @@ otError otJamDetectionStop(otInstance *aInstance); * @param[in] aInstance A pointer to an OpenThread instance. * * @returns The Jam Detection status (true if enabled, false otherwise). + * */ bool otJamDetectionIsEnabled(otInstance *aInstance); @@ -168,6 +171,7 @@ bool otJamDetectionIsEnabled(otInstance *aInstance); * @param[in] aInstance A pointer to an OpenThread instance. * * @returns The Jam Detection state (`true` jam is detected, `false' otherwise). + * */ bool otJamDetectionGetState(otInstance *aInstance); @@ -184,6 +188,7 @@ bool otJamDetectionGetState(otInstance *aInstance); * @param[in] aInstance A pointer to an OpenThread instance. * * @returns The current history bitmap. + * */ uint64_t otJamDetectionGetHistoryBitmap(otInstance *aInstance); diff --git a/include/openthread/link.h b/include/openthread/link.h index da3dc8641..a0a59cadb 100644 --- a/include/openthread/link.h +++ b/include/openthread/link.h @@ -182,18 +182,18 @@ OTAPI uint8_t OTCALL otLinkGetChannel(otInstance *aInstance); /** * Set the IEEE 802.15.4 channel * - * This function succeeds only when Thread protocols are disabled. A successful - * call to this function invalidates the Active and Pending Operational Datasets in - * non-volatile memory. + * This function succeeds only when Thread protocols are disabled. A successful call to this function invalidates the + * Active and Pending Operational Datasets in non-volatile memory. * - * @param[in] aInstance A pointer to an OpenThread instance. - * @param[in] aChannel The IEEE 802.15.4 channel. + * @param[in] aInstance A pointer to an OpenThread instance. + * @param[in] aChannel The IEEE 802.15.4 channel. * * @retval OT_ERROR_NONE Successfully set the channel. * @retval OT_ERROR_INVALID_ARGS If @p aChnanel is not in the range [11, 26]. * @retval OT_ERROR_INVALID_STATE Thread protocols are enabled. * * @sa otLinkGetChannel + * */ OTAPI otError OTCALL otLinkSetChannel(otInstance *aInstance, uint8_t aChannel); @@ -203,13 +203,14 @@ OTAPI otError OTCALL otLinkSetChannel(otInstance *aInstance, uint8_t aChannel); * @param[in] aInstance A pointer to an OpenThread instance. * * @returns A pointer to the IEEE 802.15.4 Extended Address. + * */ OTAPI const otExtAddress *OTCALL otLinkGetExtendedAddress(otInstance *aInstance); /** * This function sets the IEEE 802.15.4 Extended Address. * - * This function succeedsm only when Thread protocols are disabled. + * This function succeeds only when Thread protocols are disabled. * * @param[in] aInstance A pointer to an OpenThread instance. * @param[in] aExtAddress A pointer to the IEEE 802.15.4 Extended Address. @@ -238,24 +239,25 @@ OTAPI void OTCALL otLinkGetFactoryAssignedIeeeEui64(otInstance *aInstance, otExt * @returns The IEEE 802.15.4 PAN ID. * * @sa otLinkSetPanId + * */ OTAPI otPanId OTCALL otLinkGetPanId(otInstance *aInstance); /** * Set the IEEE 802.15.4 PAN ID. * - * This function succeeds only when Thread protocols are disabled. A successful - * call to this function also invalidates the Active and Pending Operational Datasets in - * non-volatile memory. + * This function succeeds only when Thread protocols are disabled. A successful call to this function also invalidates + * the Active and Pending Operational Datasets in non-volatile memory. * - * @param[in] aInstance A pointer to an OpenThread instance. - * @param[in] aPanId The IEEE 802.15.4 PAN ID. + * @param[in] aInstance A pointer to an OpenThread instance. + * @param[in] aPanId The IEEE 802.15.4 PAN ID. * * @retval OT_ERROR_NONE Successfully set the PAN ID. * @retval OT_ERROR_INVALID_ARGS If aPanId is not in the range [0, 65534]. * @retval OT_ERROR_INVALID_STATE Thread protocols are enabled. * * @sa otLinkGetPanId + * */ OTAPI otError OTCALL otLinkSetPanId(otInstance *aInstance, otPanId aPanId); @@ -267,6 +269,7 @@ OTAPI otError OTCALL otLinkSetPanId(otInstance *aInstance, otPanId aPanId); * @returns The data poll period of sleepy end device in milliseconds. * * @sa otLinkSetPollPeriod + * */ OTAPI uint32_t OTCALL otLinkGetPollPeriod(otInstance *aInstance); @@ -274,12 +277,13 @@ OTAPI uint32_t OTCALL otLinkGetPollPeriod(otInstance *aInstance); * Set the data poll period for sleepy end device. * * @note This function updates only poll period of sleepy end device. To update child timeout the function - * otSetChildTimeout() shall be called. + * `otSetChildTimeout()` shall be called. * * @param[in] aInstance A pointer to an OpenThread instance. * @param[in] aPollPeriod data poll period in milliseconds. * * @sa otLinkGetPollPeriod + * */ OTAPI void OTCALL otLinkSetPollPeriod(otInstance *aInstance, uint32_t aPollPeriod); @@ -289,6 +293,7 @@ OTAPI void OTCALL otLinkSetPollPeriod(otInstance *aInstance, uint32_t aPollPerio * @param[in] aInstance A pointer to an OpenThread instance. * * @returns A pointer to the IEEE 802.15.4 Short Address. + * */ OTAPI otShortAddress OTCALL otLinkGetShortAddress(otInstance *aInstance); @@ -563,6 +568,7 @@ int8_t otLinkConvertLinkQualityToRss(otInstance *aInstance, uint8_t aLinkQuality * @param[in] aInstance A pointer to an OpenThread instance. * * @returns A pointer to the MAC layer counters. + * */ OTAPI const otMacCounters *OTCALL otLinkGetCounters(otInstance *aInstance); diff --git a/include/openthread/link_raw.h b/include/openthread/link_raw.h index cb30ba478..78ee860f8 100644 --- a/include/openthread/link_raw.h +++ b/include/openthread/link_raw.h @@ -175,7 +175,7 @@ typedef void (*otLinkRawTransmitDone)(otInstance * aInstance, * * The transmit sequence consists of: * 1. Transitioning the radio to Transmit from Receive. - * 2. Transmits the psdu on the given channel and at the given transmit power. + * 2. Transmits the PSDU on the given channel and at the given transmit power. * * @param[in] aInstance A pointer to an OpenThread instance. * @param[in] aFrame A pointer to the frame that was transmitted. diff --git a/include/openthread/message.h b/include/openthread/message.h index e0374b057..a20a19fa7 100644 --- a/include/openthread/message.h +++ b/include/openthread/message.h @@ -45,7 +45,7 @@ extern "C" { * @addtogroup api-message * * @brief - * This module includes functions that manipulate OpenThread message buffers + * This module includes functions that manipulate OpenThread message buffers. * * @{ * @@ -63,6 +63,7 @@ extern "C" { * @sa otMessageSetOffset * @sa otMessageRead * @sa otMessageWrite + * */ void otMessageFree(otMessage *aMessage); @@ -81,6 +82,7 @@ void otMessageFree(otMessage *aMessage); * @sa otMessageRead * @sa otMessageWrite * @sa otMessageSetLength + * */ uint16_t otMessageGetLength(otMessage *aMessage); @@ -100,6 +102,7 @@ uint16_t otMessageGetLength(otMessage *aMessage); * @sa otMessageSetOffset * @sa otMessageRead * @sa otMessageWrite + * */ otError otMessageSetLength(otMessage *aMessage, uint16_t aLength); @@ -117,6 +120,7 @@ otError otMessageSetLength(otMessage *aMessage, uint16_t aLength); * @sa otMessageSetOffset * @sa otMessageRead * @sa otMessageWrite + * */ uint16_t otMessageGetOffset(otMessage *aMessage); @@ -136,6 +140,7 @@ uint16_t otMessageGetOffset(otMessage *aMessage); * @sa otMessageGetOffset * @sa otMessageRead * @sa otMessageWrite + * */ otError otMessageSetOffset(otMessage *aMessage, uint16_t aOffset); @@ -155,8 +160,8 @@ bool otMessageIsLinkSecurityEnabled(otMessage *aMessage); * Default setting for a new message is `false`. * * @param[in] aMessage A pointer to a message buffer. - * @param[in] aEnabled If `true`, the message is forced to use direct transmission. If `false`, the - * message follows the normal procedure. + * @param[in] aEnabled If `true`, the message is forced to use direct transmission. If `false`, the message follows + * the normal procedure. * */ void otMessageSetDirectTransmission(otMessage *aMessage, bool aEnabled); @@ -164,7 +169,7 @@ void otMessageSetDirectTransmission(otMessage *aMessage, bool aEnabled); /** * This function returns the average RSS (received signal strength) associated with the message. * - * @returns The average RSS value (in dBm) or OT_RADIO_RSSI_INVALID if no average/RSS is available. + * @returns The average RSS value (in dBm) or OT_RADIO_RSSI_INVALID if no average RSS is available. * */ int8_t otMessageGetRss(otMessage *aMessage); @@ -186,6 +191,7 @@ int8_t otMessageGetRss(otMessage *aMessage); * @sa otMessageSetOffset * @sa otMessageRead * @sa otMessageWrite + * */ otError otMessageAppend(otMessage *aMessage, const void *aBuf, uint16_t aLength); @@ -206,6 +212,7 @@ otError otMessageAppend(otMessage *aMessage, const void *aBuf, uint16_t aLength) * @sa otMessageGetOffset * @sa otMessageSetOffset * @sa otMessageWrite + * */ int otMessageRead(otMessage *aMessage, uint16_t aOffset, void *aBuf, uint16_t aLength); @@ -226,6 +233,7 @@ int otMessageRead(otMessage *aMessage, uint16_t aOffset, void *aBuf, uint16_t aL * @sa otMessageGetOffset * @sa otMessageSetOffset * @sa otMessageRead + * */ int otMessageWrite(otMessage *aMessage, uint16_t aOffset, const void *aBuf, uint16_t aLength); diff --git a/include/openthread/netdata.h b/include/openthread/netdata.h index d45ccd6d0..4f756ed34 100644 --- a/include/openthread/netdata.h +++ b/include/openthread/netdata.h @@ -56,6 +56,7 @@ extern "C" { * @param[out] aData A pointer to the data buffer. * @param[inout] aDataLength On entry, size of the data buffer pointed to by @p aData. * On exit, number of copied bytes. + * */ OTAPI otError OTCALL otNetDataGet(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_t *aDataLength); @@ -95,6 +96,7 @@ otError otNetDataGetNextRoute(otInstance *aInstance, otNetworkDataIterator *aIte * @param[in] aInstance A pointer to an OpenThread instance. * * @returns The Network Data Version. + * */ OTAPI uint8_t OTCALL otNetDataGetVersion(otInstance *aInstance); @@ -104,6 +106,7 @@ OTAPI uint8_t OTCALL otNetDataGetVersion(otInstance *aInstance); * @param[in] aInstance A pointer to an OpenThread instance. * * @returns The Stable Network Data Version. + * */ OTAPI uint8_t OTCALL otNetDataGetStableVersion(otInstance *aInstance); diff --git a/include/openthread/server.h b/include/openthread/server.h index b93106d4d..51059e137 100644 --- a/include/openthread/server.h +++ b/include/openthread/server.h @@ -59,6 +59,7 @@ extern "C" { * @param[out] aData A pointer to the data buffer. * @param[inout] aDataLength On entry, size of the data buffer pointed to by @p aData. * On exit, number of copied bytes. + * */ OTAPI otError OTCALL otServerGetNetDataLocal(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_t *aDataLength); @@ -74,6 +75,7 @@ OTAPI otError OTCALL otServerGetNetDataLocal(otInstance *aInstance, bool aStable * * @sa otServerRemoveService * @sa otServerRegister + * */ OTAPI otError OTCALL otServerAddService(otInstance *aInstance, const otServiceConfig *aConfig); @@ -90,6 +92,7 @@ OTAPI otError OTCALL otServerAddService(otInstance *aInstance, const otServiceCo * * @sa otServerAddService * @sa otServerRegister + * */ OTAPI otError OTCALL otServerRemoveService(otInstance *aInstance, uint32_t aEnterpriseNumber, @@ -137,6 +140,7 @@ OTAPI otError OTCALL otServerGetNextLeaderService(otInstance * aInstan * * @sa otServerAddService * @sa otServerRemoveService + * */ OTAPI otError OTCALL otServerRegister(otInstance *aInstance); diff --git a/include/openthread/tasklet.h b/include/openthread/tasklet.h index da20da11b..25c01a3b1 100644 --- a/include/openthread/tasklet.h +++ b/include/openthread/tasklet.h @@ -55,6 +55,7 @@ extern "C" { * Run all queued OpenThread tasklets at the time this is called. * * @param[in] aInstance A pointer to an OpenThread instance. + * */ void otTaskletsProcess(otInstance *aInstance); @@ -65,6 +66,7 @@ void otTaskletsProcess(otInstance *aInstance); * * @retval TRUE If there are tasklets pending. * @retval FALSE If there are no tasklets pending. + * */ bool otTaskletsArePending(otInstance *aInstance); diff --git a/include/openthread/thread.h b/include/openthread/thread.h index f1dbd8db7..305c05915 100644 --- a/include/openthread/thread.h +++ b/include/openthread/thread.h @@ -287,6 +287,7 @@ OTAPI otError OTCALL otThreadSetMeshLocalPrefix(otInstance *aInstance, const uin * @param[in] aInstance A pointer to an OpenThread instance. * * @returns A pointer to Thread link-local IPv6 address. + * */ const otIp6Address *otThreadGetLinkLocalIp6Address(otInstance *aInstance); @@ -298,6 +299,7 @@ const otIp6Address *otThreadGetLinkLocalIp6Address(otInstance *aInstance); * @returns A pointer to the Thread Network Name. * * @sa otThreadSetNetworkName + * */ OTAPI const char *OTCALL otThreadGetNetworkName(otInstance *aInstance); @@ -315,6 +317,7 @@ OTAPI const char *OTCALL otThreadGetNetworkName(otInstance *aInstance); * @retval OT_ERROR_INVALID_STATE Thread protocols are enabled. * * @sa otThreadGetNetworkName + * */ OTAPI otError OTCALL otThreadSetNetworkName(otInstance *aInstance, const char *aNetworkName); @@ -326,6 +329,7 @@ OTAPI otError OTCALL otThreadSetNetworkName(otInstance *aInstance, const char *a * @returns The thrKeySequenceCounter value. * * @sa otThreadSetKeySequenceCounter + * */ OTAPI uint32_t OTCALL otThreadGetKeySequenceCounter(otInstance *aInstance); @@ -336,6 +340,7 @@ OTAPI uint32_t OTCALL otThreadGetKeySequenceCounter(otInstance *aInstance); * @param[in] aKeySequenceCounter The thrKeySequenceCounter value. * * @sa otThreadGetKeySequenceCounter + * */ OTAPI void OTCALL otThreadSetKeySequenceCounter(otInstance *aInstance, uint32_t aKeySequenceCounter); @@ -347,6 +352,7 @@ OTAPI void OTCALL otThreadSetKeySequenceCounter(otInstance *aInstance, uint32_t * @returns The thrKeySwitchGuardTime value (in hours). * * @sa otThreadSetKeySwitchGuardTime + * */ OTAPI uint32_t OTCALL otThreadGetKeySwitchGuardTime(otInstance *aInstance); @@ -357,6 +363,7 @@ OTAPI uint32_t OTCALL otThreadGetKeySwitchGuardTime(otInstance *aInstance); * @param[in] aKeySwitchGuardTime The thrKeySwitchGuardTime value (in hours). * * @sa otThreadGetKeySwitchGuardTime + * */ OTAPI void OTCALL otThreadSetKeySwitchGuardTime(otInstance *aInstance, uint32_t aKeySwitchGuardTime); @@ -367,6 +374,7 @@ OTAPI void OTCALL otThreadSetKeySwitchGuardTime(otInstance *aInstance, uint32_t * * @retval OT_ERROR_NONE Successfully detached from the Thread network. * @retval OT_ERROR_INVALID_STATE Thread is disabled. + * */ OTAPI otError OTCALL otThreadBecomeDetached(otInstance *aInstance); @@ -377,6 +385,7 @@ OTAPI otError OTCALL otThreadBecomeDetached(otInstance *aInstance); * * @retval OT_ERROR_NONE Successfully begin attempt to become a child. * @retval OT_ERROR_INVALID_STATE Thread is disabled. + * */ OTAPI otError OTCALL otThreadBecomeChild(otInstance *aInstance); @@ -408,6 +417,7 @@ OTAPI otError OTCALL otThreadGetNextNeighborInfo(otInstance * aInstan * @retval OT_DEVICE_ROLE_CHILD The device is currently operating as a Thread Child. * @retval OT_DEVICE_ROLE_ROUTER The device is currently operating as a Thread Router. * @retval OT_DEVICE_ROLE_LEADER The device is currently operating as a Thread Leader. + * */ OTAPI otDeviceRole OTCALL otThreadGetDeviceRole(otInstance *aInstance); @@ -430,6 +440,7 @@ OTAPI otError OTCALL otThreadGetLeaderData(otInstance *aInstance, otLeaderData * * @param[in] aInstance A pointer to an OpenThread instance. * * @returns The Leader's Router ID. + * */ OTAPI uint8_t OTCALL otThreadGetLeaderRouterId(otInstance *aInstance); @@ -439,6 +450,7 @@ OTAPI uint8_t OTCALL otThreadGetLeaderRouterId(otInstance *aInstance); * @param[in] aInstance A pointer to an OpenThread instance. * * @returns The Leader's Weight. + * */ OTAPI uint8_t OTCALL otThreadGetLeaderWeight(otInstance *aInstance); @@ -448,6 +460,7 @@ OTAPI uint8_t OTCALL otThreadGetLeaderWeight(otInstance *aInstance); * @param[in] aInstance A pointer to an OpenThread instance. * * @returns The Partition ID. + * */ OTAPI uint32_t OTCALL otThreadGetPartitionId(otInstance *aInstance); @@ -457,6 +470,7 @@ OTAPI uint32_t OTCALL otThreadGetPartitionId(otInstance *aInstance); * @param[in] aInstance A pointer to an OpenThread instance. * * @returns The RLOC16. + * */ OTAPI uint16_t OTCALL otThreadGetRloc16(otInstance *aInstance); @@ -473,7 +487,7 @@ OTAPI otError OTCALL otThreadGetParentInfo(otInstance *aInstance, otRouterInfo * * The function retrieves the average RSSI for the Thread Parent. * * @param[in] aInstance A pointer to an OpenThread instance. - * @param[out] aParentRssi A pointer to where the parent rssi should be placed. + * @param[out] aParentRssi A pointer to where the parent RSSI should be placed. * */ OTAPI otError OTCALL otThreadGetParentAverageRssi(otInstance *aInstance, int8_t *aParentRssi); @@ -482,11 +496,12 @@ OTAPI otError OTCALL otThreadGetParentAverageRssi(otInstance *aInstance, int8_t * The function retrieves the RSSI of the last packet from the Thread Parent. * * @param[in] aInstance A pointer to an OpenThread instance. - * @param[out] aLastRssi A pointer to where the last rssi should be placed. + * @param[out] aLastRssi A pointer to where the last RSSI should be placed. * * @retval OT_ERROR_NONE Successfully retrieved the RSSI data. * @retval OT_ERROR_FAILED Unable to get RSSI data. * @retval OT_ERROR_INVALID_ARGS @p aLastRssi is NULL. + * */ OTAPI otError OTCALL otThreadGetParentLastRssi(otInstance *aInstance, int8_t *aLastRssi); diff --git a/include/openthread/thread_ftd.h b/include/openthread/thread_ftd.h index f6c267311..bd98b4c78 100644 --- a/include/openthread/thread_ftd.h +++ b/include/openthread/thread_ftd.h @@ -58,14 +58,14 @@ extern "C" { * @returns The maximum number of children currently allowed. * * @sa otThreadSetMaxAllowedChildren + * */ OTAPI uint8_t OTCALL otThreadGetMaxAllowedChildren(otInstance *aInstance); /** * Set the maximum number of children currently allowed. * - * This parameter can only be set when Thread protocol operation - * has been stopped. + * This parameter can only be set when Thread protocol operation has been stopped. * * @param[in] aInstance A pointer to an OpenThread instance. * @param[in] aMaxChildren The maximum allowed children. @@ -75,6 +75,7 @@ OTAPI uint8_t OTCALL otThreadGetMaxAllowedChildren(otInstance *aInstance); * @retval OT_ERROR_INVALID_STATE If Thread isn't stopped. * * @sa otThreadGetMaxAllowedChildren, otThreadStop + * */ OTAPI otError OTCALL otThreadSetMaxAllowedChildren(otInstance *aInstance, uint8_t aMaxChildren); @@ -101,9 +102,8 @@ OTAPI void OTCALL otThreadSetRouterRoleEnabled(otInstance *aInstance, bool aEnab /** * Set the preferred Router Id. * - * Upon becoming a router/leader the node attempts to use this Router Id. If the - * preferred Router Id is not set or if it can not be used, a randomly generated - * router id is picked. This property can be set only when the device role is + * Upon becoming a router/leader the node attempts to use this Router Id. If the preferred Router Id is not set or if + * it can not be used, a randomly generated router id is picked. This property can be set only when the device role is * either detached or disabled. * * @param[in] aInstance A pointer to an OpenThread instance. @@ -163,11 +163,12 @@ OTAPI void OTCALL otThreadSetLocalLeaderPartitionId(otInstance *aInstance, uint3 * @returns The Joiner UDP Port number. * * @sa otThreadSetJoinerUdpPort + * */ OTAPI uint16_t OTCALL otThreadGetJoinerUdpPort(otInstance *aInstance); /** - * Set the Joiner UDP Port + * Set the Joiner UDP Port. * * @param[in] aInstance A pointer to an OpenThread instance. * @param[in] aJoinerUdpPort The Joiner UDP Port number. @@ -175,11 +176,12 @@ OTAPI uint16_t OTCALL otThreadGetJoinerUdpPort(otInstance *aInstance); * @retval OT_ERROR_NONE Successfully set the Joiner UDP Port. * * @sa otThreadGetJoinerUdpPort + * */ OTAPI otError OTCALL otThreadSetJoinerUdpPort(otInstance *aInstance, uint16_t aJoinerUdpPort); /** - * Set Steering data out of band + * Set Steering data out of band. * * Configuration option `OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB` should be set to enable setting of steering * data out of band. Otherwise calling this function does nothing and it returns `OT_ERROR_DISABLED_FEATURE` @@ -205,6 +207,7 @@ otError otThreadSetSteeringData(otInstance *aInstance, const otExtAddress *aExtA * @returns The CONTEXT_ID_REUSE_DELAY value. * * @sa otThreadSetContextIdReuseDelay + * */ OTAPI uint32_t OTCALL otThreadGetContextIdReuseDelay(otInstance *aInstance); @@ -215,6 +218,7 @@ OTAPI uint32_t OTCALL otThreadGetContextIdReuseDelay(otInstance *aInstance); * @param[in] aDelay The CONTEXT_ID_REUSE_DELAY value. * * @sa otThreadGetContextIdReuseDelay + * */ OTAPI void OTCALL otThreadSetContextIdReuseDelay(otInstance *aInstance, uint32_t aDelay); @@ -226,6 +230,7 @@ OTAPI void OTCALL otThreadSetContextIdReuseDelay(otInstance *aInstance, uint32_t * @returns The NETWORK_ID_TIMEOUT value. * * @sa otThreadSetNetworkIdTimeout + * */ OTAPI uint8_t OTCALL otThreadGetNetworkIdTimeout(otInstance *aInstance); @@ -236,6 +241,7 @@ OTAPI uint8_t OTCALL otThreadGetNetworkIdTimeout(otInstance *aInstance); * @param[in] aTimeout The NETWORK_ID_TIMEOUT value. * * @sa otThreadGetNetworkIdTimeout + * */ OTAPI void OTCALL otThreadSetNetworkIdTimeout(otInstance *aInstance, uint8_t aTimeout); @@ -247,6 +253,7 @@ OTAPI void OTCALL otThreadSetNetworkIdTimeout(otInstance *aInstance, uint8_t aTi * @returns The ROUTER_UPGRADE_THRESHOLD value. * * @sa otThreadSetRouterUpgradeThreshold + * */ OTAPI uint8_t OTCALL otThreadGetRouterUpgradeThreshold(otInstance *aInstance); @@ -257,6 +264,7 @@ OTAPI uint8_t OTCALL otThreadGetRouterUpgradeThreshold(otInstance *aInstance); * @param[in] aThreshold The ROUTER_UPGRADE_THRESHOLD value. * * @sa otThreadGetRouterUpgradeThreshold + * */ OTAPI void OTCALL otThreadSetRouterUpgradeThreshold(otInstance *aInstance, uint8_t aThreshold); @@ -443,6 +451,7 @@ OTAPI otError OTCALL otThreadGetEidCacheEntry(otInstance *aInstance, uint8_t aIn * @returns A pointer to a buffer containing the thrPSKc. * * @sa otThreadSetPSKc + * */ OTAPI const uint8_t *OTCALL otThreadGetPSKc(otInstance *aInstance); @@ -460,6 +469,7 @@ OTAPI const uint8_t *OTCALL otThreadGetPSKc(otInstance *aInstance); * @retval OT_ERROR_INVALID_STATE Thread protocols are enabled. * * @sa otThreadGetPSKc + * */ OTAPI otError OTCALL otThreadSetPSKc(otInstance *aInstance, const uint8_t *aPSKc); @@ -471,6 +481,7 @@ OTAPI otError OTCALL otThreadSetPSKc(otInstance *aInstance, const uint8_t *aPSKc * @returns The assigned parent priority value, -2 means not assigned. * * @sa otThreadSetParentPriority + * */ OTAPI int8_t OTCALL otThreadGetParentPriority(otInstance *aInstance); diff --git a/include/openthread/types.h b/include/openthread/types.h index 2ab364086..0f09d5b5f 100644 --- a/include/openthread/types.h +++ b/include/openthread/types.h @@ -75,11 +75,13 @@ typedef struct otInstance otInstance; /** * This structure represents the handle to the OpenThread API. + * */ typedef struct otApiInstance otApiInstance; /** * This structure represents a list of device GUIDs. + * */ typedef struct otDeviceList { @@ -91,6 +93,7 @@ typedef struct otDeviceList /** * This enumeration represents error codes used throughout OpenThread. + * */ typedef enum otError { /** @@ -433,6 +436,7 @@ typedef struct otIp6Address otIp6Address; /** * This structure represents the local and peer IPv6 socket addresses. + * */ typedef struct otMessageInfo { @@ -667,6 +671,7 @@ typedef struct otLinkModeConfig /** * This structure represents an IPv6 prefix. + * */ OT_TOOL_PACKED_BEGIN struct otIp6Prefix @@ -677,6 +682,7 @@ struct otIp6Prefix /** * This structure represents an IPv6 prefix. + * */ typedef struct otIp6Prefix otIp6Prefix; @@ -742,6 +748,7 @@ typedef struct otBorderRouterConfig /** * This structure represents an External Route configuration. + * */ typedef struct otExternalRouteConfig { @@ -779,6 +786,7 @@ typedef struct otExternalRouteConfig /** * Defines valid values for member mPreference in otExternalRouteConfig and otBorderRouterConfig. + * */ typedef enum otRoutePreference { OT_ROUTE_PREFERENCE_LOW = -1, ///< Low route preference. @@ -792,6 +800,7 @@ typedef enum otRoutePreference { /** * This structure represents a Server configuration. + * */ typedef struct otServerConfig { @@ -818,6 +827,7 @@ typedef struct otServerConfig /** * This structure represents a Service configuration. + * */ typedef struct otServiceConfig { @@ -849,6 +859,7 @@ typedef struct otServiceConfig /** * Used to indicate no fixed received signal strength was set + * */ #define OT_MAC_FILTER_FIXED_RSS_DISABLED 127 @@ -858,6 +869,7 @@ typedef uint8_t otMacFilterIterator; ///< Used to iterate through mac filter ent /** * Defines address mode of the mac filter. + * */ typedef enum otMacFilterAddressMode { OT_MAC_FILTER_ADDRESS_MODE_DISABLED, ///< Address filter is disabled. @@ -878,6 +890,7 @@ typedef struct otMacFilterEntry /** * Represents a Thread device role. + * */ typedef enum { OT_DEVICE_ROLE_DISABLED = 0, ///< The Thread stack is disabled. @@ -892,6 +905,7 @@ typedef enum { * * `mFrameErrorRate` and `mMessageErrorRate` require `OPENTHREAD_CONFIG_ENABLE_TX_ERROR_RATE_TRACKING` feature to be * enabled. + * */ typedef struct { @@ -993,6 +1007,7 @@ typedef struct otLeaderData /** * This structure represents the MAC layer counters. + * */ typedef struct otMacCounters { @@ -1032,7 +1047,8 @@ typedef struct otMacCounters } otMacCounters; /** - * This structure represents the IP level counters + * This structure represents the IP level counters. + * */ typedef struct otIpCounters { @@ -1044,6 +1060,7 @@ typedef struct otIpCounters /** * This structure represents the message buffer information. + * */ typedef struct otBufferInfo { @@ -1097,6 +1114,7 @@ typedef struct otNetifMulticastAddress /** * This enumeration represents the list of allowable values for an InterfaceId. + * */ typedef enum otNetifInterfaceId { OT_NETIF_INTERFACE_ID_THREAD = 1, ///< The Thread Network interface ID. @@ -1122,6 +1140,7 @@ typedef struct /** * This structure represents an IPv6 socket address. + * */ typedef struct otSockAddr { @@ -1164,6 +1183,7 @@ typedef void(OTCALL *otDeviceAvailabilityChangedCallback)(bool aAdded, const GUI * #if/#else/#endif. See `openthread/platform/logging.h` for details. * * @sa OT_LOG_LEVEL_NONE and related macros. + * */ typedef uint8_t otLogLevel; diff --git a/include/openthread/udp.h b/include/openthread/udp.h index 4c2e2e5fb..09af731d9 100644 --- a/include/openthread/udp.h +++ b/include/openthread/udp.h @@ -30,6 +30,7 @@ * @file * @brief * This file defines the OpenThread UDP API. + * */ #ifndef OPENTHREAD_UDP_H_ diff --git a/src/core/common/code_utils.hpp b/src/core/common/code_utils.hpp index 1406fb2e5..0c7b73598 100644 --- a/src/core/common/code_utils.hpp +++ b/src/core/common/code_utils.hpp @@ -56,9 +56,8 @@ align_type name[(((size) + (sizeof(align_type) - 1)) / sizeof(align_type))] /** - * This checks for the specified status, which is expected to - * commonly be successful, and branches to the local label 'exit' if - * the status is unsuccessful. + * This macro checks for the specified status, which is expected to commonly be successful, and branches to the local + * label 'exit' if the status is unsuccessful. * * @param[in] aStatus A scalar status to be evaluated against zero (0). * @@ -73,13 +72,11 @@ } while (false) /** - * This checks for the specified condition, which is expected to - * commonly be true, and both executes @a ... and branches to the - * local label 'exit' if the condition is false. + * This macro checks for the specified condition, which is expected to commonly be true, and both executes @a ... and + * branches to the local label 'exit' if the condition is false. * * @param[in] aCondition A Boolean expression to be evaluated. - * @param[in] ... An expression or block to execute when the - * assertion fails. + * @param[in] ... An expression or block to execute when the assertion fails. * */ #define VerifyOrExit(aCondition, ...) \ @@ -93,15 +90,12 @@ } while (false) /** - * This unconditionally executes @a ... and branches to the local - * label 'exit'. + * This macro unconditionally executes @a ... and branches to the local label 'exit'. * - * @note The use of this interface implies neither success nor - * failure for the overall exit status of the enclosing - * function body. + * @note The use of this interface implies neither success nor failure for the overall exit status of the enclosing + * function body. * - * @param[in] ... An optional expression or block to execute - * when the assertion fails. + * @param[in] ... An optional expression or block to execute when the assertion fails. * */ #define ExitNow(...) \ @@ -112,10 +106,10 @@ } while (false) /* - * Run the `statement` and ignore the return value. + * This macro executes the `statement` and ignores the return value. * - * This is primarily used to indicate the intention of developer that - * the return value of function/method can be safely ignored. + * This is primarily used to indicate the intention of developer that the return value of a function/method can be + * safely ignored. * * @param[in] aStatement The function/method to execute. * diff --git a/src/core/common/random.hpp b/src/core/common/random.hpp index 95af16e92..ba6e16598 100644 --- a/src/core/common/random.hpp +++ b/src/core/common/random.hpp @@ -58,7 +58,7 @@ namespace Random { /** * This function generates and returns a random byte. * - * @returns A random `uint8_t` value. + * @returns A random `uint8_t` value. * */ inline uint8_t GetUint8(void) @@ -69,7 +69,7 @@ inline uint8_t GetUint8(void) /** * This function generates and returns a random `uint16_t` value. * - * @returns A random `uint16_t` value. + * @returns A random `uint16_t` value. * */ inline uint16_t GetUint16(void) @@ -80,7 +80,7 @@ inline uint16_t GetUint16(void) /** * This function generates and returns a random `uint32_t` value. * - * @returns A random `uint32_t` value. + * @returns A random `uint32_t` value. * */ inline uint32_t GetUint32(void) @@ -94,7 +94,7 @@ inline uint32_t GetUint32(void) * @param[in] aMin A minimum value (this value can be included in returned random result). * @param[in] aMax A maximum value (this value is excluded from returned random result). * - * @return A random `uint8_t` value in the given range (i.e., aMin <= random value < aMax). + * @returns A random `uint8_t` value in the given range (i.e., aMin <= random value < aMax). */ inline uint8_t GetUint8InRange(uint8_t aMin, uint8_t aMax) { @@ -109,7 +109,7 @@ inline uint8_t GetUint8InRange(uint8_t aMin, uint8_t aMax) * @param[in] aMin A minimum value (this value can be included in returned random result). * @param[in] aMax A maximum value (this value is excluded from returned random result). * - * @return A random `uint16_t` value in the given range (i.e., aMin <= random value < aMax). + * @returns A random `uint16_t` value in the given range (i.e., aMin <= random value < aMax). */ inline uint16_t GetUint16InRange(uint16_t aMin, uint16_t aMax) { @@ -124,7 +124,8 @@ inline uint16_t GetUint16InRange(uint16_t aMin, uint16_t aMax) * @param[in] aMin A minimum value (this value can be included in returned random result). * @param[in] aMax A maximum value (this value is excluded from returned random result). * - * @return A random `uint32_t` value in the given range (i.e., aMin <= random value < aMax). + * @returns A random `uint32_t` value in the given range (i.e., aMin <= random value < aMax). + * */ inline uint32_t GetUint32InRange(uint32_t aMin, uint32_t aMax) { @@ -134,8 +135,8 @@ inline uint32_t GetUint32InRange(uint32_t aMin, uint32_t aMax) /** * This function fills a given buffer with random bytes. * - * @param[out] aBuffer A pointer to a buffer to fill with the random bytes. - * @param[in] aSize Size of buffer (number of bytes to fill). + * @param[out] aBuffer A pointer to a buffer to fill with the random bytes. + * @param[in] aSize Size of buffer (number of bytes to fill). * */ inline void FillBuffer(uint8_t *aBuffer, uint16_t aSize) @@ -152,7 +153,7 @@ inline void FillBuffer(uint8_t *aBuffer, uint16_t aSize) * @param[in] aValue A value to which the random jitter is added. * @param[in] aJitter Maximum jitter. Random jitter is selected from the range `[-aJitter, aJitter]`. * - * @returns The given value with an added random jitter. + * @returns The given value with an added random jitter. * */ inline uint32_t AddJitter(uint32_t aValue, uint16_t aJitter) diff --git a/src/core/mac/mac.hpp b/src/core/mac/mac.hpp index 08b0f2b78..9c155b53c 100644 --- a/src/core/mac/mac.hpp +++ b/src/core/mac/mac.hpp @@ -68,10 +68,10 @@ namespace Mac { */ enum { - kMinBE = 3, ///< macMinBE (IEEE 802.15.4-2006) - kMaxBE = 5, ///< macMaxBE (IEEE 802.15.4-2006) - kMaxCSMABackoffs = 4, ///< macMaxCSMABackoffs (IEEE 802.15.4-2006) - kUnitBackoffPeriod = 20, ///< Number of symbols (IEEE 802.15.4-2006) + kMinBE = 3, ///< macMinBE (IEEE 802.15.4-2006). + kMaxBE = 5, ///< macMaxBE (IEEE 802.15.4-2006). + kMaxCSMABackoffs = 4, ///< macMaxCSMABackoffs (IEEE 802.15.4-2006). + kUnitBackoffPeriod = 20, ///< Number of symbols (IEEE 802.15.4-2006). kMinBackoff = 1, ///< Minimum backoff (milliseconds). @@ -556,7 +556,7 @@ public: const ExtAddress &GetExtAddress(void) const { return mExtAddress; } /** - * This method sets the IEEE 802.15.4 Extended Address + * This method sets the IEEE 802.15.4 Extended Address. * * @param[in] aExtAddress A reference to the IEEE 802.15.4 Extended Address. * @@ -608,8 +608,8 @@ public: uint8_t GetRadioChannel(void) const { return mRadioChannel; } /** - * This method sets the IEEE 802.15.4 Radio Channel. It can only be called - * after successfully calling AcquireRadioChannel(). + * This method sets the IEEE 802.15.4 Radio Channel. It can only be called after successfully calling + * `AcquireRadioChannel()`. * * @param[in] aChannel The IEEE 802.15.4 Radio Channel. * @@ -619,23 +619,20 @@ public: otError SetRadioChannel(uint16_t aAcquisitionId, uint8_t aChannel); /** - * This method acquires external ownership of the Radio channel so that future calls to - * SetRadioChannel will succeed. + * This method acquires external ownership of the Radio channel so that future calls to `SetRadioChannel)()` will + * succeed. * - * @param[out] aAcquisitionId The AcquisitionId that the caller should use when - * calling SetRadioChannel(). + * @param[out] aAcquisitionId The AcquisitionId that the caller should use when calling `SetRadioChannel()`. * - * @retval OT_ERROR_NONE Successfully acquired permission to Set the Radio Channel. - * @retval OT_ERROR_INVALID_STATE Failed to acquire permission as the radio Channel - * has already been acquired. + * @retval OT_ERROR_NONE Successfully acquired permission to Set the Radio Channel. + * @retval OT_ERROR_INVALID_STATE Failed to acquire permission as the radio Channel has already been acquired. * */ otError AcquireRadioChannel(uint16_t *aAcquisitionId); /** - * This method releases external ownership of the radio Channel - * that was acquired with AcquireRadioChannel(). The channel - * will re-adopt the PAN Channel when this API is called. + * This method releases external ownership of the radio Channel that was acquired with `AcquireRadioChannel()`. The + * channel will re-adopt the PAN Channel when this API is called. * * @retval OT_ERROR_NONE Successfully released the IEEE 802.15.4 Radio Channel. * diff --git a/src/ncp/ncp_uart.cpp b/src/ncp/ncp_uart.cpp index af06766ac..52427288d 100644 --- a/src/ncp/ncp_uart.cpp +++ b/src/ncp/ncp_uart.cpp @@ -320,12 +320,12 @@ NcpUart::NcpFrameBufferEncrypterReader::NcpFrameBufferEncrypterReader(NcpFrameBu mDataBufferReadIndex(0), mOutputDataLength(0) {} -bool NcpUart::NcpFrameBufferEncrypterReader::IsEmpty() const +bool NcpUart::NcpFrameBufferEncrypterReader::IsEmpty(void) const { return mTxFrameBuffer.IsEmpty() && !mOutputDataLength; } -otError NcpUart::NcpFrameBufferEncrypterReader::OutFrameBegin() +otError NcpUart::NcpFrameBufferEncrypterReader::OutFrameBegin(void) { otError status = OT_ERROR_FAILED; @@ -355,22 +355,22 @@ otError NcpUart::NcpFrameBufferEncrypterReader::OutFrameBegin() return status; } -bool NcpUart::NcpFrameBufferEncrypterReader::OutFrameHasEnded() +bool NcpUart::NcpFrameBufferEncrypterReader::OutFrameHasEnded(void) { return (mDataBufferReadIndex >= mOutputDataLength); } -uint8_t NcpUart::NcpFrameBufferEncrypterReader::OutFrameReadByte() +uint8_t NcpUart::NcpFrameBufferEncrypterReader::OutFrameReadByte(void) { return mDataBuffer[mDataBufferReadIndex++]; } -otError NcpUart::NcpFrameBufferEncrypterReader::OutFrameRemove() +otError NcpUart::NcpFrameBufferEncrypterReader::OutFrameRemove(void) { return mTxFrameBuffer.OutFrameRemove(); } -void NcpUart::NcpFrameBufferEncrypterReader::Reset() +void NcpUart::NcpFrameBufferEncrypterReader::Reset(void) { mOutputDataLength = 0; mDataBufferReadIndex = 0; diff --git a/src/ncp/ncp_uart.hpp b/src/ncp/ncp_uart.hpp index 6c687674b..5c653e587 100644 --- a/src/ncp/ncp_uart.hpp +++ b/src/ncp/ncp_uart.hpp @@ -113,14 +113,14 @@ private: * Takes a reference to NcpFrameBuffer in order to read spinel frames. */ explicit NcpFrameBufferEncrypterReader(NcpFrameBuffer &aTxFrameBuffer); - bool IsEmpty() const; - otError OutFrameBegin(); - bool OutFrameHasEnded(); - uint8_t OutFrameReadByte(); - otError OutFrameRemove(); + bool IsEmpty(void) const; + otError OutFrameBegin(void); + bool OutFrameHasEnded(void); + uint8_t OutFrameReadByte(void); + otError OutFrameRemove(void); private: - void Reset(); + void Reset(void); NcpFrameBuffer &mTxFrameBuffer; uint8_t mDataBuffer[kRxBufferSize];