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


C++ OIC_LOG_V函数代码示例

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


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

示例1: CAInitializePipe

static void CAInitializePipe()
{
    caglobals.ip.selectTimeout = -1;
#ifdef HAVE_PIPE2
    int ret = pipe2(caglobals.ip.shutdownFds, O_CLOEXEC);
#else
    int ret = pipe(caglobals.ip.shutdownFds);
    if (-1 != ret)
    {
        ret = fcntl(caglobals.ip.shutdownFds[0], F_GETFD);
        if (-1 != ret)
        {
            ret = fcntl(caglobals.ip.shutdownFds[0], F_SETFD, ret|FD_CLOEXEC);
        }
        if (-1 != ret)
        {
            ret = fcntl(caglobals.ip.shutdownFds[1], F_GETFD);
        }
        if (-1 != ret)
        {
            ret = fcntl(caglobals.ip.shutdownFds[1], F_SETFD, ret|FD_CLOEXEC);
        }
        if (-1 == ret)
        {
            close(caglobals.ip.shutdownFds[1]);
            close(caglobals.ip.shutdownFds[0]);
            caglobals.ip.shutdownFds[0] = -1;
            caglobals.ip.shutdownFds[1] = -1;
        }
    }
#endif
    if (-1 == ret)
    {
        OIC_LOG_V(ERROR, TAG, "pipe failed: %s", strerror(errno));
        caglobals.ip.selectTimeout = SELECT_TIMEOUT; //poll needed for shutdown
    }
}
开发者ID:InfiniteDevelopment,项目名称:iotivity,代码行数:37,代码来源:caipserver.c

示例2: CAEDRNativeRemoveDevice

void CAEDRNativeRemoveDevice(const char *remoteAddress)
{
    OIC_LOG(DEBUG, TAG, "CAEDRNativeRemoveDeviceforStateList");

    if (!g_deviceStateList)
    {
        OIC_LOG(ERROR, TAG, "[EDR][Native] gdeviceStateList is null");
        return;
    }
    if (!remoteAddress)
    {
        OIC_LOG(ERROR, TAG, "[EDR][Native] remoteAddress is null");
        return;
    }

    jint index;
    jint length = u_arraylist_length(g_deviceStateList);
    for (index = 0; index < length; index++)
    {
        state_t* state = (state_t*) u_arraylist_get(g_deviceStateList, index);
        if (!state)
        {
            OIC_LOG(DEBUG, TAG, "[EDR][Native] state_t object is null");
            continue;
        }

        if (!strcmp((const char*) state->address, remoteAddress))
        {
            OIC_LOG_V(DEBUG, TAG, "[EDR][Native] remove state : %s", remoteAddress);
            OICFree(state);

            u_arraylist_remove(g_deviceStateList, index);
            break;
        }
    }
    return;
}
开发者ID:chetan336,项目名称:iotivity,代码行数:37,代码来源:caedrutils.c

示例3: CALEIsBondedDevice

bool CALEIsBondedDevice(JNIEnv *env, jobject bluetoothDevice)
{
    VERIFY_NON_NULL_RET(env, TAG, "env is null", false);
    VERIFY_NON_NULL_RET(bluetoothDevice, TAG, "bluetoothDevice is null", false);

    jclass jni_cid_device_list = (*env)->FindClass(env, "android/bluetooth/BluetoothDevice");
    if (!jni_cid_device_list)
    {
        OIC_LOG(ERROR, TAG, "jni_cid_device_list is null");
        return false;
    }

    jmethodID jni_mid_getBondState = (*env)->GetMethodID(env, jni_cid_device_list, "getBondState",
                                                         "()I");
    if (!jni_mid_getBondState)
    {
        OIC_LOG(ERROR, TAG, "jni_mid_getBondState is null");
        return false;
    }

    jint jni_bondState = (jint)(*env)->CallIntMethod(env, bluetoothDevice, jni_mid_getBondState);

    OIC_LOG_V(DEBUG, TAG, "bond state is %d", jni_bondState);

    if (BOND_BONDED == jni_bondState)
    {
        OIC_LOG(DEBUG, TAG, "remote device is bonded");
        return true;
    }
    else
    {
        OIC_LOG(DEBUG, TAG, "remote device is not bonded");
        return false;
    }

    return false;
}
开发者ID:InfiniteDevelopment,项目名称:iotivity,代码行数:37,代码来源:caleutils.c

