/** * Performs platform lock of the device. This is intended to make * sure that no other native application * uses the same device during a transaction. * @return JSR177_STATUSCODE_OK if all done successfuly, JSR177_STATUSCODE_WOULD_BLOCK if the device is locked by the other * JSR177_STATUSCODE_FAIL if error occured */ JSR177_STATUSCODE jsr177_lock() { javacall_result result = javacall_carddevice_lock(); switch (result) { case JAVACALL_OK: return JSR177_STATUSCODE_OK; case JAVACALL_FAIL: default: return JSR177_STATUSCODE_FAIL; case JSR177_STATUSCODE_WOULD_BLOCK: return JSR177_STATUSCODE_WOULD_BLOCK; } }
/** * Performs platform lock of the device. * <p>Java declaration: * <pre> * private native boolean lock0(); * </pre> * @return KNI_TRUE in case of success, else KNI_FALSE */ KNIEXPORT KNI_RETURNTYPE_INT KNIDECL(com_sun_cardreader_PlatformCardDevice_lock0) { javacall_result lock_retcode = JAVACALL_OK; jboolean retcode = KNI_FALSE; if ((lock_retcode=javacall_carddevice_lock()) == JAVACALL_OK) { javacall_carddevice_clear_error(); retcode = KNI_TRUE; } else { if (lock_retcode == JAVACALL_WOULD_BLOCK) { midp_thread_wait(CARD_READER_DATA_SIGNAL, SIGNAL_LOCK, NULL); } } KNI_ReturnInt(retcode); }