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


C++ OIC_LOG函数代码示例

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


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

示例1: CABtAdapterLeDeviceDiscoveryStateChangedCb

void CABtAdapterLeDeviceDiscoveryStateChangedCb(int result,
        bt_adapter_le_device_discovery_state_e discoveryState,
        bt_adapter_le_device_discovery_info_s *discoveryInfo,
        void *userData)
{
    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");

    if (NULL  == discoveryInfo && BT_ADAPTER_LE_DEVICE_DISCOVERY_FOUND == discoveryState)
    {
        OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "discoveryInfo is NULL");
        return;
    }

    if (BT_ADAPTER_LE_DEVICE_DISCOVERY_FOUND != discoveryState)
    {
        OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG,
                  " LE Discovery state is [%s]",
          discoveryState == BT_ADAPTER_LE_DEVICE_DISCOVERY_STARTED ? "Started" : "Finished");
    }
    else
    {
        CAPrintDiscoveryInformation(discoveryInfo);

        if (discoveryInfo->service_uuid == NULL)
        {
            OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "NO UUIDS from device");
        }
        else
        {
            for (int32_t i = discoveryInfo->service_count - 1; i >= 0; i--)
            {
                OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "uuid[%d]: [%s]",
                          i, discoveryInfo->service_uuid[i]);
                CAResult_t res = CAVerifyOICServiceByUUID(discoveryInfo->service_uuid[i]);
                if (CA_STATUS_OK == res)
                {
                    char *addr = OICStrdup(discoveryInfo->remote_address);
                    VERIFY_NON_NULL_VOID(addr, TZ_BLE_CLIENT_TAG, "Malloc failed");

                    OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG,
                              "Trying to do Gatt connection to [%s]", addr);

                    ca_mutex_lock(g_bleClientThreadPoolMutex);
                    if (NULL == g_bleClientThreadPool)
                    {
                        OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "g_bleClientThreadPool is NULL");
                        OICFree(addr);
                        ca_mutex_unlock(g_bleClientThreadPoolMutex);
                        return;
                    }

                    CAResult_t ret = ca_thread_pool_add_task(g_bleClientThreadPool,
                                                  CAGattConnectThread, addr);
                    if (CA_STATUS_OK != ret)
                    {
                        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG,
                                  "ca_thread_pool_add_task failed with ret [%d]", ret);
                        OICFree(addr);
                        ca_mutex_unlock(g_bleClientThreadPoolMutex);
                        return;
                    }
                    ca_mutex_unlock(g_bleClientThreadPoolMutex);
                    if (discoveryInfo->adv_data_len > 31 || discoveryInfo->scan_data_len > 31)
                    {
                        bt_adapter_le_stop_device_discovery();
                        return;
                    }
                    break;  // Found the OIC Service. No need to verify remaining services.
                }
            }
        }
    }
    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
}
开发者ID:Lyoncore,项目名称:iotivity-demo-uc15,代码行数:74,代码来源:cableclient.c

示例2: CAEDRClientDisconnectAll

// It will be updated when android EDR support is added
void CAEDRClientDisconnectAll()
{
    OIC_LOG(DEBUG, TAG, "IN");

    OIC_LOG(DEBUG, TAG, "OUT");
}
开发者ID:nvelozsavino,项目名称:iotivity,代码行数:7,代码来源:caedrclient.c

示例3: CAEDRInitialize

