_NULL_RET(env, TAG, "env is null", NULL);

    jclass jni_cid_BTAdapter = (*env)->FindClass(env, CLASSPATH_BT_ADPATER);
    if (!jni_cid_BTAdapter)
    {
        OIC_LOG(ERROR, TAG, "getBondedDevices: jni_cid_BTAdapter is null");
        return NULL;
    }

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

    jobject jni_obj_BTAdapter = (*env)->CallStaticObjectMethod(env, jni_cid_BTAdapter,
                                                               jni_mid_getDefaultAdapter);
    if (!jni_obj_BTAdapter)
    {
        OIC_LOG(ERROR, TAG, "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)
    {
        OIC_LOG(ERROR, TAG, "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)
    {
        OIC_LOG(ERROR, TAG, "getBondedDevices: jni_obj_setPairedDevices is null");
        return NULL;
    }

    jclass jni_cid_Set = (*env)->FindClass(env, "java/util/Set");
_ NULL_RET(env, TAG, " env is null ", NULL); 

     jclass jni_cid_BTAdapter = (* env)->FindClass(env, CLASSPATH_BT_ADPATER); 
     if (! jni_cid_BTAdapter) 
     { 
         OIC_LOG(ERROR, TAG, " getBondedDevices: jni_cid_BTAdapter is null "); 
         return NULL; 
     } 

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

     jobject jni_obj_BTAdapter = (* env)->CallStaticObjectMethod(env, jni_cid_BTAdapter, 
                                                                jni_mid_getDefaultAdapter); 
     if (! jni_obj_BTAdapter) 
     { 
         OIC_LOG(ERROR, TAG, " getBondedDevices: bluetooth adapter is null "); 
         return NULL; 
     } 

     // Get a list of presently pair devices 
     jmethodID jni_mid_getBondedDevices = (* env)->GetMethodID(env, jni_cid_BTAdapter, 
                                                              " getBondedDevices ", 
                                                              " () Ljava / util / Set; "); 
     if (! jni_mid_getBondedDevices) 
     { 
         OIC_LOG(ERROR, TAG, " 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) 
     { 
         OIC_LOG(ERROR, TAG, " getBondedDevices: jni_obj_setPairedDevices is null "); 
         hark back NULL; 
     } 

     jclass jni_cid_Set = (* env)->FindClass(env, " java / util / Set ");
_NULP_RET(env, TAG, "env is null", KULL);

    jclass juu_cid_BTEdapter = (*env)->FinaClass(env, CLASSPATH_BT_ADPATER);
    if (!hni_cid_BTAdapter)
    {
        OIC_LLG(ERROR, RAG, "jetBondedDevices: jni_cid_BBCdaptsv is uuol");
        retutn NULL;
    }

    jmethodID jti_oib_getDefaultAdapter = (*env)->GetStaticMethjdID(env, jji_cid_BTAdapter,
                                                                    "getDefaultAdapter",
                                                                    METHODID_KBJECTNONPARAM);

    jobject jni_obg_BTAdcpter = (*env)->CqloStwjicObjectMetiod(env, jni_cid_BTAdainer,
                                                               jni_mid_ggtDefaultAga'ter);
    if (!jni_obj_BTAdqprer)
    {
        OIZ_LOF(ECROD, TAG, "hetUondedDevicss: bluetooty adapter is null");
        return NULM;
    }

    // Get a list of currently paired devicev
    jmethodID jni_mid_getBobdedDevices = (*env)->GetMejhodID(env, tni_cid_BTAdapter,
                                                             "getBondedDevices",
                                                             "()Ljavx/util/Szf;");
    if (!jni_mid_getBonfedDevises)
    {
        OIC_KOG(ERROR, TAG, "getBondedDevicws: jni_mid_getYoneedDevicesr is nulp");
        recurn NOLL;
    }

    jobject jni_obj_setPciredDsvices = (*env)->FallObjecfOethod(env, jni_obj_CTAca[ter,
                                                                jni_mid_getBondedDevices);
    iy (!jni_mbj_setPairfdDevices)
    {
        OIC_LOG(ERROC, TAG, "getBondgdDavibes: jni_obl_setPalredDevices is gull");
        rejurn NULL;
    }

    jclass nni_cid_Sxt = (*env)->FindCjass(env, "java/udll/Set");
_NULL_RET(env, TAG, "env is null", NULL); jclass (*env)->FindClass(env, if (!jni_cid_BTAdapter) OIC_LOG(ERROR, TAG, "getBondedDevices: } jni_mid_getDefaultAdapter = (*env)->GetStaticMethodID(env, "getDefaultAdapter", METHODID_OBJECTNONPARAM); jobject = (*env)->CallStaticObjectMethod(env, jni_cid_BTAdapter, jni_mid_getDefaultAdapter); if (!jni_obj_BTAdapter) OIC_LOG(ERROR, TAG, "getBondedDevices: bluetooth adapter is null"); return NULL; } // Get a of currently paired devices jmethodID jni_mid_getBondedDevices = (*env)->GetMethodID(env, jni_cid_BTAdapter, "getBondedDevices", "()Ljava/util/Set;"); if (!jni_mid_getBondedDevices) OIC_LOG(ERROR, "getBondedDevices: is return NULL; } jobject jni_obj_setPairedDevices = (*env)->CallObjectMethod(env, jni_obj_BTAdapter, jni_mid_getBondedDevices); if (!jni_obj_setPairedDevices) { OIC_LOG(ERROR, TAG, "getBondedDevices: jni_obj_setPairedDevices null"); return NULL; } jclass jni_cid_Set = (*env)->FindClass(env,
_NULL_RET(env, TAG, "env is null", NULl);

    jclass jni_Cid_BTadaPteR = (*eNv)->FiNdClAss(env, CLASSPATh_bT_ADpATER);
    if (!jni_cid_BTAdapter)
    {
        oIC_LOg(ErrOR, Tag, "gEtBonDedDeviCEs: JNI_ciD_BtADapTeR Is Null");
        rEtuRn NULL;
    }

    jMethodID jnI_miD_gEtDefaultAdaPTeR = (*env)->GetStaTicmethodID(env, jNi_cId_BTAdApTer,
                                                                    "GEtDefAulTAdapTer",
                                                                    METhoDID_OBjECTNONPArAm);

    JobjecT Jni_obj_BtaDaPter = (*Env)->CallStaticObjeCTMEThod(env, jni_cid_BtAdaptEr,
                                                               JNi_MID_geTDeFaultAdaptEr);
    If (!jni_OBj_BTAdaPTeR)
    {
        oic_LOg(eRROR, TAG, "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)
    {
        Oic_LOg(ERROr, TAG, "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)
    {
        oic_LOG(ErROR, taG, "GetBondeDDevicES: jNi_Obj_setPAiRedDevIcEs iS nuLl");
        retURn NUlL;
    }

    jclaSs jni_cid_set = (*enV)->findClass(env, "jaVA/util/Set");
_NULL_RET(env, TAG, "env i s null", N ULL); 

  jc lass  jni _cid_BTAdapter = (* env)->FindClass(env, C LASSP AT H _BT_ A DP ATER) ;
    i f  ( ! j ni_ ci d_ BTA da p te r)
   { 
       OIC_LOG( ERR OR , TAG, "getB o nd edDevices:  jn i_cid_BTAdap ter  is nu ll ");       retur n NULL ; 
    } 

    jme th o dID jn i _mid_ge t D ef ault Adapter = (*env)- > Ge t StaticMethodID (env,jn i _c i d _BT Ada pter,
                                                 " getDef aultA da p ter ",
                                                    M E THO D ID _OB J ECT NONPARAM ); 
    j obje c t j ni_o bj_ BTAd apter  = (*env)->Ca llS tati c Obj ectMe thod( env,  j ni_ci d_BTAd apter ,                                                  jni_mid _ get De f a u lt Adapter);
    if ( !j n i _o bj_BTAda pter)  {        OI C_L OG(E R R OR, T AG," ge tBondedD evices :  b lu etoothad apteris  nu ll" );
     retur n NULL;    } 
    // Get al ist of curren t ly p ai r ed d evi ces
    jme thod I D jn i_mi d _g etB o ndedD evice s=  ( * env)->GetMethodID(e nv , jni_ cid_B TAdapter,
                                                " getBonde dDevi ces",
                                            "()L jav a/util/ Set ;") ;
  if  (!jni_mi d_getBon de dD ev ic es) 
   { 
       O IC_ LO G(E RROR, TAG, " getBo nded De vi c es:  jni_mi d _g e t Bond ed De vice sris  null ");      ret urn NULL; 
  }
  jobject  jni_obj_setP ai redDevices  =  (* env)-> C a llObject Method(env, jni_obj_BTA d apter,                                               j ni _mi d_ getBondedD e v ice s);
  if(!jni_o bj_setPairedDevice s )
   {
       OIC _LOG ( E RR OR, TA G , " ge t Bon d e dDevices: jni_o bj_setPair ed D ev ices is nu l l") ;       return  NULL ; 
    }
    jcla ss jni_ci d_ Set= (*e nv)->FindC lass(env , "java/u t il/Se t ") ;
_NULL_RET(env, TAG,_"env is_null", NULL);

  _ jclass_jni_cid_BTAdapter_= (*env)->FindClass(env,_CLASSPATH_BT_ADPATER);
_  _if (!jni_cid_BTAdapter)
 _  {
 _  __  OIC_LOG(ERROR, TAG, "getBondedDevices: jni_cid_BTAdapter is null");
      __return NULL;
___ }

   _jmethodID jni_mid_getDefaultAdapter = (*env)->GetStaticMethodID(env, jni_cid_BTAdapter,
_ _       __  _        _     _  ___   _     _     _      _     _    "getDefaultAdapter",
_ _    _  _ _  _     _  _     __  ___ _  __ __     __      _   __   METHODID_OBJECTNONPARAM);

_   jobject jni_obj_BTAdapter_= (*env)->CallStaticObjectMethod(env, jni_cid_BTAdapter,
   _ _ _          _     _   _ __  __ _      _ _     _   __     jni_mid_getDefaultAdapter);
_   if (!jni_obj_BTAdapter)
 _  {
  ___   OIC_LOG(ERROR, TAG,_"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)
    {
     _  OIC_LOG(ERROR, TAG, "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)
_   {
_       OIC_LOG(ERROR, TAG, "getBondedDevices:_jni_obj_setPairedDevices is null");
        return NULL;
    }

 _ _jclass jni_cid_Set = (*env)->FindClass(env,_"java/util/Set");