Exemple #1
0
/** 
 * Selects specified slot (if possible).
 * @return JSR177_STATUSCODE_OK is if all done successfuly, JSR177_STATUSCODE_FAIL otherwise
 */
JSR177_STATUSCODE jsr177_select_slot(jint slot_index) {
    javacall_result result = javacall_carddevice_select_slot(slot_index);
    switch (result) {
    case JAVACALL_OK:
        return JSR177_STATUSCODE_OK;
    case JAVACALL_FAIL:
    default:
        return JSR177_STATUSCODE_FAIL;
    }
}
/**
 * Selects the current slot for the subsequent transfer operations.
 * <p>Java declaration:
 * <pre>
 * private native boolean selectSlot0(int slotIndex);
 * </pre>
 * @param slotIndex Slot number
 * @return KNI_TRUE in case of success, else KNI_FALSE 
 */
KNIEXPORT KNI_RETURNTYPE_INT 
KNIDECL(com_sun_cardreader_PlatformCardDevice_selectSlot0) {
    jint slotIndex;
    jboolean retcode;
    
    slotIndex = KNI_GetParameterAsInt(1);
    if (javacall_carddevice_select_slot(slotIndex) != JAVACALL_OK)
        retcode = KNI_FALSE;
    else
        retcode = KNI_TRUE;
    KNI_ReturnInt(retcode);
}