CAResult_t CAEDRInitialize()
{
    OIC_LOG(DEBUG, TAG, "CAEDRInitialize");

    CAEDRCoreJniInit();

    CAEDRJniInitContext();

    // init mutex
    CAResult_t result = CAEDRCreateMutex();
    if(CA_STATUS_OK != result)
    {
        OIC_LOG(ERROR, TAG, "CAEDRInitialize - Could not create mutex");
        return result;
    }

    bool isAttached = false;
    JNIEnv* env;
    jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
    if (JNI_OK != res)
    {
        OIC_LOG(DEBUG, TAG, "CAEDRInitialize - Could not get JNIEnv pointer");
        res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);

        if (JNI_OK != res)
        {
            OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
            return CA_STATUS_NOT_INITIALIZED;
        }
        isAttached = true;
    }
    jstring jni_address = CAEDRNativeGetLocalDeviceAddress(env);
    if (jni_address)
    {
        const char* localAddress = (*env)->GetStringUTFChars(env, jni_address, NULL);
        OIC_LOG_V(DEBUG, TAG, "My BT Address is %s", localAddress);
        (*env)->ReleaseStringUTFChars(env, jni_address, localAddress);
    }
    (*env)->DeleteLocalRef(env, jni_address);

    ca_mutex_lock(g_mutexStateList);
    CAEDRNativeCreateDeviceStateList();
    ca_mutex_unlock(g_mutexStateList);

    ca_mutex_lock(g_mutexObjectList);
    CAEDRNativeCreateDeviceSocketList();
    ca_mutex_unlock(g_mutexObjectList);

    if (isAttached)
    {
        (*g_jvm)->DetachCurrentThread(g_jvm);
    }

    if (g_context)
    {
        CAEDRCreateJNIInterfaceObject(g_context); /* create java CaEdrInterface instance*/
    }

    OIC_LOG(DEBUG, TAG, "OUT");

    return result;
}
开发者ID:nvelozsavino,项目名称:iotivity,代码行数:62,代码来源:caedrclient.c

示例4: CAEDRNativeGetBondedDevices

jobjectArray CAEDRNativeGetBondedDevices(JNIEnv *env)
{
    jclass jni_cid_BTAdapter = (*env)->FindClass(env, CLASSPATH_BT_ADPATER);
    if (!jni_cid_BTAdapter)
    {
        OIC_LOG(ERROR, TAG, "[EDR][Native] getBondedDevices: jni_cid_BTAdapter is null");
        return NULL;
    }

    jmethodID jni_mid_getDefaultAdapter = (*env)->GetStaticMethodID(env, jni_cid_BTAdapter,
                                                                    "getDefaultAdapter",
                                                                    METHODID_OBJECTNONPARAM);
    if (!jni_mid_getDefaultAdapter)
    {
        (*env)->DeleteLocalRef(env, jni_cid_BTAdapter);

        OIC_LOG(ERROR, TAG, "[EDR][Native] getBondedDevices: default adapter is null");
        return NULL;
    }

    jobject jni_obj_BTAdapter = (*env)->CallStaticObjectMethod(env, jni_cid_BTAdapter,
                                                               jni_mid_getDefaultAdapter);
    if (!jni_obj_BTAdapter)
    {
        (*env)->DeleteLocalRef(env, jni_cid_BTAdapter);

        OIC_LOG(ERROR, TAG, "[EDR][Native] getBondedDevices: bluetooth adapter is null");
        return NULL;
    }

    // Get a list of currently paired devices
    jmethodID jni_mid_getBondedDevices = (*env)->GetMethodID(env, jni_cid_BTAdapter,
                                                             "getBondedDevices",
                                                             "()Ljava/util/Set;");
    if (!jni_mid_getBondedDevices)
    {
        (*env)->DeleteLocalRef(env, jni_obj_BTAdapter);
        (*env)->DeleteLocalRef(env, jni_cid_BTAdapter);

        OIC_LOG(ERROR, TAG, "[EDR][Native] getBondedDevices: jni_mid_getBondedDevicesr is null");
        return NULL;
    }

    jobject jni_obj_setPairedDevices = (*env)->CallObjectMethod(env, jni_obj_BTAdapter,
                                                                jni_mid_getBondedDevices);
    if (!jni_obj_setPairedDevices)
    {
        (*env)->DeleteLocalRef(env, jni_obj_BTAdapter);
        (*env)->DeleteLocalRef(env, jni_cid_BTAdapter);

        OIC_LOG(ERROR, TAG, "[EDR][Native] getBondedDevices: jni_obj_setPairedDevices is null");
        return NULL;
    }

    // Convert the set to an object array
    // object[] array = Set<BluetoothDevice>.toArray();
    jclass jni_cid_Set = (*env)->FindClass(env, "java/util/Set");
    if (!jni_cid_Set)
    {
        (*env)->DeleteLocalRef(env, jni_obj_BTAdapter);
        (*env)->DeleteLocalRef(env, jni_cid_BTAdapter);
        (*env)->DeleteLocalRef(env, jni_obj_setPairedDevices);

        OIC_LOG(ERROR, TAG, "[EDR][Native] getBondedDevices: jni_cid_Set is null");
        return NULL;
    }
    jmethodID jni_mid_toArray = (*env)->GetMethodID(env, jni_cid_Set, "toArray",
                                                    "()[Ljava/lang/Object;");

    if (!jni_mid_toArray)
    {
        (*env)->DeleteLocalRef(env, jni_obj_BTAdapter);
        (*env)->DeleteLocalRef(env, jni_cid_BTAdapter);
        (*env)->DeleteLocalRef(env, jni_obj_setPairedDevices);

        OIC_LOG(ERROR, TAG, "[EDR][Native] getBondedDevices: jni_mid_toArray is null");
        return NULL;
    }

    jobjectArray jni_arrayPairedDevices = (jobjectArray)(
            (*env)->CallObjectMethod(env, jni_obj_setPairedDevices, jni_mid_toArray));
    if (!jni_arrayPairedDevices)
    {
        (*env)->DeleteLocalRef(env, jni_obj_BTAdapter);
        (*env)->DeleteLocalRef(env, jni_cid_BTAdapter);
        (*env)->DeleteLocalRef(env, jni_obj_setPairedDevices);

        OIC_LOG(ERROR, TAG, "[EDR][Native] getBondedDevices: jni_arrayPairedDevices is null");
        return NULL;
    }

    (*env)->DeleteLocalRef(env, jni_obj_BTAdapter);
    (*env)->DeleteLocalRef(env, jni_cid_BTAdapter);
    (*env)->DeleteLocalRef(env, jni_obj_setPairedDevices);

    return jni_arrayPairedDevices;
}
开发者ID:chetan336,项目名称:iotivity,代码行数:97,代码来源:caedrutils.c