示例4: CAEDRStartNetworkMonitor

CAResult_t CAEDRStartNetworkMonitor()
{
    OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");

    g_mainloop = g_main_loop_new(NULL, 0);
    if(!g_mainloop)
    {
        OIC_LOG(ERROR, EDR_ADAPTER_TAG, "g_main_loop_new failed\n");
        return CA_STATUS_FAILED;
    }

    if (CA_STATUS_OK != ca_thread_pool_add_task(g_threadPoolHandle, GMainLoopThread, (void *) NULL))
    {
        OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to create thread!");
        return CA_STATUS_FAILED;
    }

    // Initialize Bluetooth service
    int err = bt_initialize();
    if (BT_ERROR_NONE != err)
    {
        OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Bluetooth initialization failed!, error num [%x]",
                  err);
        return CA_STATUS_FAILED;
    }

    int ret = bt_adapter_set_state_changed_cb(CAEDRAdapterStateChangeCallback, NULL);
    if(BT_ERROR_NONE != ret)
    {
       OIC_LOG(ERROR, EDR_ADAPTER_TAG, "bt_adapter_set_state_changed_cb failed");
       return CA_STATUS_FAILED;
    }

    OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
    return CA_STATUS_OK;
}
开发者ID:WojciechLuczkow,项目名称:iotivity,代码行数:36,代码来源:caedrnwmonitor.c

示例5: DiscoverAmsService

OCStackResult DiscoverAmsService(PEContext_t *context)
{
    OIC_LOG(INFO, TAG, "IN DiscoverAmsService");

    OCStackResult ret = OC_STACK_ERROR;
    const char DOXM_DEVICEID_QUERY_FMT[] = "%s?%s=%s";
    char uri[MAX_URI_LENGTH + MAX_QUERY_LENGTH] = {};
    OCCallbackData cbData = {.context=NULL};
    char base64Buff[B64ENCODE_OUT_SAFESIZE(sizeof(((OicUuid_t*)0)->id)) + 1] = {};
    uint32_t outLen = 0;
    B64Result b64Ret;

    VERIFY_NON_NULL(TAG, context, ERROR);
    b64Ret = b64Encode(context->amsMgrContext->amsDeviceId.id,
          sizeof(context->amsMgrContext->amsDeviceId.id), base64Buff, sizeof(base64Buff), &outLen);
    VERIFY_SUCCESS(TAG, B64_OK == b64Ret, ERROR);
    snprintf(uri, sizeof(uri), DOXM_DEVICEID_QUERY_FMT, OIC_RSRC_DOXM_URI,
                                       OIC_JSON_DEVICE_ID_NAME, base64Buff);

    cbData.cb = &AmsMgrDiscoveryCallback;
    cbData.context = (void*)context;

    /* TODO
     * If no good response was received for this discovery request,
     * PE would be blocked forever waiting for AMS service to respond with the ACE.
     * Need logic to reset the PE state and send ACCESS_DENIED response,
     * when discovery response from AMS service is not received within certain time.
     */
    OIC_LOG_V(INFO, TAG,"AMS Manager Sending Multicast Discovery with URI = %s", uri);
    ret = OCDoResource(NULL, OC_REST_DISCOVER, uri, NULL, NULL,
                       CT_DEFAULT, OC_LOW_QOS, &cbData, NULL, 0);

exit:
    OIC_LOG(INFO, TAG, "Leaving DiscoverAmsService");
    return ret;
}
开发者ID:aaronkim,项目名称:iotivity,代码行数:36,代码来源:amsmgr.c

示例6: CAEDRStartServiceSearch

