예제 #1
0
    OCHeaderOption* InProcClientWrapper::assembleHeaderOptions(OCHeaderOption options[],
           const HeaderOptions& headerOptions)
    {
        int i = 0;

        if( headerOptions.size() == 0)
        {
            return nullptr;
        }

        for (auto it=headerOptions.begin(); it != headerOptions.end(); ++it)
        {
            options[i] = OCHeaderOption(OC_COAP_ID,
                    it->getOptionID(),
                    it->getOptionData().length() + 1,
                    reinterpret_cast<const uint8_t*>(it->getOptionData().c_str()));
            i++;
        }

        return options;
    }
예제 #2
0
    OCHeaderOption* InProcClientWrapper::assembleHeaderOptions(OCHeaderOption options[],
           const HeaderOptions& headerOptions)
    {
        int i = 0;

        if ( headerOptions.size() == 0)
        {
            return nullptr;
        }

        for (auto it=headerOptions.begin(); it != headerOptions.end(); ++it)
        {
            options[i] = OCHeaderOption();
            options[i].protocolID = OC_COAP_ID;
            options[i].optionID = it->getOptionID();
            options[i].optionLength = it->getOptionData().length() + 1;
            strcpy((char*)options[i].optionData, (it->getOptionData().c_str()));
            i++;
        }

        return options;
    }