예제 #1
0
/**
 * Checks if the card in the selected slot was changed 
 * since last call or since last reset.
 * <p>Java declaration:
 * <pre>
 * private native int checkCardMovement0();
 * </pre>
 * @return 0 if no movements has happened, 
 *         > 0 if the card was changed,
 *         < 0 if an error occured.
 */
KNIEXPORT KNI_RETURNTYPE_INT
KNIDECL(com_sun_cardreader_PlatformCardDevice_checkCardMovement0) {
    JAVACALL_CARD_MOVEMENT mv = 0;
    jint retcode = javacall_carddevice_card_movement_events(&mv);
    if (retcode == JAVACALL_OK) {
        retcode = (mv & JAVACALL_CARD_MOVEMENT_MASK);
    }
    KNI_ReturnInt(retcode);
}
예제 #2
0
/** 
 * Retrieves current slot's card movement events from driver.
 * Events is retrieved as bit mask. It can include
 * all movements from last reading, but can contain only the last.
 * Enum JSR177_CARD_MOVEMENT should be used to specify type of movement.
 * Clears the slot event state.
 * @param mask Movements retrived.
 * @return JSR177_STATUSCODE_OK if all done successfuly, JSR177_STATUSCODE_FAIL otherwise.
 */
JSR177_STATUSCODE jsr177_card_movement_events(JSR177_CARD_MOVEMENT *mask) {
    JAVACALL_CARD_MOVEMENT tmp_mask;
    javacall_result result = javacall_carddevice_card_movement_events(&tmp_mask);
    switch (result) {
    case JAVACALL_OK:
        *mask = tmp_mask;
        return JSR177_STATUSCODE_OK;
    case JAVACALL_FAIL:
    default:
        return JSR177_STATUSCODE_FAIL;
    }
}