CAResult_t CAEDRStartServiceSearch(const char *remoteAddress)
{
    OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");

    // Input validation
    VERIFY_NON_NULL(remoteAddress, EDR_ADAPTER_TAG, "Remote address is null");
    if (!remoteAddress[0])
    {
        OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Remote address is empty!");
        return CA_STATUS_INVALID_PARAM;
    }

    bt_error_e err = bt_device_start_service_search(remoteAddress);
    // Start searching for OIC service
    if (BT_ERROR_NONE != err)
    {
        OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Get bonded device failed!, error num [%x]",
                  err);
        return CA_STATUS_FAILED;
    }

    OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
    return CA_STATUS_OK;
}
开发者ID:darcyg,项目名称:iotivity-1,代码行数:24,代码来源:caedrclient.c

示例7: addInterface

/**
 * @brief addInterface Adds and bind a interface to a resource
 *
 * @param resource      The resource to bind a type to
 * @param interface     Type to be bound and added
 *
 * @return OC_STACK_OK if successfully bound
 */
OCStackResult addInterface(OCBaseResourceT *resource, OCResourceInterface *interface)
{
    OCResourceInterface *current = resource->interface;

    // Loop through the linked list of ind the tail element
    while(current->next != NULL)
    {
        current = current->next;
    }

    current->next = (OCResourceInterface*)malloc(sizeof(OCResourceInterface));
    if(current->next == NULL) {printNoMemoryMsg(); return OC_STACK_NO_MEMORY;}
    memcpy(current->next, interface, sizeof(OCResourceInterface));

    OCStackResult result = OCBindResourceInterfaceToResource(resource->handle, interface->name);

    //OIC_LOG_V(INFO, TAG, "Result of type binding: %s", getOCStackResult(result));
    OIC_LOG_V(INFO, TAG, "Interface added: %s", interface->name);


    free(interface);

    return result;
}
开发者ID:santais,项目名称:iotivity,代码行数:32,代码来源:ocbaseresource.c

示例8: InitializeKeepAlive

OCStackResult InitializeKeepAlive(OCMode mode)
{
    OIC_LOG(DEBUG, TAG, "InitializeKeepAlive IN");
    if (g_isKeepAliveInitialized)
    {
        OIC_LOG(DEBUG, TAG, "KeepAlive already initialized");
        return OC_STACK_OK;
    }

    if (OC_CLIENT != mode)
    {
        // Create the KeepAlive Resource[/oic/ping].
        OCStackResult result = CreateKeepAliveResource();
        if (OC_STACK_OK != result)
        {
            OIC_LOG_V(ERROR, TAG, "CreateKeepAliveResource failed[%d]", result);
            return result;
        }
    }

    if (!g_keepAliveConnectionTable)
    {
        g_keepAliveConnectionTable = u_arraylist_create();
        if (NULL == g_keepAliveConnectionTable)
        {
            OIC_LOG(ERROR, TAG, "Creating KeepAlive Table failed");
            TerminateKeepAlive(mode);
            return OC_STACK_ERROR;
        }
    }

    g_isKeepAliveInitialized = true;

    OIC_LOG(DEBUG, TAG, "InitializeKeepAlive OUT");
    return OC_STACK_OK;
}
开发者ID:Subh1994,项目名称:iotivity,代码行数:36,代码来源:oickeepalive.c

示例9: CALEGetBuildVersion

jint CALEGetBuildVersion(JNIEnv *env)
{
    VERIFY_NON_NULL_RET(env, TAG, "env is null", -1);

    // VERSION is a nested class within android.os.Build (hence "$" rather than "/")
    jclass jni_cls_version = (*env)->FindClass(env, "android/os/Build$VERSION");
    if (!jni_cls_version)
    {
        OIC_LOG(ERROR, TAG, "jni_cls_version is null");
        return -1;
    }

    jfieldID jni_fid_sdk = (*env)->GetStaticFieldID(env, jni_cls_version, "SDK_INT", "I");
    if (!jni_fid_sdk)
    {
        OIC_LOG(ERROR, TAG, "jni_fid_sdk is null");
        return -1;
    }

    jint jni_int_sdk = (*env)->GetStaticIntField(env, jni_cls_version, jni_fid_sdk);
    OIC_LOG_V(DEBUG, TAG, "sdk version is %d", jni_int_sdk);

    return jni_int_sdk;
}
开发者ID:InfiniteDevelopment,项目名称:iotivity,代码行数:24,代码来源:caleutils.c

