mirror of
https://github.com/espressif/openthread.git
synced 2026-08-13 22:27:47 +00:00
[spinel] create spinel interface based on the radio url protocol (#9393)
The posix platform is able to support the HDLC, SPI and vendor spinel interfaces, but the spinel interface type can't be changed dynamically. It is inconvenient to use different spinel interfaces for Thread stack in Android. This commit enables the posix platform to support the HDLC, SPI and vendor interface at the same time, and the final spinel interface type is determined by the radio url protocol. Some other changes: 1. Not use CRTP style for the radio spinel. 2. Deprecate the OT_POSIX_CONFIG_RCP_BUS and OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL.
This commit is contained in:
@@ -454,13 +454,14 @@ void TestEncoderDecoder(void)
|
||||
Spinel::MultiFrameBuffer<kBufferSize> decoderBuffer;
|
||||
DecoderContext decoderContext;
|
||||
Hdlc::Encoder encoder(encoderBuffer);
|
||||
Hdlc::Decoder decoder(decoderBuffer, ProcessDecodedFrame, &decoderContext);
|
||||
Hdlc::Decoder decoder;
|
||||
uint8_t *frame;
|
||||
uint16_t length;
|
||||
uint8_t badShortFrame[3] = {kFlagSequence, 0xaa, kFlagSequence};
|
||||
|
||||
printf("Testing Hdlc::Encoder and Hdlc::Decoder");
|
||||
|
||||
decoder.Init(decoderBuffer, ProcessDecodedFrame, &decoderContext);
|
||||
SuccessOrQuit(encoder.BeginFrame());
|
||||
SuccessOrQuit(encoder.Encode(sOpenThreadText, sizeof(sOpenThreadText) - 1));
|
||||
SuccessOrQuit(encoder.EndFrame());
|
||||
@@ -602,10 +603,11 @@ void TestFuzzEncoderDecoder(void)
|
||||
Spinel::FrameBuffer<kBufferSize> decoderBuffer;
|
||||
DecoderContext decoderContext;
|
||||
Hdlc::Encoder encoder(encoderBuffer);
|
||||
Hdlc::Decoder decoder(decoderBuffer, ProcessDecodedFrame, &decoderContext);
|
||||
Hdlc::Decoder decoder;
|
||||
|
||||
printf("Testing Hdlc::Encoder and Hdlc::Decoder with randomly generated frames");
|
||||
|
||||
decoder.Init(decoderBuffer, ProcessDecodedFrame, &decoderContext);
|
||||
for (uint32_t iter = 0; iter < kFuzzTestIteration; iter++)
|
||||
{
|
||||
encoderBuffer.Clear();
|
||||
|
||||
Reference in New Issue
Block a user