Exemple #1
0
void PlatformProcessDrivers(otInstance *aInstance)
{
    if (sInstance == NULL)
    {
        sInstance = aInstance;
        otSetStateChangedCallback(aInstance, StateChangedCallback, 0);
    }

    da15000UartProcess();
    da15000RadioProcess(aInstance);
    da15000AlarmProcess(aInstance);
    ExampleProcess(aInstance);
}
Exemple #2
0
void Interpreter::CacheInstances()
{
    if (mApiInstance)
    {
        otDeviceList *aDeviceList = otEnumerateDevices(mApiInstance);
        assert(aDeviceList);

        mInstancesLength = aDeviceList->aDevicesLength > MAX_CLI_OT_INSTANCES ?
                            MAX_CLI_OT_INSTANCES :
                            (uint8_t)aDeviceList->aDevicesLength;

        for (uint8_t i = 0; i < mInstancesLength; i++)
        {
            mInstances[i].mInterpreter = this;
            mInstances[i].mInstance = otInstanceInit(mApiInstance, &aDeviceList->aDevices[i]);
            assert(mInstances[i].mInstance);
            otSetStateChangedCallback(mInstances[i].mInstance, &Interpreter::s_HandleNetifStateChanged, &mInstances[i]);
        }

        otFreeMemory(aDeviceList);

        if (mInstancesLength > 0) { mInstance = mInstances[0].mInstance; }
    }
}