示例10: OCPayloadDestroy

void OCPayloadDestroy(OCPayload* payload)
{
    if (!payload)
    {
        return;
    }

    switch(payload->type)
    {
        case PAYLOAD_TYPE_REPRESENTATION:
            OCRepPayloadDestroy((OCRepPayload*)payload);
            break;
        case PAYLOAD_TYPE_DISCOVERY:
            OCDiscoveryPayloadDestroy((OCDiscoveryPayload*)payload);
            break;
        case PAYLOAD_TYPE_DEVICE:
            OCDevicePayloadDestroy((OCDevicePayload*)payload);
            break;
        case PAYLOAD_TYPE_PLATFORM:
            OCPlatformPayloadDestroy((OCPlatformPayload*)payload);
            break;
        case PAYLOAD_TYPE_PRESENCE:
            OCPresencePayloadDestroy((OCPresencePayload*)payload);
            break;
        case PAYLOAD_TYPE_SECURITY:
            OCSecurityPayloadDestroy((OCSecurityPayload*)payload);
            break;
        case PAYLOAD_TYPE_RD:
           OCRDPayloadDestroy((OCRDPayload*)payload);
           break;
        default:
            OIC_LOG_V(ERROR, TAG, "Unsupported payload type in destroy: %d", payload->type);
            OICFree(payload);
            break;
    }
}
开发者ID:esevan,项目名称:iotivity,代码行数:36,代码来源:ocpayload.c

示例11: DeviceDiscovery

int DeviceDiscovery()
{
    OCStackResult ret;
    OCCallbackData cbData;
    char queryUri[200];
    char ipaddr[100] = { '\0' };

    snprintf(queryUri, sizeof (queryUri), DISCOVERY_QUERY, ipaddr);

    cbData.cb = discoveryReqCB;
    cbData.context = NULL;
    cbData.cd = NULL;

    /* Start a discovery query*/
    OIC_LOG_V(INFO, TAG, "Resource Discovery : %s\n", queryUri);

    ret = OCDoResource(NULL, OC_REST_DISCOVER, queryUri, 0, 0, CT_DEFAULT,
                       OC_LOW_QOS, &cbData, NULL, 0);
    if (ret != OC_STACK_OK)
    {
        OIC_LOG(ERROR, TAG, "OCStack resource error");
    }
    return ret;
}
开发者ID:aaronkim,项目名称:iotivity,代码行数:24,代码来源:occlientdirectpairing.cpp

示例12: CAArduinoInitUdpSocket

CAResult_t CAArduinoInitUdpSocket(uint16_t *port, int *socketID)
{
    OIC_LOG(DEBUG, TAG, "IN");
    VERIFY_NON_NULL(port, TAG, "port");
    VERIFY_NON_NULL(socketID, TAG, "socketID");

    CAResult_t ret = CAArduinoGetAvailableSocket(socketID);
    if (ret != CA_STATUS_OK)
    {
        OIC_LOG(ERROR, TAG, "get sock fail");
        return ret;
    }

    //Create a datagram socket on which to recv/send.
    if (!socket(*socketID, SnMR::UDP, *port, 0))
    {
        OIC_LOG(ERROR, TAG, "sock fail");
        return CA_STATUS_FAILED;
    }

    OIC_LOG_V(DEBUG, TAG, "socketId:%d", *socketID);
    OIC_LOG(DEBUG, TAG, "OUT");
    return CA_STATUS_OK;
}
开发者ID:santais,项目名称:iotivity,代码行数:24,代码来源:caipadapterutils_eth.cpp

