I have created a server to read values (16 in total) from an oxymeter and
when requested to transmit them over the "wire".

My code is based on the simpleserver sample and when compiled and run
either under Ubuntu or raspberry everything works perfectly, but when
compiled/run under another board (specifically televes) it throws an
std::exception (specifically I get: terminate called after throwing an
instance of 'std::bad_alloc').

I have traced my code and found that the exception is thrown when calling a
specific IoTivity call:

OCEntityHandlerResult
OxymeterEntityHandler(std::shared_ptr<OCResourceRequest> request)
{
        ...........................................

        if (requestType == "GET")
        {
               ...........................................
               if (OC_STACK_OK == *OCPlatform::sendResponse(pResponse)*)
               {
               }
               ...........................................
        }

       ...........................................
}

the code in bold throws the exception (*OCPlatform::sendResponse*), but I
don't get why on two different systems (my development machine Ubuntu Linux
and my raspberry everything works fine) and on my other board (televes) it
throws the exception.\

I have checked and the memory consumption is not that high to indicate out
of memory.

I thought maybe on some systems IoTivity (1.2.1) is more strict than others
and I should provide some kind of .json file (or other) for my custom
resource, but don't know how to write one.
_______________________________________________
iotivity-dev mailing list
[email protected]
https://lists.iotivity.org/mailman/listinfo/iotivity-dev

Reply via email to