示例5: CAEDRClientTerminate

void CAEDRClientTerminate()
{
    OIC_LOG(DEBUG, TAG, "IN");
    CAEDRTerminate();
    OIC_LOG(DEBUG, TAG, "OUT");
}
开发者ID:nvelozsavino,项目名称:iotivity,代码行数:6,代码来源:caedrclient.c

示例6: CAStartLEGattClient

CAResult_t CAStartLEGattClient()
{
    OIC_LOG(DEBUG, TAG, "IN");
    OIC_LOG(DEBUG, TAG, "OUT");
    return CA_STATUS_OK;
}
开发者ID:Dosercyan,项目名称:iotivity,代码行数:6,代码来源:cableclient.cpp

示例7: CATerminateLEGattClient

void CATerminateLEGattClient()
{
    OIC_LOG(DEBUG, TAG, "IN");
    OIC_LOG(DEBUG, TAG, "OUT");
}
开发者ID:Dosercyan,项目名称:iotivity,代码行数:5,代码来源:cableclient.cpp

示例8: CALESetAdapterStateCallback

void CALESetAdapterStateCallback(CALEDeviceStateChangedCallback callback)
{
    OIC_LOG(DEBUG, TAG, "CALESetAdapterStateCallback");
    g_bleDeviceStateChangedCallback = callback;
}
开发者ID:InfiniteDevelopment,项目名称:iotivity,代码行数:5,代码来源:calenwmonitor.c

示例9: OCUnlinkDevices