示例13: main

int main() {
    OIC_LOG_V(INFO, TAG, "Starting ocserver");
    if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK) {
        OIC_LOG(ERROR, TAG, "OCStack init error");
        return 0;
    }

    /*
     * Declare and create the example resource: Light
     */
    if(createLightResource() != OC_STACK_OK)
    {
        OIC_LOG(ERROR, TAG, "OCStack cannot create resource...");
    }

    // Break from loop with Ctrl-C
    OIC_LOG(INFO, TAG, "Entering ocserver main loop...");
    signal(SIGINT, handleSigInt);
    while (!gQuitFlag) {

        if (OCProcess() != OC_STACK_OK) {
            OIC_LOG(ERROR, TAG, "OCStack process error");
            return 0;
        }

        sleep(1);
    }

    OIC_LOG(INFO, TAG, "Exiting ocserver main loop...");

    if (OCStop() != OC_STACK_OK) {
        OIC_LOG(ERROR, TAG, "OCStack process error");
    }

    return 0;
}
开发者ID:alexgg,项目名称:iotivity,代码行数:36,代码来源:ocserver.c

示例14: sendMulticastData4

static void sendMulticastData4(const u_arraylist_t *iflist,
                               CAEndpoint_t *endpoint,
                               const void *data, uint32_t datalen)
{
    struct ip_mreq mreq = { .imr_multiaddr = IPv4MulticastAddress };
    OICStrcpy(endpoint->addr, sizeof(endpoint->addr), IPv4_MULTICAST);
    int fd = caglobals.ip.u4.fd;

    uint32_t len = u_arraylist_length(iflist);
    for (uint32_t i = 0; i < len; i++)
    {
        CAInterface_t *ifitem = (CAInterface_t *)u_arraylist_get(iflist, i);
        if (!ifitem)
        {
            continue;
        }
        if ((ifitem->flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
        {
            continue;
        }
        if (ifitem->family != AF_INET)
        {
            continue;
        }

        struct in_addr inaddr;
        inaddr.s_addr = ifitem->ipv4addr;
        mreq.imr_interface = inaddr;
        if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, &mreq, sizeof (mreq)))
        {
            OIC_LOG_V(ERROR, TAG, "send IP_MULTICAST_IF failed: %s (using defualt)",
                    strerror(errno));
        }
        sendData(fd, endpoint, data, datalen, "multicast", "ipv4");
    }
}
开发者ID:WojciechLuczkow,项目名称:iotivity,代码行数:36,代码来源:caipserver.c

示例15: CAAdapterRecvData

void CAAdapterRecvData(const char *remoteAddress, const uint8_t *data, uint32_t dataLength,
                       uint32_t *sentLength)
{
    OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");

    if (false == g_adapterState)
    {
        OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Bluetooth adapter is disabled!");
        *sentLength = 0;
        return;
    }

    // Input validation
    VERIFY_NON_NULL_VOID(data, EDR_ADAPTER_TAG, "Data is null");
    VERIFY_NON_NULL_VOID(sentLength, EDR_ADAPTER_TAG, "Sent data length holder is null");

    // Create remote endpoint
    CAEndpoint_t *remoteEndpoint = CACreateEndpointObject(CA_DEFAULT_FLAGS,
                                                          CA_ADAPTER_RFCOMM_BTEDR,
                                                          remoteAddress, 0);
    if (NULL == remoteEndpoint)
    {
        OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to create remote endpoint !");
        return;
    }

    // Add message to data queue
    CAEDRData *edrData =  CACreateEDRData(remoteEndpoint, data, dataLength);
    CAQueueingThreadAddData(g_recvQueueHandle, edrData, sizeof(CAEDRData));
    *sentLength = dataLength;

    // Free remote endpoint
    CAFreeEndpoint(remoteEndpoint);

    OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
开发者ID:HoTaeWang,项目名称:iotivity,代码行数:36,代码来源:caedradapter.c


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