コード例 #1
0
ファイル: calenwmonitor.c プロジェクト: darcyg/iotivity-1
JNIEXPORT void JNICALL
Java_org_iotivity_ca_CaLeClientInterface_caLeBondStateChangedCallback(JNIEnv *env, jobject obj,
                                                                       jstring addr)
{
    OIC_LOG(DEBUG, TAG, "CaLeClientInterface - Bond State Changed");
    VERIFY_NON_NULL_VOID(env, TAG, "env is null");
    VERIFY_NON_NULL_VOID(addr, TAG, "addr is null");

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

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

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

}
コード例 #2
0
JNIEXPORT void JNICALL
Java_org_iotivity_ca_CaLeClientInterface_caLeBondStateChangedCallback(JNIEnv *env, jobject obj,
                                                                      jstring jaddr)
{
    OIC_LOG(DEBUG, TAG, "CaLeClientInterface - Bond State Changed");
    VERIFY_NON_NULL_VOID(env, TAG, "env is null");
    VERIFY_NON_NULL_VOID(obj, TAG, "obj is null");
    VERIFY_NON_NULL_VOID(jaddr, TAG, "jaddr is null");

    // geneally 'addr' parameter will be not ble address, if you didn't bond for BLE.
    // below logics will be needed when ble pairing is set.

    CAResult_t res = CALEClientDisconnectforAddress(env, jaddr);
    if (CA_STATUS_OK != res)
    {
        OIC_LOG(ERROR, TAG, "CALEClientDisconnectforAddress has failed");
    }

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

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

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