/*
* Function to unlink devices.
* This function will remove the credential & relationship between the two devices.
*
* @param[in] ctx Application context would be returned in result callback
* @param[in] pTargetDev1 first device information to be unlinked.
* @param[in] pTargetDev2 second device information to be unlinked.
* @param[in] resultCallback callback provided by API user, callback will be called when
*            device unlink is finished.
 * @return  OC_STACK_OK in case of success and other value otherwise.
*/
OCStackResult OCUnlinkDevices(void* ctx,
                              const OCProvisionDev_t* pTargetDev1,
                              const OCProvisionDev_t* pTargetDev2,
                              OCProvisionResultCB resultCallback)
{
    OIC_LOG(INFO, TAG, "IN OCUnlinkDevices");
    OCUuidList_t* idList = NULL;
    size_t numOfDev = 0;

    if (!pTargetDev1 || !pTargetDev2 || !pTargetDev1->doxm || !pTargetDev2->doxm)
    {
        OIC_LOG(ERROR, TAG, "OCUnlinkDevices : NULL parameters");
        return OC_STACK_INVALID_PARAM;
    }
    if (!resultCallback)
    {
        OIC_LOG(INFO, TAG, "OCUnlinkDevices : NULL Callback");
        return OC_STACK_INVALID_CALLBACK;
    }
    if (0 == memcmp(&pTargetDev1->doxm->deviceID, &pTargetDev2->doxm->deviceID, sizeof(OicUuid_t)))
    {
        OIC_LOG(INFO, TAG, "OCUnlinkDevices : Same device ID");
        return OC_STACK_INVALID_PARAM;
    }

    // Get linked devices with the first device.
    OCStackResult res = PDMGetLinkedDevices(&(pTargetDev1->doxm->deviceID), &idList, &numOfDev);
    if (OC_STACK_OK != res)
    {
        OIC_LOG(ERROR, TAG, "OCUnlinkDevices : PDMgetOwnedDevices failed");
        goto error;
    }
    if (1 > numOfDev)
    {
        OIC_LOG(DEBUG, TAG, "OCUnlinkDevices : Can not find linked devices");
        res = OC_STACK_INVALID_PARAM; // Input devices are not linked, No request is made
        goto error;
    }

    // Check the linked devices contains the second device. If yes send credential DELETE request.
    OCUuidList_t* curDev = idList;
    while (NULL != curDev)
    {
        if (memcmp(pTargetDev2->doxm->deviceID.id, curDev->dev.id, sizeof(curDev->dev.id)) == 0)
        {
            res = SRPUnlinkDevices(ctx, pTargetDev1, pTargetDev2, resultCallback);
            if (OC_STACK_OK != res)
            {
                OIC_LOG(ERROR, TAG, "OCUnlinkDevices : Failed to unlink devices.");
            }
            goto error;
        }
        curDev = curDev->next;
    }
    OIC_LOG(DEBUG, TAG, "No matched pair found from provisioning database");
    res = OC_STACK_INVALID_PARAM; // Input devices are not linked, No request is made

error:
    OIC_LOG(INFO, TAG, "OUT OCUnlinkDevices");

    PDMDestoryOicUuidLinkList(idList);
    return res;
}
开发者ID:hudovisk,项目名称:iotivity,代码行数:74,代码来源:ocprovisioningmanager.c

示例10: CALENetworkMonitorJNISetContext

//getting context
void CALENetworkMonitorJNISetContext()
{
    OIC_LOG(DEBUG, TAG, "CALENetworkMonitorJNISetContext - it is not supported");
}
开发者ID:InfiniteDevelopment,项目名称:iotivity,代码行数:5,代码来源:calenwmonitor.c

示例11: CALENetworkMonitorJniInit

//getting jvm
void CALENetworkMonitorJniInit()
{
    OIC_LOG(DEBUG, TAG, "CALENetworkMonitorJniInit");
    g_jvm = CANativeJNIGetJavaVM();
}
开发者ID:InfiniteDevelopment,项目名称:iotivity,代码行数:6,代码来源:calenwmonitor.c

示例12: Java_org_iotivity_ca_CaLeClientInterface_caLeStateChangedCallback

JNIEXPORT void JNICALL
Java_org_iotivity_ca_CaLeClientInterface_caLeStateChangedCallback(JNIEnv *env, jobject obj,
                                                                   jint status)
{
    VERIFY_NON_NULL_VOID(env, TAG, "env is null");
    VERIFY_NON_NULL_VOID(obj, TAG, "obj is null");

    OIC_LOG_V(DEBUG, TAG, "CaLeClientInterface - Network State Changed : status(%d)", status);

    if (!g_bleDeviceStateChangedCallback)
    {
        OIC_LOG(ERROR, TAG, "gNetworkChangeCb is null");
        return;
    }

    jint state_on = CALEGetConstantsValue(env, CLASSPATH_BT_ADAPTER, "STATE_ON");
    jint state_off = CALEGetConstantsValue(env, CLASSPATH_BT_ADAPTER, "STATE_OFF");
    jint state_turning_off = CALEGetConstantsValue(env, CLASSPATH_BT_ADAPTER, "STATE_TURNING_OFF");

    if (state_on == status) // STATE_ON:12
    {
        CANetworkStatus_t newStatus = CA_INTERFACE_UP;
        CALEClientCreateDeviceList();
        CALEServerCreateCachedDeviceList();

        g_bleDeviceStateChangedCallback(newStatus);
    }
    else if (state_turning_off == status) // BT_STATE_TURNING_OFF:13
    {
        // gatt Device list will be removed.
        // so it is need to create list again when adapter is enabled.
        CAStopLEGattClient();
    }
    else if (state_off == status) // STATE_OFF:10
    {
        CALEClientStopMulticastServer();

        // remove obj for client
        CAResult_t res = CALEClientRemoveAllGattObjs(env);
        if (CA_STATUS_OK != res)
        {
            OIC_LOG(ERROR, TAG, "CALEClientRemoveAllGattObjs has failed");
        }

        res = CALEClientResetDeviceStateForAll();
        if (CA_STATUS_OK != res)
        {
            OIC_LOG(ERROR, TAG, "CALEClientResetDeviceStateForAll has failed");
        }

        // remove obj for server
        res = CALEServerRemoveAllDevices(env);
        if (CA_STATUS_OK != res)
        {
            OIC_LOG(ERROR, TAG, "CALEServerRemoveAllDevices has failed");
        }

        CALEClientSetScanFlag(false);

        CANetworkStatus_t newStatus = CA_INTERFACE_DOWN;
        g_bleDeviceStateChangedCallback(newStatus);
    }
}
开发者ID:InfiniteDevelopment,项目名称:iotivity,代码行数:63,代码来源:calenwmonitor.c

