[otns] make various enhancements to Otns (#11643)

This commit contains various enhancements to the `Otns` class:

- Makes `Otns` methods non-static. This aligns their use with the
  clang-tidy `readability-static-accessed-through-instance` check,
  which disallows accessing static methods through an instance.
- Updates the `make-pretty` script to enable OTNS and include it in
  `clang-tidy` checks.
- Adds a stub implementation of `otPlatOtnsStatus()` in the simulation
  and fake platforms. This allows the OTNS feature to be enabled in
  `make-pretty` builds and covered by GitHub Action CI checks.
- Simplifies the `EmitStatus` methods to use the `String` class for
  constructing the status string.
- Adds a new helper method to construct the CoAP status string,
  removing duplicated code.
This commit is contained in:
Abtin Keshavarzian
2025-06-30 14:39:30 -07:00
committed by GitHub
parent 0093b9caf5
commit a495a2284b
7 changed files with 136 additions and 101 deletions
+4
View File
@@ -122,3 +122,7 @@ void otPlatAssertFail(const char *aFilename, int aLineNumber)
assert(false);
exit(1);
}
#if OPENTHREAD_CONFIG_OTNS_ENABLE && !OPENTHREAD_SIMULATION_VIRTUAL_TIME
void otPlatOtnsStatus(const char *aStatus) { OT_UNUSED_VARIABLE(aStatus); }
#endif
@@ -76,17 +76,6 @@
#define OPENTHREAD_CONFIG_NCP_SPI_ENABLE 0
#endif
/**
* Check OTNS configurations
*/
#if OPENTHREAD_CONFIG_OTNS_ENABLE
#if !OPENTHREAD_SIMULATION_VIRTUAL_TIME
#error "OTNS requires virtual time simulations"
#endif
#endif // OPENTHREAD_CONFIG_OTNS_ENABLE
/**
* @def OPENTHREAD_SIMULATION_MAX_NETWORK_SIZE
*