当前位置: 首页>>代码示例>>C++>>正文


C++ OICStrcpy函数代码示例

本文整理汇总了C++中OICStrcpy函数的典型用法代码示例。如果您正苦于以下问题:C++ OICStrcpy函数的具体用法?C++ OICStrcpy怎么用?C++ OICStrcpy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了OICStrcpy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateProvisioningResource

OCStackResult CreateProvisioningResource(bool isSecured)
{
    gProvResource.ps = ES_PS_NEED_PROVISIONING;
    gProvResource.tr = ES_PS_TRIGGER_INIT_VALUE;

    gProvResource.tnt = CT_ADAPTER_IP;
    OICStrcpy(gProvResource.tnn, sizeof(gProvResource.tnn), "Unknown");
    OICStrcpy(gProvResource.cd, sizeof(gProvResource.cd), "Unknown");

    OCStackResult res = OC_STACK_ERROR;
    if (isSecured)
    {
        res = OCCreateResource(&gProvResource.handle, OC_RSRVD_ES_PROV_RES_TYPE,
        OC_RSRVD_INTERFACE_DEFAULT,
        OC_RSRVD_ES_URI_PROV, OCEntityHandlerCb,
        NULL, OC_DISCOVERABLE | OC_OBSERVABLE | OC_SECURE);
    }
    else
    {
        res = OCCreateResource(&gProvResource.handle, OC_RSRVD_ES_PROV_RES_TYPE,
        OC_RSRVD_INTERFACE_DEFAULT,
        OC_RSRVD_ES_URI_PROV, OCEntityHandlerCb,
        NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
    }

    OIC_LOG_V(INFO, ES_RH_TAG, "Created Prov resource with result: %s", getResult(res));
    return res;
}
开发者ID:santais,项目名称:iotivity,代码行数:28,代码来源:resourcehandler.c

示例2: GetTargetNetworkInfoFromProvResource

void GetTargetNetworkInfoFromProvResource(char *name, char *pass)
{
    if (name != NULL && pass != NULL)
    {
        OICStrcpy(name, sizeof(name), gProvResource.tnn);
        OICStrcpy(pass, sizeof(pass), gProvResource.cd);
    }
}
开发者ID:santais,项目名称:iotivity,代码行数:8,代码来源:resourcehandler.c

示例3: CHPGetHttpOption

OCStackResult CHPGetHttpOption(const OCHeaderOption* option, HttpHeaderOption_t** httpOption)
{
    OIC_LOG_V(DEBUG, TAG, "%s IN", __func__);
    if (!option)
    {
        OIC_LOG(ERROR, TAG, "option is NULL");
        return OC_STACK_INVALID_PARAM;
    }

    *httpOption = (HttpHeaderOption_t *)OICCalloc(1, sizeof(HttpHeaderOption_t));
    if (NULL == *httpOption)
    {
        OIC_LOG(ERROR, TAG, "Memory allocation failed");
        return OC_STACK_NO_MEMORY;
    }

    switch (option->optionID)
    {
        case COAP_OPTION_ACCEPT:
            OICStrcpy((*httpOption)->optionName, sizeof((*httpOption)->optionName),
                      HTTP_OPTION_ACCEPT);
            break;
        case COAP_OPTION_IF_MATCH:
            OICStrcpy((*httpOption)->optionName, sizeof((*httpOption)->optionName),
                      HTTP_OPTION_IF_MATCH);
            break;
        case COAP_OPTION_IF_NONE_MATCH:
            OICStrcpy((*httpOption)->optionName, sizeof((*httpOption)->optionName),
                      HTTP_OPTION_IF_NONE_MATCH);
            break;
        case COAP_OPTION_ETAG:
            OICStrcpy((*httpOption)->optionName, sizeof((*httpOption)->optionName),
                      HTTP_OPTION_ETAG);
            break;
        case COAP_OPTION_CONTENT_TYPE:
            OICStrcpy((*httpOption)->optionName, sizeof((*httpOption)->optionName),
                      HTTP_OPTION_CONTENT_TYPE);
            break;
        default:
            OIC_LOG_V(INFO, TAG, "No Matching found for the ID %d", option->optionID);
    }

    if ('\0' == (*httpOption)->optionName[0])
    {
        OIC_LOG(ERROR, TAG, "No matching is found");
        OICFree(*httpOption);
        return OC_STACK_INVALID_OPTION;
    }

    (*httpOption)->optionLength = option->optionLength < sizeof((*httpOption)->optionData) ?
                                      option->optionLength : sizeof((*httpOption)->optionData);
    memcpy((*httpOption)->optionData, option->optionData, (*httpOption)->optionLength);

    OIC_LOG_V(DEBUG, TAG, "%s OUT", __func__);
    return OC_STACK_OK;
}
开发者ID:drashti304,项目名称:TizenRT,代码行数:56,代码来源:CoapHttpMap.c

示例4: getCredList

OicSecCred_t * getCredList()
{
    size_t sz = 0;
    OicSecCred_t *cred = (OicSecCred_t *)OICCalloc(1, sizeof(*cred));
    VERIFY_NON_NULL(TAG, cred, ERROR);
    cred->credId = 1234;
    // use |memcpy| for copying full-lengthed UUID without null termination
    memcpy(cred->subject.id, "1111111111111111", sizeof(cred->subject.id));

#if 0
    cred->roleIdsLen = 2;
    cred->roleIds = (OicSecRole_t *)OICCalloc(cred->roleIdsLen, sizeof(OicSecRole_t));
    VERIFY_NON_NULL(TAG, cred->roleIds, ERROR);
    OICStrcpy((char *)cred->roleIds[0].id, sizeof(cred->roleIds[0].id), "role11");
    OICStrcpy((char *)cred->roleIds[1].id, sizeof(cred->roleIds[1].id), "role12");
#endif

    cred->credType = SYMMETRIC_PAIR_WISE_KEY;
    cred->privateData.data = (uint8_t *)OICCalloc(1, strlen("My private Key11") + 1);
    VERIFY_NON_NULL(TAG, cred->privateData.data, ERROR);
    OICStrcpy((char *)cred->privateData.data, strlen("My private Key11")+1,"My private Key11");
    // use |memcpy| for copying full-lengthed UUID without null termination
    memcpy(cred->rownerID.id, "aaaaaaaaaaaaaaaa", sizeof(cred->rownerID.id));
    cred->next = (OicSecCred_t*)OICCalloc(1, sizeof(*cred->next));
    VERIFY_NON_NULL(TAG, cred->next, ERROR);
    cred->next->credId = 5678;
    // use |memcpy| for copying full-lengthed UUID without null termination
    memcpy(cred->next->subject.id, "2222222222222222", sizeof(cred->next->subject.id));
#if 0
    cred->next->roleIdsLen = 0;
#endif
    cred->next->credType = SYMMETRIC_PAIR_WISE_KEY;
    sz = strlen("My private Key21") + 1;
    cred->next->privateData.data = (uint8_t *)OICCalloc(1, sz);
    VERIFY_NON_NULL(TAG, cred->next->privateData.data, ERROR);
    OICStrcpy((char *)cred->next->privateData.data, sz, "My private Key21");
#if 0
    sz = strlen("My Public Key123") + 1;
    cred->next->publicData.data = (char *)OICCalloc(1, sz);
    VERIFY_NON_NULL(TAG, cred->next->publicData.data, ERROR);
    OICStrcpy(cred->next->publicData.data, sz,"My Public Key123");
#endif
    // use |memcpy| for copying full-lengthed UUID without null termination
    memcpy(cred->next->rownerID.id, "bbbbbbbbbbbbbbbb", sizeof(cred->next->rownerID.id));

    return cred;

exit:
    if(cred)
    {
        DeleteCredList(cred);
        cred = NULL;
    }
    return cred;
}
开发者ID:hudovisk,项目名称:iotivity,代码行数:55,代码来源:credentialresource.cpp

示例5: sizeof

OCRDDiscoveryPayload *OCRDDiscoveryPayloadCreate(const char *deviceName, const char *id, int biasFactor)
{
    OCRDDiscoveryPayload *discoveryPayload = (OCRDDiscoveryPayload *)OICCalloc(1, sizeof(OCRDDiscoveryPayload));

    if (!discoveryPayload)
    {
        return NULL;
    }

    if (deviceName)
    {
        discoveryPayload->n.deviceName = OICStrdup(deviceName);
        if (!discoveryPayload->n.deviceName)
        {
            OICFree(discoveryPayload);
            return NULL;
        }
    }
    if (id)
    {
        OICStrcpy((char*)discoveryPayload->di.id, MAX_IDENTITY_SIZE, id);
    }

    discoveryPayload->sel = biasFactor;

    return discoveryPayload;
}
开发者ID:TianyouLi,项目名称:iotivity,代码行数:27,代码来源:rdpayload.c

示例6: CARAXmppConnectedCB

void CARAXmppConnectedCB(void * const param, xmpp_error_code_t result,
        const char *const bound_jid,
        xmpp_connection_handle_t connection)
{
    OIC_LOG(DEBUG, RA_ADAPTER_TAG, "CARAXmppConnectedCB IN");
    CANetworkStatus_t connection_status;
    if (XMPP_ERR_OK == result)
    {
        printf("\n\n\t\t===>your jid: %s\n\n", bound_jid);

        ca_mutex_lock (g_raadapterMutex);
        OICStrcpy (g_xmppData.jabberID, CA_RAJABBERID_SIZE, bound_jid);

        g_xmppData.connection_status = CA_INTERFACE_UP;
        connection_status = CA_INTERFACE_UP;
        g_xmppData.connection_handle = connection;
        g_xmppData.message_callback.on_received = CARAXmppMessageReceivedCB;
        g_xmppData.message_callback.on_sent = CARAXmppMessageSentCB;
        g_xmppData.message_context = xmpp_message_context_create(g_xmppData.connection_handle,
                g_xmppData.message_callback);
    }
    else
    {
        g_xmppData.connection_status = CA_INTERFACE_DOWN;
        connection_status = CA_INTERFACE_DOWN;
        OIC_LOG_V(ERROR, RA_ADAPTER_TAG, "XMPP connected callback status: %d", result);
    }

    ca_mutex_unlock (g_raadapterMutex);
    // Notify network change to CA
    CARANotifyNetworkChange(bound_jid, connection_status);

    OIC_LOG(DEBUG, RA_ADAPTER_TAG, "CARAXmppConnectedCB OUT");
}
开发者ID:Lyoncore,项目名称:iotivity-demo-uc15,代码行数:34,代码来源:caraadapter.c

示例7: OICCalloc

ProvisioningInfo *PrepareProvisioingStatusCB(OCClientResponse *clientResponse,
                                             ProvStatus provStatus) {

    ProvisioningInfo *provInfo = (ProvisioningInfo *) OICCalloc(1, sizeof(ProvisioningInfo));

    if (provInfo == NULL) {
        OIC_LOG_V(ERROR, ES_PROV_TAG, "Failed to allocate memory");
        return NULL;
    }

    OCDevAddr *devAddr = (OCDevAddr *) OICCalloc(1, sizeof(OCDevAddr));

    if (devAddr == NULL) {
        OIC_LOG_V(ERROR, ES_PROV_TAG, "Failed to allocate memory");
        OICFree(provInfo);
        return NULL;
    }

    OICStrcpy(devAddr->addr, sizeof(devAddr->addr), clientResponse->addr->addr);

    devAddr->port = clientResponse->addr->port;

    provInfo->provDeviceInfo.addr = devAddr;

    provInfo->provStatus = provStatus;

    return provInfo;
}
开发者ID:KonexyIoT,项目名称:iotivity,代码行数:28,代码来源:provisioning.cpp

示例8: getDoubleValueFromString

OCEntityHandlerResult getDoubleValueFromString (const char *str, double *outDouble)
{
    size_t hexOutValSize = strlen(HexPrepend) + strlen(str) + 1;
    char * hexOutVal = (char *) OICCalloc(1, hexOutValSize);
    if(!hexOutVal)
    {
        return OC_EH_ERROR;
    }
    OICStrcpy(hexOutVal, hexOutValSize, HexPrepend);
    OICStrcat(hexOutVal, hexOutValSize, str);

    char *endPtr = NULL;
    errno = 0;
    double value = strtod(hexOutVal, &endPtr);

    if(errno != 0 || *endPtr != 0 || value == HUGE_VALF || value == HUGE_VALL)
    {
        OICFree(hexOutVal);
        return OC_EH_ERROR;
    }

    OICFree(hexOutVal);
    *outDouble = value;
    return OC_EH_OK;

}
开发者ID:TianyouLi,项目名称:iotivity,代码行数:26,代码来源:zigbee_wrapper.c

示例9: NSPutMessageResource

NSResult NSPutMessageResource(NSMessage *msg, OCResourceHandle * handle)
{
    NS_LOG(DEBUG, "NSPutMessageResource - IN");

    if(msg != NULL)
    {
        NS_LOG(DEBUG, "NSMessage is valid");

        NotificationMessageResource.messageId = msg->messageId;
        OICStrcpy(NotificationMessageResource.providerId, UUID_STRING_SIZE, msg->providerId);
        NotificationMessageResource.type = msg->type;
        NotificationMessageResource.dateTime = msg->dateTime;
        NotificationMessageResource.ttl = msg->ttl;
        NotificationMessageResource.title = msg->title;
        NotificationMessageResource.contentText = msg->contentText;
        NotificationMessageResource.sourceName = msg->sourceName;
        NotificationMessageResource.mediaContents = msg->mediaContents;
    }
    else
    {
        NS_LOG(ERROR, "NSMessage is NULL");
    }

    *handle = NotificationMessageResource.handle;
    NS_LOG(DEBUG, "NSPutMessageResource - OUT");

    return NS_OK;
}
开发者ID:stjong,项目名称:iotivity,代码行数:28,代码来源:NSProviderResource.c

示例10: OCCopyTagsResources

OCTagsPayload* OCCopyTagsResources(const char *deviceName, const unsigned char *id, uint64_t ttl)
{
    OCTagsPayload *tags = (OCTagsPayload *)OICCalloc(1, sizeof(OCTagsPayload));
    if (!tags)
    {
        return NULL;
    }
    if (deviceName)
    {
        tags->n.deviceName = OICStrdup(deviceName);
        if (!tags->n.deviceName)
        {
            goto memory_allocation_failed;
        }
    }
    if (id)
    {
        OICStrcpy((char*)tags->di.id, MAX_IDENTITY_SIZE, (char *)id);
    }
    tags->ttl = ttl;
    return tags;

memory_allocation_failed:
    OIC_LOG(ERROR, TAG, "Memory allocation failed.");
    OCFreeTagsResource(tags);
    return NULL;
}
开发者ID:alexgg,项目名称:iotivity,代码行数:27,代码来源:rdpayload.c

示例11: OCCopyTagsResources

OCTagsPayload* OCCopyTagsResources(const char *deviceName, const unsigned char *id, const char *baseURI,
        uint8_t bitmap, uint16_t port, uint8_t ins, const char *rts,const  char *drel, uint32_t ttl)
{
    OCTagsPayload *tags = (OCTagsPayload *)OICCalloc(1, sizeof(OCTagsPayload));
    if (!tags)
    {
        return NULL;
    }
	if (deviceName)
    {
        tags->n.deviceName = OICStrdup(deviceName);
        if (!tags->n.deviceName)
        {
            goto memory_allocation_failed;
        }
    }
    if (id)
    {
        OICStrcpy((char*)tags->di.id, MAX_IDENTITY_SIZE, (char *)id);
        if (!tags->di.id)
        {
            goto memory_allocation_failed;
        }
    }
    if (baseURI)
    {
        tags->baseURI = OICStrdup(baseURI);
        if (!tags->baseURI)
        {
            goto memory_allocation_failed;
        }
    }
    tags->bitmap = bitmap;
    tags->port = port;
    tags->ins = ins;
    if (rts)
    {
        tags->rts = OICStrdup(rts);
        if (!tags->rts)
        {
            goto memory_allocation_failed;
        }
    }
    if (drel)
    {
        tags->drel = OICStrdup(drel);
        if (!tags->drel)
        {
            goto memory_allocation_failed;
        }
    }
    tags->ttl = ttl;
    return tags;

memory_allocation_failed:
    OC_LOG(ERROR, TAG, "Memory allocation failed.");
    OCFreeTagsResource(tags);
    return NULL;
}
开发者ID:TianyouLi,项目名称:iotivity,代码行数:59,代码来源:rdpayload.c

示例12: TEST

// tests a copy where the destination is of length 0
TEST(StringTests, StrcpyZeroDestination)
{
    char target[0];
    char source[] = "123456789";

    char *result = OICStrcpy(target, sizeof(target), source);

    EXPECT_EQ(target, result);
}
开发者ID:Frank-KunLi,项目名称:iotivity,代码行数:10,代码来源:oic_string_tests.cpp

示例13: sizeof

static CAInterface_t *CANewInterfaceItem(int index, const char *name, int family,
                                         const char *addr, int flags)
{
    CAInterface_t *ifitem = (CAInterface_t *)OICCalloc(1, sizeof (CAInterface_t));
    if (!ifitem)
    {
        OIC_LOG(ERROR, TAG, "Malloc failed");
        return NULL;
    }

    OICStrcpy(ifitem->name, sizeof (ifitem->name), name);
    ifitem->index = index;
    ifitem->family = family;
    OICStrcpy(ifitem->addr, sizeof (ifitem->addr), addr);
    ifitem->flags = flags;

    return ifitem;
}
开发者ID:stjong,项目名称:iotivity,代码行数:18,代码来源:caipnwmonitor.c

示例14: TEST

TEST(CredResourceTest, GenerateCredentialValidInput)
{
    OicUuid_t rownerID = {{0}};
    OICStrcpy((char *)rownerID.id, sizeof(rownerID.id), "ownersId21");

    OicUuid_t subject = {{0}};
    OICStrcpy((char *)subject.id, sizeof(subject.id), "subject11");

    uint8_t privateKey[] = "My private Key11";
    OicSecKey_t key = {privateKey, sizeof(privateKey)};

    OicSecCred_t * cred  = NULL;
    cred = GenerateCredential(&subject, SYMMETRIC_PAIR_WISE_KEY, NULL,
                              &key, &rownerID);
    printCred(cred);

    ASSERT_TRUE(NULL != cred);
    DeleteCredList(cred);
}
开发者ID:hudovisk,项目名称:iotivity,代码行数:19,代码来源:credentialresource.cpp

示例15: CreateCallBackObject

ProvisioningInfo *GetCallbackObjectOnError(ProvStatus status) {

    ProvisioningInfo *provInfo = CreateCallBackObject();
    OICStrcpy(provInfo->provDeviceInfo.addr->addr, sizeof(provInfo->provDeviceInfo.addr->addr),
        netProvInfo->netAddressInfo.WIFI.ipAddress);

    provInfo->provDeviceInfo.addr->port = IP_PORT;
    provInfo->provStatus = status;
    return provInfo;
}
开发者ID:KonexyIoT,项目名称:iotivity,代码行数:10,代码来源:provisioning.cpp


注:本文中的OICStrcpy函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。