示例13: CAUnSetLEAdapterStateChangedCb

CAResult_t CAUnSetLEAdapterStateChangedCb()
{
    OIC_LOG(DEBUG, TAG, "it is not required in this platform");
    return CA_STATUS_OK;
}
开发者ID:InfiniteDevelopment,项目名称:iotivity,代码行数:5,代码来源:calenwmonitor.c

示例14: CAInitGattClientMutexVariables

CAResult_t CAInitGattClientMutexVariables()
{
    OIC_LOG(DEBUG,  TZ_BLE_CLIENT_TAG, "IN");
    if (NULL == g_bleClientStateMutex)
    {
        g_bleClientStateMutex = ca_mutex_new();
        if (NULL == g_bleClientStateMutex)
        {
            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_mutex_new failed");
            return CA_STATUS_FAILED;
        }
    }

    if (NULL == g_bleServiceListMutex)
    {
        g_bleServiceListMutex = ca_mutex_new();
        if (NULL == g_bleServiceListMutex)
        {
            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_mutex_new failed");
            return CA_STATUS_FAILED;
        }
    }

    if (NULL == g_bleReqRespClientCbMutex)
    {
        g_bleReqRespClientCbMutex = ca_mutex_new();
        if (NULL == g_bleReqRespClientCbMutex)
        {
            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_mutex_new failed");
            return CA_STATUS_FAILED;
        }
    }

    if (NULL == g_bleClientThreadPoolMutex)
    {
        g_bleClientThreadPoolMutex = ca_mutex_new();
        if (NULL == g_bleClientThreadPoolMutex)
        {
            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_mutex_new failed");
            return CA_STATUS_FAILED;
        }
    }

    if (NULL == g_bleClientConnectMutex)
    {
        g_bleClientConnectMutex = ca_mutex_new();
        if (NULL == g_bleClientConnectMutex)
        {
            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_mutex_new failed");
            return CA_STATUS_FAILED;
        }
    }

    if (NULL == g_bleClientSendCondWait)
    {
        g_bleClientSendCondWait = ca_cond_new();
        if (NULL == g_bleClientSendCondWait)
        {
            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_cond_new failed");
            return CA_STATUS_FAILED;
        }
    }

    if (NULL == g_bleServerBDAddressMutex)
    {
        g_bleServerBDAddressMutex = ca_mutex_new();
        if (NULL == g_bleServerBDAddressMutex)
        {
            OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_mutex_new failed");
            return CA_STATUS_FAILED;
        }
    }

    OIC_LOG(DEBUG,  TZ_BLE_CLIENT_TAG, "OUT");
    return CA_STATUS_OK;
}
开发者ID:Lyoncore,项目名称:iotivity-demo-uc15,代码行数:76,代码来源:cableclient.c

示例15: CASetLEReqRespClientCallback

void CASetLEReqRespClientCallback(CABLEDataReceivedCallback callback)
{
    OIC_LOG(DEBUG, TAG, "IN");
    OIC_LOG(DEBUG, TAG, "OUT");
}
开发者ID:Dosercyan,项目名称:iotivity,代码行数:5,代码来源:cableclient.cpp


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