Hi,
while working on server(edison) i tried understanding a functions ocinit(), 
through which we can connect to particular 
client(gateway/client).------------------------------------------------------------***---------------------------------------------------------------OCStackResult
 OCInit(const char *ipAddr, uint16_t port, OCMode mode)
{
    (void) ipAddr;
    (void) port;
    return OCInit1(mode, OC_DEFAULT_FLAGS, OC_DEFAULT_FLAGS);
}
OCStackResult OCInit1(OCMode mode, OCTransportFlags serverFlags, 
OCTransportFlags clientFlags)
{
    OIC_LOG(DEBUG, TAG, "call OCInit1");
    return OCInit2(mode, serverFlags, clientFlags, OC_DEFAULT_ADAPTER);
}
OCStackResult OCInit2(OCMode mode, OCTransportFlags serverFlags, 
OCTransportFlags clientFlags, OCTransportAdapter transportType)
{
    OIC_LOG(INFO, TAG, "Entering OCInit2");
    // Serialize calls to start and stop the stack.
    OCEnterInitializer();
    OCStackResult result = OC_STACK_OK;
    if (g_ocStackStartCount == 0)
    {
        // This is the first call to initialize the stack so it gets to do the 
real work.
        result = OCInitializeInternal(mode, serverFlags, clientFlags, 
transportType);
    }
    if (result == OC_STACK_OK)
    {
        // Increment the start count since we're about to return success.
        assert(g_ocStackStartCount != UINT_MAX);
        assert(stackState == OC_STACK_INITIALIZED);
        g_ocStackStartCount++;
    }
    OCLeaveInitializer();
    return result;
}
------------------------------------------------------------***---------------------------------------------------------------
i'm more interested to know how OCinit() can be used.since arguments are not 
utilized in it.

please suggest which functions are to be from server to connect to particular 
client/gateway.

Thank you,

Bharath T SSE-spanidea




_______________________________________________
iotivity-dev mailing list
[email protected]
https://lists.iotivity.org/mailman/listinfo/iotivity-dev

Reply via email to