mirror of
https://github.com/espressif/openthread.git
synced 2026-07-27 06:17:47 +00:00
[diag] add flag to enable CSMA/CA (#10723)
This commit is contained in:
@@ -80,11 +80,12 @@ Done
|
||||
|
||||
### diag frame
|
||||
|
||||
Usage: `diag frame [-s] <frame>`
|
||||
Usage: `diag frame [-c] [-s] <frame>`
|
||||
|
||||
Set the frame (hex encoded) to be used by `diag send` and `diag repeat`. The frame may be overwritten by `diag send` and `diag repeat`.
|
||||
|
||||
Specify `-s` to skip security processing in radio layer.
|
||||
- Specify `-s` to indicate that tx security is already processed so that it should be skipped in the radio layer.
|
||||
- Specify `-c` to enable CSMA/CA for this frame in the radio layer.
|
||||
|
||||
```bash
|
||||
> diag frame 11223344
|
||||
|
||||
@@ -236,15 +236,25 @@ Error Diags::ProcessFrame(uint8_t aArgsLength, char *aArgs[])
|
||||
Error error = kErrorNone;
|
||||
uint16_t size = OT_RADIO_FRAME_MAX_SIZE;
|
||||
bool securityProcessed = false;
|
||||
bool csmaCaEnabled = false;
|
||||
|
||||
if (aArgsLength >= 1)
|
||||
while (aArgsLength > 1)
|
||||
{
|
||||
if (StringMatch(aArgs[0], "-s"))
|
||||
{
|
||||
securityProcessed = true;
|
||||
aArgs++;
|
||||
aArgsLength--;
|
||||
}
|
||||
else if (StringMatch(aArgs[0], "-c"))
|
||||
{
|
||||
csmaCaEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ExitNow(error = kErrorInvalidArgs);
|
||||
}
|
||||
|
||||
aArgs++;
|
||||
aArgsLength--;
|
||||
}
|
||||
|
||||
VerifyOrExit(aArgsLength == 1, error = kErrorInvalidArgs);
|
||||
@@ -254,6 +264,7 @@ Error Diags::ProcessFrame(uint8_t aArgsLength, char *aArgs[])
|
||||
VerifyOrExit(size >= OT_RADIO_FRAME_MIN_SIZE, error = kErrorInvalidArgs);
|
||||
|
||||
ResetTxPacket();
|
||||
mTxPacket->mInfo.mTxInfo.mCsmaCaEnabled = csmaCaEnabled;
|
||||
mTxPacket->mInfo.mTxInfo.mIsSecurityProcessed = securityProcessed;
|
||||
mTxPacket->mLength = size;
|
||||
mIsTxPacketSet = true;
|
||||
|
||||
@@ -159,6 +159,13 @@ send "diag send 1\n"
|
||||
expect "length 0x3"
|
||||
expect "Done"
|
||||
|
||||
send_user "send frame with CSMA/CA enabled\n"
|
||||
send "diag frame -c 112233\n"
|
||||
expect "Done"
|
||||
send "diag send 1\n"
|
||||
expect "length 0x3"
|
||||
expect "Done"
|
||||
|
||||
send "diag repeat stop\n"
|
||||
expect "Done"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user