mirror of
https://github.com/espressif/openthread.git
synced 2026-08-21 18:09:52 +00:00
[instance] define ot::Instance class (#2307)
This commit makes the following changes: It defines the public `otInstance` as an empty opaque structure which is used by all public C OpenThread APIs. It defines a new class `ot::Instance` (inheriting from `otInstance) which is then used in core source files. The functionality related to the instance is also moved/added into the newly added `Instance` class (as class/static or member methods).
This commit is contained in:
committed by
Jonathan Hui
parent
a394155372
commit
02c876ef62
@@ -28,8 +28,8 @@
|
||||
|
||||
#include <openthread/openthread.h>
|
||||
|
||||
#include "openthread-instance.h"
|
||||
#include "common/debug.hpp"
|
||||
#include "common/instance.hpp"
|
||||
#include "common/message.hpp"
|
||||
#include "utils/wrap_string.h"
|
||||
|
||||
@@ -38,16 +38,16 @@
|
||||
|
||||
void TestMessage(void)
|
||||
{
|
||||
otInstance *instance;
|
||||
ot::Instance *instance;
|
||||
ot::MessagePool *messagePool;
|
||||
ot::Message *message;
|
||||
uint8_t writeBuffer[1024];
|
||||
uint8_t readBuffer[1024];
|
||||
|
||||
instance = testInitInstance();
|
||||
instance = static_cast<ot::Instance *>(testInitInstance());
|
||||
VerifyOrQuit(instance != NULL, "Null OpenThread instance\n");
|
||||
|
||||
messagePool = &instance->mMessagePool;
|
||||
messagePool = &instance->GetMessagePool();
|
||||
|
||||
for (unsigned i = 0; i < sizeof(writeBuffer); i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user